sootsim 0.1.186 → 0.1.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cli/bin.js +3 -3
- package/dist-cli/chunks/{agent-HOCS7BA7.js → agent-LRKJIWBT.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-OFIKO65K.js → agent-wrapper-7366QMW3.js} +2 -2
- package/dist-cli/chunks/{app-fonts-PXVMBZZ7.js → app-fonts-WIJGM2Q3.js} +2 -2
- package/dist-cli/chunks/{assert-OZS6AXZE.js → assert-XH4UWOXZ.js} +2 -2
- package/dist-cli/chunks/beta-HKL7ZI2G.js +2 -0
- package/dist-cli/chunks/{camera-QJ2PKIJB.js → camera-RKBTE4X7.js} +2 -2
- package/dist-cli/chunks/{chunk-O2SQQXUO.js → chunk-2YX77KNA.js} +1 -1
- package/dist-cli/chunks/{chunk-XQ6PPMM6.js → chunk-4MSD5YEY.js} +1 -1
- package/dist-cli/chunks/{chunk-TYV3FMBE.js → chunk-5MHGK7K5.js} +2 -2
- package/dist-cli/chunks/{chunk-6MJVRIUP.js → chunk-6DUOFTWZ.js} +1 -1
- package/dist-cli/chunks/chunk-7OSC6Q5I.js +1 -0
- package/dist-cli/chunks/{chunk-DPXVA7ZF.js → chunk-7PXPUUCL.js} +2 -2
- package/dist-cli/chunks/{chunk-N3PLEUYD.js → chunk-7ZCLPWN7.js} +2 -2
- package/dist-cli/chunks/{chunk-VPUJQTEO.js → chunk-A6YGOAVQ.js} +1 -1
- package/dist-cli/chunks/{chunk-RAY2ZSNI.js → chunk-C3TVJ3MM.js} +2 -2
- package/dist-cli/chunks/{chunk-353E6UCU.js → chunk-DVMV4JPO.js} +2 -2
- package/dist-cli/chunks/{chunk-MAGDSBXT.js → chunk-ECNEUGXI.js} +1 -1
- package/dist-cli/chunks/{chunk-ZJ64K2PL.js → chunk-ED7KWTZI.js} +2 -2
- package/dist-cli/chunks/{chunk-XFQOFRYY.js → chunk-EUJGZMDY.js} +1 -1
- package/dist-cli/chunks/{chunk-OMFESSKA.js → chunk-EXXEJKHE.js} +1 -1
- package/dist-cli/chunks/{chunk-PTUTIFWJ.js → chunk-FCEZIUSK.js} +1 -1
- package/dist-cli/chunks/{chunk-RDM3LVH2.js → chunk-FCYL4LNR.js} +2 -2
- package/dist-cli/chunks/{chunk-WBPTJ3WC.js → chunk-FHK4ZNGV.js} +2 -2
- package/dist-cli/chunks/{chunk-P5UT637B.js → chunk-FN7PINUE.js} +2 -2
- package/dist-cli/chunks/{chunk-WFSLSEGX.js → chunk-FTWRQ4GJ.js} +2 -2
- package/dist-cli/chunks/{chunk-FUHNIWFL.js → chunk-FUA7CGJ3.js} +1 -1
- package/dist-cli/chunks/{chunk-6OQVIQY7.js → chunk-FUYTE2KH.js} +2 -2
- package/dist-cli/chunks/{chunk-FN64EREO.js → chunk-HCPE77ID.js} +2 -2
- package/dist-cli/chunks/{chunk-2B2D2EBR.js → chunk-ILF5TI6Y.js} +2 -2
- package/dist-cli/chunks/{chunk-LV7DFIBL.js → chunk-JCVOSH3U.js} +1 -1
- package/dist-cli/chunks/{chunk-ZE2O7AA5.js → chunk-JUAUV4UZ.js} +2 -2
- package/dist-cli/chunks/{chunk-MP4CRGWM.js → chunk-L4Z2UJX5.js} +1 -1
- package/dist-cli/chunks/{chunk-KNICGV7H.js → chunk-N64V23HY.js} +1 -1
- package/dist-cli/chunks/{chunk-UATE6GSA.js → chunk-NXBBBNH5.js} +2 -2
- package/dist-cli/chunks/{chunk-YYZGAZQI.js → chunk-O67BWHYY.js} +2 -2
- package/dist-cli/chunks/{chunk-POOE26UD.js → chunk-OXS4KYCN.js} +2 -2
- package/dist-cli/chunks/{chunk-GNGEYMS3.js → chunk-RFIK5SZF.js} +2 -2
- package/dist-cli/chunks/{chunk-VGAD3CMW.js → chunk-TF6TFVED.js} +1 -1
- package/dist-cli/chunks/{chunk-RP5CVR6O.js → chunk-TJMPYMXV.js} +3 -3
- package/dist-cli/chunks/{chunk-I65LTDPY.js → chunk-TXSPFIUO.js} +3 -3
- package/dist-cli/chunks/{chunk-5XIRXMOS.js → chunk-UBOHWJ5L.js} +113 -97
- package/dist-cli/chunks/{chunk-BU5CRHHR.js → chunk-VZ4HTOAC.js} +2 -2
- package/dist-cli/chunks/{chunk-INIASYOZ.js → chunk-WDFDPB4M.js} +1 -1
- package/dist-cli/chunks/{chunk-MPUCQL3Q.js → chunk-WKGGTXDO.js} +1 -1
- package/dist-cli/chunks/chunk-XFDPG5AN.js +1 -0
- package/dist-cli/chunks/{chunk-V434ATFM.js → chunk-XJ3ANS4C.js} +2 -2
- package/dist-cli/chunks/{chunk-U3BTJLRM.js → chunk-XLAWETKN.js} +2 -2
- package/dist-cli/chunks/{chunk-NYYP5QQK.js → chunk-XVI2A5KE.js} +2 -2
- package/dist-cli/chunks/{chunk-QBLTH2F6.js → chunk-Y77CNEAC.js} +1 -1
- package/dist-cli/chunks/{chunk-4HVMPXJZ.js → chunk-ZR6PIQPZ.js} +1 -1
- package/dist-cli/chunks/cli-version-XGZD3TZF.js +2 -0
- package/dist-cli/chunks/{compat-BNXJOVMU.js → compat-XGX4RAXQ.js} +3 -3
- package/dist-cli/chunks/control-M76KO3SL.js +2 -0
- package/dist-cli/chunks/{cpu-profile-3KXOGOJP.js → cpu-profile-YJRYOP7N.js} +2 -2
- package/dist-cli/chunks/daemon-XRE3ZJ3A.js +2 -0
- package/dist-cli/chunks/{debug-B3MN6772.js → debug-W4VWXPA4.js} +11 -9
- package/dist-cli/chunks/{detox-YKSX4DUO.js → detox-EGVU4YL6.js} +2 -2
- package/dist-cli/chunks/{device-NZX6AKQI.js → device-XGK2VNF5.js} +2 -2
- package/dist-cli/chunks/{diagnose-26HE6KS5.js → diagnose-DI4BFQBP.js} +2 -2
- package/dist-cli/chunks/drivers-O6BFN76G.js +2 -0
- package/dist-cli/chunks/{electron-XEUWIM47.js → electron-3BE5EPSM.js} +3 -3
- package/dist-cli/chunks/flow-6WB3FX4N.js +2 -0
- package/dist-cli/chunks/help-BXNU6OAS.js +2 -0
- package/dist-cli/chunks/{hints-C56M4PMW.js → hints-E7NSLFDT.js} +2 -2
- package/dist-cli/chunks/{home-paths-EYH3RBPS.js → home-paths-UASDA6NF.js} +2 -2
- package/dist-cli/chunks/inspect-Z33SVDQJ.js +2 -0
- package/dist-cli/chunks/{install-desktop-UWHLWFKB.js → install-desktop-KFWZQGHM.js} +3 -3
- package/dist-cli/chunks/{keys-Q37NM52E.js → keys-C5T4EK3E.js} +2 -2
- package/dist-cli/chunks/{login-6E6ZEJRF.js → login-IB6EEROJ.js} +4 -4
- package/dist-cli/chunks/{logout-A7QHH6DQ.js → logout-UPNDZL6K.js} +2 -2
- package/dist-cli/chunks/{maestro-YJRGFGDQ.js → maestro-IU2V4VZI.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-P67F7BGJ.js +2 -0
- package/dist-cli/chunks/{preview-3OYFVL4A.js → preview-JBLUMPDD.js} +2 -2
- package/dist-cli/chunks/{profile-5Z2YGBCJ.js → profile-SNBM3CDF.js} +2 -2
- package/dist-cli/chunks/{react-ZNFFE3VQ.js → react-SDFO4G5R.js} +2 -2
- package/dist-cli/chunks/{record-V4CBW3GG.js → record-ZWXDWCCP.js} +2 -2
- package/dist-cli/chunks/runtime-KQQS4SNR.js +2 -0
- package/dist-cli/chunks/{screenshot-QWMRWTIQ.js → screenshot-CVHGCLGS.js} +2 -2
- package/dist-cli/chunks/{screenshot-mode-36EUFBF5.js → screenshot-mode-NDTW64AM.js} +2 -2
- package/dist-cli/chunks/{screenshots-LOS6WHZN.js → screenshots-V6STBJXN.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-6D6TBI6A.js → screenshots-capture-6WYQMQ2U.js} +2 -2
- package/dist-cli/chunks/{serve-YWGZ2JSI.js → serve-PW4LITPE.js} +2 -2
- package/dist-cli/chunks/{setup-JS35KZ6P.js → setup-CGNDZVXB.js} +3 -3
- package/dist-cli/chunks/{skills-2TRDAXNC.js → skills-KOK2FNL2.js} +2 -2
- package/dist-cli/chunks/{slides-AO5MBP5Q.js → slides-3PLFSQMQ.js} +2 -2
- package/dist-cli/chunks/store-FSEOWL7R.js +2 -0
- package/dist-cli/chunks/{telemetry-MBWJUKBU.js → telemetry-B7LYDPT5.js} +2 -2
- package/dist-cli/chunks/telemetry-XACCAQXE.js +2 -0
- package/dist-cli/chunks/{test-TRP2O6AP.js → test-RE7DJ2VV.js} +3 -3
- package/dist-cli/chunks/{three-mode-VVNOGAZT.js → three-mode-3IDJZUWE.js} +2 -2
- package/dist-cli/chunks/{timeline-4WDFXUXB.js → timeline-VSAVV7SE.js} +2 -2
- package/dist-cli/chunks/{upgrade-NHQRFD4J.js → upgrade-N7F4A22A.js} +2 -2
- package/dist-cli/chunks/upload-5YUE5AXH.js +2 -0
- package/dist-cli/chunks/{version-T7O46MZL.js → version-NI3AUFKF.js} +2 -2
- package/dist-cli/chunks/{web-7YW2ISLF.js → web-B4BOB3BY.js} +2 -2
- package/dist-cli/chunks/{what-happened-IDOUXSFI.js → what-happened-J6KHS3NN.js} +2 -2
- package/dist-cli/chunks/{whoami-DQBR3UTO.js → whoami-JX2QC2MC.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -3
- package/dist-lib/sdk.mjs +2 -3
- package/dist-lib/skills.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/beta-LUMNYREE.js +0 -2
- package/dist-cli/chunks/chunk-3ISH4ZRW.js +0 -1
- package/dist-cli/chunks/chunk-5TTEOJ4A.js +0 -1
- package/dist-cli/chunks/cli-version-474OBNTF.js +0 -2
- package/dist-cli/chunks/control-6LPRGKTF.js +0 -2
- package/dist-cli/chunks/daemon-OMT3RVU4.js +0 -2
- package/dist-cli/chunks/drivers-2PZC4QA3.js +0 -2
- package/dist-cli/chunks/flow-P22NDT6V.js +0 -2
- package/dist-cli/chunks/help-ECGL4JSP.js +0 -2
- package/dist-cli/chunks/inspect-LJYG4WC6.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-OVWOHGTW.js +0 -2
- package/dist-cli/chunks/runtime-OC6S2C22.js +0 -2
- package/dist-cli/chunks/store-HQKPCA6W.js +0 -2
- package/dist-cli/chunks/telemetry-I2H25VVF.js +0 -2
- package/dist-cli/chunks/upload-6C2EC56N.js +0 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as ko,b as xo}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.187 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as ko,b as xo}from"./chunk-WKGGTXDO.js";import{b as wo,c as So,k as $o}from"./chunk-XJ3ANS4C.js";import{a as ke,b as H,c as Y,d as Xt,e as Re,f as fe,g as ot,h as Nt,i as go,j as yo,k as Zt,l as bo}from"./chunk-O67BWHYY.js";import{A as io,B as ro,E as ao,G as lo,I as nt,J as co,P as Qs,a as Gt,b as Un,c as Wn,d as Vn,e as Hn,f as Yn,g as Gn,h as zn,i as Qn,j as Xn,k as Hs,l as Ys,q as Gs,r as Zn,s as eo,t as vt,u as to,v as zt,w as zs,x as so,y as no,z as oo}from"./chunk-7ZCLPWN7.js";import{e as uo,g as fo,i as po,j as mo,k as ho,l as Qt}from"./chunk-VZ4HTOAC.js";import{a as qn}from"./chunk-EUJGZMDY.js";import{a as Ws,c as Vs}from"./chunk-6DUOFTWZ.js";import{a as pe}from"./chunk-HCPE77ID.js";import{c as Kn}from"./chunk-L4Z2UJX5.js";import{b as Jn}from"./chunk-JCVOSH3U.js";import{b as jn}from"./chunk-TF6TFVED.js";function Xs(s){return`(async () => {
|
|
3
3
|
const bridge = globalThis.SootSim && globalThis.SootSim.bridges && globalThis.SootSim.bridges.hotRemount
|
|
4
4
|
if (!bridge || typeof bridge.reloadExternalApp !== 'function') return false
|
|
5
5
|
await bridge.reloadExternalApp({ resetStorage: ${s?"true":"false"} })
|
|
6
6
|
return true
|
|
7
|
-
})()`}import{existsSync as Gr,mkdirSync as ki,readFileSync as zr,rmSync as An,writeFileSync as xi}from"fs";import{tmpdir as Qr}from"os";import{dirname as vi,join as Xr,resolve as Ni}from"path";var Tn={};jn(Tn,{Alias:()=>Pe,CST:()=>vn,Composer:()=>et,Document:()=>
|
|
7
|
+
})()`}import{existsSync as Gr,mkdirSync as ki,readFileSync as zr,rmSync as An,writeFileSync as xi}from"fs";import{tmpdir as Qr}from"os";import{dirname as vi,join as Xr,resolve as Ni}from"path";var Tn={};jn(Tn,{Alias:()=>Pe,CST:()=>vn,Composer:()=>et,Document:()=>Le,Lexer:()=>wt,LineCounter:()=>St,Pair:()=>X,Parser:()=>tt,Scalar:()=>P,Schema:()=>mt,YAMLError:()=>gt,YAMLMap:()=>Z,YAMLParseError:()=>he,YAMLSeq:()=>oe,YAMLWarning:()=>yt,isAlias:()=>ye,isCollection:()=>W,isDocument:()=>be,isMap:()=>we,isNode:()=>U,isPair:()=>J,isScalar:()=>j,isSeq:()=>Se,parse:()=>wi,parseAllDocuments:()=>bi,parseDocument:()=>In,stringify:()=>Si,visit:()=>ve,visitAsync:()=>It});var es=Symbol.for("yaml.alias"),ts=Symbol.for("yaml.document"),xe=Symbol.for("yaml.map"),Zs=Symbol.for("yaml.pair"),me=Symbol.for("yaml.scalar"),Be=Symbol.for("yaml.seq"),ce=Symbol.for("yaml.node.type"),ye=s=>!!s&&typeof s=="object"&&s[ce]===es,be=s=>!!s&&typeof s=="object"&&s[ce]===ts,we=s=>!!s&&typeof s=="object"&&s[ce]===xe,J=s=>!!s&&typeof s=="object"&&s[ce]===Zs,j=s=>!!s&&typeof s=="object"&&s[ce]===me,Se=s=>!!s&&typeof s=="object"&&s[ce]===Be;function W(s){if(s&&typeof s=="object")switch(s[ce]){case xe:case Be:return!0}return!1}function U(s){if(s&&typeof s=="object")switch(s[ce]){case es:case xe:case me:case Be:return!0}return!1}var ss=s=>(j(s)||W(s))&&!!s.anchor;var de=Symbol("break visit"),vo=Symbol("skip children"),Me=Symbol("remove node");function ve(s,e){let t=No(e);be(s)?it(null,s.contents,t,Object.freeze([s]))===Me&&(s.contents=null):it(null,s,t,Object.freeze([]))}ve.BREAK=de;ve.SKIP=vo;ve.REMOVE=Me;function it(s,e,t,n){let o=Io(s,e,t,n);if(U(o)||J(o))return To(s,n,o),it(s,o,t,n);if(typeof o!="symbol"){if(W(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let r=it(i,e.items[i],t,n);if(typeof r=="number")i=r-1;else{if(r===de)return de;r===Me&&(e.items.splice(i,1),i-=1)}}}else if(J(e)){n=Object.freeze(n.concat(e));let i=it("key",e.key,t,n);if(i===de)return de;i===Me&&(e.key=null);let r=it("value",e.value,t,n);if(r===de)return de;r===Me&&(e.value=null)}}return o}async function It(s,e){let t=No(e);be(s)?await rt(null,s.contents,t,Object.freeze([s]))===Me&&(s.contents=null):await rt(null,s,t,Object.freeze([]))}It.BREAK=de;It.SKIP=vo;It.REMOVE=Me;async function rt(s,e,t,n){let o=await Io(s,e,t,n);if(U(o)||J(o))return To(s,n,o),rt(s,o,t,n);if(typeof o!="symbol"){if(W(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let r=await rt(i,e.items[i],t,n);if(typeof r=="number")i=r-1;else{if(r===de)return de;r===Me&&(e.items.splice(i,1),i-=1)}}}else if(J(e)){n=Object.freeze(n.concat(e));let i=await rt("key",e.key,t,n);if(i===de)return de;i===Me&&(e.key=null);let r=await rt("value",e.value,t,n);if(r===de)return de;r===Me&&(e.value=null)}}return o}function No(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Io(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(we(e))return t.Map?.(s,e,n);if(Se(e))return t.Seq?.(s,e,n);if(J(e))return t.Pair?.(s,e,n);if(j(e))return t.Scalar?.(s,e,n);if(ye(e))return t.Alias?.(s,e,n)}function To(s,e,t){let n=e[e.length-1];if(W(n))n.items[s]=t;else if(J(n))s==="key"?n.key=t:n.value=t;else if(be(n))n.contents=t;else{let o=ye(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}var hr={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gr=s=>s.replace(/[!,[\]{}]/g,e=>hr[e]),_e=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),o=n.shift();switch(o){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[i,r]=n;return this.tags[i]=r,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let r=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,r),!1}}default:return t(0,`Unknown directive ${o}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let r=e.slice(2,-1);return r==="!"||r==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),r)}let[,n,o]=e.match(/^(.*!)([^!]*)$/s);o||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(o)}catch(r){return t(String(r)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+gr(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),o;if(e&&n.length>0&&U(e.contents)){let i={};ve(e.contents,(r,a)=>{U(a)&&a.tag&&(i[a.tag]=!0)}),o=Object.keys(i)}else o=[];for(let[i,r]of n)i==="!!"&&r==="tag:yaml.org,2002:"||(!e||o.some(a=>a.startsWith(r)))&&t.push(`%TAG ${i} ${r}`);return t.join(`
|
|
8
8
|
`)}};_e.defaultYaml={explicit:!1,version:"1.2"};_e.defaultTags={"!!":"tag:yaml.org,2002:"};function ns(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function en(s){let e=new Set;return ve(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function tn(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function Oo(s,e){let t=[],n=new Map,o=null;return{onAnchor:i=>{t.push(i),o??(o=en(s));let r=tn(e,o);return o.add(r),r},setAnchors:()=>{for(let i of t){let r=n.get(i);if(typeof r=="object"&&r.anchor&&(j(r.node)||W(r.node)))r.node.anchor=r.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:n}}function Ue(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let o=0,i=n.length;o<i;++o){let r=n[o],a=Ue(s,n,String(o),r);a===void 0?delete n[o]:a!==r&&(n[o]=a)}else if(n instanceof Map)for(let o of Array.from(n.keys())){let i=n.get(o),r=Ue(s,n,o,i);r===void 0?n.delete(o):r!==i&&n.set(o,r)}else if(n instanceof Set)for(let o of Array.from(n)){let i=Ue(s,n,o,o);i===void 0?n.delete(o):i!==o&&(n.delete(o),n.add(i))}else for(let[o,i]of Object.entries(n)){let r=Ue(s,n,o,i);r===void 0?delete n[o]:r!==i&&(n[o]=r)}return s.call(e,t,n)}function se(s,e,t){if(Array.isArray(s))return s.map((n,o)=>se(n,String(o),t));if(s&&typeof s.toJSON=="function"){if(!t||!ss(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=i=>{n.res=i,delete t.onCreate};let o=s.toJSON(e,t);return t.onCreate&&t.onCreate(o),o}return typeof s=="bigint"&&!t?.keep?Number(s):s}var We=class{constructor(e){Object.defineProperty(this,ce,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:o,reviver:i}={}){if(!be(e))throw new TypeError("A document argument is required");let r={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=se(this,"",r);if(typeof o=="function")for(let{count:l,res:u}of r.anchors.values())o(u,l);return typeof i=="function"?Ue(i,{"":a},"",a):a}};var Pe=class extends We{constructor(e){super(es),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ve(e,{Node:(i,r)=>{(ye(r)||ss(r))&&n.push(r)}}),t&&(t.aliasResolveCache=n));let o;for(let i of n){if(i===this)break;i.anchor===this.source&&(o=i)}return o}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:o,maxAliasCount:i}=t,r=this.resolve(o,t);if(!r){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(r);if(a||(se(r,null,t),a=n.get(r)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=os(o,r,n)),a.count*a.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let o=`*${this.source}`;if(e){if(ns(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${o} `}return o}};function os(s,e,t){if(ye(e)){let n=e.resolve(s),o=t&&n&&t.get(n);return o?o.count*o.aliasCount:0}else if(W(e)){let n=0;for(let o of e.items){let i=os(s,o,t);i>n&&(n=i)}return n}else if(J(e)){let n=os(s,e.key,t),o=os(s,e.value,t);return Math.max(n,o)}return 1}var is=s=>!s||typeof s!="function"&&typeof s!="object",P=class extends We{constructor(e){super(me),this.value=e}toJSON(e,t){return t?.keep?this.value:se(this.value,e,t)}toString(){return String(this.value)}};P.BLOCK_FOLDED="BLOCK_FOLDED";P.BLOCK_LITERAL="BLOCK_LITERAL";P.PLAIN="PLAIN";P.QUOTE_DOUBLE="QUOTE_DOUBLE";P.QUOTE_SINGLE="QUOTE_SINGLE";var yr="tag:yaml.org,2002:";function br(s,e,t){if(e){let n=t.filter(i=>i.tag===e),o=n.find(i=>!i.format)??n[0];if(!o)throw new Error(`Tag ${e} not found`);return o}return t.find(n=>n.identify?.(s)&&!n.format)}function je(s,e,t){if(be(s)&&(s=s.contents),U(s))return s;if(J(s)){let h=t.schema[xe].createNode?.(t.schema,null,t);return h.items.push(s),h}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:o,onTagObj:i,schema:r,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=o(s)),new Pe(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=yr+e.slice(2));let u=br(s,e,r.tags);if(!u){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let h=new P(s);return l&&(l.node=h),h}u=s instanceof Map?r[xe]:Symbol.iterator in Object(s)?r[Be]:r[xe]}i&&(i(u),delete t.onTagObj);let g=u?.createNode?u.createNode(t.schema,s,t):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(t.schema,s,t):new P(s);return e?g.tag=e:u.default||(g.tag=u.tag),l&&(l.node=g),g}function Tt(s,e,t){let n=t;for(let o=e.length-1;o>=0;--o){let i=e[o];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let r=[];r[i]=n,n=r}else n=new Map([[i,n]])}return je(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var lt=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,at=class extends We{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>U(n)||J(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(lt(e))this.add(t);else{let[n,...o]=e,i=this.get(n,!0);if(W(i))i.addIn(o,t);else if(i===void 0&&this.schema)this.set(n,Tt(this.schema,o,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${o}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let o=this.get(t,!0);if(W(o))return o.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...o]=e,i=this.get(n,!0);return o.length===0?!t&&j(i)?i.value:i:W(i)?i.getIn(o,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!J(t))return!1;let n=t.value;return n==null||e&&j(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let o=this.get(t,!0);return W(o)?o.hasIn(n):!1}setIn(e,t){let[n,...o]=e;if(o.length===0)this.set(n,t);else{let i=this.get(n,!0);if(W(i))i.setIn(o,t);else if(i===void 0&&this.schema)this.set(n,Tt(this.schema,o,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${o}`)}}};var Ao=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function $e(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Ce=(s,e,t)=>s.endsWith(`
|
|
9
9
|
`)?$e(t,e):t.includes(`
|
|
10
10
|
`)?`
|
|
11
11
|
`+$e(t,e):(s.endsWith(" ")?"":" ")+t;var sn="flow",rs="block",Ot="quoted";function At(s,e,t="flow",{indentAtStart:n,lineWidth:o=80,minContentWidth:i=20,onFold:r,onOverflow:a}={}){if(!o||o<0)return s;o<i&&(i=0);let l=Math.max(1+i,1+o-e.length);if(s.length<=l)return s;let u=[],g={},h=o-e.length;typeof n=="number"&&(n>o-Math.max(2,i)?u.push(0):h=o-n);let y,w,N=!1,b=-1,f=-1,T=-1;t===rs&&(b=Eo(s,b,e.length),b!==-1&&(h=b+l));for(let O;O=s[b+=1];){if(t===Ot&&O==="\\"){switch(f=b,s[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}T=b}if(O===`
|
|
12
12
|
`)t===rs&&(b=Eo(s,b,e.length)),h=b+e.length+l,y=void 0;else{if(O===" "&&w&&w!==" "&&w!==`
|
|
13
13
|
`&&w!==" "){let C=s[b+1];C&&C!==" "&&C!==`
|
|
14
|
-
`&&C!==" "&&(y=b)}if(b>=h)if(y)u.push(y),h=y+l,y=void 0;else if(t===Ot){for(;w===" "||w===" ";)w=O,O=s[b+=1],N=!0;let C=b>T+1?b-2:f-1;if(g[C])return s;u.push(C),g[C]=!0,h=C+l,y=void 0}else N=!0}w=O}if(N&&a&&a(),u.length===0)return s;r&&r();let I=s.slice(0,u[0]);for(let O=0;O<u.length;++O){let C=u[O],
|
|
15
|
-
${e}${s.slice(0,
|
|
16
|
-
${e}${s.slice(C+1,
|
|
14
|
+
`&&C!==" "&&(y=b)}if(b>=h)if(y)u.push(y),h=y+l,y=void 0;else if(t===Ot){for(;w===" "||w===" ";)w=O,O=s[b+=1],N=!0;let C=b>T+1?b-2:f-1;if(g[C])return s;u.push(C),g[C]=!0,h=C+l,y=void 0}else N=!0}w=O}if(N&&a&&a(),u.length===0)return s;r&&r();let I=s.slice(0,u[0]);for(let O=0;O<u.length;++O){let C=u[O],F=u[O+1]||s.length;C===0?I=`
|
|
15
|
+
${e}${s.slice(0,F)}`:(t===Ot&&g[C]&&(I+=`${s[C]}\\`),I+=`
|
|
16
|
+
${e}${s.slice(C+1,F)}`)}return I}function Eo(s,e,t){let n=e,o=e+1,i=s[o];for(;i===" "||i===" ";)if(e<o+t)i=s[++e];else{do i=s[++e];while(i&&i!==`
|
|
17
17
|
`);n=e,o=e+1,i=s[o]}return n}var ls=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),cs=s=>/^(%|---|\.\.\.)/m.test(s);function wr(s,e,t){if(!e||e<0)return!1;let n=e-t,o=s.length;if(o<=n)return!1;for(let i=0,r=0;i<o;++i)if(s[i]===`
|
|
18
18
|
`){if(i-r>n)return!0;if(r=i+1,o-r<=n)return!1}return!0}function Et(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,o=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(cs(s)?" ":""),r="",a=0;for(let l=0,u=t[l];u;u=t[++l])if(u===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(r+=t.slice(a,l)+"\\ ",l+=1,a=l,u="\\"),u==="\\")switch(t[l+1]){case"u":{r+=t.slice(a,l);let g=t.substr(l+2,4);switch(g){case"0000":r+="\\0";break;case"0007":r+="\\a";break;case"000b":r+="\\v";break;case"001b":r+="\\e";break;case"0085":r+="\\N";break;case"00a0":r+="\\_";break;case"2028":r+="\\L";break;case"2029":r+="\\P";break;default:g.substr(0,2)==="00"?r+="\\x"+g.substr(2):r+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<o)l+=1;else{for(r+=t.slice(a,l)+`
|
|
19
19
|
|
|
@@ -25,53 +25,53 @@ ${t}`)+"'";return e.implicitKey?n:At(n,t,sn,ls(e,!1))}function ct(s,e){let{singl
|
|
|
25
25
|
+(?!
|
|
26
26
|
|$)`,"g")}catch{on=/\n+(?!\n|$)/g}function as({comment:s,type:e,value:t},n,o,i){let{blockQuote:r,commentString:a,lineWidth:l}=n.options;if(!r||/\n[\t ]+$/.test(t))return ct(t,n);let u=n.indent||(n.forceBlockIndent||cs(t)?" ":""),g=r==="literal"?!0:r==="folded"||e===P.BLOCK_FOLDED?!1:e===P.BLOCK_LITERAL?!0:!wr(t,l,u.length);if(!t)return g?`|
|
|
27
27
|
`:`>
|
|
28
|
-
`;let h,y;for(y=t.length;y>0;--y){let
|
|
29
|
-
`&&
|
|
28
|
+
`;let h,y;for(y=t.length;y>0;--y){let F=t[y-1];if(F!==`
|
|
29
|
+
`&&F!==" "&&F!==" ")break}let w=t.substring(y),N=w.indexOf(`
|
|
30
30
|
`);N===-1?h="-":t===w||N!==w.length-1?(h="+",i&&i()):h="",w&&(t=t.slice(0,-w.length),w[w.length-1]===`
|
|
31
|
-
`&&(w=w.slice(0,-1)),w=w.replace(on,`$&${u}`));let b=!1,f,T=-1;for(f=0;f<t.length;++f){let
|
|
32
|
-
`)T=f;else break}let I=t.substring(0,T<f?T+1:f);I&&(t=t.substring(I.length),I=I.replace(/\n+/g,`$&${u}`));let C=(b?u?"2":"1":"")+h;if(s&&(C+=" "+a(s.replace(/ ?[\r\n]+/g," ")),o&&o()),!g){let
|
|
33
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,
|
|
31
|
+
`&&(w=w.slice(0,-1)),w=w.replace(on,`$&${u}`));let b=!1,f,T=-1;for(f=0;f<t.length;++f){let F=t[f];if(F===" ")b=!0;else if(F===`
|
|
32
|
+
`)T=f;else break}let I=t.substring(0,T<f?T+1:f);I&&(t=t.substring(I.length),I=I.replace(/\n+/g,`$&${u}`));let C=(b?u?"2":"1":"")+h;if(s&&(C+=" "+a(s.replace(/ ?[\r\n]+/g," ")),o&&o()),!g){let F=t.replace(/\n+/g,`
|
|
33
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,M=ls(n,!0);r!=="folded"&&e!==P.BLOCK_FOLDED&&(M.onOverflow=()=>{k=!0});let A=At(`${I}${F}${w}`,u,rs,M);if(!k)return`>${C}
|
|
34
34
|
${u}${A}`}return t=t.replace(/\n+/g,`$&${u}`),`|${C}
|
|
35
35
|
${u}${I}${t}${w}`}function Sr(s,e,t,n){let{type:o,value:i}=s,{actualString:r,implicitKey:a,indent:l,indentStep:u,inFlow:g}=e;if(a&&i.includes(`
|
|
36
36
|
`)||g&&/[[\]{},]/.test(i))return ct(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||g||!i.includes(`
|
|
37
37
|
`)?ct(i,e):as(s,e,t,n);if(!a&&!g&&o!==P.PLAIN&&i.includes(`
|
|
38
38
|
`))return as(s,e,t,n);if(cs(i)){if(l==="")return e.forceBlockIndent=!0,as(s,e,t,n);if(a&&l===u)return ct(i,e)}let h=i.replace(/\n+/g,`$&
|
|
39
39
|
${l}`);if(r){let y=b=>b.default&&b.tag!=="tag:yaml.org,2002:str"&&b.test?.test(h),{compat:w,tags:N}=e.doc.schema;if(N.some(y)||w?.some(y))return ct(i,e)}return a?h:At(h,l,sn,ls(e,!1))}function qe(s,e,t,n){let{implicitKey:o,inFlow:i}=e,r=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==P.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(r.value)&&(a=P.QUOTE_DOUBLE);let l=g=>{switch(g){case P.BLOCK_FOLDED:case P.BLOCK_LITERAL:return o||i?ct(r.value,e):as(r,e,t,n);case P.QUOTE_DOUBLE:return Et(r.value,e);case P.QUOTE_SINGLE:return nn(r.value,e);case P.PLAIN:return Sr(r,e,t,n);default:return null}},u=l(a);if(u===null){let{defaultKeyType:g,defaultStringType:h}=e.options,y=o&&g||h;if(u=l(y),u===null)throw new Error(`Unsupported default string type ${y}`)}return u}function us(s,e){let t=Object.assign({blockQuote:!0,commentString:Ao,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function $r(s,e){if(e.tag){let o=s.filter(i=>i.tag===e.tag);if(o.length>0)return o.find(i=>i.format===e.format)??o[0]}let t,n;if(j(e)){n=e.value;let o=s.filter(i=>i.identify?.(n));if(o.length>1){let i=o.filter(r=>r.test);i.length>0&&(o=i)}t=o.find(i=>i.format===e.format)??o.find(i=>!i.format)}else n=e,t=s.find(o=>o.nodeClass&&n instanceof o.nodeClass);if(!t){let o=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${o} value`)}return t}function kr(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let o=[],i=(j(s)||W(s))&&s.anchor;i&&ns(i)&&(t.add(i),o.push(`&${i}`));let r=s.tag??(e.default?null:e.tag);return r&&o.push(n.directives.tagString(r)),o.join(" ")}function Ke(s,e,t,n){if(J(s))return s.toString(e,t,n);if(ye(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let o,i=U(s)?s:e.doc.createNode(s,{onTagObj:l=>o=l});o??(o=$r(e.doc.schema.tags,i));let r=kr(i,o,e);r.length>0&&(e.indentAtStart=(e.indentAtStart??0)+r.length+1);let a=typeof o.stringify=="function"?o.stringify(i,e,t,n):j(i)?qe(i,e,t,n):i.toString(e,t,n);return r?j(i)||a[0]==="{"||a[0]==="["?`${r} ${a}`:`${r}
|
|
40
|
-
${e.indent}${a}`:a}function Mo({key:s,value:e},t,n,o){let{allNullValues:i,doc:r,indent:a,indentStep:l,options:{commentString:u,indentSeq:g,simpleKeys:h}}=t,y=U(s)&&s.comment||null;if(h){if(y)throw new Error("With simple keys, key nodes cannot have comments");if(W(s)||!U(s)&&typeof s=="object"){let
|
|
41
|
-
${a}:`):(f=`${f}:`,y&&(f+=Ce(f,t.indent,u(y))));let T,I,O;U(e)?(T=!!e.spaceBefore,I=e.commentBefore,O=e.comment):(T=!1,I=null,O=null,e&&typeof e=="object"&&(e=r.createNode(e))),t.implicitKey=!1,!w&&!y&&j(e)&&(t.indentAtStart=f.length+1),b=!1,!g&&l.length>=2&&!t.inFlow&&!w&&Se(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let C=!1,
|
|
42
|
-
`:"",I){let
|
|
43
|
-
${$e(
|
|
40
|
+
${e.indent}${a}`:a}function Mo({key:s,value:e},t,n,o){let{allNullValues:i,doc:r,indent:a,indentStep:l,options:{commentString:u,indentSeq:g,simpleKeys:h}}=t,y=U(s)&&s.comment||null;if(h){if(y)throw new Error("With simple keys, key nodes cannot have comments");if(W(s)||!U(s)&&typeof s=="object"){let M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let w=!h&&(!s||y&&e==null&&!t.inFlow||W(s)||(j(s)?s.type===P.BLOCK_FOLDED||s.type===P.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!w&&(h||!i),indent:a+l});let N=!1,b=!1,f=Ke(s,t,()=>N=!0,()=>b=!0);if(!w&&!t.inFlow&&f.length>1024){if(h)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");w=!0}if(t.inFlow){if(i||e==null)return N&&n&&n(),f===""?"?":w?`? ${f}`:f}else if(i&&!h||e==null&&w)return f=`? ${f}`,y&&!N?f+=Ce(f,t.indent,u(y)):b&&o&&o(),f;N&&(y=null),w?(y&&(f+=Ce(f,t.indent,u(y))),f=`? ${f}
|
|
41
|
+
${a}:`):(f=`${f}:`,y&&(f+=Ce(f,t.indent,u(y))));let T,I,O;U(e)?(T=!!e.spaceBefore,I=e.commentBefore,O=e.comment):(T=!1,I=null,O=null,e&&typeof e=="object"&&(e=r.createNode(e))),t.implicitKey=!1,!w&&!y&&j(e)&&(t.indentAtStart=f.length+1),b=!1,!g&&l.length>=2&&!t.inFlow&&!w&&Se(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let C=!1,F=Ke(e,t,()=>C=!0,()=>b=!0),k=" ";if(y||T||I){if(k=T?`
|
|
42
|
+
`:"",I){let M=u(I);k+=`
|
|
43
|
+
${$e(M,t.indent)}`}F===""&&!t.inFlow?k===`
|
|
44
44
|
`&&O&&(k=`
|
|
45
45
|
|
|
46
46
|
`):k+=`
|
|
47
|
-
${t.indent}`}else if(!w&&W(e)){let
|
|
48
|
-
`),q=A!==-1,ee=t.inFlow??e.flow??e.items.length===0;if(q||!ee){let ne=!1;if(q&&(
|
|
49
|
-
${t.indent}`)}}else(
|
|
50
|
-
`)&&(k="");return f+=k+
|
|
47
|
+
${t.indent}`}else if(!w&&W(e)){let M=F[0],A=F.indexOf(`
|
|
48
|
+
`),q=A!==-1,ee=t.inFlow??e.flow??e.items.length===0;if(q||!ee){let ne=!1;if(q&&(M==="&"||M==="!")){let V=F.indexOf(" ");M==="&"&&V!==-1&&V<A&&F[V+1]==="!"&&(V=F.indexOf(" ",V+1)),(V===-1||A<V)&&(ne=!0)}ne||(k=`
|
|
49
|
+
${t.indent}`)}}else(F===""||F[0]===`
|
|
50
|
+
`)&&(k="");return f+=k+F,t.inFlow?C&&n&&n():O&&!C?f+=Ce(f,t.indent,u(O)):b&&o&&o(),f}function fs(s,e){(s==="debug"||s==="warn")&&console.warn(e)}var ds="<<",Ne={identify:s=>s===ds||typeof s=="symbol"&&s.description===ds,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new P(Symbol(ds)),{addToJSMap:an}),stringify:()=>ds},_o=(s,e)=>(Ne.identify(e)||j(e)&&(!e.type||e.type===P.PLAIN)&&Ne.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===Ne.tag&&t.default);function an(s,e,t){let n=Po(s,t);if(Se(n))for(let o of n.items)rn(s,e,o);else if(Array.isArray(n))for(let o of n)rn(s,e,o);else rn(s,e,n)}function rn(s,e,t){let n=Po(s,t);if(!we(n))throw new Error("Merge sources must be maps or map aliases");let o=n.toJSON(null,s,Map);for(let[i,r]of o)e instanceof Map?e.has(i)||e.set(i,r):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0});return e}function Po(s,e){return s&&ye(e)?e.resolve(s.doc,s):e}function ps(s,e,{key:t,value:n}){if(U(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(_o(s,t))an(s,e,n);else{let o=se(t,"",s);if(e instanceof Map)e.set(o,se(n,o,s));else if(e instanceof Set)e.add(o);else{let i=xr(t,o,s),r=se(n,i,s);i in e?Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[i]=r}}return e}function xr(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(U(s)&&t?.doc){let n=us(t.doc,{});n.anchors=new Set;for(let i of t.anchors.keys())n.anchors.add(i.anchor);n.inFlow=!0,n.inStringifyKey=!0;let o=s.toString(n);if(!t.mapKeyWarned){let i=JSON.stringify(o);i.length>40&&(i=i.substring(0,36)+'..."'),fs(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return o}return JSON.stringify(e)}function ut(s,e,t){let n=je(s,void 0,t),o=je(e,void 0,t);return new X(n,o)}var X=class s{constructor(e,t=null){Object.defineProperty(this,ce,{value:Zs}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return U(t)&&(t=t.clone(e)),U(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return ps(t,n,this)}toString(e,t,n){return e?.doc?Mo(this,e,t,n):JSON.stringify(this)}};function hs(s,e,t){return(e.inFlow??s.flow?Nr:vr)(s,e,t)}function vr({comment:s,items:e},t,{blockItemPrefix:n,flowChars:o,itemIndent:i,onChompKeep:r,onComment:a}){let{indent:l,options:{commentString:u}}=t,g=Object.assign({},t,{indent:i,type:null}),h=!1,y=[];for(let N=0;N<e.length;++N){let b=e[N],f=null;if(U(b))!h&&b.spaceBefore&&y.push(""),ms(t,y,b.commentBefore,h),b.comment&&(f=b.comment);else if(J(b)){let I=U(b.key)?b.key:null;I&&(!h&&I.spaceBefore&&y.push(""),ms(t,y,I.commentBefore,h))}h=!1;let T=Ke(b,g,()=>f=null,()=>h=!0);f&&(T+=Ce(T,i,u(f))),h&&f&&(h=!1),y.push(n+T)}let w;if(y.length===0)w=o.start+o.end;else{w=y[0];for(let N=1;N<y.length;++N){let b=y[N];w+=b?`
|
|
51
51
|
${l}${b}`:`
|
|
52
52
|
`}}return s?(w+=`
|
|
53
53
|
`+$e(u(s),l),a&&a()):h&&r&&r(),w}function Nr({items:s},e,{flowChars:t,itemIndent:n}){let{indent:o,indentStep:i,flowCollectionPadding:r,options:{commentString:a}}=e;n+=i;let l=Object.assign({},e,{indent:n,inFlow:!0,type:null}),u=!1,g=0,h=[];for(let N=0;N<s.length;++N){let b=s[N],f=null;if(U(b))b.spaceBefore&&h.push(""),ms(e,h,b.commentBefore,!1),b.comment&&(f=b.comment);else if(J(b)){let I=U(b.key)?b.key:null;I&&(I.spaceBefore&&h.push(""),ms(e,h,I.commentBefore,!1),I.comment&&(u=!0));let O=U(b.value)?b.value:null;O?(O.comment&&(f=O.comment),O.commentBefore&&(u=!0)):b.value==null&&I?.comment&&(f=I.comment)}f&&(u=!0);let T=Ke(b,l,()=>f=null);u||(u=h.length>g||T.includes(`
|
|
54
54
|
`)),N<s.length-1?T+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(u||(u=h.reduce((I,O)=>I+O.length+2,2)+(T.length+2)>e.options.lineWidth)),u&&(T+=",")),f&&(T+=Ce(T,n,a(f))),h.push(T),g=h.length}let{start:y,end:w}=t;if(h.length===0)return y+w;if(!u){let N=h.reduce((b,f)=>b+f.length+2,2);u=e.options.lineWidth>0&&N>e.options.lineWidth}if(u){let N=y;for(let b of h)N+=b?`
|
|
55
55
|
${i}${o}${b}`:`
|
|
56
56
|
`;return`${N}
|
|
57
|
-
${o}${w}`}else return`${y}${r}${h.join(" ")}${r}${w}`}function ms({indent:s,options:{commentString:e}},t,n,o){if(n&&o&&(n=n.replace(/^\n+/,"")),n){let i=$e(e(n),s);t.push(i.trimStart())}}function Ve(s,e){let t=j(e)?e.value:e;for(let n of s)if(J(n)&&(n.key===e||n.key===t||j(n.key)&&n.key.value===t))return n}var Z=class extends at{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(xe,e),this.items=[]}static from(e,t,n){let{keepUndefined:o,replacer:i}=n,r=new this(e),a=(l,u)=>{if(typeof i=="function")u=i.call(t,l,u);else if(Array.isArray(i)&&!i.includes(l))return;(u!==void 0||o)&&r.items.push(ut(l,u,n))};if(t instanceof Map)for(let[l,u]of t)a(l,u);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;J(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new X(e,e?.value):n=new X(e.key,e.value);let o=Ve(this.items,n.key),i=this.schema?.sortMapEntries;if(o){if(!t)throw new Error(`Key ${n.key} already set`);j(o.value)&&is(n.value)?o.value.value=n.value:o.value=n.value}else if(i){let r=this.items.findIndex(a=>i(n,a)<0);r===-1?this.items.push(n):this.items.splice(r,0,n)}else this.items.push(n)}delete(e){let t=Ve(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let o=Ve(this.items,e)?.value;return(!t&&j(o)?o.value:o)??void 0}has(e){return!!Ve(this.items,e)}set(e,t){this.add(new X(e,t),!0)}toJSON(e,t,n){let o=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(o);for(let i of this.items)ps(t,o,i);return o}toString(e,t,n){if(!e)return JSON.stringify(this);for(let o of this.items)if(!J(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};var Ie={collection:"map",default:!0,nodeClass:Z,tag:"tag:yaml.org,2002:map",resolve(s,e){return we(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Z.from(s,e,t)};var oe=class extends at{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Be,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=gs(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=gs(e);if(typeof n!="number")return;let o=this.items[n];return!t&&j(o)?o.value:o}has(e){let t=gs(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=gs(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let o=this.items[n];j(o)&&is(t)?o.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let o=0;for(let i of this.items)n.push(se(i,String(o++),t));return n}toString(e,t,n){return e?hs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:o}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let r=0;for(let a of t){if(typeof o=="function"){let l=t instanceof Set?a:String(r++);a=o.call(t,l,a)}i.items.push(je(a,void 0,n))}}return i}};function gs(s){let e=j(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Te={collection:"seq",default:!0,nodeClass:oe,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Se(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>oe.from(s,e,t)};var
|
|
57
|
+
${o}${w}`}else return`${y}${r}${h.join(" ")}${r}${w}`}function ms({indent:s,options:{commentString:e}},t,n,o){if(n&&o&&(n=n.replace(/^\n+/,"")),n){let i=$e(e(n),s);t.push(i.trimStart())}}function Ve(s,e){let t=j(e)?e.value:e;for(let n of s)if(J(n)&&(n.key===e||n.key===t||j(n.key)&&n.key.value===t))return n}var Z=class extends at{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(xe,e),this.items=[]}static from(e,t,n){let{keepUndefined:o,replacer:i}=n,r=new this(e),a=(l,u)=>{if(typeof i=="function")u=i.call(t,l,u);else if(Array.isArray(i)&&!i.includes(l))return;(u!==void 0||o)&&r.items.push(ut(l,u,n))};if(t instanceof Map)for(let[l,u]of t)a(l,u);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;J(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new X(e,e?.value):n=new X(e.key,e.value);let o=Ve(this.items,n.key),i=this.schema?.sortMapEntries;if(o){if(!t)throw new Error(`Key ${n.key} already set`);j(o.value)&&is(n.value)?o.value.value=n.value:o.value=n.value}else if(i){let r=this.items.findIndex(a=>i(n,a)<0);r===-1?this.items.push(n):this.items.splice(r,0,n)}else this.items.push(n)}delete(e){let t=Ve(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let o=Ve(this.items,e)?.value;return(!t&&j(o)?o.value:o)??void 0}has(e){return!!Ve(this.items,e)}set(e,t){this.add(new X(e,t),!0)}toJSON(e,t,n){let o=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(o);for(let i of this.items)ps(t,o,i);return o}toString(e,t,n){if(!e)return JSON.stringify(this);for(let o of this.items)if(!J(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};var Ie={collection:"map",default:!0,nodeClass:Z,tag:"tag:yaml.org,2002:map",resolve(s,e){return we(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Z.from(s,e,t)};var oe=class extends at{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Be,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=gs(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=gs(e);if(typeof n!="number")return;let o=this.items[n];return!t&&j(o)?o.value:o}has(e){let t=gs(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=gs(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let o=this.items[n];j(o)&&is(t)?o.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let o=0;for(let i of this.items)n.push(se(i,String(o++),t));return n}toString(e,t,n){return e?hs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:o}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let r=0;for(let a of t){if(typeof o=="function"){let l=t instanceof Set?a:String(r++);a=o.call(t,l,a)}i.items.push(je(a,void 0,n))}}return i}};function gs(s){let e=j(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Te={collection:"seq",default:!0,nodeClass:oe,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Se(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>oe.from(s,e,t)};var He={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),qe(s,e,t,n)}};var Ze={identify:s=>s==null,createNode:()=>new P(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new P(null),stringify:({source:s},e)=>typeof s=="string"&&Ze.test.test(s)?s:e.options.nullStr};var Mt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new P(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Mt.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function ae({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let o=typeof n=="number"?n:Number(n);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let i=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let r=i.indexOf(".");r<0&&(r=i.length,i+=".");let a=e-(i.length-r-1);for(;a-- >0;)i+="0"}return i}var ys={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ae},bs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():ae(s)}},ws={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new P(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:ae};var Ss=s=>typeof s=="bigint"||Number.isInteger(s),ln=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Co(s,e,t){let{value:n}=s;return Ss(n)&&n>=0?t+n.toString(e):ae(s)}var $s={identify:s=>Ss(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>ln(s,2,8,t),stringify:s=>Co(s,8,"0o")},ks={identify:Ss,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>ln(s,0,10,t),stringify:ae},xs={identify:s=>Ss(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>ln(s,2,16,t),stringify:s=>Co(s,16,"0x")};var Lo=[Ie,Te,He,Ze,Mt,$s,ks,xs,ys,bs,ws];function Fo(s){return typeof s=="bigint"||Number.isInteger(s)}var vs=({value:s})=>JSON.stringify(s),Ir=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:vs},{identify:s=>s==null,createNode:()=>new P(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:vs},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:vs},{identify:Fo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Fo(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:vs}],Tr={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Do=[Ie,Te].concat(Ir,Tr);var _t={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let o=0;o<t.length;++o)n[o]=t.charCodeAt(o);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,o,i){if(!t)return"";let r=t,a;if(typeof btoa=="function"){let l="";for(let u=0;u<r.length;++u)l+=String.fromCharCode(r[u]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=P.BLOCK_LITERAL),e!==P.QUOTE_DOUBLE){let l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),u=Math.ceil(a.length/l),g=new Array(u);for(let h=0,y=0;h<u;++h,y+=l)g[h]=a.substr(y,l);a=g.join(e===P.BLOCK_LITERAL?`
|
|
58
58
|
`:" ")}return qe({comment:s,type:e,value:a},n,o,i)}};function cn(s,e){if(Se(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!J(n)){if(we(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let o=n.items[0]||new X(new P(null));if(n.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${n.commentBefore}
|
|
59
59
|
${o.key.commentBefore}`:n.commentBefore),n.comment){let i=o.value??o.key;i.comment=i.comment?`${n.comment}
|
|
60
|
-
${i.comment}`:n.comment}n=o}s.items[t]=J(n)?n:new X(n)}}else e("Expected a sequence for this tag");return s}function un(s,e,t){let{replacer:n}=t,o=new oe(s);o.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let r of e){typeof n=="function"&&(r=n.call(e,String(i++),r));let a,l;if(Array.isArray(r))if(r.length===2)a=r[0],l=r[1];else throw new TypeError(`Expected [key, value] tuple: ${r}`);else if(r&&r instanceof Object){let u=Object.keys(r);if(u.length===1)a=u[0],l=r[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=r;o.items.push(ut(a,l,t))}return o}var Pt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cn,createNode:un};var ft=class s extends oe{constructor(){super(),this.add=Z.prototype.add.bind(this),this.delete=Z.prototype.delete.bind(this),this.get=Z.prototype.get.bind(this),this.has=Z.prototype.has.bind(this),this.set=Z.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let o of this.items){let i,r;if(J(o)?(i=se(o.key,"",t),r=se(o.value,i,t)):i=se(o,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,r)}return n}static from(e,t,n){let o=un(e,t,n),i=new this;return i.items=o.items,i}};ft.tag="tag:yaml.org,2002:omap";var Ct={collection:"seq",identify:s=>s instanceof Map,nodeClass:ft,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=cn(s,e),n=[];for(let{key:o}of t.items)j(o)&&(n.includes(o.value)?e(`Ordered maps must not include duplicate keys: ${o.value}`):n.push(o.value));return Object.assign(new ft,t)},createNode:(s,e,t)=>ft.from(s,e,t)};function Ro({value:s,source:e},t){return e&&(s?fn:dn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var fn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new P(!0),stringify:Ro},dn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new P(!1),stringify:Ro};var Bo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ae},jo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():ae(s)}},qo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new P(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:ae};var
|
|
60
|
+
${i.comment}`:n.comment}n=o}s.items[t]=J(n)?n:new X(n)}}else e("Expected a sequence for this tag");return s}function un(s,e,t){let{replacer:n}=t,o=new oe(s);o.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let r of e){typeof n=="function"&&(r=n.call(e,String(i++),r));let a,l;if(Array.isArray(r))if(r.length===2)a=r[0],l=r[1];else throw new TypeError(`Expected [key, value] tuple: ${r}`);else if(r&&r instanceof Object){let u=Object.keys(r);if(u.length===1)a=u[0],l=r[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=r;o.items.push(ut(a,l,t))}return o}var Pt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cn,createNode:un};var ft=class s extends oe{constructor(){super(),this.add=Z.prototype.add.bind(this),this.delete=Z.prototype.delete.bind(this),this.get=Z.prototype.get.bind(this),this.has=Z.prototype.has.bind(this),this.set=Z.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let o of this.items){let i,r;if(J(o)?(i=se(o.key,"",t),r=se(o.value,i,t)):i=se(o,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,r)}return n}static from(e,t,n){let o=un(e,t,n),i=new this;return i.items=o.items,i}};ft.tag="tag:yaml.org,2002:omap";var Ct={collection:"seq",identify:s=>s instanceof Map,nodeClass:ft,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=cn(s,e),n=[];for(let{key:o}of t.items)j(o)&&(n.includes(o.value)?e(`Ordered maps must not include duplicate keys: ${o.value}`):n.push(o.value));return Object.assign(new ft,t)},createNode:(s,e,t)=>ft.from(s,e,t)};function Ro({value:s,source:e},t){return e&&(s?fn:dn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var fn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new P(!0),stringify:Ro},dn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new P(!1),stringify:Ro};var Bo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ae},jo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():ae(s)}},qo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new P(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:ae};var Lt=s=>typeof s=="bigint"||Number.isInteger(s);function Ns(s,e,t,{intAsBigInt:n}){let o=s[0];if((o==="-"||o==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let r=BigInt(s);return o==="-"?BigInt(-1)*r:r}let i=parseInt(s,t);return o==="-"?-1*i:i}function pn(s,e,t){let{value:n}=s;if(Lt(n)){let o=n.toString(e);return n<0?"-"+t+o.substr(1):t+o}return ae(s)}var Ko={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Ns(s,2,2,t),stringify:s=>pn(s,2,"0b")},Jo={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Ns(s,1,8,t),stringify:s=>pn(s,8,"0")},Uo={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Ns(s,0,10,t),stringify:ae},Wo={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Ns(s,2,16,t),stringify:s=>pn(s,16,"0x")};var dt=class s extends Z{constructor(e){super(e),this.tag=s.tag}add(e){let t;J(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new X(e.key,null):t=new X(e,null),Ve(this.items,t.key)||this.items.push(t)}get(e,t){let n=Ve(this.items,e);return!t&&J(n)?j(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Ve(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new X(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:o}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let r of t)typeof o=="function"&&(r=o.call(t,r,r)),i.items.push(ut(r,null,n));return i}};dt.tag="tag:yaml.org,2002:set";var Ft={collection:"map",identify:s=>s instanceof Set,nodeClass:dt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>dt.from(s,e,t),resolve(s,e){if(we(s)){if(s.hasAllNullValues(!0))return Object.assign(new dt,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function mn(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,o=r=>e?BigInt(r):Number(r),i=n.replace(/_/g,"").split(":").reduce((r,a)=>r*o(60)+o(a),o(0));return t==="-"?o(-1)*i:i}function Vo(s){let{value:e}=s,t=r=>r;if(typeof e=="bigint")t=r=>BigInt(r);else if(isNaN(e)||!isFinite(e))return ae(s);let n="";e<0&&(n="-",e*=t(-1));let o=t(60),i=[e%o];return e<60?i.unshift(0):(e=(e-i[0])/o,i.unshift(e%o),e>=60&&(e=(e-i[0])/o,i.unshift(e))),n+i.map(r=>String(r).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Is={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>mn(s,t),stringify:Vo},Ts={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>mn(s,!1),stringify:Vo},pt={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(pt.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,o,i,r,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(t,n-1,o,i||0,r||0,a||0,l),g=e[8];if(g&&g!=="Z"){let h=mn(g,!1);Math.abs(h)<30&&(h*=60),u-=6e4*h}return new Date(u)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var hn=[Ie,Te,He,Ze,fn,dn,Ko,Jo,Uo,Wo,Bo,jo,qo,_t,Ne,Ct,Pt,Ft,Is,Ts,pt];var Ho=new Map([["core",Lo],["failsafe",[Ie,Te,He]],["json",Do],["yaml11",hn],["yaml-1.1",hn]]),Yo={binary:_t,bool:Mt,float:ws,floatExp:bs,floatNaN:ys,floatTime:Ts,int:ks,intHex:xs,intOct:$s,intTime:Is,map:Ie,merge:Ne,null:Ze,omap:Ct,pairs:Pt,seq:Te,set:Ft,timestamp:pt},Go={"tag:yaml.org,2002:binary":_t,"tag:yaml.org,2002:merge":Ne,"tag:yaml.org,2002:omap":Ct,"tag:yaml.org,2002:pairs":Pt,"tag:yaml.org,2002:set":Ft,"tag:yaml.org,2002:timestamp":pt};function Os(s,e,t){let n=Ho.get(e);if(n&&!s)return t&&!n.includes(Ne)?n.concat(Ne):n.slice();let o=n;if(!o)if(Array.isArray(s))o=[];else{let i=Array.from(Ho.keys()).filter(r=>r!=="yaml11").map(r=>JSON.stringify(r)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(s))for(let i of s)o=o.concat(i);else typeof s=="function"&&(o=s(o.slice()));return t&&(o=o.concat(Ne)),o.reduce((i,r)=>{let a=typeof r=="string"?Yo[r]:r;if(!a){let l=JSON.stringify(r),u=Object.keys(Yo).map(g=>JSON.stringify(g)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return i.includes(a)||i.push(a),i},[])}var Or=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,mt=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:o,schema:i,sortMapEntries:r,toStringDefaults:a}){this.compat=Array.isArray(e)?Os(e,"compat"):e?Os(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=o?Go:{},this.tags=Os(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,xe,{value:Ie}),Object.defineProperty(this,me,{value:He}),Object.defineProperty(this,Be,{value:Te}),this.sortMapEntries=typeof r=="function"?r:r===!0?Or:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function zo(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let o=us(s,e),{commentString:i}=o.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=i(s.commentBefore);t.unshift($e(l,""))}let r=!1,a=null;if(s.contents){if(U(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let g=i(s.contents.commentBefore);t.push($e(g,""))}o.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>r=!0,u=Ke(s.contents,o,()=>a=null,l);a&&(u+=Ce(u,"",i(a))),(u[0]==="|"||u[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${u}`:t.push(u)}else t.push(Ke(s.contents,o));if(s.directives?.docEnd)if(s.comment){let l=i(s.comment);l.includes(`
|
|
61
61
|
`)?(t.push("..."),t.push($e(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&r&&(l=l.replace(/^\n+/,"")),l&&((!r||a)&&t[t.length-1]!==""&&t.push(""),t.push($e(i(l),"")))}return t.join(`
|
|
62
62
|
`)+`
|
|
63
|
-
`}var
|
|
63
|
+
`}var Le=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ce,{value:ts});let o=null;typeof t=="function"||Array.isArray(t)?o=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:r}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(r=this.directives.yaml.version)):this.directives=new _e({version:r}),this.setSchema(r,n),this.contents=e===void 0?null:this.createNode(e,o,n)}clone(){let e=Object.create(s.prototype,{[ce]:{value:ts}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=U(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ht(this.contents)&&this.contents.add(e)}addIn(e,t){ht(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=en(this);e.anchor=!t||n.has(t)?tn(t||"a",n):t}return new Pe(e.anchor)}createNode(e,t,n){let o;if(typeof t=="function")e=t.call({"":e},"",e),o=t;else if(Array.isArray(t)){let f=I=>typeof I=="number"||I instanceof String||I instanceof Number,T=t.filter(f).map(String);T.length>0&&(t=t.concat(T)),o=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:r,flow:a,keepUndefined:l,onTagObj:u,tag:g}=n??{},{onAnchor:h,setAnchors:y,sourceObjects:w}=Oo(this,r||"a"),N={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:h,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:w},b=je(e,g,N);return a&&W(b)&&(b.flow=!0),y(),b}createPair(e,t,n={}){let o=this.createNode(e,null,n),i=this.createNode(t,null,n);return new X(o,i)}delete(e){return ht(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lt(e)?this.contents==null?!1:(this.contents=null,!0):ht(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return W(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return lt(e)?!t&&j(this.contents)?this.contents.value:this.contents:W(this.contents)?this.contents.getIn(e,t):void 0}has(e){return W(this.contents)?this.contents.has(e):!1}hasIn(e){return lt(e)?this.contents!==void 0:W(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Tt(this.schema,[e],t):ht(this.contents)&&this.contents.set(e,t)}setIn(e,t){lt(e)?this.contents=t:this.contents==null?this.contents=Tt(this.schema,Array.from(e),t):ht(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _e({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new _e({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let o=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new mt(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:o,onAnchor:i,reviver:r}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},l=se(this.contents,t??"",a);if(typeof i=="function")for(let{count:u,res:g}of a.anchors.values())i(g,u);return typeof r=="function"?Ue(r,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return zo(this,e)}};function ht(s){if(W(s))return!0;throw new Error("Expected a YAML collection as document contents")}var gt=class extends Error{constructor(e,t,n,o){super(),this.name=e,this.code=n,this.message=o,this.pos=t}},he=class extends gt{constructor(e,t,n){super("YAMLParseError",e,t,n)}},yt=class extends gt{constructor(e,t,n){super("YAMLWarning",e,t,n)}},Dt=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:o}=t.linePos[0];t.message+=` at line ${n}, column ${o}`;let i=o-1,r=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(i>=60&&r.length>80){let a=Math.min(i-39,r.length-79);r="\u2026"+r.substring(a),i-=a-1}if(r.length>80&&(r=r.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(r.substring(0,i))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
64
64
|
`),r=a+r}if(/[^ ]/.test(r)){let a=1,l=t.linePos[1];l?.line===n&&l.col>o&&(a=Math.max(1,Math.min(l.col-o,80-i)));let u=" ".repeat(i)+"^".repeat(a);t.message+=`:
|
|
65
65
|
|
|
66
66
|
${r}
|
|
67
67
|
${u}
|
|
68
|
-
`}};function
|
|
69
|
-
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(
|
|
70
|
-
`+b.comment:a.comment=b.comment);continue}(b.newlineAfterProp||
|
|
71
|
-
`+O.comment:I.comment=O.comment);let C=new X(I);t.options.keepSourceTokens&&(C.srcToken=g),a.items.push(C)}}return u&&u<l&&o(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,u??l],a}function Zo({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=i?.nodeClass??oe,a=new r(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,u=null;for(let{start:g,value:h}of n.items){let y=
|
|
72
|
-
`+k.comment:u.comment=k.comment),h=k.end;continue}!r&&t.options.strict&&
|
|
73
|
-
`+
|
|
74
|
-
`+q.comment:A.comment=q.comment);let ne=new X(A,ee);if(t.options.keepSourceTokens&&(ne.srcToken=T),r){let V=u;As(t,V.items,A)&&o(
|
|
68
|
+
`}};function Fe(s,{flow:e,indicator:t,next:n,offset:o,onError:i,parentIndent:r,startOnNewline:a}){let l=!1,u=a,g=a,h="",y="",w=!1,N=!1,b=null,f=null,T=null,I=null,O=null,C=null,F=null;for(let A of s)switch(N&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&i(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),N=!1),b&&(u&&A.type!=="comment"&&A.type!=="newline"&&i(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),A.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(b=A),g=!0;break;case"comment":{g||i(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=A.source.substring(1)||" ";h?h+=y+q:h=q,y="",u=!1;break}case"newline":u?h?h+=A.source:(!C||t!=="seq-item-ind")&&(l=!0):y+=A.source,u=!0,w=!0,(f||T)&&(I=A),g=!0;break;case"anchor":f&&i(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&i(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),f=A,F??(F=A.offset),u=!1,g=!1,N=!0;break;case"tag":{T&&i(A,"MULTIPLE_TAGS","A node can have at most one tag"),T=A,F??(F=A.offset),u=!1,g=!1,N=!0;break}case t:(f||T)&&i(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),C&&i(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),C=A,u=t==="seq-item-ind"||t==="explicit-key-ind",g=!1;break;case"comma":if(e){O&&i(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),O=A,u=!1,g=!1;break}default:i(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),u=!1,g=!1}let k=s[s.length-1],M=k?k.offset+k.source.length:o;return N&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&i(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=r||n?.type==="block-map"||n?.type==="block-seq")&&i(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:O,found:C,spaceBefore:l,comment:h,hasNewline:w,anchor:f,tag:T,newlineAfterProp:I,end:M,start:F??M}}function Ye(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
|
69
|
+
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Ye(e.key)||Ye(e.value))return!0}return!1;default:return!0}}function Rt(s,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Ye(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function As(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let o=typeof n=="function"?n:(i,r)=>i===r||j(i)&&j(r)&&i.value===r.value;return e.some(i=>o(i.key,t))}var Qo="All mapping items must start at the same column";function Xo({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=i?.nodeClass??Z,a=new r(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,u=null;for(let g of n.items){let{start:h,key:y,sep:w,value:N}=g,b=Fe(h,{indicator:"explicit-key-ind",next:y??w?.[0],offset:l,onError:o,parentIndent:n.indent,startOnNewline:!0}),f=!b.found;if(f){if(y&&(y.type==="block-seq"?o(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==n.indent&&o(l,"BAD_INDENT",Qo)),!b.anchor&&!b.tag&&!w){u=b.end,b.comment&&(a.comment?a.comment+=`
|
|
70
|
+
`+b.comment:a.comment=b.comment);continue}(b.newlineAfterProp||Ye(y))&&o(y??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else b.found?.indent!==n.indent&&o(l,"BAD_INDENT",Qo);t.atKey=!0;let T=b.end,I=y?s(t,y,b,o):e(t,T,h,null,b,o);t.schema.compat&&Rt(n.indent,y,o),t.atKey=!1,As(t,a.items,I)&&o(T,"DUPLICATE_KEY","Map keys must be unique");let O=Fe(w??[],{indicator:"map-value-ind",next:N,offset:I.range[2],onError:o,parentIndent:n.indent,startOnNewline:!y||y.type==="block-scalar"});if(l=O.end,O.found){f&&(N?.type==="block-map"&&!O.hasNewline&&o(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&b.start<O.found.offset-1024&&o(I.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=N?s(t,N,O,o):e(t,l,w,null,O,o);t.schema.compat&&Rt(n.indent,N,o),l=C.range[2];let F=new X(I,C);t.options.keepSourceTokens&&(F.srcToken=g),a.items.push(F)}else{f&&o(I.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),O.comment&&(I.comment?I.comment+=`
|
|
71
|
+
`+O.comment:I.comment=O.comment);let C=new X(I);t.options.keepSourceTokens&&(C.srcToken=g),a.items.push(C)}}return u&&u<l&&o(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,u??l],a}function Zo({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=i?.nodeClass??oe,a=new r(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,u=null;for(let{start:g,value:h}of n.items){let y=Fe(g,{indicator:"seq-item-ind",next:h,offset:l,onError:o,parentIndent:n.indent,startOnNewline:!0});if(!y.found)if(y.anchor||y.tag||h)h?.type==="block-seq"?o(y.end,"BAD_INDENT","All sequence items must start at the same column"):o(l,"MISSING_CHAR","Sequence item without - indicator");else{u=y.end,y.comment&&(a.comment=y.comment);continue}let w=h?s(t,h,y,o):e(t,y.end,g,null,y,o);t.schema.compat&&Rt(n.indent,h,o),l=w.range[2],a.items.push(w)}return a.range=[n.offset,l,u??l],a}function De(s,e,t,n){let o="";if(s){let i=!1,r="";for(let a of s){let{source:l,type:u}=a;switch(u){case"space":i=!0;break;case"comment":{t&&!i&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let g=l.substring(1)||" ";o?o+=r+g:o=g,r="";break}case"newline":o&&(r+=l),i=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=l.length}}return{comment:o,offset:e}}var gn="Block collections are not allowed within flow collections",yn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function ei({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=n.start.source==="{",a=r?"flow map":"flow sequence",l=i?.nodeClass??(r?Z:oe),u=new l(t.schema);u.flow=!0;let g=t.atRoot;g&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let h=n.offset+n.start.source.length;for(let f=0;f<n.items.length;++f){let T=n.items[f],{start:I,key:O,sep:C,value:F}=T,k=Fe(I,{flow:a,indicator:"explicit-key-ind",next:O??C?.[0],offset:h,onError:o,parentIndent:n.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!C&&!F){f===0&&k.comma?o(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):f<n.items.length-1&&o(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),k.comment&&(u.comment?u.comment+=`
|
|
72
|
+
`+k.comment:u.comment=k.comment),h=k.end;continue}!r&&t.options.strict&&Ye(O)&&o(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(f===0)k.comma&&o(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(k.comma||o(k.start,"MISSING_CHAR",`Missing , between ${a} items`),k.comment){let M="";e:for(let A of I)switch(A.type){case"comma":case"space":break;case"comment":M=A.source.substring(1);break e;default:break e}if(M){let A=u.items[u.items.length-1];J(A)&&(A=A.value??A.key),A.comment?A.comment+=`
|
|
73
|
+
`+M:A.comment=M,k.comment=k.comment.substring(M.length+1)}}if(!r&&!C&&!k.found){let M=F?s(t,F,k,o):e(t,k.end,C,null,k,o);u.items.push(M),h=M.range[2],yn(F)&&o(M.range,"BLOCK_IN_FLOW",gn)}else{t.atKey=!0;let M=k.end,A=O?s(t,O,k,o):e(t,M,I,null,k,o);yn(O)&&o(A.range,"BLOCK_IN_FLOW",gn),t.atKey=!1;let q=Fe(C??[],{flow:a,indicator:"map-value-ind",next:F,offset:A.range[2],onError:o,parentIndent:n.indent,startOnNewline:!1});if(q.found){if(!r&&!k.found&&t.options.strict){if(C)for(let V of C){if(V===q.found)break;if(V.type==="newline"){o(V,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}k.start<q.found.offset-1024&&o(q.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else F&&("source"in F&&F.source?.[0]===":"?o(F,"MISSING_CHAR",`Missing space after : in ${a}`):o(q.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ee=F?s(t,F,q,o):q.found?e(t,q.end,C,null,q,o):null;ee?yn(F)&&o(ee.range,"BLOCK_IN_FLOW",gn):q.comment&&(A.comment?A.comment+=`
|
|
74
|
+
`+q.comment:A.comment=q.comment);let ne=new X(A,ee);if(t.options.keepSourceTokens&&(ne.srcToken=T),r){let V=u;As(t,V.items,A)&&o(M,"DUPLICATE_KEY","Map keys must be unique"),V.items.push(ne)}else{let V=new Z(t.schema);V.flow=!0,V.items.push(ne);let Qe=(ee??A).range;V.range=[A.range[0],Qe[1],Qe[2]],u.items.push(V)}h=ee?ee.range[2]:q.end}}let y=r?"}":"]",[w,...N]=n.end,b=h;if(w?.source===y)b=w.offset+w.source.length;else{let f=a[0].toUpperCase()+a.substring(1),T=g?`${f} must end with a ${y}`:`${f} in block collection must be sufficiently indented and end with a ${y}`;o(h,g?"MISSING_CHAR":"BAD_INDENT",T),w&&w.source.length!==1&&N.unshift(w)}if(N.length>0){let f=De(N,b,t.options.strict,o);f.comment&&(u.comment?u.comment+=`
|
|
75
75
|
`+f.comment:u.comment=f.comment),u.range=[n.offset,b,f.offset]}else u.range=[n.offset,b,b];return u}function bn(s,e,t,n,o,i){let r=t.type==="block-map"?Xo(s,e,t,n,i):t.type==="block-seq"?Zo(s,e,t,n,i):ei(s,e,t,n,i),a=r.constructor;return o==="!"||o===a.tagName?(r.tag=a.tagName,r):(o&&(r.tag=o),r)}function ti(s,e,t,n,o){let i=n.tag,r=i?e.directives.tagName(i.source,y=>o(i,"TAG_RESOLVE_FAILED",y)):null;if(t.type==="block-seq"){let{anchor:y,newlineAfterProp:w}=n,N=y&&i?y.offset>i.offset?y:i:y??i;N&&(!w||w.offset<N.offset)&&o(N,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!r||r==="!"||r===Z.tagName&&a==="map"||r===oe.tagName&&a==="seq")return bn(s,e,t,o,r);let l=e.schema.tags.find(y=>y.tag===r&&y.collection===a);if(!l){let y=e.schema.knownTags[r];if(y?.collection===a)e.schema.tags.push(Object.assign({},y,{default:!1})),l=y;else return y?o(i,"BAD_COLLECTION_TYPE",`${y.tag} used for ${a} collection, but expects ${y.collection??"scalar"}`,!0):o(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,!0),bn(s,e,t,o,r)}let u=bn(s,e,t,o,r,l),g=l.resolve?.(u,y=>o(i,"TAG_RESOLVE_FAILED",y),e.options)??u,h=U(g)?g:new P(g);return h.range=u.range,h.tag=r,l?.format&&(h.format=l.format),h}function Es(s,e,t){let n=e.offset,o=Ar(e,s.options.strict,t);if(!o)return{value:"",type:null,comment:"",range:[n,n,n]};let i=o.mode===">"?P.BLOCK_FOLDED:P.BLOCK_LITERAL,r=e.source?Er(e.source):[],a=r.length;for(let b=r.length-1;b>=0;--b){let f=r[b][1];if(f===""||f==="\r")a=b;else break}if(a===0){let b=o.chomp==="+"&&r.length>0?`
|
|
76
76
|
`.repeat(Math.max(1,r.length-1)):"",f=n+o.length;return e.source&&(f+=e.source.length),{value:b,type:i,comment:o.comment,range:[n,f,f]}}let l=e.indent+o.indent,u=e.offset+o.length,g=0;for(let b=0;b<a;++b){let[f,T]=r[b];if(T===""||T==="\r")o.indent===0&&f.length>l&&(l=f.length);else{f.length<l&&t(u+f.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(l=f.length),g=b,l===0&&!s.atRoot&&t(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=f.length+T.length+1}for(let b=r.length-1;b>=a;--b)r[b][0].length>l&&(a=b+1);let h="",y="",w=!1;for(let b=0;b<g;++b)h+=r[b][0].slice(l)+`
|
|
77
77
|
`;for(let b=g;b<a;++b){let[f,T]=r[b];u+=f.length+T.length+1;let I=T[T.length-1]==="\r";if(I&&(T=T.slice(0,-1)),T&&f.length<l){let C=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;t(u-T.length-(I?2:1),"BAD_INDENT",C),f=""}i===P.BLOCK_LITERAL?(h+=y+f.slice(l)+T,y=`
|
|
@@ -93,23 +93,23 @@ ${u}
|
|
|
93
93
|
`?o+=i:i=`
|
|
94
94
|
`:(o+=i+n[1],i=" "),r=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=r,n=a.exec(s),o+i+(n?.[1]??"")}function Pr(s,e){let t="";for(let n=1;n<s.length-1;++n){let o=s[n];if(!(o==="\r"&&s[n+1]===`
|
|
95
95
|
`))if(o===`
|
|
96
|
-
`){let{fold:i,offset:r}=Cr(s,n);t+=i,n=r}else if(o==="\\"){let i=s[++n],r=
|
|
96
|
+
`){let{fold:i,offset:r}=Cr(s,n);t+=i,n=r}else if(o==="\\"){let i=s[++n],r=Lr[i];if(r)t+=r;else if(i===`
|
|
97
97
|
`)for(i=s[n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="\r"&&s[n+1]===`
|
|
98
|
-
`)for(i=s[++n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;t+=
|
|
98
|
+
`)for(i=s[++n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;t+=Fr(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(o===" "||o===" "){let i=n,r=s[n+1];for(;r===" "||r===" ";)r=s[++n+1];r!==`
|
|
99
99
|
`&&!(r==="\r"&&s[n+2]===`
|
|
100
100
|
`)&&(t+=n>i?s.slice(i,n+1):o)}else t+=o}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Cr(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
|
|
101
101
|
`||n==="\r")&&!(n==="\r"&&s[e+2]!==`
|
|
102
102
|
`);)n===`
|
|
103
103
|
`&&(t+=`
|
|
104
|
-
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var
|
|
105
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
104
|
+
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var Lr={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
105
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Fr(s,e,t,n){let o=s.substr(e,t),r=o.length===t&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(r)}catch{let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function wn(s,e,t,n){let{value:o,type:i,comment:r,range:a}=e.type==="block-scalar"?Es(s,e,n):Ms(e,s.options.strict,n),l=t?s.directives.tagName(t.source,h=>n(t,"TAG_RESOLVE_FAILED",h)):null,u;s.options.stringKeys&&s.atKey?u=s.schema[me]:l?u=Dr(s.schema,o,l,t,n):e.type==="scalar"?u=Rr(s,o,e,n):u=s.schema[me];let g;try{let h=u.resolve(o,y=>n(t??e,"TAG_RESOLVE_FAILED",y),s.options);g=j(h)?h:new P(h)}catch(h){let y=h instanceof Error?h.message:String(h);n(t??e,"TAG_RESOLVE_FAILED",y),g=new P(o)}return g.range=a,g.source=o,i&&(g.type=i),l&&(g.tag=l),u.format&&(g.format=u.format),r&&(g.comment=r),g}function Dr(s,e,t,n,o){if(t==="!")return s[me];let i=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let r=s.knownTags[t];return r&&!r.collection?(s.tags.push(Object.assign({},r,{default:!1,test:void 0})),r):(o(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[me])}function Rr({atKey:s,directives:e,schema:t},n,o,i){let r=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[me];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(n))??t[me];if(r.tag!==a.tag){let l=e.tagString(r.tag),u=e.tagString(a.tag),g=`Value may be parsed as either ${l} or ${u}`;i(o,"TAG_RESOLVE_FAILED",g,!0)}}return r}function ni(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let o=e[n];switch(o.type){case"space":case"comment":case"newline":s-=o.source.length;continue}for(o=e[++n];o?.type==="space";)s+=o.source.length,o=e[++n];break}}return s}var Br={composeNode:Sn,composeEmptyNode:_s};function Sn(s,e,t,n){let o=s.atKey,{spaceBefore:i,comment:r,anchor:a,tag:l}=t,u,g=!0;switch(e.type){case"alias":u=jr(s,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=wn(s,e,l,n),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=ti(Br,s,e,t,n),a&&(u.anchor=a.source.substring(1))}catch(h){let y=h instanceof Error?h.message:String(h);n(e,"RESOURCE_EXHAUSTION",y)}break;default:{let h=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",h),g=!1}}return u??(u=_s(s,e.offset,void 0,null,t,n)),a&&u.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),o&&s.options.stringKeys&&(!j(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?u.comment=r:u.commentBefore=r),s.options.keepSourceTokens&&g&&(u.srcToken=e),u}function _s(s,e,t,n,{spaceBefore:o,comment:i,anchor:r,tag:a,end:l},u){let g={type:"scalar",offset:ni(e,t,n),indent:-1,source:""},h=wn(s,g,a,u);return r&&(h.anchor=r.source.substring(1),h.anchor===""&&u(r,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(h.spaceBefore=!0),i&&(h.comment=i,h.range[2]=l),h}function jr({options:s},{offset:e,source:t,end:n},o){let i=new Pe(t.substring(1));i.source===""&&o(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&o(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let r=e+t.length,a=De(n,r,s.strict,o);return i.range=[e,r,a.offset],a.comment&&(i.comment=a.comment),i}function oi(s,e,{offset:t,start:n,value:o,end:i},r){let a=Object.assign({_directives:e},s),l=new Le(void 0,a),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},g=Fe(n,{indicator:"doc-start",next:o??i?.[0],offset:t,onError:r,parentIndent:0,startOnNewline:!0});g.found&&(l.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!g.hasNewline&&r(g.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=o?Sn(u,o,g,r):_s(u,g.end,n,null,g,r);let h=l.contents.range[2],y=De(i,h,!1,r);return y.comment&&(l.comment=y.comment),l.range=[t,h,y.offset],l}function Bt(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function ii(s){let e="",t=!1,n=!1;for(let o=0;o<s.length;++o){let i=s[o];switch(i[0]){case"#":e+=(e===""?"":n?`
|
|
106
106
|
|
|
107
107
|
`:`
|
|
108
108
|
`)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":s[o+1]?.[0]!=="#"&&(o+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var et=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,o,i)=>{let r=Bt(t);i?this.warnings.push(new yt(r,n,o)):this.errors.push(new he(r,n,o))},this.directives=new _e({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:o}=ii(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
109
109
|
${n}`:n;else if(o||e.directives.docStart||!i)e.commentBefore=n;else if(W(i)&&!i.flow&&i.items.length>0){let r=i.items[0];J(r)&&(r=r.key);let a=r.commentBefore;r.commentBefore=a?`${n}
|
|
110
110
|
${a}`:n}else{let r=i.commentBefore;i.commentBefore=r?`${n}
|
|
111
111
|
${r}`:n}}if(t){for(let i=0;i<this.errors.length;++i)e.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)e.warnings.push(this.warnings[i])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ii(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let o of e)yield*this.next(o);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,o)=>{let i=Bt(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,o)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=oi(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new he(Bt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new he(Bt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=De(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
112
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new he(Bt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),o=new
|
|
112
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new he(Bt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),o=new Le(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,t,t],this.decorate(o,!1),yield o}}};var vn={};jn(vn,{BOM:()=>jt,DOCUMENT:()=>qt,FLOW_END:()=>Kt,SCALAR:()=>bt,createScalarToken:()=>ai,isCollection:()=>Jr,isScalar:()=>Ur,prettyToken:()=>Wr,resolveAsScalar:()=>ri,setScalarValue:()=>li,stringify:()=>ui,tokenType:()=>xn,visit:()=>Ge});function ri(s,e=!0,t){if(s){let n=(o,i,r)=>{let a=typeof o=="number"?o:Array.isArray(o)?o[0]:o.offset;if(t)t(a,i,r);else throw new he([a,a+1],i,r)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ms(s,e,n);case"block-scalar":return Es({options:{strict:e}},s,n)}}return null}function ai(s,e){let{implicitKey:t=!1,indent:n,inFlow:o=!1,offset:i=-1,type:r="PLAIN"}=e,a=qe({type:r,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
113
113
|
`}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
|
|
114
114
|
`),g=a.substring(0,u),h=a.substring(u+1)+`
|
|
115
115
|
`,y=[{type:"block-scalar-header",offset:i,indent:n,source:g}];return ci(y,l)||y.push({type:"newline",offset:-1,indent:n,source:`
|
|
@@ -120,8 +120,8 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
120
120
|
`};delete s.items,Object.assign(s,{type:t,source:e,end:[o]});break}default:{let n="indent"in s?s.indent:-1,o="end"in s&&Array.isArray(s.end)?s.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(s))i!=="type"&&i!=="offset"&&delete s[i];Object.assign(s,{type:t,indent:n,source:e,end:o})}}}var ui=s=>"type"in s?Cs(s):Ps(s);function Cs(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Cs(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Ps(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Ps(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Ps(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Ps({start:s,key:e,sep:t,value:n}){let o="";for(let i of s)o+=i.source;if(e&&(o+=Cs(e)),t)for(let i of t)o+=i.source;return n&&(o+=Cs(n)),o}var kn=Symbol("break visit"),Kr=Symbol("skip children"),fi=Symbol("remove item");function Ge(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),di(Object.freeze([]),s,e)}Ge.BREAK=kn;Ge.SKIP=Kr;Ge.REMOVE=fi;Ge.itemAtPath=(s,e)=>{let t=s;for(let[n,o]of e){let i=t?.[n];if(i&&"items"in i)t=i.items[o];else return}return t};Ge.parentCollection=(s,e)=>{let t=Ge.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],o=t?.[n];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function di(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let o of["key","value"]){let i=e[o];if(i&&"items"in i){for(let r=0;r<i.items.length;++r){let a=di(Object.freeze(s.concat([[o,r]])),i.items[r],t);if(typeof a=="number")r=a-1;else{if(a===kn)return kn;a===fi&&(i.items.splice(r,1),r-=1)}}typeof n=="function"&&o==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}var jt="\uFEFF",qt="",Kt="",bt="",Jr=s=>!!s&&"items"in s,Ur=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Wr(s){switch(s){case jt:return"<BOM>";case qt:return"<DOC>";case Kt:return"<FLOW_END>";case bt:return"<SCALAR>";default:return JSON.stringify(s)}}function xn(s){switch(s){case jt:return"byte-order-mark";case qt:return"doc-mode";case Kt:return"flow-error-end";case bt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
121
121
|
`:case`\r
|
|
122
122
|
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Oe(s){switch(s){case void 0:case" ":case`
|
|
123
|
-
`:case"\r":case" ":return!0;default:return!1}}var pi=new Set("0123456789ABCDEFabcdef"),Vr=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),
|
|
124
|
-
\r `),Nn=s=>!s||
|
|
123
|
+
`:case"\r":case" ":return!0;default:return!1}}var pi=new Set("0123456789ABCDEFabcdef"),Vr=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ls=new Set(",[]{}"),Hr=new Set(` ,[]{}
|
|
124
|
+
\r `),Nn=s=>!s||Hr.has(s),wt=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
125
125
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
126
126
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let o=this.buffer[n+e+1];if(o===`
|
|
127
127
|
`||!o&&!this.atEnd)return e+n+1}return t===`
|
|
@@ -133,16 +133,16 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
133
133
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
|
134
134
|
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let o=e+1;for(n=this.buffer[o];n===" ";)n=this.buffer[++o];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
135
135
|
`;)n=this.buffer[++o];e=o-1}else if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];r==="\r"&&(r=this.buffer[--i]);let a=i;for(;r===" ";)r=this.buffer[--i];if(r===`
|
|
136
|
-
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield bt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,o;for(;o=this.buffer[++n];)if(o===":"){let i=this.buffer[n+1];if(Oe(i)||e&&
|
|
136
|
+
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield bt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,o;for(;o=this.buffer[++n];)if(o===":"){let i=this.buffer[n+1];if(Oe(i)||e&&Ls.has(i))break;t=n}else if(Oe(o)){let i=this.buffer[n+1];if(o==="\r"&&(i===`
|
|
137
137
|
`?(n+=1,o=`
|
|
138
|
-
`,i=this.buffer[n+1]):t=n),i==="#"||e&&
|
|
139
|
-
`){let r=this.continueScalar(n+1);if(r===-1)break;n=Math.max(n,r-2)}}else{if(e&&
|
|
138
|
+
`,i=this.buffer[n+1]):t=n),i==="#"||e&&Ls.has(i))break;if(o===`
|
|
139
|
+
`){let r=this.continueScalar(n+1);if(r===-1)break;n=Math.max(n,r-2)}}else{if(e&&Ls.has(o))break;t=n}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield bt,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Nn),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if(Oe(n)||t&&Ls.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Oe(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Vr.has(t))t=this.buffer[++e];else if(t==="%"&&pi.has(this.buffer[e+1])&&pi.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
140
140
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
141
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let o=t-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=t),o}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var St=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let o=this.lineStarts[t-1];return{line:t,col:e-o+1}}}};function ze(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function mi(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function gi(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function
|
|
141
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let o=t-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=t),o}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var St=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let o=this.lineStarts[t-1];return{line:t,col:e-o+1}}}};function ze(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function mi(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function gi(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Fs(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function $t(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Ds(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let t=0;t<e.length;++t)s.push(e[t])}function hi(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!ze(e.start,"explicit-key-ind")&&!ze(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,gi(e.value)?e.value.end?Ds(e.value.end,e.sep):e.value.end=e.sep:Ds(e.start,e.sep),delete e.sep)}var tt=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new wt,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=xn(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&hi(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let o=n.items[n.items.length-1];if(o.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=t;else{Object.assign(o,{key:t,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=n.items[n.items.length-1];o.value?n.items.push({start:[],value:t}):o.value=t;break}case"flow-collection":{let o=n.items[n.items.length-1];!o||o.value?n.items.push({start:[],key:t,sep:[]}):o.sep?o.value=t:Object.assign(o,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let o=t.items[t.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&mi(o.start)===-1&&(t.indent===0||o.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=o.start:n.items.push({start:o.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{mi(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Fs(this.peek(2)),n=$t(t),o;e.end?(o=e.end,o.push(this.sourceToken),delete e.end):o=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
142
142
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
143
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Ds(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,o=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(o&&t.sep&&!t.value){let r=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":r.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":o||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):o||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ze(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(gi(t.key)&&!ze(t.sep,"newline")){let r=$t(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:a,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(ze(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let r=$t(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||o?e.items.push({start:i,key:null,sep:[this.sourceToken]}):ze(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);o||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ze(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Ds(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||ze(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:o,sep:[]}):t.sep?this.stack.push(o):Object.assign(t,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let o=
|
|
143
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Ds(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,o=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(o&&t.sep&&!t.value){let r=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":r.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":o||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):o||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ze(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(gi(t.key)&&!ze(t.sep,"newline")){let r=$t(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:a,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(ze(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let r=$t(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||o?e.items.push({start:i,key:null,sep:[this.sourceToken]}):ze(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);o||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ze(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Ds(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||ze(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:o,sep:[]}):t.sep?this.stack.push(o):Object.assign(t,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let o=Fs(n),i=$t(o);hi(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
144
144
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
145
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=
|
|
145
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Fs(e),n=$t(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Fs(e),n=$t(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function yi(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new St||null,prettyErrors:e}}function bi(s,e={}){let{lineCounter:t,prettyErrors:n}=yi(e),o=new tt(t?.addNewLine),i=new et(e),r=Array.from(i.compose(o.parse(s)));if(n&&t)for(let a of r)a.errors.forEach(Dt(s,t)),a.warnings.forEach(Dt(s,t));return r.length>0?r:Object.assign([],{empty:!0},i.streamInfo())}function In(s,e={}){let{lineCounter:t,prettyErrors:n}=yi(e),o=new tt(t?.addNewLine),i=new et(e),r=null;for(let a of i.compose(o.parse(s),!0,s.length))if(!r)r=a;else if(r.options.logLevel!=="silent"){r.errors.push(new he(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(r.errors.forEach(Dt(s,t)),r.warnings.forEach(Dt(s,t))),r}function wi(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let o=In(s,t);if(!o)return null;if(o.warnings.forEach(i=>fs(o.options.logLevel,i)),o.errors.length>0){if(o.options.logLevel!=="silent")throw o.errors[0];o.errors=[]}return o.toJS(Object.assign({reviver:n},t))}function Si(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let o=Math.round(t);t=o<1?void 0:o>8?{indent:8}:{indent:o}}if(s===void 0){let{keepUndefined:o}=t??e??{};if(!o)return}return be(s)&&!n?s.toString(t):new Le(s,n,t).toString(t)}var st=Tn;import*as Rs from"fs";function Yr(s){let e={},t=s,n=r=>Array.isArray(r)?r:[],o=s.match(/^---\n([\s\S]*?)\n---\n?/);if(o){try{e=st.parse(o[1])??{}}catch(a){console.warn(` warn: could not parse frontmatter: ${a.message}`)}t=s.slice(o[0].length);let r=st.parse(t);return{frontmatter:e,steps:n(r)}}if(/\n---\s*\n/.test(s))try{let r=st.parseAllDocuments(s);if(r.length>=2){let a=r[0].toJS(),l=r[r.length-1].toJS();return{frontmatter:a&&typeof a=="object"?a:{},steps:n(l)}}}catch(r){console.warn(` warn: could not parse multi-doc flow: ${r.message}`)}let i=st.parse(t);return{frontmatter:e,steps:n(i)}}var $i=new Set(["tapOn","inputText","pressKey","dispatchKey","hideKeyboard","swipe","pinch","scroll","scrollUntilVisible"]);function On(s){let e=[];if(!Array.isArray(s)||s.length===0)return e.push("flow body must be a non-empty YAML array of steps"),e;let t=0;for(let n of s)n&&typeof n=="object"?Object.keys(n).some(i=>$i.has(i))&&(t+=1):typeof n=="string"&&$i.has(n)&&(t+=1);return t===0&&e.push("no interaction steps found (expected at least one tapOn / inputText / pressKey / swipe / scroll)"),e}function wp(s){if(!Rs.existsSync(s))return[`file not found: ${s}`];let e;try{e=Rs.readFileSync(s,"utf8")}catch(t){return[`cannot read file: ${t.message}`]}if(e.trim().length===0)return["file is empty"];try{let t=Yr(e);return On(t.steps)}catch(t){return[`yaml parse error: ${t.message}`]}}var En=1;function Bs(){return Ni(process.env.SOOTSIM_FLOW_SESSION_PATH||Xr(Qr(),"sootsim-flow-session.json"))}function Mn(s){let e=Bs();ki(vi(e),{recursive:!0}),xi(e,JSON.stringify(s,null,2)+`
|
|
146
146
|
`)}function _n(){let s=Bs();if(!Gr(s))return null;try{let e=JSON.parse(zr(s,"utf8"));return e.version!==En||!Array.isArray(e.steps)||typeof e.startedAt!="string"||typeof e.updatedAt!="string"?(An(s,{force:!0}),null):{version:En,startedAt:e.startedAt,updatedAt:e.updatedAt,steps:e.steps,candidate:e.candidate??null}}catch{return An(s,{force:!0}),null}}function Ip(){let s=new Date().toISOString(),e={version:En,startedAt:s,updatedAt:s,steps:[],candidate:null};return Mn(e),{path:Bs(),state:e}}function Zr(){An(Bs(),{force:!0})}function Tp(){Zr()}function js(s){let e=_n();if(!e)return{active:!1};let t=e.candidate,n={...e,updatedAt:new Date().toISOString(),candidate:{step:s.step,summary:s.summary,source:s.source,recordedAt:new Date().toISOString()}};return Mn(n),{active:!0,candidate:n.candidate,replaced:t}}function Op(){let s=_n();if(!s)return{active:!1,kept:!1,reason:"no-session"};if(!s.candidate)return{active:!0,kept:!1,reason:"no-candidate"};let e=s.candidate,t={...s,updatedAt:new Date().toISOString(),steps:[...s.steps,e.step],candidate:null};return Mn(t),{active:!0,kept:!0,candidate:e,stepCount:t.steps.length}}function ea(s){return st.stringify(s).trimEnd()+`
|
|
147
147
|
`}function Ap(s){let e=_n();if(!e)return{active:!1};let t=ea(e.steps),n=On(e.steps);if(n.length>0)return{active:!0,valid:!1,issues:n,yaml:t,stepCount:e.steps.length,outputPath:null};let o=null;return s&&(o=Ni(s),ki(vi(o),{recursive:!0}),xi(o,t)),{active:!0,valid:!0,issues:[],yaml:t,stepCount:e.steps.length,outputPath:o}}import{existsSync as ta,mkdirSync as sa,readFileSync as na,rmSync as Ii,writeFileSync as oa}from"fs";import{tmpdir as ia}from"os";import{dirname as ra,join as aa,resolve as la}from"path";var Jt=1,ca="SOOTSIM_INSPECT_NOTICE_PATH",ua=300*1e3,fa=15e3;function Ti(){return la(process.env[ca]||aa(ia(),"sootsim-inspect-notice-state.json"))}function da(s,e){return Object.fromEntries(Object.entries(s).filter(([,t])=>typeof t?.signature=="string"&&Number.isFinite(t?.updatedAt)&&e-t.updatedAt<=ua))}function pa(s){let e=Ti();if(!ta(e))return{version:Jt,entries:{}};try{let t=JSON.parse(na(e,"utf8"));return t.version!==Jt||!t.entries||typeof t.entries!="object"?(Ii(e,{force:!0}),{version:Jt,entries:{}}):{version:Jt,entries:da(t.entries,s)}}catch{return Ii(e,{force:!0}),{version:Jt,entries:{}}}}function ma(s){let e=Ti();sa(ra(e),{recursive:!0}),oa(e,JSON.stringify(s,null,2)+`
|
|
148
148
|
`)}function ha(s,e){let t=e.trim()||"default";return`${s}:${t}`}function Pn(s,e,t,n={}){let o=n.nowMs??Date.now(),i=n.cooldownMs??fa,r=pa(o),a=ha(s,e),l=r.entries[a];return l&&l.signature===t&&o-l.updatedAt<i?!1:(r.entries[a]={signature:t,updatedAt:o},ma(r),!0)}async function Ae({bridge:s,simId:e,maxMs:t,pollMs:n=50,stablePolls:o=3,strict:i=!1}){let r=await s.send({type:"evaluate",simId:e,code:`(async () => {
|
|
@@ -459,17 +459,17 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
return { strategy: 'none' }
|
|
462
|
-
})()`});if(!o||!("node"in o))return o;let i=o.node,r=i.absolutePosition.x+i.layout.width/2,a=i.absolutePosition.y+i.layout.height/2;return{...o,cx:r,cy:a,target:{id:i.id,testID:i.testID,text:o.strategy==="text"?e:i.text,type:i.type}}}})}async function _i(s,e={args:[]}){let t=await Wn(s);if(
|
|
463
|
-
`),Xe=[];for(let
|
|
464
|
-
`)}console.log(ee),ne>0&&console.log(` ${ne} clipped row(s) hidden (omit --no-clipped to see)`);let V=I||w||O||b;if((I||w||O)&&!a&&pe("describe-filter-context"),!V&&!a&&
|
|
462
|
+
})()`});if(!o||!("node"in o))return o;let i=o.node,r=i.absolutePosition.x+i.layout.width/2,a=i.absolutePosition.y+i.layout.height/2;return{...o,cx:r,cy:a,target:{id:i.id,testID:i.testID,text:o.strategy==="text"?e:i.text,type:i.type}}}})}async function _i(s,e={args:[]}){let t=await Wn(s);if(H(e.args)){Y(t);return}console.log(` nodes: ${t.nodes}`)}function Cn(s,e){let t=s.indexOf(e);return t>=0&&t+1<s.length?s[t+1]:null}async function Pi(s){let{bridge:e,args:t,positional:n}=s,o=t.includes("--verbose")||t.includes("-v"),i=H(t),r=o&&!i,a=t.includes("--watch")||t.includes("-w"),l=1e3,u=t.includes("--compact"),g=t.includes("--no-xy"),h=t.includes("--no-clipped"),y=t.includes("--include-occluded"),w=Cn(t,"--testid-like"),N=Cn(t,"--only"),b=Cn(t,"--subtree"),f=n[1]&&!n[1].startsWith("-")?n[1]:void 0,T=f?/[*?]/.test(f):!1,I=!T&&!N?f:void 0,O=N??(T?f:void 0),C=async()=>{await ot(e,{verbose:r});let k=await Yn(e,{describe:!0,verbose:o,filter:I||"",testIdLike:w||void 0,onlyGlob:O||void 0,subtreeRoot:b||void 0,compact:u,hideXy:g,includeOccluded:y}),M=k?.tree,A=k?.shell,q=k?.keyboard;if(i){Y({shell:A,tree:M??"",keyboard:q});return}if(A&&typeof A=="object"){let z=[A.state?`state=${A.state}`:null,A.activeApp?`app=${A.activeApp}`:null,A.showSwitcher?"switcher":null,A.switcherPhase&&A.switcherPhase!=="idle"?`phase=${A.switcherPhase}`:null].filter(Boolean);z.length>0&&console.log(` shell: ${z.join(" ")}`)}if(typeof M=="string"&&M.startsWith("__SUBTREE_NOT_FOUND__:")){let z=M.slice(22);console.log(` subtree root not found: ${z}`),pe("subtree-root-not-found",z);return}if(!M){let z=k?.nodeCount??0;console.log(" no matching nodes found"),!(I||w||O||b)&&z<10&&pe("app-still-loading",z);return}let ee=M,ne=0;if(h&&typeof ee=="string"){let z=ee.split(`
|
|
463
|
+
`),Xe=[];for(let Ht of z){if(Ht.includes("(clipped:")){ne+=1;continue}Xe.push(Ht)}ee=Xe.join(`
|
|
464
|
+
`)}console.log(ee),ne>0&&console.log(` ${ne} clipped row(s) hidden (omit --no-clipped to see)`);let V=I||w||O||b;if((I||w||O)&&!a&&pe("describe-filter-context"),!V&&!a&&M.split(`
|
|
465
465
|
`).length>=80&&pe("describe-use-filters"),q&&q.visible){let z=q.spec,Xe=[z?.keyboardType?`type=${z.keyboardType}`:null,z?.returnKeyType&&z.returnKeyType!=="default"?`return=${z.returnKeyType}`:null,q.mode!=="letters"?`mode=${q.mode}`:null,q.shifted?"shift":null,q.capsLock?"caps":null,z?.autoCapitalize&&z.autoCapitalize!=="sentences"?`autoCap=${z.autoCapitalize}`:null,q.accessoryBarId?`accessory=${q.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
466
466
|
keyboard: ${Xe.join(" ")||"visible"}`)}};if(a)for(console.log(` watching... (Ctrl+C to stop)
|
|
467
|
-
`);;)console.clear(),await C(),await ke(l);else await C()}var Sa=["SOOTSIM_AGENT","AGENTBUS_SESSION","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function xt(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let s of Sa){let e=process.env[s];if(e&&e.trim()&&e!=="0")return!0}return!1}async function Ci(s){let{bridge:e,args:t,effectiveArgs:n,positional:o,inspectUsage:i}=s,r=k=>{let
|
|
467
|
+
`);;)console.clear(),await C(),await ke(l);else await C()}var Sa=["SOOTSIM_AGENT","AGENTBUS_SESSION","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function xt(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let s of Sa){let e=process.env[s];if(e&&e.trim()&&e!=="0")return!0}return!1}async function Ci(s){let{bridge:e,args:t,effectiveArgs:n,positional:o,inspectUsage:i}=s,r=k=>{let M=n.indexOf(k);return M>=0&&M+1<n.length?n[M+1]:null},a=k=>n.includes(k),l=r("--testid")||r("--test-id"),u=r("--role"),g=r("--type"),h=r("--text"),y=a("--pressable"),w=a("--visible"),N=a("--interactive-targets")||a("--actions"),b=!l&&!u&&!g&&!h&&!y&&!w&&!N?o[1]:null,f=h??b,T=await Xn(e,{testId:l,role:u,type:g,text:f,pressable:y,visible:w,interactive:N});T||(console.error(i("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:I,result:O}=T,C=H(t),F=t.includes("--verbose")||t.includes("--dump");if(C)I==="interactive-targets"&&Array.isArray(O)?Y(Hs(O).map(k=>({...k,tap:Ys(k)}))):Y(O??null);else if(Array.isArray(O))if(O.length===0){console.log(` no ${I} nodes found`);let k=await e.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof k=="number"&&k<10&&pe("app-still-loading",k)}else if(I==="interactive-targets"){let k=Hs(O);console.log(` found ${k.length} interactive target${k.length===1?"":"s"} (sorted by score):`);for(let M of k.slice(0,20)){let A=M.absolutePosition?`@(${Math.round(M.absolutePosition.x)},${Math.round(M.absolutePosition.y)})`:"",q=M.layout?`${Math.round(M.layout.width)}x${Math.round(M.layout.height)}`:"?x?",ee=M.text?` "${M.text.slice(0,30)}"`:"",ne=M.testID?` #${M.testID}`:"",V=M.accessibilityLabel?` \u24D8"${String(M.accessibilityLabel).slice(0,24)}"`:"",Qe=M.accessibilityRole?`[${M.accessibilityRole}]`:M.type,z=Ys(M);console.log(` ${Qe}${ee}${V}${ne} ${q} ${A}`),console.log(` \u2192 ${z}`),F&&console.log(Ln(JSON.stringify(M,null,2)," "))}k.length>20&&console.log(` ... and ${k.length-20} more`)}else{console.log(` found ${O.length} node${O.length===1?"":"s"} (${I}):`);for(let k of O.slice(0,20)){let M=k.absolutePosition?`@(${Math.round(k.absolutePosition.x)},${Math.round(k.absolutePosition.y)})`:"",A=k.layout?`${Math.round(k.layout.width)}x${Math.round(k.layout.height)}`:"?x?",q=k.text?` "${k.text.slice(0,30)}"`:"",ee=k.testID?` #${k.testID}`:"",ne=k.pressable?" (tap)":"",V=k.accessibilityRole?`[${k.accessibilityRole}]`:k.type;console.log(` ${V}${q}${ee} ${A} ${M}${ne}`),F&&console.log(Ln(JSON.stringify(k,null,2)," "))}O.length>20&&console.log(` ... and ${O.length-20} more`)}else if(O==null)console.log(` not found: ${f||l||u||g||""||I}`),l&&pe("wait-selector-for-missing-testid",l);else{let k=O;if(k.type&&k.absolutePosition){let M=`@(${Math.round(k.absolutePosition.x)},${Math.round(k.absolutePosition.y)})`,A=k.layout?`${Math.round(k.layout.width)}x${Math.round(k.layout.height)}`:"?x?",q=k.text?` "${k.text.slice(0,40)}"`:"",ee=k.testID?` #${k.testID}`:"",ne=k.pressable?" (tap)":"",V=k.accessibilityRole?`[${k.accessibilityRole}]`:k.type;console.log(` ${V}${q}${ee} ${A} ${M}${ne}`),F&&console.log(Ln(JSON.stringify(k,null,2)," "))}else console.log(JSON.stringify(O,null,2))}}function Ln(s,e){return s.split(`
|
|
468
468
|
`).map(t=>e+t).join(`
|
|
469
|
-
`)}async function
|
|
470
|
-
`),console.log(zn(i,{styling:o}))}async function
|
|
471
|
-
`))}async function Di(s){let e=await s.bridge.listSims(),t=s.args.includes("--all"),n=s.args.find((a,l)=>s.args[l-1]==="--bundle"),o=s.args.find((a,l)=>s.args[l-1]==="--app-port"),i=s.args.includes("--primary"),r=e.filter(a=>!(i&&!a.isPrimary||n&&!(a.url??"").includes(n)||o&&!(a.url??"").includes(`/rn/${o}`)||!t&&!n&&!o&&!i&&!(a.url&&(a.url.includes("bundle=")||a.url.includes("/index.bundle")))&&a.id!==s.simId));if(
|
|
472
|
-
slope over ${y.toFixed(0)}s:`);let N=Object.entries(w).filter(([,b])=>b!==0).sort((b,f)=>Math.abs(f[1])-Math.abs(b[1]));if(N.length===0){console.log(" all counters flat");return}for(let[b,f]of N){let T=b.endsWith("Bytes")?`${Je(Math.abs(f))}/s${f<0?" (shrinking)":""}`:`${f>0?"+":""}${f.toFixed(2)}/s`;console.log(` ${b.padEnd(28)}${T}`)}}var ge="<redacted secure text>";function Wt(s){let e=s?.layout?.spec??s?.spec??null;return!!e?.secureTextEntry&&e.keyboardType!=="visible-password"}function
|
|
469
|
+
`)}async function Li(s){let{bridge:e,args:t}=s,n=H(t);await ot(e,{verbose:!n});let o=t.includes("--styling"),i=await Gn(e,{styling:o});if(n){Y({count:i.length,elements:i});return}console.log(` layout (${i.length} element${i.length===1?"":"s"}):
|
|
470
|
+
`),console.log(zn(i,{styling:o}))}async function Fi(s,e={}){let t=await lo(s);if("error"in t&&(console.error(t.error),process.exit(1)),e.json){console.log(JSON.stringify(t,null,2));return}let{visible:n,spec:o,mode:i,shifted:r,capsLock:a,accessoryBarId:l}=t,u=[];u.push(`keyboard: ${n?"visible":"hidden"}`),o?(u.push(` type: ${o.keyboardType}`),u.push(` returnKey: ${o.returnKeyType}`),u.push(` autoCap: ${o.autoCapitalize}`),u.push(` autoCorrect: ${o.autoCorrect?"on":"off"}`),u.push(` appearance: ${o.keyboardAppearance}`),o.secureTextEntry&&u.push(" secureTextEntry: true"),o.enablesReturnKeyAutomatically&&u.push(` return: ${o.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):u.push(" spec: <none> (shown via dev-tools with no TextInput)"),u.push(` mode: ${i}${r?" (shifted)":""}${a?" (caps)":""}`),l&&u.push(` accessoryBar: ${l}`),console.log(u.join(`
|
|
471
|
+
`))}async function Di(s){let e=await s.bridge.listSims(),t=s.args.includes("--all"),n=s.args.find((a,l)=>s.args[l-1]==="--bundle"),o=s.args.find((a,l)=>s.args[l-1]==="--app-port"),i=s.args.includes("--primary"),r=e.filter(a=>!(i&&!a.isPrimary||n&&!(a.url??"").includes(n)||o&&!(a.url??"").includes(`/rn/${o}`)||!t&&!n&&!o&&!i&&!(a.url&&(a.url.includes("bundle=")||a.url.includes("/index.bundle")))&&a.id!==s.simId));if(H(s.args)){Y(r.map(a=>({...a,active:a.id===s.simId})));return}$o(r,s.simId),r.length<e.length&&!H(s.args)&&console.log(` (${e.length-r.length} more hidden \u2014 pass --all to show)`)}function Je(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/1024/1024).toFixed(1)}MB`}function $a(s,e){return e<=0?"?":`${(s/e*100).toFixed(0)}%`}function ka(s){let e={},t=(n,o)=>{o&&(o.nodesRegistered!=null&&(e[`${n}.nodes`]=o.nodesRegistered),o.nodesDetached!=null&&(e[`${n}.detached`]=o.nodesDetached),o.objects&&(e[`${n}.paragraphs`]=o.objects.paragraphs,e[`${n}.yogaNodes`]=o.objects.yogaNodes,e[`${n}.pictures`]=o.objects.pictures,e[`${n}.rasterImages`]=o.objects.rasterImages),o.imageLoader&&(e[`${n}.imageCacheEntries`]=o.imageLoader.cacheEntries,e[`${n}.imagePixelBytes`]=o.imageLoader.cachePixelBytes),o.workerHeap&&(e[`${n}.heapBytes`]=o.workerHeap.usedJSHeapSize))};return t("tenant",s.tenant),t("shell",s.shell),s.hostHeap&&(e["host.heapBytes"]=s.hostHeap.usedJSHeapSize),e}function Ri(s,e){return s.endsWith("Bytes")?Je(e):String(e)}function Bi(s,e){if(!e){console.log(` ${s}: not available`);return}let t=e.objects;if(console.log(` ${s}`),e.nodesRegistered!=null&&console.log(` nodes registered: ${e.nodesRegistered}`),e.nodesDetached!=null){let n=Object.entries(e.detachedTypes??{}).map(([o,i])=>`${o}:${i}`).join(" ");console.log(` nodes detached: ${e.nodesDetached}${n?` (${n})`:""}`)}if(t&&(console.log(` paragraphs: ${t.paragraphs}`),console.log(` yoga nodes: ${t.yogaNodes}`),console.log(` pictures: ${t.pictures}`),console.log(` raster images: ${t.rasterImages}`)),e.activeNativeAnimations!=null&&console.log(` native anims: ${e.activeNativeAnimations}`),e.imageLoader){let n=e.imageLoader;console.log(` image cache: ${n.cacheEntries}/${n.cacheMaxEntries} entries, ${Je(n.cachePixelBytes)}/${Je(n.cachePixelBudget)} (${$a(n.cachePixelBytes,n.cachePixelBudget)})`)}e.workerHeap&&console.log(` js heap: ${Je(e.workerHeap.usedJSHeapSize)} used / ${Je(e.workerHeap.totalJSHeapSize)} total`)}function xa(s){console.log(" memory:"),Bi("tenant worker",s.tenant),Bi("shell worker",s.shell),s.hostHeap?(console.log(" host"),console.log(` js heap: ${Je(s.hostHeap.usedJSHeapSize)} used / ${Je(s.hostHeap.totalJSHeapSize)} total`)):console.log(" host js heap: not available (chrome only)")}function va(s,e,t){let n=s.indexOf(e);if(n===-1)return t;let o=Number(s[n+1]);return Number.isFinite(o)&&o>0?o:t}async function ji(s,e={args:[]}){let t=H(e.args),n=e.args.indexOf("--watch");if(n===-1){let b=await Qs(s);if(t){Y(b);return}xa(b);return}let o=Number(e.args[n+1]),i=Number.isFinite(o)&&o>0?o:60,r=va(e.args,"--interval",5),a=[],l=Date.now(),u=null;for(t||console.log(` sampling every ${r}s for ${i}s \u2014 deltas per tick:`);;){let b=await Qs(s),f=(Date.now()-l)/1e3,T=ka(b);if(a.push({tSec:f,counters:T}),!t){let I=[];for(let[O,C]of Object.entries(T)){let F=u&&O in u?C-u[O]:null;if(F===null||F===0)continue;let k=F>0?"+":"-",M=O.endsWith("Bytes")?`${k}${Je(Math.abs(F))}`:`${k}${Math.abs(F)}`;I.push(`${O} ${Ri(O,C)} (${M})`)}console.log(` t+${f.toFixed(0)}s ${I.length?I.join(" "):u?"no change":Object.entries(T).map(([O,C])=>`${O} ${Ri(O,C)}`).join(" ")}`)}if(u=T,f>=i)break;await new Promise(I=>setTimeout(I,r*1e3))}let g=a[0],h=a[a.length-1],y=Math.max(h.tSec-g.tSec,.001),w={};for(let b of Object.keys(h.counters))b in g.counters&&(w[b]=(h.counters[b]-g.counters[b])/y);if(t){Y({samples:a,perSecond:w,elapsedSec:y});return}console.log(`
|
|
472
|
+
slope over ${y.toFixed(0)}s:`);let N=Object.entries(w).filter(([,b])=>b!==0).sort((b,f)=>Math.abs(f[1])-Math.abs(b[1]));if(N.length===0){console.log(" all counters flat");return}for(let[b,f]of N){let T=b.endsWith("Bytes")?`${Je(Math.abs(f))}/s${f<0?" (shrinking)":""}`:`${f>0?"+":""}${f.toFixed(2)}/s`;console.log(` ${b.padEnd(28)}${T}`)}}var ge="<redacted secure text>";function Wt(s){let e=s?.layout?.spec??s?.spec??null;return!!e?.secureTextEntry&&e.keyboardType!=="visible-password"}function Fn(s,e){return Wt(e)?ge:s}function Dn(s){if(!s||!Wt(s))return s;let e=s.focusedInput;return!e||typeof e!="object"?s:{...s,focusedInput:{...e,secureTextEntry:!0,text:typeof e.text=="string"?ge:e.text}}}function Vt(s){let e=s.indexOf("--testid");if(e>=0&&s[e+1])return{mode:"testid",value:s[e+1]};let t=s.indexOf("--test-id");if(t>=0&&s[t+1])return{mode:"testid",value:s[t+1]};let n=s.indexOf("--text");return n>=0&&s[n+1]?{mode:"text",value:s[n+1]}:null}async function qs(s,e){let t=JSON.stringify(e.value),n=e.mode==="testid"?`(await t.findByTestId(${t})) || (await t.findById(${t}))`:`await t.findByText(${t})`;return await s.send({type:"evaluate",code:`(async () => {
|
|
473
473
|
const t = window.__sootsimTest
|
|
474
474
|
if (!t) return null
|
|
475
475
|
const n = ${n}
|
|
@@ -495,11 +495,11 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
495
495
|
type: n.type ?? null,
|
|
496
496
|
}
|
|
497
497
|
})()`})??null}async function qi(s,e={}){let{nav:t,keyboard:n,shell:o}=await co(s);if(e.json){console.log(JSON.stringify({shell:o??null,nav:t,keyboard:n},null,2));return}let i=[];if(o){let r=o.activeApp??o.state??"<none>",a=o.showSwitcher?" (app switcher open)":"",l=typeof o.launchProgress=="number"&&o.launchProgress<.98?` launching (${Math.round(o.launchProgress*100)}%)`:"";i.push(`shell: ${r}${a}${l}`)}else i.push("shell: <unavailable>");if(t){let r=t.transitionPhase!=="idle"?` (${t.transitionPhase}, ${t.activeTransitionCount} active)`:"";if(i.push(`nav: phase=${t.transitionPhase}${r}`),t.screens.length===0)i.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let a of t.screens){let l=a.isActive?"\u25B6":" ",u=a.routeName?` ${a.routeName}`:"",g=a.headerHeight>0?` header=${a.headerHeight}`:"",h=a.largeTitleState&&a.largeTitleState!=="expanded"?` large-title=${a.largeTitleState}`:"";i.push(` ${l} #${a.id}${u}${g}${h}`)}}else i.push("nav: <runtime not available>");if(n&&n.visible){let r=n.spec?.keyboardType??"default",a=n.spec?.returnKeyType??"default";i.push(`keyboard: visible (${r}, return=${a}, mode=${n.mode??"?"})`)}else i.push("keyboard: hidden");console.log(i.join(`
|
|
498
|
-
`))}async function Ki(s){let{bridge:e,args:t,positional:n}=s,o=n[1]?Number(n[1])*1e3:3e3,i=t.includes("--strict"),{elapsed:r,settled:a}=await Ae({bridge:e,maxMs:o,strict:i});console.log(a?` settled in ${r}ms`:` timed out after ${r}ms (may still be animating)`)}async function Ji(s){let e=s.positional[1]?Number(s.positional[1]):.5;(!Number.isFinite(e)||e<0)&&(console.error(s.inspectUsage("sleep","[seconds]")),process.exit(1)),await ke(e*1e3),console.log(` slept ${e}s`)}async function Ui(s){let{bridge:e,args:t,positional:n}=s,o=n[1]?Number(n[1]):5,{tree:i}=await Vn(e,o);if(
|
|
498
|
+
`))}async function Ki(s){let{bridge:e,args:t,positional:n}=s,o=n[1]?Number(n[1])*1e3:3e3,i=t.includes("--strict"),{elapsed:r,settled:a}=await Ae({bridge:e,maxMs:o,strict:i});console.log(a?` settled in ${r}ms`:` timed out after ${r}ms (may still be animating)`)}async function Ji(s){let e=s.positional[1]?Number(s.positional[1]):.5;(!Number.isFinite(e)||e<0)&&(console.error(s.inspectUsage("sleep","[seconds]")),process.exit(1)),await ke(e*1e3),console.log(` slept ${e}s`)}async function Ui(s){let{bridge:e,args:t,positional:n}=s,o=n[1]?Number(n[1]):5,{tree:i}=await Vn(e,o);if(H(t)){Y({depth:o,tree:i??null});return}console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}async function Wi(s,e={args:[]}){let t=await Hn(s);if(H(e.args)){Y(t);return}console.log(t.url)}async function Vi(s){let{wsPort:e,commandTimeoutMs:t,simId:n,simIdSource:o,positional:i}=s,r=i[1]?Number(i[1]):30,a=Math.max(1e3,(Number.isFinite(r)?r:30)*1e3),l=Math.max(1,Math.ceil(a/500));console.log(" waiting for sim reconnect...");let u=await go(e,t,n,{attempts:l,simIdSource:o});u||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),u.bridge.close(),js({source:"inspect wait",step:{wait:a},summary:`wait ${Math.round(a/1e3)}s`}),console.log(` ready: ${u.count} nodes`)}var Hi=new Set(["app-launch","toast","keyboard","screen","route","alert","actionsheet","picker","notification","fetch","console","shell","scroll","gesture","text-input","react-commit","animation","reanimated"]);function Ks(s,e){let t=s.indexOf(e);if(t>=0&&t+1<s.length)return s[t+1]}function Na(s,e){if(!e.filter&&!e.equals)return!0;let t=s.data,n=[];if(t&&typeof t=="object")for(let i of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let r=t[i];typeof r=="string"&&r.length>0&&n.push(r)}let o=n.join(" ");return e.equals?n.some(i=>i===e.equals):e.filter?o.toLowerCase().includes(e.filter.toLowerCase()):!0}async function Yi(s){let{bridge:e,args:t,positional:n,inspectUsage:o}=s,i=n[1];i||(console.error(o("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),Hi.has(i)||console.error(` warning: '${i}' is not a known timeline kind \u2014 waiting anyway. known: ${[...Hi].sort().join(", ")}`);let r=Ks(t,"--max-ms"),a=r&&Number.isFinite(Number(r))?Math.max(100,Number(r)):5e3,l=Ks(t,"--filter"),u=Ks(t,"--equals"),g=Ks(t,"--since")??"now",h=t.includes("--json"),y=Date.now(),w=y+a,N=200,b=y;for(;Date.now()<w;){let T={kinds:[i],since:g==="cursor"?void 0:b,limit:50},I=await e.send({type:"evaluate",code:`(async () => {
|
|
499
499
|
const t = window.SootSim?.bridges?.timeline
|
|
500
500
|
if (!t) return { ok: false, error: 'timeline bridge missing' }
|
|
501
501
|
return { ok: true, result: await t.recent(${JSON.stringify(T)}) }
|
|
502
|
-
})()`});(!I||!I.ok)&&(console.error(` could not query timeline: ${I&&"error"in I?I.error:"unknown"}`),process.exit(1));let O=I.result.events??[];for(let C of O)if(Na(C,{filter:l,equals:u})){let
|
|
502
|
+
})()`});(!I||!I.ok)&&(console.error(` could not query timeline: ${I&&"error"in I?I.error:"unknown"}`),process.exit(1));let O=I.result.events??[];for(let C of O)if(Na(C,{filter:l,equals:u})){let F=Date.now()-y;console.log(h?JSON.stringify({found:!0,elapsedMs:F,event:C}):` ${i} event after ${F}ms${l?` (filter: ${l})`:""}${u?` (equals: ${u})`:""}`);return}I.result.watermark&&I.result.watermark>b&&(b=I.result.watermark),await new Promise(C=>setTimeout(C,N))}let f=Date.now()-y;h?console.log(JSON.stringify({found:!1,elapsedMs:f,kind:i,filter:l,equals:u})):console.error(` \u26A0 wait event ${i} timed out after ${f}ms${l?` (filter: ${l})`:""}${u?` (equals: ${u})`:""}`),process.exit(1)}async function Gi(s){let{bridge:e,args:t}=s,n=t.includes("--strict"),o=Gt(t,3e3),{elapsed:i,settled:r}=await Ae({bridge:e,maxMs:o,strict:n});r?console.log(` idle in ${i}ms`):(console.error(` \u26A0 wait idle timed out after ${i}ms (may still be animating)`),process.exit(1))}async function zi(s){let{bridge:e,args:t}=s,n=Gt(t,2e4),{ready:o,elapsedMs:i,nodes:r,targets:a,flag:l,loadingText:u,externalReady:g,externalError:h,suppressedEntryError:y,errors:w}=await Zn(e,n,{onProgress(b){console.error(` still waiting after ${b.elapsedMs}ms \u2014 ${Gs(b)} (nodes: ${b.nodes}, targets: ${b.targets}, errors: ${b.errors})`)}});if(o){let b=n-i,f=Math.max(100,Math.min(1e4,b)),T=await Ae({bridge:e,maxMs:f,pollMs:32,stablePolls:2});T.settled||(console.error(` \u26A0 wait ready timed out after ${i+T.elapsed}ms \u2014 app mounted but did not settle (nodes: ${r}, targets: ${a})`),process.exit(1)),console.log(` ready in ${i+T.elapsed}ms: ${r} nodes, ${a} targets`);return}let N=Gs({externalError:h,loadingText:u,externalReady:g,flag:l,targets:a,suppressedEntryError:y});console.error(` \u26A0 wait ready timed out after ${i}ms \u2014 ${N} (nodes: ${r}, targets: ${a}, errors: ${w})`),process.exit(1)}async function Qi(s){let{bridge:e,args:t,positional:n,inspectUsage:o}=s,i=n[1];i||(console.error(o("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let r=t.indexOf("--max-ms"),a=r>=0&&t[r+1]?Math.max(100,Number(t[r+1])):5e3,l=t.includes("--gone"),{found:u,node:g,elapsed:h}=await eo(e,i,a,{gone:l});if(l){u?console.log(` #${i} gone after ${h}ms`):(console.error(` \u26A0 wait selector #${i} --gone timed out after ${h??a}ms (still present)`),process.exit(1));return}if(u&&g){let y=g.absolutePosition?`@(${Math.round(g.absolutePosition.x)},${Math.round(g.absolutePosition.y)})`:"",w=g.layout?`${Math.round(g.layout.width)}x${Math.round(g.layout.height)}`:"?x?";console.log(` found #${i} in ${h}ms ${w} ${y}`)}else console.error(` \u26A0 wait selector #${i} timed out after ${h??a}ms`),process.exit(1)}function ar(s){return s==null?"\u2014":s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}K`:`${(s/1024/1024).toFixed(1)}M`}function lr(s){return s==null?" \u2026":s<1e3?`${s}ms`.padStart(5):`${(s/1e3).toFixed(2)}s`.padStart(5)}function Xi(){process.stderr.write(` the sim is not responding. recover it with:
|
|
503
503
|
sootsim close --sim <id> # force-close the wedged sim
|
|
504
504
|
sootsim list # confirm it's gone
|
|
505
505
|
`)}async function Ta(s){try{return await s.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function Oa(s,e){try{let t=await s.send({type:"evaluate",code:`(async () => {
|
|
@@ -522,8 +522,8 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
522
522
|
return []
|
|
523
523
|
}
|
|
524
524
|
})()`});if(!Array.isArray(t)||t.length===0)return;let n=e.toLowerCase(),o=t.map(i=>({id:i,score:Aa(n,i.toLowerCase())})).filter(i=>i.score<n.length+4).sort((i,r)=>i.score-r.score).slice(0,5);if(o.length===0)return;console.error(" similar testIDs:");for(let i of o)console.error(` ${i.id}`)}catch{}}function Aa(s,e){if(e===s)return 0;if(e.includes(s))return 1;if(s.includes(e))return 2;let t=0;for(;t<s.length&&t<e.length&&s[t]===e[t];)t+=1;return Ea(s,e)-t}function Ea(s,e){if(s===e)return 0;if(!s.length)return e.length;if(!e.length)return s.length;let t=new Array(e.length+1),n=new Array(e.length+1);for(let o=0;o<=e.length;o++)t[o]=o;for(let o=1;o<=s.length;o++){n[0]=o;for(let r=1;r<=e.length;r++)n[r]=Math.min(t[r]+1,n[r-1]+1,t[r-1]+(s[o-1]===e[r-1]?0:1));let i=t;t=n,n=i}return t[e.length]}function Ma(s){return s.error?"err":s.status==null?" \u2026 ":String(s.status)}function Zi(s){return s.externalError?`guest app errored: ${s.externalError}`:s.loadingText?`still showing "${s.loadingText}"`:s.externalReady===!1?"guest app is still loading":s.flag!==!0?"guest app has not emitted sootsim:externalAppReady":s.targets<=0?"ready flag emitted but no visible app content is inspectable yet":"node tree is still changing"}function er(s){let e=Re(s.startTs),t=Ma(s).padEnd(3),n=s.method.padEnd(5),o=ar(s.size).padStart(6),i=lr(s.durationMs);console.log(` [${e}] ${t} ${n} ${o} ${i} ${s.displayUrl}`),s.error&&console.log(` error: ${s.error}`)}function _a(s){let e=[["id",s.id],["source",s.source],["kind",s.kind],["method",s.method],["status",s.error?`error: ${s.error}`:`${s.status??"\u2014"} ${s.statusText??""}`.trim()],["url",s.url],["started",Re(s.startTs)],["duration",lr(s.durationMs).trim()],["size",ar(s.size)],["content-type",s.type??"\u2014"]];for(let[t,n]of e)console.log(` ${t.padEnd(13)} ${n}`)}var Pa={error:"\x1B[31m",warn:"\x1B[33m",info:"\x1B[36m",debug:"\x1B[35m",log:"\x1B[37m"},tr="\x1B[0m",Ca="\x1B[2m";function sr(s,e){let t=Re(s.ts),n=s.level.toUpperCase().padEnd(5),o=s.args.join(" ");if(e){let i=Pa[s.level];console.log(` ${Ca}[${t}]${tr} ${i}${n}${tr} ${o}`)}else console.log(` [${t}] ${n} ${o}`);if(s.stack&&s.level==="error"){let i=s.stack.split(`
|
|
525
|
-
`).slice(0,5);for(let r of i)console.log(` ${r.trim()}`)}}var
|
|
526
|
-
`),console.log(` painted frames: ${s.frames}${s.skippedFrames?` (+${s.skippedFrames} skipped idle ticks)`:""}`),console.log(` avg: ${s.avgMs}ms (${e} fps) \xB7 max ${s.maxMs}ms`),console.log(` p50/p95/p99: ${s.p50} / ${s.p95} / ${s.p99} ms`),console.log(` jank: ${s.jankFrames} frames (${s.jankPct}%) >16.67ms`),console.log(` avg per frame: overlay ${s.avgOverlayMs}ms \xB7 aux ${s.avgAuxMs}ms \xB7 layout ${s.avgLayoutMs}ms`);let t=Array.isArray(s.auxSurfaces)?s.auxSurfaces:[];if(t.length>0){console.log(""),console.log(" surfaces (last 100 frames):");for(let i of t)console.log(` ${String(i.surfaceId).padEnd(10)} ${String(i.frames).padStart(4)} paints avg ${i.avgMs}ms (layout ${i.avgLayoutMs}, render ${i.avgRenderMs}, flush ${i.avgFlushMs}) max ${i.maxMs}ms`)}let n=s.renderProfile;n&&typeof n=="object"
|
|
525
|
+
`).slice(0,5);for(let r of i)console.log(` ${r.trim()}`)}}var La=120;async function nr(s,e){let t=s.find((y,w)=>s[w-1]==="--id"),n=s.find((y,w)=>s[w-1]==="--text");if(t||n){let y=await e.send({type:"evaluate",code:ko({id:t,text:n})});if(!y)throw new Error(t?`no node with id "${t}"`:`no node matching text "${n}"`);let{x:w,y:N,w:b,h:f}=y;return{x:w,y:N,w:b,h:f}}let o=s.find((y,w)=>s[w-1]==="--area");if(o){let y=o.split(",").map(T=>Number(T.trim()));if(y.length!==4||y.some(T=>!Number.isFinite(T)))throw new Error(`--area expects x,y,w,h (got "${o}")`);let[w,N,b,f]=y;return{x:w,y:N,w:b,h:f}}let i=y=>{let w=s.find((b,f)=>s[f-1]===y);if(w==null)return null;let N=Number(w);return Number.isFinite(N)?N:null},r=i("--x"),a=i("--y"),l=i("--w"),u=i("--h");if(r!=null||a!=null||l!=null||u!=null)return{x:r??0,y:a??0,w:l??1,h:u??1};let h=s.filter((y,w)=>w>0&&!y.startsWith("-")&&s[w-1]!=="--output"&&s[w-1]!=="--area"&&s[w-1]!=="--id"&&s[w-1]!=="--text"&&s[w-1]!=="--x"&&s[w-1]!=="--y"&&s[w-1]!=="--w"&&s[w-1]!=="--h").map(Number).filter(y=>Number.isFinite(y));if(h.length>=2){let[y,w,N=1,b=1]=h;return{x:y,y:w,w:N,h:b}}return null}function or(s){let e=s.avgMs>0?(1e3/s.avgMs).toFixed(1):"?";console.log(` shell frame profile:
|
|
526
|
+
`),console.log(` painted frames: ${s.frames}${s.skippedFrames?` (+${s.skippedFrames} skipped idle ticks)`:""}`),console.log(` avg: ${s.avgMs}ms (${e} fps) \xB7 max ${s.maxMs}ms`),console.log(` p50/p95/p99: ${s.p50} / ${s.p95} / ${s.p99} ms`),console.log(` jank: ${s.jankFrames} frames (${s.jankPct}%) >16.67ms`),console.log(` avg per frame: overlay ${s.avgOverlayMs}ms \xB7 aux ${s.avgAuxMs}ms \xB7 layout ${s.avgLayoutMs}ms`);let t=Array.isArray(s.auxSurfaces)?s.auxSurfaces:[];if(t.length>0){console.log(""),console.log(" surfaces (last 100 frames):");for(let i of t)console.log(` ${String(i.surfaceId).padEnd(10)} ${String(i.frames).padStart(4)} paints avg ${i.avgMs}ms (layout ${i.avgLayoutMs}, render ${i.avgRenderMs}, flush ${i.avgFlushMs}) max ${i.maxMs}ms`)}let n=s.renderProfile;if(n&&typeof n=="object"){console.log(""),console.log(" render profile (per frame):"),console.log(` node visits: ${n.nodeVisitsPerFrame}`),console.log(` boundaries: ${n.recordsPerFrame} records (${n.avgBoundaryRecordMs}ms) / ${n.replaysPerFrame} replays`),console.log(` raster tier: ${n.rasterPromotionsPerFrame} promotions / ${n.rasterBlitsPerFrame} blits`);let i=[n.rasterRejectRebuild?`rebuild ${n.rasterRejectRebuild}`:"",n.rasterRejectLinear?`linear ${n.rasterRejectLinear}`:"",n.rasterRejectAnimated?`animated ${n.rasterRejectAnimated}`:"",n.rasterRejectTransform?`transform ${n.rasterRejectTransform}`:"",n.rasterRejectOpacity?`opacity ${n.rasterRejectOpacity}`:"",n.rasterRejectCacheable?`cacheable ${n.rasterRejectCacheable}`:"",n.rasterRejectBounds?`bounds ${n.rasterRejectBounds}`:"",n.rasterRejectPixels?`pixels ${n.rasterRejectPixels}`:"",n.rasterWarming?`warming ${n.rasterWarming}`:""].filter(Boolean).join(" \xB7 ");i&&console.log(` raster skips: ${i} (total across run)`),console.log(` blur: ${n.avgBlurMs}ms`),console.log(` draw calls: text ${n.textDrawsPerFrame} \xB7 image ${n.imageDrawsPerFrame} \xB7 path ${n.pathDrawsPerFrame} \xB7 saveLayer ${n.saveLayersPerFrame}`)}let o=Array.isArray(s.worstFrames)?s.worstFrames:[];if(o.length>0){console.log(""),console.log(" worst frames (of last 100):");for(let i of o){let r=(i.auxSurfaces??[]).map(a=>`${a.surfaceId} ${a.totalMs}ms (layout ${a.layoutMs}, render ${a.renderMs})`).join(" \xB7 ");console.log(` ${String(i.totalMs).padStart(7)}ms overlay ${i.overlayMs} \xB7 aux ${i.auxMs} \xB7 layout ${i.layoutMs}${r?` [${r}]`:""}`)}}}async function Js(s,e,t){let n=Date.now()+e,o=await nt(s,e);for(;;){if(t(o))return{settled:!0,state:o};if(Date.now()>=n)return{settled:!1,state:o};await ke(16),o=await nt(s)}}async function Bn(s){return s.send({type:"evaluate",code:`(async () => {
|
|
527
527
|
const kb = window.__sootsimKeyboard
|
|
528
528
|
const test = window.__sootsimTest
|
|
529
529
|
if (!kb) return { error: 'keyboard bridge not available' }
|
|
@@ -560,7 +560,7 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
560
560
|
frame: runtimeSnapshot?.keyboard?.frame ?? null,
|
|
561
561
|
focusedRect: runtimeSnapshot?.focused?.rect ?? null,
|
|
562
562
|
}
|
|
563
|
-
})()`}).then(e=>Dn(e))}function
|
|
563
|
+
})()`}).then(e=>Dn(e))}function Fa(s,e,t){if(!s.visible)return!1;let n=s.focusedInput;return!(e&&n&&!(n.testID===e||n.id===e)||t!==null&&Wt(s)!==t)}async function Da(s,e=600,t={}){let n=Date.now()+e;for(;Date.now()<=n;){let o=await Bn(s);if(Fa(o,t.targetId??null,t.secureTextEntry??null))return o;await ke(30)}return Bn(s)}async function Us(s,e){let t=await Bn(s);if(t.visible&&t.focusedInput)return t;t.visible&&(console.error(` ${e} requires a focused TextInput. the iOS keyboard is visible, but no input owns focus.`),process.exit(1)),console.error(` ${e} requires the iOS keyboard to be visible. focus an input first with sootsim do tap-id/tap-text or sootsim do type-into.`),process.exit(1)}async function ir(s,e,t){return e==="appearance"?s.send({type:"evaluate",code:`(async () => {
|
|
564
564
|
const requested = ${JSON.stringify(t??"toggle")}
|
|
565
565
|
// the engine owns toggle + auto resolution (settingsStore is the single
|
|
566
566
|
// source of truth). never infer the current scheme client-side \u2014 the old
|
|
@@ -590,19 +590,19 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
590
590
|
`);console.log(`${c??""}
|
|
591
591
|
|
|
592
592
|
${d}
|
|
593
|
-
`),process.exit(0)}let y=o.wsPort,w=o.simId,N=o.simIdSource,b=o.commandTimeoutMs;if(r==="list"&&n.some(D=>D==="--drivers"||D==="-D")){let{buildDriverListRows:D}=await import("./drivers-
|
|
594
|
-
`);let d=Math.max(...c.map(m=>m.id.length),6),p=Math.max(...c.map(m=>m.kind.length),4);for(let m of c){let S=m.available?"\u2713":"\u2717",$=m.id.padEnd(d),x=m.kind.padEnd(p);console.log(` ${S} ${$} ${x} ${m.description}`),m.available&&m.detail?console.log(` ${m.detail}`):!m.available&&m.reason&&console.log(` unavailable: ${m.reason}`)}return}let f=po(o),T=w||"default",I=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),O=200;function C(D){let c=D.replace(/\s+/g," ").trim();if(!c)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(c)){let p=/<title[^>]*>([^<]+)<\/title>/i.exec(D)?.[1]?.trim(),m=/<body[^>]*>([\s\S]*?)<\//i.exec(D)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),S=p||m||"html error page";return`<html ${D.length}B> "${S}" (body elided \u2014 add --json for the full payload)`}return c.length<=O?c:`${c.slice(0,O)}\u2026 (+${c.length-O} more bytes)`}function
|
|
595
|
-
`)}catch{}}function
|
|
593
|
+
`),process.exit(0)}let y=o.wsPort,w=o.simId,N=o.simIdSource,b=o.commandTimeoutMs;if(r==="list"&&n.some(D=>D==="--drivers"||D==="-D")){let{buildDriverListRows:D}=await import("./drivers-O6BFN76G.js"),c=D();console.log(` available drivers (${c.length}):
|
|
594
|
+
`);let d=Math.max(...c.map(m=>m.id.length),6),p=Math.max(...c.map(m=>m.kind.length),4);for(let m of c){let S=m.available?"\u2713":"\u2717",$=m.id.padEnd(d),x=m.kind.padEnd(p);console.log(` ${S} ${$} ${x} ${m.description}`),m.available&&m.detail?console.log(` ${m.detail}`):!m.available&&m.reason&&console.log(` unavailable: ${m.reason}`)}return}let f=po(o),T=w||"default",I=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),O=200;function C(D){let c=D.replace(/\s+/g," ").trim();if(!c)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(c)){let p=/<title[^>]*>([^<]+)<\/title>/i.exec(D)?.[1]?.trim(),m=/<body[^>]*>([\s\S]*?)<\//i.exec(D)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),S=p||m||"html error page";return`<html ${D.length}B> "${S}" (body elided \u2014 add --json for the full payload)`}return c.length<=O?c:`${c.slice(0,O)}\u2026 (+${c.length-O} more bytes)`}function F(D){let c=D.displayUrl||D.url;return D.status!=null?`${D.method} ${c} -> ${D.status}${D.statusText?` ${D.statusText}`:""}`:D.error?`${D.method} ${c} -> ${D.error}`:`${D.method} ${c}`}async function k(D){let c=xt()?5e3:1500;try{let{settled:d,elapsed:p}=await Ae({bridge:D,maxMs:c,pollMs:32,stablePolls:2});d||process.stderr.write(` \u26A0 auto-wait timed out after ${p??c}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
|
|
595
|
+
`)}catch{}}function M(D,c){console.error(` tap failed: ${D} stayed visible but did not receive a hittable press after ${c.attempts} attempt${c.attempts===1?"":"s"}`),c.result&&console.error(` last result: ${JSON.stringify(c.result)}`)}async function A(){try{return await f.send({type:"evaluate",code:`(() => ({
|
|
596
596
|
console: ${zt},
|
|
597
597
|
requests: window.__sootsimTest?.getRequestCounts?.() || null,
|
|
598
598
|
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function q(D={}){let c=D.counts!==void 0?D.counts:await fe(f,"getRequestCounts");if(!c||typeof c!="object")return;let d=Math.max(0,Number(c.failed)||0);if(d===0||!D.includeTail&&!Pn("requests",T,String(d))||(console.log(`
|
|
599
599
|
network: ${d} failed request${d===1?"":"s"}`),console.log(` inspect: ${g("requests")} 5`),!D.includeTail))return;let p=await fe(f,"getFailedRequests",5);if(!(!Array.isArray(p)||p.length===0)){console.log(`
|
|
600
600
|
recent failed requests:
|
|
601
|
-
`);for(let m of p){let S=Re(m.timestamp);console.log(` [${S}] ${
|
|
601
|
+
`);for(let m of p){let S=Re(m.timestamp);console.log(` [${S}] ${F(m)}`),m.responseBody?console.log(` ${C(m.responseBody)}`):m.error&&console.log(` ${m.error}`)}}}function ee(D){for(let c of D){let d=c.title?` (\u201C${c.title}\u201D)`:"";console.log(`
|
|
602
602
|
note: ${c.label} is open${d} \u2014 taps/drags hit it, not the app`)}}async function ne(D={}){let c=D.counts!==void 0?D.counts:await f.send({type:"evaluate",code:zt});if(!c||typeof c!="object")return;let d=c,p=Math.max(0,Number(d.errors)||0),m=Math.max(0,Number(d.warnings)||0);if(p===0&&m===0||!D.includeTail&&!Pn("console",T,`${p}:${m}`))return;let S=[];if(p>0&&S.push(`${p} console error${p===1?"":"s"}`),m>0&&S.push(`${m} console warning${m===1?"":"s"}`),console.log(`
|
|
603
603
|
console: ${S.join(", ")}`),console.log(` inspect: ${g("errors")} 5`),m>0&&console.log(` inspect: ${g("warnings")} 5`),!D.includeTail||p===0)return;let $=await vt(f,5);if(!(!Array.isArray($)||$.length===0)){console.log(`
|
|
604
604
|
recent console errors:
|
|
605
|
-
`);for(let x of $){let
|
|
605
|
+
`);for(let x of $){let E=Re(x.timestamp),v=Array.isArray(x.args)?x.args.map(L=>typeof L=="object"?JSON.stringify(L):String(L)).join(" "):String(x);console.log(` [${E}] ${v}`)}}}let V=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function Qe(D){let c=Jn(),d=null;try{d=await ho(D,`(() => {
|
|
606
606
|
const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
|
|
607
607
|
if (!tl || typeof tl.summary !== 'function') return null
|
|
608
608
|
const cursorKey = ${JSON.stringify(c)}
|
|
@@ -618,9 +618,9 @@ ${d}
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
return summary ? { summary, consoleSplit } : null
|
|
621
|
-
})()`)}catch{return}if(!d||!d.summary||!d.summary.total)return;let p=d.summary.byKind??{},m=[],S=new Set;for(let $ of V){let x=p[$];if(x)if(S.add($),$==="console"&&d.consoleSplit){let{error:
|
|
622
|
-
since last: ${m.join(" \xB7 ")} \u2014 sootsim what-happened`),d.summary.lastAt))try{await Qt(D,"SootSim.bridges.timeline.cursorAdvance",c,d.summary.lastAt)}catch{}}let z=new Set(["tap","double-tap","tap-text","tap-id","type","type-into","key","key-sequence","keycode","drag","swipe","long-press","touch","gesture","pinch","scroll","shell","storage-clear"]),Xe=new Set(["a11y","capture","count","double-tap","drag","find","gesture","layout","long-press","node","pinch","sample-color","scroll","screenshot","swipe","tap","tap-id","tap-text","touch","tree","type-into"]),
|
|
623
|
-
`);for(let d of c){let p=[];if(p.push(`[${d.role}]`),d.label){let m=d.label.length>50?d.label.slice(0,47)+"...":d.label;p.push(`"${m}"`)}if(d.hint&&p.push(`(hint: "${d.hint}")`),d.testID&&p.push(`#${d.testID}`),d.state){let m=[];d.state.disabled&&m.push("disabled"),d.state.selected&&m.push("selected"),d.state.checked===!0&&m.push("checked"),d.state.checked==="mixed"&&m.push("mixed"),d.state.busy&&m.push("busy"),d.state.expanded===!0&&m.push("expanded"),d.state.expanded===!1&&m.push("collapsed"),m.length&&p.push(`{${m.join(", ")}}`)}d.position&&p.push(`@(${d.position.x},${d.position.y})`),d.size&&p.push(`${d.size.w}x${d.size.h}`),console.log(" "+p.join(" "))}}break}case"find":{await Ci({bridge:f,args:s,effectiveArgs:n,positional:i,inspectUsage:h});break}case"count":{await _i(f,{args:n});break}case"keyboard":{await
|
|
621
|
+
})()`)}catch{return}if(!d||!d.summary||!d.summary.total)return;let p=d.summary.byKind??{},m=[],S=new Set;for(let $ of V){let x=p[$];if(x)if(S.add($),$==="console"&&d.consoleSplit){let{error:E,warn:v}=d.consoleSplit;E>0&&m.push(`${E} error${E===1?"":"s"}`),v>0&&m.push(`${v} warning${v===1?"":"s"}`)}else m.push(`${x} ${$}${x===1?"":"s"}`)}for(let[$,x]of Object.entries(p))!S.has($)&&x&&m.push(`${x} ${$}${x===1?"":"s"}`);if(m.length!==0&&(console.log(`
|
|
622
|
+
since last: ${m.join(" \xB7 ")} \u2014 sootsim what-happened`),d.summary.lastAt))try{await Qt(D,"SootSim.bridges.timeline.cursorAdvance",c,d.summary.lastAt)}catch{}}let z=new Set(["tap","double-tap","tap-text","tap-id","type","type-into","key","key-sequence","keycode","drag","swipe","long-press","touch","gesture","pinch","scroll","shell","storage-clear"]),Xe=new Set(["a11y","capture","count","double-tap","drag","find","gesture","layout","long-press","node","pinch","sample-color","scroll","screenshot","swipe","tap","tap-id","tap-text","touch","tree","type-into"]),Ht=(s.includes("--verbose")||s.includes("-v"))&&!s.includes("--json");a==="do"&&r==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),z.has(r)&&await mo(f),Xe.has(r)&&await ot(f,{verbose:Ht});try{let D=z.has(r)&&!H(n)?await ao(f):[];switch(r){case"list":{uo(o.wsPort),await Di({bridge:f,simId:w,args:n});break}case"tree":{await Ui({bridge:f,args:n,positional:i});break}case"a11y":{let c=await Qn(f);if(!Array.isArray(c)||c.length===0){console.log(" no accessible nodes found");break}if(s.includes("--json"))console.log(JSON.stringify(c,null,2));else{console.log(` accessibility tree (${c.length} nodes):
|
|
623
|
+
`);for(let d of c){let p=[];if(p.push(`[${d.role}]`),d.label){let m=d.label.length>50?d.label.slice(0,47)+"...":d.label;p.push(`"${m}"`)}if(d.hint&&p.push(`(hint: "${d.hint}")`),d.testID&&p.push(`#${d.testID}`),d.state){let m=[];d.state.disabled&&m.push("disabled"),d.state.selected&&m.push("selected"),d.state.checked===!0&&m.push("checked"),d.state.checked==="mixed"&&m.push("mixed"),d.state.busy&&m.push("busy"),d.state.expanded===!0&&m.push("expanded"),d.state.expanded===!1&&m.push("collapsed"),m.length&&p.push(`{${m.join(", ")}}`)}d.position&&p.push(`@(${d.position.x},${d.position.y})`),d.size&&p.push(`${d.size.w}x${d.size.h}`),console.log(" "+p.join(" "))}}break}case"find":{await Ci({bridge:f,args:s,effectiveArgs:n,positional:i,inspectUsage:h});break}case"count":{await _i(f,{args:n});break}case"keyboard":{await Fi(f,{json:s.includes("--json")});break}case"screens":{await qi(f,{json:s.includes("--json")});break}case"memory":{await ji(f,{args:n});break}case"wait":{await Vi({wsPort:y,commandTimeoutMs:b,simId:w,simIdSource:N,positional:i});break}case"sleep":{await Ji({positional:i,inspectUsage:h});break}case"settle":{await Ki({bridge:f,args:s,positional:i});break}case"ready":{await zi({bridge:f,args:s});break}case"idle":{await Gi({bridge:f,args:s,positional:i});break}case"selector":{await Qi({bridge:f,args:s,positional:i,inspectUsage:h});break}case"event":{await Yi({bridge:f,args:s,positional:i,inspectUsage:h});break}case"layout":{let c=i[1];if(!c){await Li({bridge:f,args:n});break}let d=await f.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(c)}))()`});console.log(JSON.stringify(d,null,2));break}case"capture":case"screenshot":{let d=s.find((E,v)=>s[v-1]==="--output")||"/tmp/sootsim-inspect.png",p=await nr(s,f),m={type:"screenshot"};p&&(m.crop=p);let $=(await f.send(m)).replace(/^data:image\/png;base64,/,"");p&&console.log(` area: x=${p.x} y=${p.y} w=${p.w} h=${p.h}`),(await import("fs")).writeFileSync(d,Buffer.from($,"base64")),console.log(` saved: ${d}`);break}case"sample-color":{let c=await nr(s,f);c||(console.error(h("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical sootsim units."),process.exit(1));let d=await f.send({type:"evaluate",code:xo(c)});if(s.includes("--json"))console.log(JSON.stringify(d,null,2));else{let{r:p,g:m,b:S,a:$,hex:x,samples:E}=d,v=c.w===1&&c.h===1?`@(${c.x},${c.y})`:`@(${c.x},${c.y}) ${c.w}x${c.h}`;console.log(` ${x} rgba(${p}, ${m}, ${S}, ${$}) ${v} ${E} samples`)}break}case"node":{let c=i[1];c||(console.error(h("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let d=await f.send({type:"evaluate",code:`(async () => {
|
|
624
624
|
const t = window.__sootsimTest
|
|
625
625
|
const q = ${JSON.stringify(c)}
|
|
626
626
|
let node = null
|
|
@@ -676,17 +676,17 @@ ${d}
|
|
|
676
676
|
transform,
|
|
677
677
|
parentChain,
|
|
678
678
|
}
|
|
679
|
-
})()`});console.log(JSON.stringify(d,null,2));break}case"tap":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s);if(p){let $=await Ut(f,{agent:xt(),textFallback:p.mode==="text"?p.value:void 0,resolve:async()=>{let v=await qs(f,p);return v?{cx:v.x,cy:v.y,match:{id:p.mode==="testid"?p.value:v.id??null,testID:p.mode==="testid"?p.value:v.testID??null,text:p.mode==="text"?p.value:v.text??null,type:v.type??null},target:{id:v.id??null,testID:v.testID??null,text:v.text??null,type:v.type??null}}:null}}),x=$.payload;(!x||typeof x.cx!="number")&&(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),kt($.result)||(
|
|
679
|
+
})()`});console.log(JSON.stringify(d,null,2));break}case"tap":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s);if(p){let $=await Ut(f,{agent:xt(),textFallback:p.mode==="text"?p.value:void 0,resolve:async()=>{let v=await qs(f,p);return v?{cx:v.x,cy:v.y,match:{id:p.mode==="testid"?p.value:v.id??null,testID:p.mode==="testid"?p.value:v.testID??null,text:p.mode==="text"?p.value:v.text??null,type:v.type??null},target:{id:v.id??null,testID:v.testID??null,text:v.text??null,type:v.type??null}}:null}}),x=$.payload;(!x||typeof x.cx!="number")&&(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),kt($.result)||(M(`${p.mode} "${p.value}"`,$),process.exit(1));let E=rr(x.cx,x.cy,$.result);E&&await te("inspect tap",E.step,E.summary),console.log(JSON.stringify({...$.attempts>1?{attempts:$.attempts}:{},...$.result},null,2));break}(!Number.isFinite(c)||!Number.isFinite(d))&&(console.error(h("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let m=await Oi(f,c,d),S=rr(c,d,m);S&&await te("inspect tap",S.step,S.summary),console.log(JSON.stringify(m,null,2));break}case"drag":case"swipe":{let c=Number(i[1]),d=Number(i[2]),p=Number(i[3]),m=Number(i[4]),S=r==="swipe"?10:12,$=r==="swipe"?8:16,x=i[5]?Number(i[5]):S,E=i[6]?Number(i[6]):$;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(x)||!Number.isFinite(E))&&(console.error(h(r,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let v=await f.send({type:"evaluate",code:`(async () => {
|
|
680
680
|
const interact = window.__sootsimInteract
|
|
681
681
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
682
|
-
const value = await interact.drag(${c}, ${d}, ${p}, ${m}, ${Math.max(1,Math.round(x))}, ${Math.max(0,Math.round(
|
|
682
|
+
const value = await interact.drag(${c}, ${d}, ${p}, ${m}, ${Math.max(1,Math.round(x))}, ${Math.max(0,Math.round(E))})
|
|
683
683
|
return { ok: !!value, value }
|
|
684
|
-
})()`});if(v?.ok){let
|
|
684
|
+
})()`});if(v?.ok){let L=Math.max(1,Math.round(Math.max(1,x)*Math.max(0,E)));await te(`inspect ${r}`,{swipe:{start:`${c}, ${d}`,end:`${p}, ${m}`,duration:L}},`${r} ${c},${d} -> ${p},${m}`)}console.log(JSON.stringify(v,null,2));break}case"pinch":{let c=Number(i[1]),d=Number(i[2]),p=Number(i[3]),m=Number(i[4]),S=Number(i[5]),$=Number(i[6]),x=Number(i[7]),E=Number(i[8]),v=i[9]?Number(i[9]):12,L=i[10]?Number(i[10]):16;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(S)||!Number.isFinite($)||!Number.isFinite(x)||!Number.isFinite(E)||!Number.isFinite(v)||!Number.isFinite(L))&&(console.error(h("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let Q=await f.send({type:"evaluate",code:`(async () => {
|
|
685
685
|
const interact = window.__sootsimInteract
|
|
686
686
|
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
687
|
-
const value = await interact.pinch(${c}, ${d}, ${p}, ${m}, ${S}, ${$}, ${x}, ${
|
|
687
|
+
const value = await interact.pinch(${c}, ${d}, ${p}, ${m}, ${S}, ${$}, ${x}, ${E}, ${Math.max(1,Math.round(v))}, ${Math.max(0,Math.round(L))})
|
|
688
688
|
return { ok: !!value, value }
|
|
689
|
-
})()`});Q?.ok&&await te("inspect pinch",{pinch:{from:[c,d,p,m],to:[S,$,x,
|
|
689
|
+
})()`});Q?.ok&&await te("inspect pinch",{pinch:{from:[c,d,p,m],to:[S,$,x,E],steps:Math.max(1,Math.round(v)),stepMs:Math.max(0,Math.round(L))}},`pinch (${c},${d}) (${p},${m}) -> (${S},${$}) (${x},${E})`),console.log(JSON.stringify(Q,null,2));break}case"tap-text":{let c=i[1];c||(console.error(h("tap-text","<text>")),process.exit(1));let d=le=>{let G=s.indexOf(le);return G>=0&&G+1<s.length?s[G+1]:null},p=le=>s.includes(le),m=d("--nth")??d("--index"),S=m!==null?Number(m):null;S!==null&&!Number.isFinite(S)&&(console.error(` --nth/--index requires an integer, got: ${m}`),process.exit(1));let $=d("--within"),x=d("--role"),E=p("--exact"),v=p("--first"),L=d("--min-y"),Q=d("--max-y"),ue=d("--min-x"),ie=d("--max-x");for(let[le,G]of[["--min-y",L],["--max-y",Q],["--min-x",ue],["--max-x",ie]])G!==null&&!Number.isFinite(Number(G))&&(console.error(` ${le} requires a number, got: ${G}`),process.exit(1));let re=s.indexOf("--near"),K=null;if(re>=0){let le=Number(s[re+1]),G=Number(s[re+2]);(!Number.isFinite(le)||!Number.isFinite(G))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),K={x:le,y:G}}let _={exact:E,role:x,within:$,minX:ue!==null?Number(ue):null,maxX:ie!==null?Number(ie):null,minY:L!==null?Number(L):null,maxY:Q!==null?Number(Q):null,near:K,nth:S,first:v},R=await Ei(f,c,_,{agent:xt()}),B=R.payload;if(B?.error==="bridge-not-ready"&&(console.error(" sootsim test bridge not ready"),process.exit(1)),B?.ambiguous){let le=B.candidates;console.error(` ambiguous: ${B.total} matches for "${c}"`);for(let G of le){let Yt=G.abs?`@(${Math.round(G.abs.x)},${Math.round(G.abs.y)})`:"",ur=G.layout?` ${G.layout.width}x${G.layout.height}`:"",fr=G.testID?` #${G.testID}`:"",dr=G.text?` "${G.text}"`:"",pr=G.ancestorTestIDs.length>0?` within ${G.ancestorTestIDs.slice(0,3).map(mr=>`#${mr}`).join(" > ")}`:"";console.error(` [${G.idx}] <${G.type}>${dr}${fr} ${Yt}${ur}${pr}`)}B.total>le.length&&console.error(` ... and ${B.total-le.length} more`),console.error(" pick one:"),console.error(" --nth <index> pick the nth match (top-to-bottom, left-to-right; negatives from end)"),console.error(" --within <testID> narrow to descendants of a node"),console.error(" --min-y / --max-y geometric filter (pixels, absolute)"),console.error(" --min-x / --max-x geometric filter (pixels, absolute)"),console.error(" --near <x> <y> pick the closest match to a point"),console.error(" --exact exact text match (default is substring)"),console.error(" --role <role> narrow to accessibilityRole"),console.error(" --first keep the old pick-first-silently behavior"),process.exit(2)}B?.nthOutOfRange&&(console.error(` not found: nth ${B.nth} of ${B.total} match${B.total===1?"":"es"} for "${c}"`),process.exit(1)),(!B||typeof B.cx!="number")&&(console.error(` not found: ${c}`),process.exit(1)),kt(R.result)||(M(`text "${c}"`,R),process.exit(1));let Ee=Rn(c,{id:B.target?.id??null,testID:B.target?.testID??null,type:B.target?.type??null,cx:B.cx,cy:B.cy},"text");await te("inspect tap-text",Ee.step,Ee.summary),console.log(JSON.stringify({matched:B.match,tapped:{nodeId:B.target?.nodeId??null,id:B.target?.id??null,testID:B.target?.testID??null,type:B.target?.type??null,cx:B.cx,cy:B.cy},...B.strategy&&B.strategy!=="matched-node"?{strategy:B.strategy}:{},...B.total>1||S!==null?{nth:{index:B.idx,total:B.total}}:{},...R.attempts>1?{attempts:R.attempts}:{},result:R.result},null,2));break}case"tap-best":{let c=i[1];c||(console.error(h("tap-best","<query>")),process.exit(1));let d=await Mi(f,c,{agent:xt()}),p=d.payload;p||(console.error(` tap-best: no testID or visible text matched "${c}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1)),"error"in p&&(console.error(` ${p.error}`),process.exit(1)),p.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${c}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1));let m=p.node;kt(d.result)||(M(`best "${c}"`,d),process.exit(1));let S=Rn(c,{id:m.id,testID:m.testID,type:m.type,cx:p.cx,cy:p.cy},p.strategy==="testid"?"id":"text");await te("inspect tap-best",S.step,S.summary),console.log(JSON.stringify({matched:{strategy:p.strategy,nodeId:m.nodeId,id:m.id,testID:m.testID,type:m.type,text:m.text},tapped:{cx:p.cx,cy:p.cy},...d.attempts>1?{attempts:d.attempts}:{},result:d.result},null,2));break}case"tap-id":{let c=i[1];c||(console.error(h("tap-id","<id>")),process.exit(1));let d=await Ai(f,c,{agent:xt()}),p=d.payload;(!p||typeof p.cx!="number")&&(console.error(` not found: ${c}`),await Oa(f,c),process.exit(1)),kt(d.result)||(M(`id "${c}"`,d),process.exit(1));let m=Rn(c,{id:p.target?.id??null,testID:p.target?.testID??null,type:p.target?.type??null,cx:p.cx,cy:p.cy},"id");await te("inspect tap-id",m.step,m.summary),console.log(JSON.stringify({matched:p.match,tapped:{nodeId:p.target?.nodeId??null,id:p.target?.id??null,testID:p.target?.testID??null,type:p.target?.type??null,cx:p.cx,cy:p.cy},...p.strategy&&p.strategy!=="matched-node"?{strategy:p.strategy}:{},...d.attempts>1?{attempts:d.attempts}:{},result:d.result},null,2));break}case"type-into":{let c=i[1],d=i.slice(2).join(" ");(!c||!d)&&(console.error(h("type-into","<id> <text>")),process.exit(1));let p=JSON.stringify(c),m=await f.send({type:"evaluate",code:`(async () => {
|
|
690
690
|
const t = window.__sootsimTest
|
|
691
691
|
if (!t) return null
|
|
692
692
|
const n = await (t.findByTestId(${p}) || t.findById(${p}))
|
|
@@ -701,7 +701,7 @@ ${d}
|
|
|
701
701
|
secureTextEntry: !!n.secureTextEntry,
|
|
702
702
|
placeholder: n.placeholder || null,
|
|
703
703
|
}
|
|
704
|
-
})()`});(!m||typeof m.cx!="number")&&(console.error(` not found: ${c}`),process.exit(1)),m.isTextInput||console.error(` warning: ${c} is not a text input (isTextInput: false)`);let S=await f.send({type:"tap",x:m.cx,y:m.cy,target:{id:m.id??c,testID:m.testID??c,text:null,type:m.type??null}}),$=m.secureTextEntry===!0,x=await Da(f,1e3,{targetId:c,secureTextEntry:$});x.visible||(console.error(` keyboard did not open after tapping ${c}`),process.exit(1));let
|
|
704
|
+
})()`});(!m||typeof m.cx!="number")&&(console.error(` not found: ${c}`),process.exit(1)),m.isTextInput||console.error(` warning: ${c} is not a text input (isTextInput: false)`);let S=await f.send({type:"tap",x:m.cx,y:m.cy,target:{id:m.id??c,testID:m.testID??c,text:null,type:m.type??null}}),$=m.secureTextEntry===!0,x=await Da(f,1e3,{targetId:c,secureTextEntry:$});x.visible||(console.error(` keyboard did not open after tapping ${c}`),process.exit(1));let E=x.focusedInput;E&&(E.testID===c||E.id===c||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(c)} but focus is on ${JSON.stringify(E.testID??E.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await f.send({type:"keyboard",action:"type",text:d});let v=$||Wt(x),L=v?ge:Fn(d,x),Q=v&&x.focusedInput?{...x.focusedInput,secureTextEntry:!0,text:typeof x.focusedInput.text=="string"?ge:x.focusedInput.text}:x.focusedInput??null;await te("inspect type-into",{tapOn:{id:c},inputText:L},L===ge?`type-into #${c} ${ge}`:`type-into #${c} ${JSON.stringify(d)}`),console.log(JSON.stringify({target:c,isTextInput:m.isTextInput,secureTextEntry:v,keyboardOpened:x.visible??S?.keyboardOpened??!1,focusedInput:Q,typed:L},null,2));break}case"type":{let c=i.slice(1).join(" ");c||(console.error(h("type","<text>")),process.exit(1));let d=await Us(f,"type");await f.send({type:"keyboard",action:"type",text:c});let p=Fn(c,d);await te("inspect type",{inputText:p},p===ge?`type ${ge}`:`type ${JSON.stringify(c)}`),console.log(p===ge?` typed: ${ge}`:` typed: ${JSON.stringify(c)}`);break}case"key":{let c=i[1];c||(console.error(h("key","<name>")),process.exit(1)),await Us(f,"key"),await f.send({type:"keyboard",action:"press",text:c}),await te("inspect key",{pressKey:c},`key ${c}`),console.log(` pressed: ${c}`);break}case"key-sequence":{let c=i.slice(1);c.length===0&&(console.error(h("key-sequence","<key> [<key> ...]")),process.exit(1)),await Us(f,"key-sequence");for(let d of c)await f.send({type:"keyboard",action:"press",text:d});await te("inspect key-sequence",{pressKey:c.join(" ")},`key-sequence ${c.join(" ")}`),console.log(` pressed: ${c.join(", ")}`);break}case"keycode":{let c=i.slice(1);c.length===0&&(console.error(h("keycode","<code> [<code> ...]")),process.exit(1));let d=c.map(m=>({code:m,key:Ra(m)})),p=d.filter(m=>!m.key);p.length>0&&(console.error(` unsupported keycode(s): ${p.map(m=>m.code).join(", ")}`),process.exit(1)),await Us(f,"keycode");for(let m of d)await f.send({type:"keyboard",action:"press",text:m.key});await te("inspect keycode",{pressKey:d.map(m=>m.key).join(" ")},`keycode ${c.join(" ")}`),console.log(` pressed: ${c.join(", ")}`);break}case"dispatch":{let c=i[1];c||(console.error(h("dispatch","<char>")),process.exit(1)),await f.send({type:"keyboard",action:"dispatchKey",text:c}),await te("inspect dispatch",{dispatchKey:c},`dispatch ${JSON.stringify(c)}`),console.log(` dispatched: ${c}`);break}case"dismiss":{await f.send({type:"keyboard",action:"dismiss"}),await te("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s);if(p){let x=await qs(f,p);x||(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),c=x.x,d=x.y}let m=i[3]?Number(i[3]):80;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(m))&&(console.error(h("double-tap","<x> <y> [gapMs] | --testid <id>")),process.exit(1));let S=Math.max(0,Math.round(m)),$=await f.send({type:"evaluate",code:`(async () => {
|
|
705
705
|
const interact = window.__sootsimInteract
|
|
706
706
|
if (interact?.doubleTap) {
|
|
707
707
|
return {
|
|
@@ -724,13 +724,13 @@ ${d}
|
|
|
724
724
|
first,
|
|
725
725
|
second,
|
|
726
726
|
}
|
|
727
|
-
})()`});$?.ok&&await te("inspect double-tap",{doubleTapAtCoords:{x:c,y:d,gapMs:S}},`double-tap @${c},${d}`),console.log(JSON.stringify($,null,2));break}case"long-press":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s),m=null;if(p){let v=await qs(f,p);v||(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),c=v.x,d=v.y,m={id:v.id??null,testID:v.testID??null,text:v.text??null,type:v.type??null}}let S=p?i[1]:i[3],$=S?Number(S):600;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite($))&&(console.error(h("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let x=Math.max(0,Math.round($)),
|
|
727
|
+
})()`});$?.ok&&await te("inspect double-tap",{doubleTapAtCoords:{x:c,y:d,gapMs:S}},`double-tap @${c},${d}`),console.log(JSON.stringify($,null,2));break}case"long-press":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s),m=null;if(p){let v=await qs(f,p);v||(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),c=v.x,d=v.y,m={id:v.id??null,testID:v.testID??null,text:v.text??null,type:v.type??null}}let S=p?i[1]:i[3],$=S?Number(S):600;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite($))&&(console.error(h("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let x=Math.max(0,Math.round($)),E=await f.send({type:"longPress",x:c,y:d,durationMs:x,target:m});E?.ok&&await te("inspect long-press",{tapAtCoords:{x:c,y:d}},`long-press @${c},${d}`),console.log(JSON.stringify(E,null,2));break}case"touch":{let c=i[1],d=Number(i[2]),p=Number(i[3]),m=i[4]?Number(i[4]):999,S=c==="down"?"touchDown":c==="move"?"touchMove":c==="up"?"touchUp":c==="cancel"?"touchCancel":null;S||(console.error(h("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),c!=="cancel"&&(!Number.isFinite(d)||!Number.isFinite(p))&&(console.error(h("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let $=c==="down"?"tap":c==="move"?"move":null,x=$&&Number.isFinite(d)&&Number.isFinite(p)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${$}', x: ${d}, y: ${p} } }));`:"",E=await f.send({type:"evaluate",code:`(async () => {
|
|
728
728
|
${x}
|
|
729
729
|
const interact = window.__sootsimInteract
|
|
730
730
|
if (!interact?.${S}) return { ok: false, reason: 'no interact.${S}' }
|
|
731
731
|
const value = ${c==="cancel"?`await interact.${S}(${Math.max(1,Math.round(m))})`:`await interact.${S}(${d}, ${p}, ${Math.max(1,Math.round(m))})`}
|
|
732
732
|
return { ok: !!value, value }
|
|
733
|
-
})()`});
|
|
733
|
+
})()`});E?.ok&&c!=="cancel"&&await te("inspect touch",{tapAtCoords:{x:d,y:p}},`touch ${c} @${d},${p}`),console.log(JSON.stringify(E,null,2));break}case"gesture":{let c=["scroll-up","scroll-down","scroll-left","scroll-right","swipe-from-left-edge","swipe-from-right-edge","swipe-from-top-edge","swipe-from-bottom-edge"],d=i[1],p=i[2]?Number(i[2]):220;(!d||!Number.isFinite(p))&&(console.error(h("gesture","<preset> [durationMs]")),console.error(` presets: ${c.join(", ")}`),process.exit(1)),c.includes(d)||(console.error(` unknown gesture preset: ${d}`),console.error(` presets: ${c.join(", ")}`),process.exit(1));let m=await f.send({type:"evaluate",code:`(async () => {
|
|
734
734
|
const spec = globalThis.__sootsimDeviceSpec || {}
|
|
735
735
|
return {
|
|
736
736
|
width: spec.width || window.innerWidth || 393,
|
|
@@ -738,12 +738,12 @@ ${d}
|
|
|
738
738
|
statusBarHeight: spec.statusBarHeight || 0,
|
|
739
739
|
homeIndicatorHeight: spec.homeIndicatorHeight || 0,
|
|
740
740
|
}
|
|
741
|
-
})()`}),S=Number(m?.width)||393,$=Number(m?.height)||852,x=Number(m?.statusBarHeight)||0,
|
|
741
|
+
})()`}),S=Number(m?.width)||393,$=Number(m?.height)||852,x=Number(m?.statusBarHeight)||0,E=Number(m?.homeIndicatorHeight)||0,v=Math.round(S/2),L=Math.round($/2),Q=Math.max(24,x+18),ue=Math.max(24,E+18),ie=18,re=Math.min(220,Math.round($*.24)),K=Math.min(180,Math.round(S*.32)),_=v,R=L,B=v,Ee=L;switch(d){case"scroll-up":R=L+Math.round(re/2),Ee=L-Math.round(re/2);break;case"scroll-down":R=L-Math.round(re/2),Ee=L+Math.round(re/2);break;case"scroll-left":_=v+Math.round(K/2),B=v-Math.round(K/2);break;case"scroll-right":_=v-Math.round(K/2),B=v+Math.round(K/2);break;case"swipe-from-left-edge":_=ie,R=L,B=Math.min(S-ie,ie+K);break;case"swipe-from-right-edge":_=S-ie,R=L,B=Math.max(ie,S-ie-K);break;case"swipe-from-top-edge":_=v,R=Q,Ee=Math.min($-ue,Q+re);break;case"swipe-from-bottom-edge":_=v,R=$-ue,Ee=Math.max(Q,$-ue-re);break}let le=Math.max(8,Math.round(p/16)),G=Math.max(1,Math.round(p/le)),Yt=await f.send({type:"evaluate",code:`(async () => {
|
|
742
742
|
const interact = window.__sootsimInteract
|
|
743
743
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
744
|
-
const value = await interact.drag(${
|
|
744
|
+
const value = await interact.drag(${_}, ${R}, ${B}, ${Ee}, ${le}, ${G})
|
|
745
745
|
return { ok: !!value, value }
|
|
746
|
-
})()`});
|
|
746
|
+
})()`});Yt?.ok&&await te("inspect gesture",{swipe:{start:`${_}, ${R}`,end:`${B}, ${Ee}`,duration:Math.max(1,Math.round(p))}},`gesture ${d}`),console.log(JSON.stringify({preset:d,from:{x:_,y:R},to:{x:B,y:Ee},result:Yt},null,2));break}case"scroll":{let c=Vt(s),d=ja(s),p=c?.mode==="testid"?c.value:d==null?i[1]:null,m=c||d!=null?1:2,S=Number(i[m]),$=Number(i[m+1]);(!p&&d==null||!Number.isFinite(S)||!Number.isFinite($))&&(console.error(h("scroll","<id> <x> <y> | --testid <id> <x> <y> | --node-id <nodeId> <x> <y>")),process.exit(1));let x=await f.send({type:"evaluate",code:`(async () => {
|
|
747
747
|
const t = window.__sootsimTest
|
|
748
748
|
if (!t) return null
|
|
749
749
|
const n = ${d!=null?`await t.inspectByNodeId(${JSON.stringify(d)})`:`await t.findByTestId(${JSON.stringify(p)})
|
|
@@ -753,7 +753,7 @@ ${d}
|
|
|
753
753
|
cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
|
|
754
754
|
cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
|
|
755
755
|
}
|
|
756
|
-
})()`}),
|
|
756
|
+
})()`}),E=await fe(f,"scrollTo",d!=null?{nodeId:d}:p,S,$,!1);if(E?.ok){let v=d!=null?`node ${d}`:`#${p}`;await te("inspect scroll",{scrollTo:{...d!=null?{nodeId:d}:{id:p},x:S,y:$}},`scroll ${v} -> ${S},${$}`)}console.log(JSON.stringify({...E,...x?{at:{x:x.cx,y:x.cy}}:{}},null,2));break}case"state":{let c=i[1];if(t==="get"&&!c){let p=await fe(f,"getRuntimeState"),m=await f.send({type:"evaluate",code:zt});if(p&&typeof p=="object"&&p.diagnostics&&(p.diagnostics.errors=m?.errors??0,p.diagnostics.warnings=m?.warnings??0),p&&typeof p=="object"&&p.shell==null)try{let S=await nt(f);S&&(p.shell=S)}catch{}console.log(JSON.stringify(p,null,2));break}if(!c||c==="--help"||c==="-h"){console.log(`
|
|
757
757
|
${g("state")} \u2014 dump raw runtime state
|
|
758
758
|
|
|
759
759
|
subcommands:
|
|
@@ -835,21 +835,37 @@ ${d}
|
|
|
835
835
|
${g("shell")} open-card clock 800
|
|
836
836
|
${g("shell")} appearance dark
|
|
837
837
|
${g("shell")} lock
|
|
838
|
-
`);break}let d=c==="launch"||c==="open-card"||c==="home"||c==="switcher",p=c==="launch"||c==="open-card"?i[3]:i[2],m=p?Number(p):350;d&&(!Number.isFinite(m)||m<0)&&(console.error(h("shell",c==="launch"||c==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let S=!1,$=!1,x=null,
|
|
838
|
+
`);break}let d=c==="launch"||c==="open-card"||c==="home"||c==="switcher",p=c==="launch"||c==="open-card"?i[3]:i[2],m=p?Number(p):350;d&&(!Number.isFinite(m)||m<0)&&(console.error(h("shell",c==="launch"||c==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let S=!1,$=!1,x=null,E=s.includes("--clear-state");if(c==="launch"){let v=i[2];v||(console.error(h("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),E&&await f.send({type:"evaluate",code:Xs(!0)}),S=!!await Nt(f,"launchApp",m,v),{settled:$,state:x}=await Js(f,Math.round(m),L=>!!L&&L.state==="app"&&L.activeApp===v&&L.showSwitcher===!1&&L.switcherPhase==="idle"&&typeof L.launchProgress=="number"&&L.launchProgress>=.98),S&&await te("inspect shell launch",E?{launchApp:{clearState:!0}}:{launchApp:{}},E?"launch app (clear state)":"launch app")}else if(c==="home")S=!!await Nt(f,"goHome",m),{settled:$,state:x}=await Js(f,Math.round(m),v=>!!v&&v.state==="home"&&v.activeApp==null&&v.showSwitcher===!1&&v.switcherPhase==="idle"&&typeof v.launchProgress=="number"&&v.launchProgress>=.98);else if(c==="switcher")S=!!await Nt(f,"openSwitcher",m),{settled:$,state:x}=await Js(f,Math.round(m),v=>!!v&&v.state==="app"&&v.showSwitcher===!0&&v.switcherPhase==="idle"&&typeof v.zoomLevel=="number"&&Math.abs(v.zoomLevel)<=.02&&typeof v.horizontalZoom=="number"&&Math.abs(v.horizontalZoom)<=.02),$&&(await ke(La),x=await nt(f));else if(c==="open-card"){let v=i[2];v||(console.error(h("shell","open-card <appId> [settleMs]")),process.exit(1)),S=!!await Nt(f,"openSwitcherCard",m,v),{settled:$,state:x}=await Js(f,Math.round(m),L=>!!L&&L.state==="app"&&L.activeApp===v&&L.showSwitcher===!1&&L.switcherPhase==="idle"&&typeof L.zoomLevel=="number"&&L.zoomLevel>=.98&&typeof L.horizontalZoom=="number"&&L.horizontalZoom>=.98),S&&await te("inspect shell open-card",{openSwitcherCard:{appId:v}},`open switcher card ${v}`)}else if(c==="appearance"){let v=i[2];(!v||!["light","dark","auto","toggle"].includes(v))&&(console.error(h("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let L=await ir(f,"appearance",v);if(S=!!L?.ok,x={appearance:L},S){let Q=L?.applied??v;console.log(` appearance: ${Q}`)}}else if(c==="lock"||c==="shake"){let v=await ir(f,c);S=!!v?.ok,x={[c]:v}}else console.error(` unknown shell subcommand: ${c}`),process.exit(1);console.log(JSON.stringify({ok:S,settled:$,state:x},null,2));break}case"url":{await Wi(f,{args:n});break}case"reload":{let p=!1,m=!1;try{await f.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let x=await f.send({type:"evaluate",code:`;(async () => {
|
|
839
|
+
// in-place guest reload is only valid while the page still runs
|
|
840
|
+
// the engine build the server would serve NOW. the shell dev
|
|
841
|
+
// server has no HMR client, so a long-lived sim tab otherwise
|
|
842
|
+
// keeps a stale engine forever while builds churn underneath it.
|
|
843
|
+
// compare the inlined engine manifest against a fresh fetch of
|
|
844
|
+
// this page's html; any drift means the whole page must reload.
|
|
845
|
+
let engineStale = false
|
|
846
|
+
try {
|
|
847
|
+
const loaded = document.getElementById('__sootsim-engine-manifest')?.textContent
|
|
848
|
+
if (loaded) {
|
|
849
|
+
const res = await fetch(location.href, { cache: 'no-store' })
|
|
850
|
+
const html = await res.text()
|
|
851
|
+
const m = html.match(/<script[^>]*id="__sootsim-engine-manifest"[^>]*>([^<]*)<\\/script>/)
|
|
852
|
+
if (m && m[1] !== loaded) engineStale = true
|
|
853
|
+
}
|
|
854
|
+
} catch {}
|
|
839
855
|
const reloadExternalApp = window.SootSim?.bridges?.hotRemount?.reloadExternalApp
|
|
840
|
-
if (typeof reloadExternalApp === 'function') {
|
|
856
|
+
if (!engineStale && typeof reloadExternalApp === 'function') {
|
|
841
857
|
reloadExternalApp()
|
|
842
858
|
return { kind: 'external-app' }
|
|
843
859
|
}
|
|
844
860
|
window.location.reload()
|
|
845
|
-
return { kind: 'page' }
|
|
846
|
-
})()`});m=!!x&&x.kind==="external-app",p=!0}catch{}console.log(" reloading...");let S=f,$=null;if(m)$=await Zt(f,{timeoutMs:1e4,errorGraceMs:3e3});else{p&&await ke(300);let
|
|
861
|
+
return { kind: 'page', engineStale }
|
|
862
|
+
})()`});m=!!x&&x.kind==="external-app",p=!0,x&&x.engineStale&&console.log(" engine build changed since page load \u2014 full page reload")}catch{}console.log(" reloading...");let S=f,$=null;if(m)$=await Zt(f,{timeoutMs:1e4,errorGraceMs:3e3});else{p&&await ke(300);let E=await yo(y,b,w,{timeoutMs:3e4,simIdSource:N});E?(S=E,$=await Zt(E,{timeoutMs:3e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 30000ms"),S=null)}if($)if($.ready){let x=$.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${$.elapsedMs}ms: ${$.nodes} nodes${x}`)}else if($.source==="error-bail")console.log(` \u26A0 reload bailed after ${$.elapsedMs}ms: ${$.errors} console error(s), ready signal never fired`);else{let x=Zi($);console.log(` \u26A0 reload timed out after ${$.elapsedMs}ms \u2014 ${x} (nodes: ${$.nodes}, targets: ${$.targets}, errors: ${$.errors})`)}if(S)try{let x=await vt(S,10);if(S!==f&&S.close(),Array.isArray(x)&&x.length>0){console.log(`
|
|
847
863
|
\u26A0 ${x.length} error(s) during mount:
|
|
848
|
-
`);for(let
|
|
849
|
-
`).slice(0,2);for(let Q of
|
|
864
|
+
`);for(let E of x){let v=E.args.map(L=>typeof L=="object"?JSON.stringify(L):L).join(" ");if(console.log(` ${v}`),E.stack){let L=E.stack.split(`
|
|
865
|
+
`).slice(0,2);for(let Q of L)console.log(` ${Q.trim()}`)}}}}catch{}$&&!$.ready&&(process.exitCode=1);break}case"storage-clear":{if(await zs(f),await f.send({type:"evaluate",code:Xs(!0)})!==!0){H(n)?Y({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let m=await Zt(f,{timeoutMs:1e4,errorGraceMs:3e3});if(H(n)){Y({cleared:!0,ready:m.ready,reload:m}),m.ready||(process.exitCode=1);break}if(m.ready){let S=m.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` cleared tenant storage; ready in ${m.elapsedMs}ms: ${m.nodes} nodes${S}`)}else if(m.source==="error-bail")console.log(` \u26A0 storage clear reloaded but bailed after ${m.elapsedMs}ms: ${m.errors} console error(s), ready signal never fired`);else{let S=Zi(m);console.log(` \u26A0 storage clear reloaded but timed out after ${m.elapsedMs}ms \u2014 ${S} (nodes: ${m.nodes}, targets: ${m.targets}, errors: ${m.errors})`)}try{let S=await vt(f,10);if(Array.isArray(S)&&S.length>0){console.log(`
|
|
850
866
|
\u26A0 ${S.length} error(s) during mount:
|
|
851
|
-
`);for(let $ of S){let x=$.args.map(
|
|
852
|
-
`).slice(0,2);for(let v of
|
|
867
|
+
`);for(let $ of S){let x=$.args.map(E=>typeof E=="object"?JSON.stringify(E):E).join(" ");if(console.log(` ${x}`),$.stack){let E=$.stack.split(`
|
|
868
|
+
`).slice(0,2);for(let v of E)console.log(` ${v.trim()}`)}}}}catch{}m.ready||(process.exitCode=1);break}case"eval":case"js":{let c=i.slice(1).join(" ");c||(console.error(h("js","<javascript>")),console.error(""),console.error(" runs the snippet in the engine realm. SootSim is the"),console.error(" canonical state surface \u2014 reach into it directly."),console.error(""),console.error(" examples:"),console.error(` ${g("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${g("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${g("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${g("js")} SootSim.state.root.children.length`),process.exit(1));let d=c;d.startsWith("(async")||(d=`(async () => ${d})()`);let p=await f.send({type:"evaluate",code:d});console.log(JSON.stringify(p,null,2));let m=c.toLowerCase(),S=[];(m.includes("sootsim:gohome")||m.includes("gohome"))&&S.push("sootsim shell home"),(m.includes("sootsim:appswitcher")||m.includes("appswitcher"))&&S.push("sootsim shell switcher"),(m.includes("keyboard.isvisible")||m.includes("keyboard.getmode"))&&S.push("sootsim debug state keyboard"),m.includes("interact.tap")&&S.push("sootsim do tap <x> <y>"),m.includes("keyboard.type")&&S.push("sootsim do type <text>"),(m.includes("keyboard.press")||m.includes("keyboard.dispatchkey"))&&S.push("sootsim do key <name>"),m.includes("keyboard.dismiss")&&S.push("sootsim do dismiss"),m.includes("dumptree")&&S.push("sootsim get tree"),m.includes("dumpaccessibilitytree")&&S.push("sootsim get a11y"),m.includes("getnodecount")&&S.push("sootsim get count"),m.includes("findbytext")&&S.push("sootsim find <text>"),(m.includes("findbytestid")||m.includes("findbyid"))&&S.push("sootsim find --testid <id>"),m.includes("document.hidden")&&S.push("sootsim debug state keyboard (includes tab health)"),S.length>0&&pe("prefer-cli-over-eval",S);break}case"globals":{let c=await f.send({type:"evaluate",code:`(async () => {
|
|
853
869
|
const globals = {}
|
|
854
870
|
|
|
855
871
|
// test bridge (proxy in worker mode)
|
|
@@ -918,7 +934,7 @@ ${d}
|
|
|
918
934
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
919
935
|
}
|
|
920
936
|
return await window.__sootsimShellPerf.stop()
|
|
921
|
-
})()`});if(d?.error&&(console.error(` error: ${d.error}`),d.error==="timeout"&&console.error(" (shell worker did not answer within 5s \u2014 is a sim loaded?)"),process.exit(1)),
|
|
937
|
+
})()`});if(d?.error&&(console.error(` error: ${d.error}`),d.error==="timeout"&&console.error(" (shell worker did not answer within 5s \u2014 is a sim loaded?)"),process.exit(1)),H(n)){Y(d);break}or(d);break}case"transition":{let d=i[2];if(!d||!["goHome","appSwitcher","lockScreen"].includes(d)){console.log(`
|
|
922
938
|
${g("perf")} transition <event> \u2014 profile a shell transition
|
|
923
939
|
|
|
924
940
|
events:
|
|
@@ -943,29 +959,29 @@ ${d}
|
|
|
943
959
|
// animation-end detection
|
|
944
960
|
await new Promise(r => setTimeout(r, 600))
|
|
945
961
|
return await window.__sootsimShellPerf.stop()
|
|
946
|
-
})()`});if(S?.error&&(console.error(` error: ${S.error}`),process.exit(1)),
|
|
962
|
+
})()`});if(S?.error&&(console.error(` error: ${S.error}`),process.exit(1)),H(n)){Y(S);break}Xt(` ${d} transition profiled:`),or(S);break}default:console.error(` unknown perf subcommand: ${c}`),console.error(" valid: start, stop, transition"),/^--?reset$/.test(c)&&console.error(" note: 'perf start' already clears prior frames \u2014 no reset needed"),(c==="stats"||c==="frames"||c==="worst")&&(console.error(" note: the tenant sampler (stats/frames/worst) was removed \u2014 it hardcoded"),console.error(" layout/render/copy to zero because the shell worker owns every real paint."),console.error(" use 'perf start' / 'perf stop' (worst frames are in the stop report).")),process.exit(1)}break}case"errors":{let c=i[1];if(c==="clear"){await zs(f),H(n)?Y({cleared:!0}):console.log(" error buffer cleared");break}let d=c?Number(c):20,p=await vt(f,d);if(H(n)){Y(p);break}if(p.length===0){console.log(" no errors captured");break}console.log(` ${p.length} error(s):
|
|
947
963
|
`);for(let m of p){let S=Re(m.timestamp),$=m.args.map(x=>typeof x=="object"?JSON.stringify(x):x).join(" ");if(console.log(` [${S}] ${$}`),m.stack){let x=m.stack.split(`
|
|
948
|
-
`).slice(0,3);for(let
|
|
964
|
+
`).slice(0,3);for(let E of x)console.log(` ${E.trim()}`)}}break}case"warnings":{let c=i[1]?Number(i[1]):20,d=await to(f,c);if(H(n)){Y(d);break}if(d.length===0){console.log(" no warnings captured");break}console.log(` ${d.length} warning(s):
|
|
949
965
|
`);for(let p of d){let m=Re(p.timestamp),S=p.args.map($=>typeof $=="object"?JSON.stringify($):$).join(" ");console.log(` [${m}] ${S}`)}break}case"animations":{let c=await fe(f,"listAnimations")??[];if(s.includes("--json")){console.log(JSON.stringify(c,null,2));break}if(c.length===0){console.log(" no active animations");break}console.log(` ${c.length} active animation(s):
|
|
950
|
-
`);for(let d of c){let p=String(d.kind).padEnd(6),m=`${Number(d.from).toFixed(2)}\u2192${Number(d.to).toFixed(2)}`,S=Number(d.current??0).toFixed(2),$=`${Math.round((d.progress??0)*100)}%`,x=`${Math.round(d.elapsedMs??0)}ms`,
|
|
951
|
-
`);for(let $ of S){let x=Re($.timestamp);console.log(` [${x}] ${
|
|
966
|
+
`);for(let d of c){let p=String(d.kind).padEnd(6),m=`${Number(d.from).toFixed(2)}\u2192${Number(d.to).toFixed(2)}`,S=Number(d.current??0).toFixed(2),$=`${Math.round((d.progress??0)*100)}%`,x=`${Math.round(d.elapsedMs??0)}ms`,E=d.loop?" loop":"",v=d.layoutBound?" layout":"";console.log(` #${d.id} ${p} ${m.padEnd(14)} cur=${S.padEnd(7)} ${$.padStart(4)} ${x}${E}${v}`)}break}case"animation":{let c=i[1];(!c||c==="--help"||c==="-h")&&(console.error(` usage: ${g("animation")} <id>`),process.exit(1));let d=Number(c);Number.isFinite(d)||(console.error(` invalid id: ${c}`),process.exit(1));let p=await fe(f,"getAnimation",d);console.log(JSON.stringify(p,null,2));break}case"stop-animation":{let c=i[1];(!c||c==="--help"||c==="-h")&&(console.error(` usage: ${g("stop-animation")} <id|all>`),process.exit(1));let d=c==="all"?"all":Number(c);d!=="all"&&!Number.isFinite(d)&&(console.error(` invalid id: ${c}`),process.exit(1));let p=await fe(f,"stopAnimation",d);console.log(` stopped ${p??0} animation(s)`);break}case"requests":{let c=i[1];if(c==="clear"){await no(f),H(n)?Y({cleared:!0}):console.log(" request buffer cleared");break}let d=c==="all",p=d?i[2]:c,m=p?Number(p):20,S=await so(f,{failed:!d,limit:m});if(H(n)){Y(S);break}if(S.length===0){console.log(d?" no requests captured":" no failed requests captured");break}console.log(` ${S.length} ${d?"request(s)":"failed request(s)"}:
|
|
967
|
+
`);for(let $ of S){let x=Re($.timestamp);console.log(` [${x}] ${F($)}`),$.responseBody?console.log(` ${$.responseBody}`):$.error&&console.log(` ${$.error}`)}break}case"network":{let c=i[1],d=null,p=null,m=!1,S=!1,$=1e3,x=!1,E=!1;for(let K=0;K<n.length;K++){let _=n[K];if(_==="--filter")d=n[K+1]??null,K++;else if(_==="--limit"){let R=Number(n[K+1]);Number.isFinite(R)&&(p=R),K++}else if(_==="--threshold"){let R=Number(n[K+1]);Number.isFinite(R)&&R>0&&($=R),K++}else _==="--failed"?m=!0:_==="--slow"?S=!0:_==="--tail"||_==="-f"?x=!0:_==="--json"&&(E=!0)}if(c==="clear"){await f.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(c==="get"){let K=i[2];K||(console.error(" usage: sootsim network get <id>"),process.exit(1));let _=await f.send({type:"evaluate",code:`(() => {
|
|
952
968
|
const obs = window.__sootsimObservability;
|
|
953
969
|
if (!obs) return null;
|
|
954
970
|
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(K)}) || null;
|
|
955
|
-
})()`});
|
|
956
|
-
to target a specific sim, use \`--sim ${c}\` instead.`),process.exit(1));let
|
|
971
|
+
})()`});_||(console.error(` no entry with id ${K}`),process.exit(1)),E?console.log(JSON.stringify(_,null,2)):_a(_);break}let v=p??(x?200:c?Number(c):20);Number.isFinite(v)||(console.error(` invalid limit: ${c} \u2014 \`network\` takes a numeric count (e.g. ${g("network")} 100).
|
|
972
|
+
to target a specific sim, use \`--sim ${c}\` instead.`),process.exit(1));let L=async()=>{let K=await f.send({type:"evaluate",code:`(() => {
|
|
957
973
|
const obs = window.__sootsimObservability;
|
|
958
974
|
if (!obs) return { ok: false };
|
|
959
975
|
return { ok: true, entries: obs.network.getSnapshot() };
|
|
960
|
-
})()`});if(!K||!K.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return K.entries??[]},Q=K=>{let
|
|
961
|
-
`:` ${
|
|
962
|
-
`);for(let R of
|
|
963
|
-
`);let ue=new Set,ie=!0,re=()=>{ie=!1};process.on("SIGINT",re);try{for(;ie;){let K=await
|
|
964
|
-
to target a specific sim, use \`--sim ${c}\` instead.`),process.exit(1));let Q=()=>oo(f),ue=
|
|
976
|
+
})()`});if(!K||!K.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return K.entries??[]},Q=K=>{let _=K;if(m&&(_=_.filter(R=>!!R.error||R.status!=null&&R.status>=400)),S&&(_=_.filter(R=>R.durationMs!=null&&R.durationMs>=$)),d){let R=d.toLowerCase();_=_.filter(B=>(B.displayUrl||B.url).toLowerCase().includes(R))}return S&&!x&&(_=[..._].sort((R,B)=>(B.durationMs??0)-(R.durationMs??0))),_};if(!x){let K=await L(),_=Q(K).slice(-v);if(E){console.log(JSON.stringify(_,null,2));break}if(_.length===0){K.length===0?console.log(" no network requests captured"):console.log(S?` no requests slower than ${$}ms (${K.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(S?` ${_.length} request(s) slower than ${$}ms (sorted by duration desc):
|
|
977
|
+
`:` ${_.length} request(s):
|
|
978
|
+
`);for(let R of _)er(R);break}console.log(` tailing network (ctrl-c to stop)...
|
|
979
|
+
`);let ue=new Set,ie=!0,re=()=>{ie=!1};process.on("SIGINT",re);try{for(;ie;){let K=await L(),_=Q(K);for(let R of _)R.durationMs!=null&&(ue.has(R.id)||(ue.add(R.id),E?console.log(JSON.stringify(R)):er(R)));await ke(250)}}finally{process.off("SIGINT",re)}break}case"logs":{let c=i[1],d=null,p=null,m=null,S=!1,$=!1,x=!1;for(let _=0;_<n.length;_++){let R=n[_];if(R==="--filter")d=n[_+1]??null,_++;else if(R==="--limit"){let B=Number(n[_+1]);Number.isFinite(B)&&(p=B),_++}else R==="--level"?(m=n[_+1]??null,_++):R==="--tail"||R==="-f"?S=!0:R==="--json"?$=!0:(R==="--internal"||R==="--all")&&(x=!0)}let E=m?new Set(m.split(",").map(_=>_.trim()).filter(_=>_==="log"||_==="info"||_==="warn"||_==="error"||_==="debug")):null;if(c==="clear"){await io(f),console.log(" log buffer cleared");break}let v=!$&&process.stdout.isTTY===!0,L=p??(S?500:c?Number(c):50);Number.isFinite(L)||(console.error(` invalid limit: ${c} \u2014 \`logs\` takes a numeric count (e.g. ${g("logs")} 100).
|
|
980
|
+
to target a specific sim, use \`--sim ${c}\` instead.`),process.exit(1));let Q=()=>oo(f),ue=_=>ro(_,{level:E,filter:d,showInternal:x});if(!S){let _=await Q(),R=ue(_).slice(-L);if($){console.log(JSON.stringify(R,null,2));break}if(R.length===0){console.log(_.length===0?" no logs captured":" no matching logs");break}console.log(` ${R.length} log(s):
|
|
965
981
|
`);for(let B of R)sr(B,v);break}console.log(` tailing logs (ctrl-c to stop)...
|
|
966
|
-
`);let ie=new Set,re=!0,K=()=>{re=!1};process.on("SIGINT",K);try{for(;re;){let
|
|
982
|
+
`);let ie=new Set,re=!0,K=()=>{re=!1};process.on("SIGINT",K);try{for(;re;){let _=await Q(),R=ue(_);for(let B of R)ie.has(B.id)||(ie.add(B.id),$?console.log(JSON.stringify(B)):sr(B,v));await ke(250)}}finally{process.off("SIGINT",K)}break}default:console.error(` unknown subcommand: ${r}`),process.exit(1)}if(z.has(r)&&!s.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await Un(f,r)&&await k(f),D.length>0&&ee(D),!I.has(r)&&!H(n))try{await Qe(f)}catch{}}catch(D){let c=D instanceof Error?D.message:String(D);console.error(` ${r??"inspect"} failed: ${c}`);let d=/^no sim connected with id (.+)$/.exec(c),p=/^command timed out after (\d+)s$/.exec(c),m=c.startsWith("sim disconnected:")||c.startsWith("bridge never reconnected")||c.startsWith("could not connect to ws://");if(d)await So(f,y,d[1]);else if(/^no sim connected$/.test(c))wo(y);else if(p)if(await Ta(f)){let $=r??"describe";process.stderr.write(` the sim is still responsive \u2014 '${$}' just exceeded the ${p[1]}s command budget.
|
|
967
983
|
the screen's node tree is large; narrow the query or raise the budget:
|
|
968
984
|
sootsim ${$} --testid <id> # scope to one subtree
|
|
969
985
|
sootsim find --testid <id> # targeted single-node lookup
|
|
970
986
|
sootsim ${$} --timeout 60000 # raise per-command budget (ms)
|
|
971
|
-
`)}else Xi();else if(m)Xi();else{try{await bo(f)}catch{}try{await ne({includeTail:!0})}catch{}try{await q({includeTail:!0})}catch{}}process.exit(1)}finally{f.close()}}export{Xs as a,st as b,
|
|
987
|
+
`)}else Xi();else if(m)Xi();else{try{await bo(f)}catch{}try{await ne({includeTail:!0})}catch{}try{await q({includeTail:!0})}catch{}}process.exit(1)}finally{f.close()}}export{Xs as a,st as b,Yr as c,wp as d,Ip as e,Tp as f,Op as g,Ap as h,Ae as i,or as j,$h as k};
|