typebulb 0.62.5 → 0.62.7
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/README.md +1 -1
- package/SKILL.md +3 -3
- package/dist/agents/claude/client.js +2 -2
- package/dist/agents/codex/client.js +2 -2
- package/dist/agents/pi/client.js +2 -2
- package/dist/index.js +273 -273
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`),n=0;if(e[n]?.trim()!=="---")return{reason:
|
|
5
|
-
`)),a.set(u,m),c=n}else n++}return{bulb:{frontmatter:i,files:o,warnings:l,bodyEndLine:c,starts:a}}}catch(e){return{reason:`unexpected parse error: ${e instanceof Error?e.message:String(e)}`}}}function
|
|
6
|
-
`),n=[],r=0;for(;r<e.length;){if(e[r]?.trim()!=="---"){r++;continue}let s=
|
|
3
|
+
var px=Object.create;var Gl=Object.defineProperty;var hx=Object.getOwnPropertyDescriptor;var mx=Object.getOwnPropertyNames;var gx=Object.getPrototypeOf,yx=Object.prototype.hasOwnProperty;var Ni=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Li=(t,e)=>{for(var n in e)Gl(t,n,{get:e[n],enumerable:!0})},bx=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of mx(e))!yx.call(t,s)&&s!==n&&Gl(t,s,{get:()=>e[s],enumerable:!(r=hx(e,s))||r.enumerable});return t};var wx=(t,e,n)=>(n=t!=null?px(gx(t)):{},bx(e||!t||!t.__esModule?Gl(n,"default",{value:t,enumerable:!0}):n,t));import*as jp from"fs/promises";import{existsSync as Jn,readFileSync as vx}from"fs";import*as le from"path";import{pathToFileURL as Sx}from"url";import{resolve as Ql}from"resolve.exports";import{init as Fp,parse as Up}from"es-module-lexer";function qp(t,e){let n=le.join(t,"package.json");try{return JSON.parse(vx(n,"utf8"))}catch{throw new Error(`--replace package '${e}' has no readable package.json at ${n}`)}}function Jp(t){let e=t.indexOf("=");if(e===-1)throw new Error(`--replace must be <name>=<path> (got '${t}')`);let n=t.slice(0,e).trim(),r=t.slice(e+1).trim();if(!n)throw new Error(`--replace missing package name (got '${t}')`);if(!r)throw new Error(`--replace missing path for '${n}'`);if(n.startsWith("@"))throw new Error(`--replace does not support scoped names yet; '${n}' is scoped`);return{name:n,dir:le.resolve(r)}}async function Wp(t){let{name:e,dir:n}=t;if(!Jn(n))throw new Error(`--replace path for '${e}' does not exist: ${n}`);let r=qp(n,e),s=kx(r,e),i=le.resolve(n,s);if(!Jn(i))throw new Error(`--replace package '${e}' entry not found on disk: ${i} \u2014 did you build it (e.g. \`pnpm run build\`)?`);let o=le.dirname(i),a=`/local/${e}/${le.basename(i)}`,l=xx(r,n);return await Ex(e,i,o),{name:e,dir:n,entryAbs:i,serveDir:o,entryUrl:a,typesAbs:l}}function kx(t,e){if(t.exports!==void 0){let r;try{r=Ql(t,".",{browser:!0,conditions:Xl})}catch(i){throw new Error(`--replace package '${e}' "exports" does not resolve a browser entry (conditions: ${Xl.join(", ")}): ${i instanceof Error?i.message:i}`)}let s=Zl(r);if(!s)throw new Error(`--replace package '${e}' "exports" did not resolve "." to a single file (conditions: ${Xl.join(", ")}); too complex to override.`);return s}let n=t.module??t.main;if(!n)throw new Error(`--replace package '${e}' has no "exports", "module", or "main" entry to resolve.`);return n}function xx(t,e){if(t.exports!==void 0)try{let r=Ql(t,".",{conditions:["types"]}),s=Zl(r);if(s){let i=le.resolve(e,s);if(Jn(i))return i}}catch{}let n=t.types??t.typings;if(n){let r=le.resolve(e,n);if(Jn(r))return r}}function Zl(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.find(e=>typeof e=="string")}async function Ex(t,e,n){await Fp;let r=le.normalize(n),s=new Set,i=[e];for(;i.length;){let o=i.shift();if(s.has(o))continue;s.add(o);let a;try{a=await jp.readFile(o,"utf8")}catch{continue}let l,c;try{[l,,,c]=Up(a,o)}catch{continue}if(o===e&&!c)throw new Error(`override package '${t}' entry is not an ES module (no import/export syntax); CommonJS or non-module entries aren't supported (esm.sh would have to transform it).`);for(let f of l){if(f.d===-2)continue;let d=f.n;if(d&&!d.startsWith("node:")){if(d.startsWith("./")||d.startsWith("../")||d.startsWith("/")){let u=Ax(o,d,r);u&&!s.has(u)&&i.push(u);continue}throw new Error(`override package must ship self-contained (bundle its dependencies); ${t} externalizes '${d}'`)}}}}function Ax(t,e,n){let r=e.replace(/[?#].*$/,""),s=le.resolve(le.dirname(t),r),i=[s,s+".js",s+".mjs",le.join(s,"index.js"),le.join(s,"index.mjs")];for(let o of i)if(le.normalize(o).startsWith(n)&&Jn(o))return o}function Tx(t,e,n){let r=qp(t,e),s;if(r.exports!==void 0)try{s=Zl(Ql(r,n,{conditions:Bp}))}catch(o){throw new Error(`--replace package '${e}' "exports" does not resolve a node entry for '${n}' (conditions: ${Bp.join(", ")}): ${o instanceof Error?o.message:o}`)}else n==="."&&(s=r.main??r.module);if(!s)throw new Error(`--replace package '${e}' has no node export for '${n}'.`);let i=le.resolve(t,s);if(!Jn(i))throw new Error(`--replace package '${e}' built file not found: ${i} \u2014 did you build it (e.g. \`pnpm run build\`)?`);return Sx(i).href}async function Kp(t,e){await Fp;let n;try{[n]=Up(t)}catch{return t}let r="",s=0;for(let i of n){if(i.d!==-1)continue;let o=i.n;if(!o||o!==e.name&&!o.startsWith(e.name+"/"))continue;let a=o===e.name?".":"."+o.slice(e.name.length),l=Tx(e.dir,e.name,a);r+=t.slice(s,i.s)+l,s=i.e}return r+t.slice(s)}var Xl,Bp,Mi=S(()=>{"use strict";Xl=["browser","import","default"],Bp=["node","import","default"]});function Hp(t){return Ye.find(e=>de[e].path===t)}function Yp(t){return!!t?.startsWith("typebulb")}var de,Ye,zp,Di=S(()=>{de={code:{path:"code.tsx",language:"typescript"},css:{path:"styles.css",language:"css"},html:{path:"index.html",language:"html"},config:{path:"config.json",language:"json"},notes:{path:"notes.md",language:"markdown"},data:{path:"data.txt",language:"text"},infer:{path:"infer.md",language:"markdown"},insight:{path:"insight.json",language:"json"}},Ye=["code","css","html","data","infer","insight","config","notes"];zp="typebulb/v1"});function ec(t){return/[:\n"']/.test(t)||t.startsWith(" ")||t.endsWith(" ")?`"${t.replace(/"/g,'\\"')}"`:t}function tc(t){return t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1).replace(/\\"/g,'"'):t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}var Bi=S(()=>{});function Wn(t){let e=Gp(t);if("reason"in e)throw new Error(`Invalid .bulb.md file format: ${e.reason}`);return e.bulb}function Ve(t){let e=Gp(t);return"bulb"in e?e.bulb:void 0}function Gp(t){try{let e=t.split(`
|
|
4
|
+
`),n=0;if(e[n]?.trim()!=="---")return{reason:Ox(t,e)};n++;let r=[];for(;n<e.length&&e[n]?.trim()!=="---";)r.push(e[n]),n++;if(e[n]?.trim()!=="---")return{reason:"the frontmatter opened on line 1 but never closed (no second '---')"};n++;let s=Rx(r);if(!Yp(s.format))return{reason:s.format?`frontmatter 'format: ${s.format}' is not a typebulb format (expected 'format: typebulb/v1')`:"frontmatter has no 'format:' (expected 'format: typebulb/v1')"};if(!s.name)return{reason:"frontmatter has no 'name:'"};let i=s,o=new Map,a=new Map,l=[],c=n;for(;n<e.length;){let d=e[n]?.trim()?.match(Vp);if(d){let u=d[1].trim();for(n++;n<e.length&&e[n]?.trim()==="";)n++;let p=e[n]?.match(ji);if(!p){l.push(`**${u}** has no code fence \u2014 block skipped`);continue}let h=p[1];n++;let m=n+1,g=[],b=nc(h);for(;n<e.length&&!e[n]?.match(b);)g.push(e[n]),n++;let C=n<e.length;n++,l.push(...Px(u,g,C)),o.set(u,g.join(`
|
|
5
|
+
`)),a.set(u,m),c=n}else n++}return{bulb:{frontmatter:i,files:o,warnings:l,bodyEndLine:c,starts:a}}}catch(e){return{reason:`unexpected parse error: ${e instanceof Error?e.message:String(e)}`}}}function Ox(t,e){let n=Ix(t)[0];if(n&&n.start>0)return`expected '---' on line 1; the frontmatter starts on line ${n.start+1} instead. Is there content above it?`;let r=e.find(s=>s.trim())?.trim()??"";return r?`expected '---' on line 1, found '${r.length>40?`${r.slice(0,40)}\u2026`:r}'`:"expected '---' on line 1, found an empty file"}function Px(t,e,n){let r=[];for(let s=0;s<e.length;s++){let i=e[s]?.trim().match(Vp);i&&Cx.has(i[1].trim())&&_x(e,s)&&r.push(i[1].trim())}return r.length?r.map(s=>`**${t}** block has an unterminated code fence \u2014 it swallowed the **${s}** block.`):n?[]:[`**${t}** block has an unterminated code fence (it runs to the end of the file).`]}function _x(t,e){let n=e+1;for(;n<t.length&&t[n]?.trim()==="";)n++;return!!t[n]?.match(ji)}function Rx(t){let e={};for(let n of t){let r=n.indexOf(":");if(r===-1)continue;let s=n.slice(0,r).trim(),i=n.slice(r+1).trim();switch(s){case"format":e.format=i;break;case"name":e.name=tc(i);break}}return e}function Xp(t){return Ve(t)?.warnings??[]}function Ix(t){let e=t.split(`
|
|
6
|
+
`),n=[],r=0;for(;r<e.length;){if(e[r]?.trim()!=="---"){r++;continue}let s=Ve(e.slice(r).join(`
|
|
7
7
|
`));if(s&&s.files.size>0){let i=r+s.bodyEndLine;n.push({start:r,end:i,source:e.slice(r,i).join(`
|
|
8
|
-
`)}),r=i}else r++}return n}function
|
|
8
|
+
`)}),r=i}else r++}return n}function Qp(t){let e=Object.fromEntries(Ye.map(n=>[n,t.files.get(de[n].path)||""]));return{name:t.frontmatter.name,...e}}var Vp,ji,Cx,nc,rc=S(()=>{Di();Bi();Vp=/^\*\*(.+)\*\*$/,ji=/^(`{3,})(\w*)\s*$/,Cx=new Set(Ye.map(t=>de[t].path)),nc=t=>new RegExp(`^${t}\\s*$`)});function Zp(t){let e=t.match(/^`{3,}/gm),n=e?Math.max(...e.map(r=>r.length)):0;return"`".repeat(Math.max(3,n+1))}function eh(t,e){let{path:n}=de[t],r=n.split(".").pop(),s=Zp(e);return`**${n}**
|
|
9
9
|
|
|
10
10
|
${s}${r}
|
|
11
11
|
${e}
|
|
12
|
-
${s}`}function
|
|
13
|
-
`)}function
|
|
14
|
-
`),s=
|
|
12
|
+
${s}`}function th(t){let e=Ye.filter(n=>t[n]).map(n=>eh(n,t[n]));return["---",`format: ${zp}`,`name: ${ec(t.name)}`,"---","",...e].join(`
|
|
13
|
+
`)}function nh(t,e){for(let n=0;n<t.length;n++){if(t[n]?.trim()!==`**${e}**`)continue;let r=n+1;for(;r<t.length&&t[r]?.trim()==="";)r++;let s=t[r]?.match(ji);if(!s)continue;let i=nc(s[1]),o=r+1;for(;o<t.length&&!t[o]?.match(i);)o++;return o>=t.length?"unterminated":{header:n,open:r,close:o,fence:s[1],lang:s[2]}}}function zr(t,e,n){let r=t.split(`
|
|
14
|
+
`),s=nh(r,de[e].path);if(s==="unterminated")return t;if(!s)return`${t.replace(/\s*$/,"")}
|
|
15
15
|
|
|
16
|
-
${
|
|
17
|
-
`;let i=
|
|
16
|
+
${eh(e,n)}
|
|
17
|
+
`;let i=Zp(n),o=i.length>s.fence.length?i:s.fence;return[...r.slice(0,s.open),o+s.lang,...n.split(`
|
|
18
18
|
`),o,...r.slice(s.close+1)].join(`
|
|
19
|
-
`)}function
|
|
20
|
-
`),r=
|
|
19
|
+
`)}function rh(t,e){let n=t.split(`
|
|
20
|
+
`),r=nh(n,de[e].path);if(!r||r==="unterminated")return t;let s=r.close+1;for(;s<n.length&&n[s]?.trim()==="";)s++;return[...n.slice(0,r.header),...n.slice(s)].join(`
|
|
21
21
|
`).replace(/\s*$/,"")+`
|
|
22
|
-
`}var
|
|
23
|
-
>/]`,i);if(r&&console.log("[xml-utils] start:",o),o===-1)return;let a=t.slice(o+e.length),l=
|
|
24
|
-
>]`),m+=
|
|
25
|
-
`)}};
|
|
26
|
-
`)?
|
|
22
|
+
`}var sh=S(()=>{Di();rc();Bi()});function Yr(t){if(!t.trim())return{};try{return JSON.parse(t)}catch{return{}}}function oh(t){switch(ih(t)){case".js":case".mjs":return"text/javascript";case".wasm":return"application/wasm";case".json":case".map":return"application/json";case".svg":return"image/svg+xml";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".avif":return"image/avif";case".ico":return"image/x-icon";case".mp3":return"audio/mpeg";case".wav":return"audio/wav";case".ogg":return"audio/ogg";case".m4a":return"audio/mp4";case".mp4":return"video/mp4";case".webm":return"video/webm";case".woff2":return"font/woff2";case".ttf":return"font/ttf";case".css":return"text/css";case".txt":return"text/plain; charset=utf-8";default:return"application/octet-stream"}}function ah(t){let e=ih(t);return e!==void 0&&Nx.has(e)?e:void 0}function Mx(t){return t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"")}function sc(t){let e=Yr(t??"").description?.trim();if(!e)return Lx;let n=Mx(e);return(n.length>200?n.slice(0,197)+"...":n).replace(/\n/g," ")}var $x,Fi,ih,Nx,Lx,lh=S(()=>{$x="https://assets.typebulb.com",Fi=(t,e)=>`${$x}/u/${encodeURIComponent(t)}/${encodeURIComponent(e)}/`,ih=t=>/\.[^./\\]+$/.exec(t)?.[0]?.toLowerCase();Nx=new Set([".html",".htm",".xhtml",".js",".mjs",".cjs",".ts",".tsx",".css"]);Lx="A Typebulb bulb."});var ch=S(()=>{});function ic(t,e,n){let s=new RegExp(e).exec(t.slice(n));return s?n+s.index:-1}var uh=S(()=>{});function Vr(t,e,n){let s=new RegExp(e).exec(t.slice(n));return s?n+s.index+s[0].length-1:-1}var dh=S(()=>{});function Ui(t,e){let n=new RegExp(e,"g"),r=t.match(n);return r?r.length:0}var fh=S(()=>{});function Gr(t,e,n){let r=n&&n.debug||!1,s=!(n&&typeof n.nested===!1),i=n&&n.startIndex||0;r&&console.log("[xml-utils] starting findTagByName with",e," and ",n);let o=ic(t,`<${e}[
|
|
23
|
+
>/]`,i);if(r&&console.log("[xml-utils] start:",o),o===-1)return;let a=t.slice(o+e.length),l=Vr(a,"^[^<]*[ /]>",0),c=l!==-1&&a[l-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",c),c===!1)if(s){let p=0,h=1,m=0;for(;(l=Vr(a,"[ /]"+e+">",p))!==-1;){let g=a.substring(p,l+1);if(h+=Ui(g,"<"+e+`[
|
|
24
|
+
>]`),m+=Ui(g,"</"+e+">"),m>=h)break;p=l}}else l=Vr(a,"[ /]"+e+">",0);let f=o+e.length+l+1;if(r&&console.log("[xml-utils] end:",f),f===-1)return;let d=t.slice(o,f),u;return c?u=null:u=d.slice(d.indexOf(">")+1,d.lastIndexOf("<")),{inner:u,outer:d,start:o,end:f}}var oc=S(()=>{uh();dh();fh()});var ac=S(()=>{oc()});var lc=S(()=>{ac()});var ph=S(()=>{lc()});var hh=S(()=>{});var mh=S(()=>{ch();oc();ac();ph();lc();hh()});var W=I(me=>{"use strict";var cc=Symbol.for("yaml.alias"),gh=Symbol.for("yaml.document"),qi=Symbol.for("yaml.map"),yh=Symbol.for("yaml.pair"),uc=Symbol.for("yaml.scalar"),Ji=Symbol.for("yaml.seq"),pt=Symbol.for("yaml.node.type"),jx=t=>!!t&&typeof t=="object"&&t[pt]===cc,Fx=t=>!!t&&typeof t=="object"&&t[pt]===gh,Ux=t=>!!t&&typeof t=="object"&&t[pt]===qi,qx=t=>!!t&&typeof t=="object"&&t[pt]===yh,bh=t=>!!t&&typeof t=="object"&&t[pt]===uc,Jx=t=>!!t&&typeof t=="object"&&t[pt]===Ji;function wh(t){if(t&&typeof t=="object")switch(t[pt]){case qi:case Ji:return!0}return!1}function Wx(t){if(t&&typeof t=="object")switch(t[pt]){case cc:case qi:case uc:case Ji:return!0}return!1}var Kx=t=>(bh(t)||wh(t))&&!!t.anchor;me.ALIAS=cc;me.DOC=gh;me.MAP=qi;me.NODE_TYPE=pt;me.PAIR=yh;me.SCALAR=uc;me.SEQ=Ji;me.hasAnchor=Kx;me.isAlias=jx;me.isCollection=wh;me.isDocument=Fx;me.isMap=Ux;me.isNode=Wx;me.isPair=qx;me.isScalar=bh;me.isSeq=Jx});var Xr=I(dc=>{"use strict";var ce=W(),Ee=Symbol("break visit"),vh=Symbol("skip children"),ot=Symbol("remove node");function Wi(t,e){let n=Sh(e);ce.isDocument(t)?Kn(null,t.contents,n,Object.freeze([t]))===ot&&(t.contents=null):Kn(null,t,n,Object.freeze([]))}Wi.BREAK=Ee;Wi.SKIP=vh;Wi.REMOVE=ot;function Kn(t,e,n,r){let s=kh(t,e,n,r);if(ce.isNode(s)||ce.isPair(s))return xh(t,r,s),Kn(t,s,n,r);if(typeof s!="symbol"){if(ce.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=Kn(i,e.items[i],n,r);if(typeof o=="number")i=o-1;else{if(o===Ee)return Ee;o===ot&&(e.items.splice(i,1),i-=1)}}}else if(ce.isPair(e)){r=Object.freeze(r.concat(e));let i=Kn("key",e.key,n,r);if(i===Ee)return Ee;i===ot&&(e.key=null);let o=Kn("value",e.value,n,r);if(o===Ee)return Ee;o===ot&&(e.value=null)}}return s}async function Ki(t,e){let n=Sh(e);ce.isDocument(t)?await Hn(null,t.contents,n,Object.freeze([t]))===ot&&(t.contents=null):await Hn(null,t,n,Object.freeze([]))}Ki.BREAK=Ee;Ki.SKIP=vh;Ki.REMOVE=ot;async function Hn(t,e,n,r){let s=await kh(t,e,n,r);if(ce.isNode(s)||ce.isPair(s))return xh(t,r,s),Hn(t,s,n,r);if(typeof s!="symbol"){if(ce.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=await Hn(i,e.items[i],n,r);if(typeof o=="number")i=o-1;else{if(o===Ee)return Ee;o===ot&&(e.items.splice(i,1),i-=1)}}}else if(ce.isPair(e)){r=Object.freeze(r.concat(e));let i=await Hn("key",e.key,n,r);if(i===Ee)return Ee;i===ot&&(e.key=null);let o=await Hn("value",e.value,n,r);if(o===Ee)return Ee;o===ot&&(e.value=null)}}return s}function Sh(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function kh(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(ce.isMap(e))return n.Map?.(t,e,r);if(ce.isSeq(e))return n.Seq?.(t,e,r);if(ce.isPair(e))return n.Pair?.(t,e,r);if(ce.isScalar(e))return n.Scalar?.(t,e,r);if(ce.isAlias(e))return n.Alias?.(t,e,r)}function xh(t,e,n){let r=e[e.length-1];if(ce.isCollection(r))r.items[t]=n;else if(ce.isPair(r))t==="key"?r.key=n:r.value=n;else if(ce.isDocument(r))r.contents=n;else{let s=ce.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}dc.visit=Wi;dc.visitAsync=Ki});var fc=I(Ah=>{"use strict";var Eh=W(),Hx=Xr(),zx={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Yx=t=>t.replace(/[!,[\]{}]/g,e=>zx[e]),Qr=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[i,o]=r;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,o),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,r,s]=e.match(/^(.*!)([^!]*)$/s);s||n(`The ${e} tag has no suffix`);let i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(o){return n(String(o)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+Yx(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),s;if(e&&r.length>0&&Eh.isNode(e.contents)){let i={};Hx.visit(e.contents,(o,a)=>{Eh.isNode(a)&&a.tag&&(i[a.tag]=!0)}),s=Object.keys(i)}else s=[];for(let[i,o]of r)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(o)))&&n.push(`%TAG ${i} ${o}`);return n.join(`
|
|
25
|
+
`)}};Qr.defaultYaml={explicit:!1,version:"1.2"};Qr.defaultTags={"!!":"tag:yaml.org,2002:"};Ah.Directives=Qr});var Hi=I(Zr=>{"use strict";var Th=W(),Vx=Xr();function Gx(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function Ch(t){let e=new Set;return Vx.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function Oh(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function Xx(t,e){let n=[],r=new Map,s=null;return{onAnchor:i=>{n.push(i),s??(s=Ch(t));let o=Oh(e,s);return s.add(o),o},setAnchors:()=>{for(let i of n){let o=r.get(i);if(typeof o=="object"&&o.anchor&&(Th.isScalar(o.node)||Th.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:r}}Zr.anchorIsValid=Gx;Zr.anchorNames=Ch;Zr.createNodeAnchors=Xx;Zr.findNewAnchor=Oh});var pc=I(Ph=>{"use strict";function es(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;s<i;++s){let o=r[s],a=es(t,r,String(s),o);a===void 0?delete r[s]:a!==o&&(r[s]=a)}else if(r instanceof Map)for(let s of Array.from(r.keys())){let i=r.get(s),o=es(t,r,s,i);o===void 0?r.delete(s):o!==i&&r.set(s,o)}else if(r instanceof Set)for(let s of Array.from(r)){let i=es(t,r,s,s);i===void 0?r.delete(s):i!==s&&(r.delete(s),r.add(i))}else for(let[s,i]of Object.entries(r)){let o=es(t,r,s,i);o===void 0?delete r[s]:o!==i&&(r[s]=o)}return t.call(e,n,r)}Ph.applyReviver=es});var It=I(Rh=>{"use strict";var Qx=W();function _h(t,e,n){if(Array.isArray(t))return t.map((r,s)=>_h(r,String(s),n));if(t&&typeof t.toJSON=="function"){if(!n||!Qx.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=i=>{r.res=i,delete n.onCreate};let s=t.toJSON(e,n);return n.onCreate&&n.onCreate(s),s}return typeof t=="bigint"&&!n?.keep?Number(t):t}Rh.toJS=_h});var zi=I($h=>{"use strict";var Zx=pc(),Ih=W(),e0=It(),hc=class{constructor(e){Object.defineProperty(this,Ih.NODE_TYPE,{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:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!Ih.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=e0.toJS(this,"",o);if(typeof s=="function")for(let{count:l,res:c}of o.anchors.values())s(c,l);return typeof i=="function"?Zx.applyReviver(i,{"":a},"",a):a}};$h.NodeBase=hc});var ts=I(Nh=>{"use strict";var t0=Hi(),n0=Xr(),zn=W(),r0=zi(),s0=It(),mc=class extends r0.NodeBase{constructor(e){super(zn.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],n0.visit(e,{Node:(i,o)=>{(zn.isAlias(o)||zn.hasAnchor(o))&&r.push(o)}}),n&&(n.aliasResolveCache=r));let s;for(let i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:s,maxAliasCount:i}=n,o=this.resolve(s,n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=r.get(o);if(a||(s0.toJS(o,null,n),a=r.get(o)),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=Yi(s,o,r)),a.count*a.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,r){let s=`*${this.source}`;if(e){if(t0.anchorIsValid(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`${s} `}return s}};function Yi(t,e,n){if(zn.isAlias(e)){let r=e.resolve(t),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(zn.isCollection(e)){let r=0;for(let s of e.items){let i=Yi(t,s,n);i>r&&(r=i)}return r}else if(zn.isPair(e)){let r=Yi(t,e.key,n),s=Yi(t,e.value,n);return Math.max(r,s)}return 1}Nh.Alias=mc});var re=I(gc=>{"use strict";var i0=W(),o0=zi(),a0=It(),l0=t=>!t||typeof t!="function"&&typeof t!="object",$t=class extends o0.NodeBase{constructor(e){super(i0.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:a0.toJS(this.value,e,n)}toString(){return String(this.value)}};$t.BLOCK_FOLDED="BLOCK_FOLDED";$t.BLOCK_LITERAL="BLOCK_LITERAL";$t.PLAIN="PLAIN";$t.QUOTE_DOUBLE="QUOTE_DOUBLE";$t.QUOTE_SINGLE="QUOTE_SINGLE";gc.Scalar=$t;gc.isScalarValue=l0});var ns=I(Mh=>{"use strict";var c0=ts(),cn=W(),Lh=re(),u0="tag:yaml.org,2002:";function d0(t,e,n){if(e){let r=n.filter(i=>i.tag===e),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return n.find(r=>r.identify?.(t)&&!r.format)}function f0(t,e,n){if(cn.isDocument(t)&&(t=t.contents),cn.isNode(t))return t;if(cn.isPair(t)){let d=n.schema[cn.MAP].createNode?.(n.schema,null,n);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:o,sourceObjects:a}=n,l;if(r&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=s(t)),new c0.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=u0+e.slice(2));let c=d0(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Lh.Scalar(t);return l&&(l.node=d),d}c=t instanceof Map?o[cn.MAP]:Symbol.iterator in Object(t)?o[cn.SEQ]:o[cn.MAP]}i&&(i(c),delete n.onTagObj);let f=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new Lh.Scalar(t);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}Mh.createNode=f0});var Gi=I(Vi=>{"use strict";var p0=ns(),at=W(),h0=zi();function yc(t,e,n){let r=n;for(let s=e.length-1;s>=0;--s){let i=e[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=r,r=o}else r=new Map([[i,r]])}return p0.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Dh=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,bc=class extends h0.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>at.isNode(r)||at.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Dh(e))this.add(n);else{let[r,...s]=e,i=this.get(r,!0);if(at.isCollection(i))i.addIn(s,n);else if(i===void 0&&this.schema)this.set(r,yc(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let s=this.get(n,!0);if(at.isCollection(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...s]=e,i=this.get(r,!0);return s.length===0?!n&&at.isScalar(i)?i.value:i:at.isCollection(i)?i.getIn(s,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!at.isPair(n))return!1;let r=n.value;return r==null||e&&at.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let s=this.get(n,!0);return at.isCollection(s)?s.hasIn(r):!1}setIn(e,n){let[r,...s]=e;if(s.length===0)this.set(r,n);else{let i=this.get(r,!0);if(at.isCollection(i))i.setIn(s,n);else if(i===void 0&&this.schema)this.set(r,yc(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}};Vi.Collection=bc;Vi.collectionFromPath=yc;Vi.isEmptyPath=Dh});var rs=I(Xi=>{"use strict";var m0=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function wc(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var g0=(t,e,n)=>t.endsWith(`
|
|
26
|
+
`)?wc(n,e):n.includes(`
|
|
27
27
|
`)?`
|
|
28
|
-
`+
|
|
29
|
-
`)n===
|
|
28
|
+
`+wc(n,e):(t.endsWith(" ")?"":" ")+n;Xi.indentComment=wc;Xi.lineComment=g0;Xi.stringifyComment=m0});var jh=I(ss=>{"use strict";var y0="flow",vc="block",Qi="quoted";function b0(t,e,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return t;s<i&&(i=0);let l=Math.max(1+i,1+s-e.length);if(t.length<=l)return t;let c=[],f={},d=s-e.length;typeof r=="number"&&(r>s-Math.max(2,i)?c.push(0):d=s-r);let u,p,h=!1,m=-1,g=-1,b=-1;n===vc&&(m=Bh(t,m,e.length),m!==-1&&(d=m+l));for(let T;T=t[m+=1];){if(n===Qi&&T==="\\"){switch(g=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if(T===`
|
|
29
|
+
`)n===vc&&(m=Bh(t,m,e.length)),d=m+e.length+l,u=void 0;else{if(T===" "&&p&&p!==" "&&p!==`
|
|
30
30
|
`&&p!==" "){let E=t[m+1];E&&E!==" "&&E!==`
|
|
31
|
-
`&&E!==" "&&(u=m)}if(m>=d)if(u)c.push(u),d=u+l,u=void 0;else if(n===
|
|
32
|
-
${e}${t.slice(0,$)}`:(n===
|
|
33
|
-
${e}${t.slice(E+1,$)}`)}return C}function
|
|
34
|
-
`);r=e,s=e+1,i=t[s]}return r}
|
|
35
|
-
`){if(i-o>r)return!0;if(o=i+1,s-o<=r)return!1}return!0}function
|
|
31
|
+
`&&E!==" "&&(u=m)}if(m>=d)if(u)c.push(u),d=u+l,u=void 0;else if(n===Qi){for(;p===" "||p===" ";)p=T,T=t[m+=1],h=!0;let E=m>b+1?m-2:g-1;if(f[E])return t;c.push(E),f[E]=!0,d=E+l,u=void 0}else h=!0}p=T}if(h&&a&&a(),c.length===0)return t;o&&o();let C=t.slice(0,c[0]);for(let T=0;T<c.length;++T){let E=c[T],$=c[T+1]||t.length;E===0?C=`
|
|
32
|
+
${e}${t.slice(0,$)}`:(n===Qi&&f[E]&&(C+=`${t[E]}\\`),C+=`
|
|
33
|
+
${e}${t.slice(E+1,$)}`)}return C}function Bh(t,e,n){let r=e,s=e+1,i=t[s];for(;i===" "||i===" ";)if(e<s+n)i=t[++e];else{do i=t[++e];while(i&&i!==`
|
|
34
|
+
`);r=e,s=e+1,i=t[s]}return r}ss.FOLD_BLOCK=vc;ss.FOLD_FLOW=y0;ss.FOLD_QUOTED=Qi;ss.foldFlowLines=b0});var os=I(Fh=>{"use strict";var Ge=re(),Nt=jh(),eo=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),to=t=>/^(%|---|\.\.\.)/m.test(t);function w0(t,e,n){if(!e||e<0)return!1;let r=e-n,s=t.length;if(s<=r)return!1;for(let i=0,o=0;i<s;++i)if(t[i]===`
|
|
35
|
+
`){if(i-o>r)return!0;if(o=i+1,s-o<=r)return!1}return!0}function is(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,s=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(to(t)?" ":""),o="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let f=n.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||n[l+2]==='"'||n.length<s)l+=1;else{for(o+=n.slice(a,l)+`
|
|
36
36
|
|
|
37
37
|
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)o+=`
|
|
38
|
-
`,l+=2;o+=i,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,r?o
|
|
39
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
40
|
-
${n}`)+"'";return e.implicitKey?r
|
|
38
|
+
`,l+=2;o+=i,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,r?o:Nt.foldFlowLines(o,i,Nt.FOLD_QUOTED,eo(e,!1))}function Sc(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
39
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return is(t,e);let n=e.indent||(to(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
40
|
+
${n}`)+"'";return e.implicitKey?r:Nt.foldFlowLines(r,n,Nt.FOLD_FLOW,eo(e,!1))}function Yn(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=is;else{let s=t.includes('"'),i=t.includes("'");s&&!i?r=Sc:i&&!s?r=is:r=n?Sc:is}return r(t,e)}var kc;try{kc=new RegExp(`(^|(?<!
|
|
41
41
|
))
|
|
42
42
|
+(?!
|
|
43
|
-
|$)`,"g")}catch{
|
|
43
|
+
|$)`,"g")}catch{kc=/\n+(?!\n|$)/g}function Zi({comment:t,type:e,value:n},r,s,i){let{blockQuote:o,commentString:a,lineWidth:l}=r.options;if(!o||/\n[\t ]+$/.test(n))return Yn(n,r);let c=r.indent||(r.forceBlockIndent||to(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===Ge.Scalar.BLOCK_FOLDED?!1:e===Ge.Scalar.BLOCK_LITERAL?!0:!w0(n,l,c.length);if(!n)return f?`|
|
|
44
44
|
`:`>
|
|
45
45
|
`;let d,u;for(u=n.length;u>0;--u){let $=n[u-1];if($!==`
|
|
46
46
|
`&&$!==" "&&$!==" ")break}let p=n.substring(u),h=p.indexOf(`
|
|
47
47
|
`);h===-1?d="-":n===p||h!==p.length-1?(d="+",i&&i()):d="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
48
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
48
|
+
`&&(p=p.slice(0,-1)),p=p.replace(kc,`$&${c}`));let m=!1,g,b=-1;for(g=0;g<n.length;++g){let $=n[g];if($===" ")m=!0;else if($===`
|
|
49
49
|
`)b=g;else break}let C=n.substring(0,b<g?b+1:g);C&&(n=n.substring(C.length),C=C.replace(/\n+/g,`$&${c}`));let E=(m?c?"2":"1":"")+d;if(t&&(E+=" "+a(t.replace(/ ?[\r\n]+/g," ")),s&&s()),!f){let $=n.replace(/\n+/g,`
|
|
50
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),
|
|
50
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),O=!1,P=eo(r,!0);o!=="folded"&&e!==Ge.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{O=!0});let k=Nt.foldFlowLines(`${C}${$}${p}`,c,Nt.FOLD_BLOCK,P);if(!O)return`>${E}
|
|
51
51
|
${c}${k}`}return n=n.replace(/\n+/g,`$&${c}`),`|${E}
|
|
52
|
-
${c}${C}${n}${p}`}function
|
|
52
|
+
${c}${C}${n}${p}`}function v0(t,e,n,r){let{type:s,value:i}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&i.includes(`
|
|
53
53
|
`)||f&&/[[\]{},]/.test(i))return Yn(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||f||!i.includes(`
|
|
54
|
-
`)?Yn(i,e):
|
|
55
|
-
`))return
|
|
56
|
-
${l}`);if(o){let u=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:p,tags:h}=e.doc.schema;if(h.some(u)||p?.some(u))return Yn(i,e)}return a?d
|
|
57
|
-
${e.indent}${a}`:a}
|
|
58
|
-
${a}:`):(g=`${g}:`,u&&(g+=
|
|
59
|
-
`:"",C){let
|
|
60
|
-
${
|
|
61
|
-
`&&T&&(
|
|
62
|
-
|
|
63
|
-
`):
|
|
64
|
-
${n.indent}`}else if(!p&&
|
|
65
|
-
`),
|
|
54
|
+
`)?Yn(i,e):Zi(t,e,n,r);if(!a&&!f&&s!==Ge.Scalar.PLAIN&&i.includes(`
|
|
55
|
+
`))return Zi(t,e,n,r);if(to(i)){if(l==="")return e.forceBlockIndent=!0,Zi(t,e,n,r);if(a&&l===c)return Yn(i,e)}let d=i.replace(/\n+/g,`$&
|
|
56
|
+
${l}`);if(o){let u=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:p,tags:h}=e.doc.schema;if(h.some(u)||p?.some(u))return Yn(i,e)}return a?d:Nt.foldFlowLines(d,l,Nt.FOLD_FLOW,eo(e,!1))}function S0(t,e,n,r){let{implicitKey:s,inFlow:i}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Ge.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Ge.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case Ge.Scalar.BLOCK_FOLDED:case Ge.Scalar.BLOCK_LITERAL:return s||i?Yn(o.value,e):Zi(o,e,n,r);case Ge.Scalar.QUOTE_DOUBLE:return is(o.value,e);case Ge.Scalar.QUOTE_SINGLE:return Sc(o.value,e);case Ge.Scalar.PLAIN:return v0(o,e,n,r);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:d}=e.options,u=s&&f||d;if(c=l(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}Fh.stringifyString=S0});var as=I(xc=>{"use strict";var k0=Hi(),Lt=W(),x0=rs(),E0=os();function A0(t,e){let n=Object.assign({blockQuote:!0,commentString:x0.stringifyComment,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,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function T0(t,e){if(e.tag){let s=t.filter(i=>i.tag===e.tag);if(s.length>0)return s.find(i=>i.format===e.format)??s[0]}let n,r;if(Lt.isScalar(e)){r=e.value;let s=t.filter(i=>i.identify?.(r));if(s.length>1){let i=s.filter(o=>o.test);i.length>0&&(s=i)}n=s.find(i=>i.format===e.format)??s.find(i=>!i.format)}else r=e,n=t.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!n){let s=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${s} value`)}return n}function C0(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let s=[],i=(Lt.isScalar(t)||Lt.isCollection(t))&&t.anchor;i&&k0.anchorIsValid(i)&&(n.add(i),s.push(`&${i}`));let o=t.tag??(e.default?null:e.tag);return o&&s.push(r.directives.tagString(o)),s.join(" ")}function O0(t,e,n,r){if(Lt.isPair(t))return t.toString(e,n,r);if(Lt.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let s,i=Lt.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>s=l});s??(s=T0(e.doc.schema.tags,i));let o=C0(i,s,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof s.stringify=="function"?s.stringify(i,e,n,r):Lt.isScalar(i)?E0.stringifyString(i,e,n,r):i.toString(e,n,r);return o?Lt.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
57
|
+
${e.indent}${a}`:a}xc.createStringifyContext=A0;xc.stringify=O0});var Wh=I(Jh=>{"use strict";var ht=W(),Uh=re(),qh=as(),ls=rs();function P0({key:t,value:e},n,r,s){let{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:d}}=n,u=ht.isNode(t)&&t.comment||null;if(d){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(ht.isCollection(t)||!ht.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!d&&(!t||u&&e==null&&!n.inFlow||ht.isCollection(t)||(ht.isScalar(t)?t.type===Uh.Scalar.BLOCK_FOLDED||t.type===Uh.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!i),indent:a+l});let h=!1,m=!1,g=qh.stringify(t,n,()=>h=!0,()=>m=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||e==null)return h&&r&&r(),g===""?"?":p?`? ${g}`:g}else if(i&&!d||e==null&&p)return g=`? ${g}`,u&&!h?g+=ls.lineComment(g,n.indent,c(u)):m&&s&&s(),g;h&&(u=null),p?(u&&(g+=ls.lineComment(g,n.indent,c(u))),g=`? ${g}
|
|
58
|
+
${a}:`):(g=`${g}:`,u&&(g+=ls.lineComment(g,n.indent,c(u))));let b,C,T;ht.isNode(e)?(b=!!e.spaceBefore,C=e.commentBefore,T=e.comment):(b=!1,C=null,T=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!p&&!u&&ht.isScalar(e)&&(n.indentAtStart=g.length+1),m=!1,!f&&l.length>=2&&!n.inFlow&&!p&&ht.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let E=!1,$=qh.stringify(e,n,()=>E=!0,()=>m=!0),O=" ";if(u||b||C){if(O=b?`
|
|
59
|
+
`:"",C){let P=c(C);O+=`
|
|
60
|
+
${ls.indentComment(P,n.indent)}`}$===""&&!n.inFlow?O===`
|
|
61
|
+
`&&T&&(O=`
|
|
62
|
+
|
|
63
|
+
`):O+=`
|
|
64
|
+
${n.indent}`}else if(!p&&ht.isCollection(e)){let P=$[0],k=$.indexOf(`
|
|
65
|
+
`),L=k!==-1,j=n.inFlow??e.flow??e.items.length===0;if(L||!j){let Q=!1;if(L&&(P==="&"||P==="!")){let U=$.indexOf(" ");P==="&"&&U!==-1&&U<k&&$[U+1]==="!"&&(U=$.indexOf(" ",U+1)),(U===-1||k<U)&&(Q=!0)}Q||(O=`
|
|
66
66
|
${n.indent}`)}}else($===""||$[0]===`
|
|
67
|
-
`)&&(
|
|
67
|
+
`)&&(O="");return g+=O+$,n.inFlow?E&&r&&r():T&&!E?g+=ls.lineComment(g,n.indent,c(T)):m&&s&&s(),g}Jh.stringifyPair=P0});var Ac=I(Ec=>{"use strict";var Kh=Ni("process");function _0(t,...e){t==="debug"&&console.log(...e)}function R0(t,e){(t==="debug"||t==="warn")&&(typeof Kh.emitWarning=="function"?Kh.emitWarning(e):console.warn(e))}Ec.debug=_0;Ec.warn=R0});var io=I(so=>{"use strict";var cs=W(),Hh=re(),no="<<",ro={identify:t=>t===no||typeof t=="symbol"&&t.description===no,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Hh.Scalar(Symbol(no)),{addToJSMap:zh}),stringify:()=>no},I0=(t,e)=>(ro.identify(e)||cs.isScalar(e)&&(!e.type||e.type===Hh.Scalar.PLAIN)&&ro.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===ro.tag&&n.default);function zh(t,e,n){if(n=t&&cs.isAlias(n)?n.resolve(t.doc):n,cs.isSeq(n))for(let r of n.items)Tc(t,e,r);else if(Array.isArray(n))for(let r of n)Tc(t,e,r);else Tc(t,e,n)}function Tc(t,e,n){let r=t&&cs.isAlias(n)?n.resolve(t.doc):n;if(!cs.isMap(r))throw new Error("Merge sources must be maps or map aliases");let s=r.toJSON(null,t,Map);for(let[i,o]of s)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}so.addMergeToJSMap=zh;so.isMergeKey=I0;so.merge=ro});var Oc=I(Gh=>{"use strict";var $0=Ac(),Yh=io(),N0=as(),Vh=W(),Cc=It();function L0(t,e,{key:n,value:r}){if(Vh.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(Yh.isMergeKey(t,n))Yh.addMergeToJSMap(t,e,r);else{let s=Cc.toJS(n,"",t);if(e instanceof Map)e.set(s,Cc.toJS(r,s,t));else if(e instanceof Set)e.add(s);else{let i=M0(n,s,t),o=Cc.toJS(r,i,t);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function M0(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Vh.isNode(t)&&n?.doc){let r=N0.createStringifyContext(n.doc,{});r.anchors=new Set;for(let i of n.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;let s=t.toString(r);if(!n.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),$0.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(e)}Gh.addPairToJSMap=L0});var Mt=I(Pc=>{"use strict";var Xh=ns(),D0=Wh(),B0=Oc(),oo=W();function j0(t,e,n){let r=Xh.createNode(t,void 0,n),s=Xh.createNode(e,void 0,n);return new ao(r,s)}var ao=class t{constructor(e,n=null){Object.defineProperty(this,oo.NODE_TYPE,{value:oo.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return oo.isNode(n)&&(n=n.clone(e)),oo.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return B0.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?D0.stringifyPair(this,e,n,r):JSON.stringify(this)}};Pc.Pair=ao;Pc.createPair=j0});var _c=I(Zh=>{"use strict";var un=W(),Qh=as(),lo=rs();function F0(t,e,n){return(e.inFlow??t.flow?q0:U0)(t,e,n)}function U0({comment:t,items:e},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,f=Object.assign({},n,{indent:i,type:null}),d=!1,u=[];for(let h=0;h<e.length;++h){let m=e[h],g=null;if(un.isNode(m))!d&&m.spaceBefore&&u.push(""),co(n,u,m.commentBefore,d),m.comment&&(g=m.comment);else if(un.isPair(m)){let C=un.isNode(m.key)?m.key:null;C&&(!d&&C.spaceBefore&&u.push(""),co(n,u,C.commentBefore,d))}d=!1;let b=Qh.stringify(m,f,()=>g=null,()=>d=!0);g&&(b+=lo.lineComment(b,i,c(g))),d&&g&&(d=!1),u.push(r+b)}let p;if(u.length===0)p=s.start+s.end;else{p=u[0];for(let h=1;h<u.length;++h){let m=u[h];p+=m?`
|
|
68
68
|
${l}${m}`:`
|
|
69
69
|
`}}return t?(p+=`
|
|
70
|
-
`+
|
|
70
|
+
`+lo.indentComment(c(t),l),a&&a()):d&&o&&o(),p}function q0({items:t},e,{flowChars:n,itemIndent:r}){let{indent:s,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;r+=i;let l=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,f=0,d=[];for(let h=0;h<t.length;++h){let m=t[h],g=null;if(un.isNode(m))m.spaceBefore&&d.push(""),co(e,d,m.commentBefore,!1),m.comment&&(g=m.comment);else if(un.isPair(m)){let C=un.isNode(m.key)?m.key:null;C&&(C.spaceBefore&&d.push(""),co(e,d,C.commentBefore,!1),C.comment&&(c=!0));let T=un.isNode(m.value)?m.value:null;T?(T.comment&&(g=T.comment),T.commentBefore&&(c=!0)):m.value==null&&C?.comment&&(g=C.comment)}g&&(c=!0);let b=Qh.stringify(m,l,()=>g=null);h<t.length-1&&(b+=","),g&&(b+=lo.lineComment(b,r,a(g))),!c&&(d.length>f||b.includes(`
|
|
71
71
|
`))&&(c=!0),d.push(b),f=d.length}let{start:u,end:p}=n;if(d.length===0)return u+p;if(!c){let h=d.reduce((m,g)=>m+g.length+2,2);c=e.options.lineWidth>0&&h>e.options.lineWidth}if(c){let h=u;for(let m of d)h+=m?`
|
|
72
72
|
${i}${s}${m}`:`
|
|
73
73
|
`;return`${h}
|
|
74
|
-
${s}${p}`}else return`${u}${o}${d.join(" ")}${o}${p}`}function
|
|
75
|
-
`:" ")}return
|
|
74
|
+
${s}${p}`}else return`${u}${o}${d.join(" ")}${o}${p}`}function co({indent:t,options:{commentString:e}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){let i=lo.indentComment(e(r),t);n.push(i.trimStart())}}Zh.stringifyCollection=F0});var Bt=I(Ic=>{"use strict";var J0=_c(),W0=Oc(),K0=Gi(),Dt=W(),uo=Mt(),H0=re();function us(t,e){let n=Dt.isScalar(e)?e.value:e;for(let r of t)if(Dt.isPair(r)&&(r.key===e||r.key===n||Dt.isScalar(r.key)&&r.key.value===n))return r}var Rc=class extends K0.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Dt.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:s,replacer:i}=r,o=new this(e),a=(l,c)=>{if(typeof i=="function")c=i.call(n,l,c);else if(Array.isArray(i)&&!i.includes(l))return;(c!==void 0||s)&&o.items.push(uo.createPair(l,c,r))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let r;Dt.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new uo.Pair(e,e?.value):r=new uo.Pair(e.key,e.value);let s=us(this.items,r.key),i=this.schema?.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);Dt.isScalar(s.value)&&H0.isScalarValue(r.value)?s.value.value=r.value:s.value=r.value}else if(i){let o=this.items.findIndex(a=>i(r,a)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let n=us(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let s=us(this.items,e)?.value;return(!n&&Dt.isScalar(s)?s.value:s)??void 0}has(e){return!!us(this.items,e)}set(e,n){this.add(new uo.Pair(e,n),!0)}toJSON(e,n,r){let s=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(s);for(let i of this.items)W0.addPairToJSMap(n,s,i);return s}toString(e,n,r){if(!e)return JSON.stringify(this);for(let s of this.items)if(!Dt.isPair(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),J0.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};Ic.YAMLMap=Rc;Ic.findPair=us});var Vn=I(tm=>{"use strict";var z0=W(),em=Bt(),Y0={collection:"map",default:!0,nodeClass:em.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return z0.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>em.YAMLMap.from(t,e,n)};tm.map=Y0});var jt=I(nm=>{"use strict";var V0=ns(),G0=_c(),X0=Gi(),po=W(),Q0=re(),Z0=It(),$c=class extends X0.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(po.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=fo(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=fo(e);if(typeof r!="number")return;let s=this.items[r];return!n&&po.isScalar(s)?s.value:s}has(e){let n=fo(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=fo(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[r];po.isScalar(s)&&Q0.isScalarValue(n)?s.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let s=0;for(let i of this.items)r.push(Z0.toJS(i,String(s++),n));return r}toString(e,n,r){return e?G0.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:s}=r,i=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof s=="function"){let l=n instanceof Set?a:String(o++);a=s.call(n,l,a)}i.items.push(V0.createNode(a,void 0,r))}}return i}};function fo(t){let e=po.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}nm.YAMLSeq=$c});var Gn=I(sm=>{"use strict";var eE=W(),rm=jt(),tE={collection:"seq",default:!0,nodeClass:rm.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return eE.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>rm.YAMLSeq.from(t,e,n)};sm.seq=tE});var ds=I(im=>{"use strict";var nE=os(),rE={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),nE.stringifyString(t,e,n,r)}};im.string=rE});var ho=I(lm=>{"use strict";var om=re(),am={identify:t=>t==null,createNode:()=>new om.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new om.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&am.test.test(t)?t:e.options.nullStr};lm.nullTag=am});var Nc=I(um=>{"use strict";var sE=re(),cm={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new sE.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&cm.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};um.boolTag=cm});var Xn=I(dm=>{"use strict";function iE({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}dm.stringifyNumber=iE});var Mc=I(mo=>{"use strict";var oE=re(),Lc=Xn(),aE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Lc.stringifyNumber},lE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Lc.stringifyNumber(t)}},cE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new oE.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Lc.stringifyNumber};mo.float=cE;mo.floatExp=lE;mo.floatNaN=aE});var Bc=I(yo=>{"use strict";var fm=Xn(),go=t=>typeof t=="bigint"||Number.isInteger(t),Dc=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function pm(t,e,n){let{value:r}=t;return go(r)&&r>=0?n+r.toString(e):fm.stringifyNumber(t)}var uE={identify:t=>go(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Dc(t,2,8,n),stringify:t=>pm(t,8,"0o")},dE={identify:go,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Dc(t,0,10,n),stringify:fm.stringifyNumber},fE={identify:t=>go(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Dc(t,2,16,n),stringify:t=>pm(t,16,"0x")};yo.int=dE;yo.intHex=fE;yo.intOct=uE});var mm=I(hm=>{"use strict";var pE=Vn(),hE=ho(),mE=Gn(),gE=ds(),yE=Nc(),jc=Mc(),Fc=Bc(),bE=[pE.map,mE.seq,gE.string,hE.nullTag,yE.boolTag,Fc.intOct,Fc.int,Fc.intHex,jc.floatNaN,jc.floatExp,jc.float];hm.schema=bE});var bm=I(ym=>{"use strict";var wE=re(),vE=Vn(),SE=Gn();function gm(t){return typeof t=="bigint"||Number.isInteger(t)}var bo=({value:t})=>JSON.stringify(t),kE=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:bo},{identify:t=>t==null,createNode:()=>new wE.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:bo},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:bo},{identify:gm,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>gm(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:bo}],xE={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},EE=[vE.map,SE.seq].concat(kE,xE);ym.schema=EE});var qc=I(wm=>{"use strict";var fs=Ni("buffer"),Uc=re(),AE=os(),TE={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof fs.Buffer=="function")return fs.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s<n.length;++s)r[s]=n.charCodeAt(s);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,s,i){if(!n)return"";let o=n,a;if(typeof fs.Buffer=="function")a=o instanceof fs.Buffer?o.toString("base64"):fs.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Uc.Scalar.BLOCK_LITERAL),e!==Uc.Scalar.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let d=0,u=0;d<c;++d,u+=l)f[d]=a.substr(u,l);a=f.join(e===Uc.Scalar.BLOCK_LITERAL?`
|
|
75
|
+
`:" ")}return AE.stringifyString({comment:t,type:e,value:a},r,s,i)}};wm.binary=TE});var So=I(vo=>{"use strict";var wo=W(),Jc=Mt(),CE=re(),OE=jt();function vm(t,e){if(wo.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!wo.isPair(r)){if(wo.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let s=r.items[0]||new Jc.Pair(new CE.Scalar(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore}
|
|
76
76
|
${s.key.commentBefore}`:r.commentBefore),r.comment){let i=s.value??s.key;i.comment=i.comment?`${r.comment}
|
|
77
|
-
${i.comment}`:r.comment}r=s}t.items[n]=yo.isPair(r)?r:new qc.Pair(r)}}else e("Expected a sequence for this tag");return t}function vm(t,e,n){let{replacer:r}=n,s=new CE.YAMLSeq(t);s.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;s.items.push(qc.createPair(a,l,n))}return s}var OE={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:wm,createNode:vm};bo.createPairs=vm;bo.pairs=OE;bo.resolvePairs=wm});var Kc=I(Wc=>{"use strict";var Sm=W(),Jc=Rt(),fs=Dt(),PE=Bt(),km=wo(),un=class t extends PE.YAMLSeq{constructor(){super(),this.add=fs.YAMLMap.prototype.add.bind(this),this.delete=fs.YAMLMap.prototype.delete.bind(this),this.get=fs.YAMLMap.prototype.get.bind(this),this.has=fs.YAMLMap.prototype.has.bind(this),this.set=fs.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let s of this.items){let i,o;if(Sm.isPair(s)?(i=Jc.toJS(s.key,"",n),o=Jc.toJS(s.value,i,n)):i=Jc.toJS(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,n,r){let s=km.createPairs(e,n,r),i=new this;return i.items=s.items,i}};un.tag="tag:yaml.org,2002:omap";var _E={collection:"seq",identify:t=>t instanceof Map,nodeClass:un,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=km.resolvePairs(t,e),r=[];for(let{key:s}of n.items)Sm.isScalar(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new un,n)},createNode:(t,e,n)=>un.from(t,e,n)};Wc.YAMLOMap=un;Wc.omap=_E});var Cm=I(Hc=>{"use strict";var xm=re();function Em({value:t,source:e},n){return e&&(t?Am:Tm).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Am={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new xm.Scalar(!0),stringify:Em},Tm={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new xm.Scalar(!1),stringify:Em};Hc.falseTag=Tm;Hc.trueTag=Am});var Om=I(vo=>{"use strict";var RE=re(),zc=Xn(),IE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:zc.stringifyNumber},$E={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():zc.stringifyNumber(t)}},NE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new RE.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:zc.stringifyNumber};vo.float=NE;vo.floatExp=$E;vo.floatNaN=IE});var _m=I(hs=>{"use strict";var Pm=Xn(),ps=t=>typeof t=="bigint"||Number.isInteger(t);function So(t,e,n,{intAsBigInt:r}){let s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return s==="-"?BigInt(-1)*o:o}let i=parseInt(t,n);return s==="-"?-1*i:i}function Yc(t,e,n){let{value:r}=t;if(ps(r)){let s=r.toString(e);return r<0?"-"+n+s.substr(1):n+s}return Pm.stringifyNumber(t)}var LE={identify:ps,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>So(t,2,2,n),stringify:t=>Yc(t,2,"0b")},ME={identify:ps,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>So(t,1,8,n),stringify:t=>Yc(t,8,"0")},DE={identify:ps,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>So(t,0,10,n),stringify:Pm.stringifyNumber},BE={identify:ps,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>So(t,2,16,n),stringify:t=>Yc(t,16,"0x")};hs.int=DE;hs.intBin=LE;hs.intHex=BE;hs.intOct=ME});var Gc=I(Vc=>{"use strict";var Eo=W(),ko=Lt(),xo=Dt(),dn=class t extends xo.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Eo.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ko.Pair(e.key,null):n=new ko.Pair(e,null),xo.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=xo.findPair(this.items,e);return!n&&Eo.isPair(r)?Eo.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=xo.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new ko.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:s}=r,i=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof s=="function"&&(o=s.call(n,o,o)),i.items.push(ko.createPair(o,null,r));return i}};dn.tag="tag:yaml.org,2002:set";var jE={collection:"map",identify:t=>t instanceof Set,nodeClass:dn,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>dn.from(t,e,n),resolve(t,e){if(Eo.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new dn,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Vc.YAMLSet=dn;Vc.set=jE});var Qc=I(Ao=>{"use strict";var FE=Xn();function Xc(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,s=o=>e?BigInt(o):Number(o),i=r.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return n==="-"?s(-1)*i:i}function Rm(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return FE.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let s=n(60),i=[e%s];return e<60?i.unshift(0):(e=(e-i[0])/s,i.unshift(e%s),e>=60&&(e=(e-i[0])/s,i.unshift(e))),r+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var UE={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Xc(t,n),stringify:Rm},qE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Xc(t,!1),stringify:Rm},Im={identify:t=>t 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(t){let e=t.match(Im.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,s,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,s,i||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let d=Xc(f,!1);Math.abs(d)<30&&(d*=60),c-=6e4*d}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Ao.floatTime=qE;Ao.intTime=UE;Ao.timestamp=Im});var Lm=I(Nm=>{"use strict";var JE=Vn(),WE=fo(),KE=Gn(),HE=us(),zE=Uc(),$m=Cm(),Zc=Om(),To=_m(),YE=ro(),VE=Kc(),GE=wo(),XE=Gc(),eu=Qc(),QE=[JE.map,KE.seq,HE.string,WE.nullTag,$m.trueTag,$m.falseTag,To.intBin,To.intOct,To.int,To.intHex,Zc.floatNaN,Zc.floatExp,Zc.float,zE.binary,YE.merge,VE.omap,GE.pairs,XE.set,eu.intTime,eu.floatTime,eu.timestamp];Nm.schema=QE});var Km=I(ru=>{"use strict";var jm=Vn(),ZE=fo(),Fm=Gn(),eA=us(),tA=$c(),tu=Lc(),nu=Dc(),nA=hm(),rA=ym(),Um=Uc(),ms=ro(),qm=Kc(),Jm=wo(),Mm=Lm(),Wm=Gc(),Co=Qc(),Dm=new Map([["core",nA.schema],["failsafe",[jm.map,Fm.seq,eA.string]],["json",rA.schema],["yaml11",Mm.schema],["yaml-1.1",Mm.schema]]),Bm={binary:Um.binary,bool:tA.boolTag,float:tu.float,floatExp:tu.floatExp,floatNaN:tu.floatNaN,floatTime:Co.floatTime,int:nu.int,intHex:nu.intHex,intOct:nu.intOct,intTime:Co.intTime,map:jm.map,merge:ms.merge,null:ZE.nullTag,omap:qm.omap,pairs:Jm.pairs,seq:Fm.seq,set:Wm.set,timestamp:Co.timestamp},sA={"tag:yaml.org,2002:binary":Um.binary,"tag:yaml.org,2002:merge":ms.merge,"tag:yaml.org,2002:omap":qm.omap,"tag:yaml.org,2002:pairs":Jm.pairs,"tag:yaml.org,2002:set":Wm.set,"tag:yaml.org,2002:timestamp":Co.timestamp};function iA(t,e,n){let r=Dm.get(e);if(r&&!t)return n&&!r.includes(ms.merge)?r.concat(ms.merge):r.slice();let s=r;if(!s)if(Array.isArray(t))s=[];else{let i=Array.from(Dm.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(t))for(let i of t)s=s.concat(i);else typeof t=="function"&&(s=t(s.slice()));return n&&(s=s.concat(ms.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?Bm[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Bm).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return i.includes(a)||i.push(a),i},[])}ru.coreKnownTags=sA;ru.getTags=iA});var ou=I(Hm=>{"use strict";var su=W(),oA=Vn(),aA=Gn(),lA=us(),Oo=Km(),cA=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,iu=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Oo.getTags(e,"compat"):e?Oo.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?Oo.coreKnownTags:{},this.tags=Oo.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,su.MAP,{value:oA.map}),Object.defineProperty(this,su.SCALAR,{value:lA.string}),Object.defineProperty(this,su.SEQ,{value:aA.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?cA:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Hm.Schema=iu});var Ym=I(zm=>{"use strict";var uA=W(),au=os(),gs=ns();function dA(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let s=au.createStringifyContext(t,e),{commentString:i}=s.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=i(t.commentBefore);n.unshift(gs.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(uA.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let f=i(t.contents.commentBefore);n.push(gs.indentComment(f,""))}s.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=au.stringify(t.contents,s,()=>a=null,l);a&&(c+=gs.lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(au.stringify(t.contents,s));if(t.directives?.docEnd)if(t.comment){let l=i(t.comment);l.includes(`
|
|
78
|
-
`)?(n.push("..."),n.push(
|
|
77
|
+
${i.comment}`:r.comment}r=s}t.items[n]=wo.isPair(r)?r:new Jc.Pair(r)}}else e("Expected a sequence for this tag");return t}function Sm(t,e,n){let{replacer:r}=n,s=new OE.YAMLSeq(t);s.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;s.items.push(Jc.createPair(a,l,n))}return s}var PE={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:vm,createNode:Sm};vo.createPairs=Sm;vo.pairs=PE;vo.resolvePairs=vm});var Hc=I(Kc=>{"use strict";var km=W(),Wc=It(),ps=Bt(),_E=jt(),xm=So(),dn=class t extends _E.YAMLSeq{constructor(){super(),this.add=ps.YAMLMap.prototype.add.bind(this),this.delete=ps.YAMLMap.prototype.delete.bind(this),this.get=ps.YAMLMap.prototype.get.bind(this),this.has=ps.YAMLMap.prototype.has.bind(this),this.set=ps.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let s of this.items){let i,o;if(km.isPair(s)?(i=Wc.toJS(s.key,"",n),o=Wc.toJS(s.value,i,n)):i=Wc.toJS(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,n,r){let s=xm.createPairs(e,n,r),i=new this;return i.items=s.items,i}};dn.tag="tag:yaml.org,2002:omap";var RE={collection:"seq",identify:t=>t instanceof Map,nodeClass:dn,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=xm.resolvePairs(t,e),r=[];for(let{key:s}of n.items)km.isScalar(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new dn,n)},createNode:(t,e,n)=>dn.from(t,e,n)};Kc.YAMLOMap=dn;Kc.omap=RE});var Om=I(zc=>{"use strict";var Em=re();function Am({value:t,source:e},n){return e&&(t?Tm:Cm).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Tm={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Em.Scalar(!0),stringify:Am},Cm={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Em.Scalar(!1),stringify:Am};zc.falseTag=Cm;zc.trueTag=Tm});var Pm=I(ko=>{"use strict";var IE=re(),Yc=Xn(),$E={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Yc.stringifyNumber},NE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Yc.stringifyNumber(t)}},LE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new IE.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Yc.stringifyNumber};ko.float=LE;ko.floatExp=NE;ko.floatNaN=$E});var Rm=I(ms=>{"use strict";var _m=Xn(),hs=t=>typeof t=="bigint"||Number.isInteger(t);function xo(t,e,n,{intAsBigInt:r}){let s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return s==="-"?BigInt(-1)*o:o}let i=parseInt(t,n);return s==="-"?-1*i:i}function Vc(t,e,n){let{value:r}=t;if(hs(r)){let s=r.toString(e);return r<0?"-"+n+s.substr(1):n+s}return _m.stringifyNumber(t)}var ME={identify:hs,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>xo(t,2,2,n),stringify:t=>Vc(t,2,"0b")},DE={identify:hs,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>xo(t,1,8,n),stringify:t=>Vc(t,8,"0")},BE={identify:hs,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>xo(t,0,10,n),stringify:_m.stringifyNumber},jE={identify:hs,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>xo(t,2,16,n),stringify:t=>Vc(t,16,"0x")};ms.int=BE;ms.intBin=ME;ms.intHex=jE;ms.intOct=DE});var Xc=I(Gc=>{"use strict";var To=W(),Eo=Mt(),Ao=Bt(),fn=class t extends Ao.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;To.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Eo.Pair(e.key,null):n=new Eo.Pair(e,null),Ao.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=Ao.findPair(this.items,e);return!n&&To.isPair(r)?To.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Ao.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Eo.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:s}=r,i=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof s=="function"&&(o=s.call(n,o,o)),i.items.push(Eo.createPair(o,null,r));return i}};fn.tag="tag:yaml.org,2002:set";var FE={collection:"map",identify:t=>t instanceof Set,nodeClass:fn,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>fn.from(t,e,n),resolve(t,e){if(To.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new fn,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Gc.YAMLSet=fn;Gc.set=FE});var Zc=I(Co=>{"use strict";var UE=Xn();function Qc(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,s=o=>e?BigInt(o):Number(o),i=r.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return n==="-"?s(-1)*i:i}function Im(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return UE.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let s=n(60),i=[e%s];return e<60?i.unshift(0):(e=(e-i[0])/s,i.unshift(e%s),e>=60&&(e=(e-i[0])/s,i.unshift(e))),r+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var qE={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Qc(t,n),stringify:Im},JE={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Qc(t,!1),stringify:Im},$m={identify:t=>t 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(t){let e=t.match($m.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,s,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,s,i||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let d=Qc(f,!1);Math.abs(d)<30&&(d*=60),c-=6e4*d}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Co.floatTime=JE;Co.intTime=qE;Co.timestamp=$m});var Mm=I(Lm=>{"use strict";var WE=Vn(),KE=ho(),HE=Gn(),zE=ds(),YE=qc(),Nm=Om(),eu=Pm(),Oo=Rm(),VE=io(),GE=Hc(),XE=So(),QE=Xc(),tu=Zc(),ZE=[WE.map,HE.seq,zE.string,KE.nullTag,Nm.trueTag,Nm.falseTag,Oo.intBin,Oo.intOct,Oo.int,Oo.intHex,eu.floatNaN,eu.floatExp,eu.float,YE.binary,VE.merge,GE.omap,XE.pairs,QE.set,tu.intTime,tu.floatTime,tu.timestamp];Lm.schema=ZE});var Hm=I(su=>{"use strict";var Fm=Vn(),eA=ho(),Um=Gn(),tA=ds(),nA=Nc(),nu=Mc(),ru=Bc(),rA=mm(),sA=bm(),qm=qc(),gs=io(),Jm=Hc(),Wm=So(),Dm=Mm(),Km=Xc(),Po=Zc(),Bm=new Map([["core",rA.schema],["failsafe",[Fm.map,Um.seq,tA.string]],["json",sA.schema],["yaml11",Dm.schema],["yaml-1.1",Dm.schema]]),jm={binary:qm.binary,bool:nA.boolTag,float:nu.float,floatExp:nu.floatExp,floatNaN:nu.floatNaN,floatTime:Po.floatTime,int:ru.int,intHex:ru.intHex,intOct:ru.intOct,intTime:Po.intTime,map:Fm.map,merge:gs.merge,null:eA.nullTag,omap:Jm.omap,pairs:Wm.pairs,seq:Um.seq,set:Km.set,timestamp:Po.timestamp},iA={"tag:yaml.org,2002:binary":qm.binary,"tag:yaml.org,2002:merge":gs.merge,"tag:yaml.org,2002:omap":Jm.omap,"tag:yaml.org,2002:pairs":Wm.pairs,"tag:yaml.org,2002:set":Km.set,"tag:yaml.org,2002:timestamp":Po.timestamp};function oA(t,e,n){let r=Bm.get(e);if(r&&!t)return n&&!r.includes(gs.merge)?r.concat(gs.merge):r.slice();let s=r;if(!s)if(Array.isArray(t))s=[];else{let i=Array.from(Bm.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(t))for(let i of t)s=s.concat(i);else typeof t=="function"&&(s=t(s.slice()));return n&&(s=s.concat(gs.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?jm[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(jm).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return i.includes(a)||i.push(a),i},[])}su.coreKnownTags=iA;su.getTags=oA});var au=I(zm=>{"use strict";var iu=W(),aA=Vn(),lA=Gn(),cA=ds(),_o=Hm(),uA=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ou=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?_o.getTags(e,"compat"):e?_o.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?_o.coreKnownTags:{},this.tags=_o.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,iu.MAP,{value:aA.map}),Object.defineProperty(this,iu.SCALAR,{value:cA.string}),Object.defineProperty(this,iu.SEQ,{value:lA.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?uA:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};zm.Schema=ou});var Vm=I(Ym=>{"use strict";var dA=W(),lu=as(),ys=rs();function fA(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let s=lu.createStringifyContext(t,e),{commentString:i}=s.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=i(t.commentBefore);n.unshift(ys.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(dA.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let f=i(t.contents.commentBefore);n.push(ys.indentComment(f,""))}s.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=lu.stringify(t.contents,s,()=>a=null,l);a&&(c+=ys.lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(lu.stringify(t.contents,s));if(t.directives?.docEnd)if(t.comment){let l=i(t.comment);l.includes(`
|
|
78
|
+
`)?(n.push("..."),n.push(ys.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(ys.indentComment(i(l),"")))}return n.join(`
|
|
79
79
|
`)+`
|
|
80
|
-
`}
|
|
80
|
+
`}Ym.stringifyDocument=fA});var bs=I(Gm=>{"use strict";var pA=ts(),Qn=Gi(),De=W(),hA=Mt(),mA=It(),gA=au(),yA=Vm(),cu=Hi(),bA=pc(),wA=ns(),uu=fc(),du=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,De.NODE_TYPE,{value:De.DOC});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:o}=i;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new uu.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,s,r)}clone(){let e=Object.create(t.prototype,{[De.NODE_TYPE]:{value:De.DOC}});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=De.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Zn(this.contents)&&this.contents.add(e)}addIn(e,n){Zn(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=cu.anchorNames(this);e.anchor=!n||r.has(n)?cu.findNewAnchor(n||"a",r):n}return new pA.Alias(e.anchor)}createNode(e,n,r){let s;if(typeof n=="function")e=n.call({"":e},"",e),s=n;else if(Array.isArray(n)){let g=C=>typeof C=="number"||C instanceof String||C instanceof Number,b=n.filter(g).map(String);b.length>0&&(n=n.concat(b)),s=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=r??{},{onAnchor:d,setAnchors:u,sourceObjects:p}=cu.createNodeAnchors(this,o||"a"),h={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:d,onTagObj:c,replacer:s,schema:this.schema,sourceObjects:p},m=wA.createNode(e,f,h);return a&&De.isCollection(m)&&(m.flow=!0),u(),m}createPair(e,n,r={}){let s=this.createNode(e,null,r),i=this.createNode(n,null,r);return new hA.Pair(s,i)}delete(e){return Zn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qn.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Zn(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return De.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Qn.isEmptyPath(e)?!n&&De.isScalar(this.contents)?this.contents.value:this.contents:De.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return De.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qn.isEmptyPath(e)?this.contents!==void 0:De.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Qn.collectionFromPath(this.schema,[e],n):Zn(this.contents)&&this.contents.set(e,n)}setIn(e,n){Qn.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Qn.collectionFromPath(this.schema,Array.from(e),n):Zn(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new uu.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new uu.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new gA.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=mA.toJS(this.contents,n??"",a);if(typeof i=="function")for(let{count:c,res:f}of a.anchors.values())i(f,c);return typeof o=="function"?bA.applyReviver(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return yA.stringifyDocument(this,e)}};function Zn(t){if(De.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Gm.Document=du});var Ss=I(vs=>{"use strict";var ws=class extends Error{constructor(e,n,r,s){super(),this.name=e,this.code=r,this.message=s,this.pos=n}},fu=class extends ws{constructor(e,n,r){super("YAMLParseError",e,n,r)}},pu=class extends ws{constructor(e,n,r){super("YAMLWarning",e,n,r)}},vA=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(o.substring(0,i))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
81
81
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=n.linePos[1];l?.line===r&&l.col>s&&(a=Math.max(1,Math.min(l.col-s,80-i)));let c=" ".repeat(i)+"^".repeat(a);n.message+=`:
|
|
82
82
|
|
|
83
83
|
${o}
|
|
84
84
|
${c}
|
|
85
|
-
`}};
|
|
86
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(
|
|
87
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
88
|
-
`+T.comment:C.comment=T.comment);let E=new
|
|
89
|
-
`+
|
|
90
|
-
`+
|
|
91
|
-
`+
|
|
92
|
-
`+g.comment:c.comment=g.comment),c.range=[r.offset,m,g.offset]}else c.range=[r.offset,m,m];return c}
|
|
85
|
+
`}};vs.YAMLError=ws;vs.YAMLParseError=fu;vs.YAMLWarning=pu;vs.prettifyError=vA});var ks=I(Xm=>{"use strict";function SA(t,{flow:e,indicator:n,next:r,offset:s,onError:i,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,d="",u="",p=!1,h=!1,m=null,g=null,b=null,C=null,T=null,E=null,$=null;for(let k of t)switch(h&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&i(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(c&&k.type!=="comment"&&k.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),k.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(m=k),f=!0;break;case"comment":{f||i(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=k.source.substring(1)||" ";d?d+=u+L:d=L,u="",c=!1;break}case"newline":c?d?d+=k.source:(!E||n!=="seq-item-ind")&&(l=!0):u+=k.source,c=!0,p=!0,(g||b)&&(C=k),f=!0;break;case"anchor":g&&i(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&i(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=k,$??($=k.offset),c=!1,f=!1,h=!0;break;case"tag":{b&&i(k,"MULTIPLE_TAGS","A node can have at most one tag"),b=k,$??($=k.offset),c=!1,f=!1,h=!0;break}case n:(g||b)&&i(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),E&&i(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),E=k,c=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){T&&i(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),T=k,c=!1,f=!1;break}default:i(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,f=!1}let O=t[t.length-1],P=O?O.offset+O.source.length:s;return h&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:T,found:E,spaceBefore:l,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:C,end:P,start:$??P}}Xm.resolveProps=SA});var Ro=I(Qm=>{"use strict";function hu(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
86
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(hu(e.key)||hu(e.value))return!0}return!1;default:return!0}}Qm.containsNewline=hu});var mu=I(Zm=>{"use strict";var kA=Ro();function xA(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&kA.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Zm.flowIndentCheck=xA});var gu=I(tg=>{"use strict";var eg=W();function EA(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let s=typeof r=="function"?r:(i,o)=>i===o||eg.isScalar(i)&&eg.isScalar(o)&&i.value===o.value;return e.some(i=>s(i.key,n))}tg.mapIncludes=EA});var ag=I(og=>{"use strict";var ng=Mt(),AA=Bt(),rg=ks(),TA=Ro(),sg=mu(),CA=gu(),ig="All mapping items must start at the same column";function OA({composeNode:t,composeEmptyNode:e},n,r,s,i){let o=i?.nodeClass??AA.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,c=null;for(let f of r.items){let{start:d,key:u,sep:p,value:h}=f,m=rg.resolveProps(d,{indicator:"explicit-key-ind",next:u??p?.[0],offset:l,onError:s,parentIndent:r.indent,startOnNewline:!0}),g=!m.found;if(g){if(u&&(u.type==="block-seq"?s(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&s(l,"BAD_INDENT",ig)),!m.anchor&&!m.tag&&!p){c=m.end,m.comment&&(a.comment?a.comment+=`
|
|
87
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||TA.containsNewline(u))&&s(u??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&s(l,"BAD_INDENT",ig);n.atKey=!0;let b=m.end,C=u?t(n,u,m,s):e(n,b,d,null,m,s);n.schema.compat&&sg.flowIndentCheck(r.indent,u,s),n.atKey=!1,CA.mapIncludes(n,a.items,C)&&s(b,"DUPLICATE_KEY","Map keys must be unique");let T=rg.resolveProps(p??[],{indicator:"map-value-ind",next:h,offset:C.range[2],onError:s,parentIndent:r.indent,startOnNewline:!u||u.type==="block-scalar"});if(l=T.end,T.found){g&&(h?.type==="block-map"&&!T.hasNewline&&s(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<T.found.offset-1024&&s(C.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=h?t(n,h,T,s):e(n,l,p,null,T,s);n.schema.compat&&sg.flowIndentCheck(r.indent,h,s),l=E.range[2];let $=new ng.Pair(C,E);n.options.keepSourceTokens&&($.srcToken=f),a.items.push($)}else{g&&s(C.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),T.comment&&(C.comment?C.comment+=`
|
|
88
|
+
`+T.comment:C.comment=T.comment);let E=new ng.Pair(C);n.options.keepSourceTokens&&(E.srcToken=f),a.items.push(E)}}return c&&c<l&&s(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,l,c??l],a}og.resolveBlockMap=OA});var cg=I(lg=>{"use strict";var PA=jt(),_A=ks(),RA=mu();function IA({composeNode:t,composeEmptyNode:e},n,r,s,i){let o=i?.nodeClass??PA.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset,c=null;for(let{start:f,value:d}of r.items){let u=_A.resolveProps(f,{indicator:"seq-item-ind",next:d,offset:l,onError:s,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||d)d?.type==="block-seq"?s(u.end,"BAD_INDENT","All sequence items must start at the same column"):s(l,"MISSING_CHAR","Sequence item without - indicator");else{c=u.end,u.comment&&(a.comment=u.comment);continue}let p=d?t(n,d,u,s):e(n,u.end,f,null,u,s);n.schema.compat&&RA.flowIndentCheck(r.indent,d,s),l=p.range[2],a.items.push(p)}return a.range=[r.offset,l,c??l],a}lg.resolveBlockSeq=IA});var er=I(ug=>{"use strict";function $A(t,e,n,r){let s="";if(t){let i=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":i=!0;break;case"comment":{n&&!i&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=l.substring(1)||" ";s?s+=o+f:s=f,o="";break}case"newline":s&&(o+=l),i=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:s,offset:e}}ug.resolveEnd=$A});var hg=I(pg=>{"use strict";var NA=W(),LA=Mt(),dg=Bt(),MA=jt(),DA=er(),fg=ks(),BA=Ro(),jA=gu(),yu="Block collections are not allowed within flow collections",bu=t=>t&&(t.type==="block-map"||t.type==="block-seq");function FA({composeNode:t,composeEmptyNode:e},n,r,s,i){let o=r.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?dg.YAMLMap:MA.YAMLSeq),c=new l(n.schema);c.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let b=r.items[g],{start:C,key:T,sep:E,value:$}=b,O=fg.resolveProps(C,{flow:a,indicator:"explicit-key-ind",next:T??E?.[0],offset:d,onError:s,parentIndent:r.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!E&&!$){g===0&&O.comma?s(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<r.items.length-1&&s(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),O.comment&&(c.comment?c.comment+=`
|
|
89
|
+
`+O.comment:c.comment=O.comment),d=O.end;continue}!o&&n.options.strict&&BA.containsNewline(T)&&s(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)O.comma&&s(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(O.comma||s(O.start,"MISSING_CHAR",`Missing , between ${a} items`),O.comment){let P="";e:for(let k of C)switch(k.type){case"comma":case"space":break;case"comment":P=k.source.substring(1);break e;default:break e}if(P){let k=c.items[c.items.length-1];NA.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
|
|
90
|
+
`+P:k.comment=P,O.comment=O.comment.substring(P.length+1)}}if(!o&&!E&&!O.found){let P=$?t(n,$,O,s):e(n,O.end,E,null,O,s);c.items.push(P),d=P.range[2],bu($)&&s(P.range,"BLOCK_IN_FLOW",yu)}else{n.atKey=!0;let P=O.end,k=T?t(n,T,O,s):e(n,P,C,null,O,s);bu(T)&&s(k.range,"BLOCK_IN_FLOW",yu),n.atKey=!1;let L=fg.resolveProps(E??[],{flow:a,indicator:"map-value-ind",next:$,offset:k.range[2],onError:s,parentIndent:r.indent,startOnNewline:!1});if(L.found){if(!o&&!O.found&&n.options.strict){if(E)for(let U of E){if(U===L.found)break;if(U.type==="newline"){s(U,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<L.found.offset-1024&&s(L.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else $&&("source"in $&&$.source?.[0]===":"?s($,"MISSING_CHAR",`Missing space after : in ${a}`):s(L.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let j=$?t(n,$,L,s):L.found?e(n,L.end,E,null,L,s):null;j?bu($)&&s(j.range,"BLOCK_IN_FLOW",yu):L.comment&&(k.comment?k.comment+=`
|
|
91
|
+
`+L.comment:k.comment=L.comment);let Q=new LA.Pair(k,j);if(n.options.keepSourceTokens&&(Q.srcToken=b),o){let U=c;jA.mapIncludes(n,U.items,k)&&s(P,"DUPLICATE_KEY","Map keys must be unique"),U.items.push(Q)}else{let U=new dg.YAMLMap(n.schema);U.flow=!0,U.items.push(Q);let ie=(j??k).range;U.range=[k.range[0],ie[1],ie[2]],c.items.push(U)}d=j?j.range[2]:L.end}}let u=o?"}":"]",[p,...h]=r.end,m=d;if(p?.source===u)m=p.offset+p.source.length;else{let g=a[0].toUpperCase()+a.substring(1),b=f?`${g} must end with a ${u}`:`${g} in block collection must be sufficiently indented and end with a ${u}`;s(d,f?"MISSING_CHAR":"BAD_INDENT",b),p&&p.source.length!==1&&h.unshift(p)}if(h.length>0){let g=DA.resolveEnd(h,m,n.options.strict,s);g.comment&&(c.comment?c.comment+=`
|
|
92
|
+
`+g.comment:c.comment=g.comment),c.range=[r.offset,m,g.offset]}else c.range=[r.offset,m,m];return c}pg.resolveFlowCollection=FA});var gg=I(mg=>{"use strict";var UA=W(),qA=re(),JA=Bt(),WA=jt(),KA=ag(),HA=cg(),zA=hg();function wu(t,e,n,r,s,i){let o=n.type==="block-map"?KA.resolveBlockMap(t,e,n,r,i):n.type==="block-seq"?HA.resolveBlockSeq(t,e,n,r,i):zA.resolveFlowCollection(t,e,n,r,i),a=o.constructor;return s==="!"||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function YA(t,e,n,r,s){let i=r.tag,o=i?e.directives.tagName(i.source,u=>s(i,"TAG_RESOLVE_FAILED",u)):null;if(n.type==="block-seq"){let{anchor:u,newlineAfterProp:p}=r,h=u&&i?u.offset>i.offset?u:i:u??i;h&&(!p||p.offset<h.offset)&&s(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===JA.YAMLMap.tagName&&a==="map"||o===WA.YAMLSeq.tagName&&a==="seq")return wu(t,e,n,s,o);let l=e.schema.tags.find(u=>u.tag===o&&u.collection===a);if(!l){let u=e.schema.knownTags[o];if(u?.collection===a)e.schema.tags.push(Object.assign({},u,{default:!1})),l=u;else return u?s(i,"BAD_COLLECTION_TYPE",`${u.tag} used for ${a} collection, but expects ${u.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),wu(t,e,n,s,o)}let c=wu(t,e,n,s,o,l),f=l.resolve?.(c,u=>s(i,"TAG_RESOLVE_FAILED",u),e.options)??c,d=UA.isNode(f)?f:new qA.Scalar(f);return d.range=c.range,d.tag=o,l?.format&&(d.format=l.format),d}mg.composeCollection=YA});var Su=I(yg=>{"use strict";var vu=re();function VA(t,e,n){let r=e.offset,s=GA(e,t.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};let i=s.mode===">"?vu.Scalar.BLOCK_FOLDED:vu.Scalar.BLOCK_LITERAL,o=e.source?XA(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let g=o[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&o.length>0?`
|
|
93
93
|
`.repeat(Math.max(1,o.length-1)):"",g=r+s.length;return e.source&&(g+=e.source.length),{value:m,type:i,comment:s.comment,range:[r,g,g]}}let l=e.indent+s.indent,c=e.offset+s.length,f=0;for(let m=0;m<a;++m){let[g,b]=o[m];if(b===""||b==="\r")s.indent===0&&g.length>l&&(l=g.length);else{g.length<l&&n(c+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(l=g.length),f=m,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=g.length+b.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>l&&(a=m+1);let d="",u="",p=!1;for(let m=0;m<f;++m)d+=o[m][0].slice(l)+`
|
|
94
|
-
`;for(let m=f;m<a;++m){let[g,b]=o[m];c+=g.length+b.length+1;let C=b[b.length-1]==="\r";if(C&&(b=b.slice(0,-1)),b&&g.length<l){let E=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;n(c-b.length-(C?2:1),"BAD_INDENT",E),g=""}i===
|
|
94
|
+
`;for(let m=f;m<a;++m){let[g,b]=o[m];c+=g.length+b.length+1;let C=b[b.length-1]==="\r";if(C&&(b=b.slice(0,-1)),b&&g.length<l){let E=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;n(c-b.length-(C?2:1),"BAD_INDENT",E),g=""}i===vu.Scalar.BLOCK_LITERAL?(d+=u+g.slice(l)+b,u=`
|
|
95
95
|
`):g.length>l||b[0]===" "?(u===" "?u=`
|
|
96
96
|
`:!p&&u===`
|
|
97
97
|
`&&(u=`
|
|
@@ -104,73 +104,73 @@ ${c}
|
|
|
104
104
|
`+o[m][0].slice(l);d[d.length-1]!==`
|
|
105
105
|
`&&(d+=`
|
|
106
106
|
`);break;default:d+=`
|
|
107
|
-
`}let h=r+s.length+e.source.length;return{value:d,type:i,comment:s.comment,range:[r,h,h]}}function
|
|
107
|
+
`}let h=r+s.length+e.source.length;return{value:d,type:i,comment:s.comment,range:[r,h,h]}}function GA({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=e[0],i=s[0],o=0,a="",l=-1;for(let u=1;u<s.length;++u){let p=s[u];if(!a&&(p==="-"||p==="+"))a=p;else{let h=Number(p);!o&&h?o=h:l===-1&&(l=t+u)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let c=!1,f="",d=s.length;for(let u=1;u<e.length;++u){let p=e[u];switch(p.type){case"space":c=!0;case"newline":d+=p.source.length;break;case"comment":n&&!c&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,f=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let h=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",h);let m=p.source;m&&typeof m=="string"&&(d+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:f,length:d}}function XA(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}yg.resolveBlockScalar=VA});var xu=I(wg=>{"use strict";var ku=re(),QA=er();function ZA(t,e,n){let{offset:r,type:s,source:i,end:o}=t,a,l,c=(u,p,h)=>n(r+u,p,h);switch(s){case"scalar":a=ku.Scalar.PLAIN,l=eT(i,c);break;case"single-quoted-scalar":a=ku.Scalar.QUOTE_SINGLE,l=tT(i,c);break;case"double-quoted-scalar":a=ku.Scalar.QUOTE_DOUBLE,l=nT(i,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}let f=r+i.length,d=QA.resolveEnd(o,f,e,n);return{value:l,type:a,comment:d.comment,range:[r,f,d.offset]}}function eT(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),bg(t)}function tT(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),bg(t.slice(1,-1)).replace(/''/g,"'")}function bg(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
108
108
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
109
109
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let s=r[1],i=" ",o=e.lastIndex;for(n.lastIndex=o;r=n.exec(t);)r[1]===""?i===`
|
|
110
110
|
`?s+=i:i=`
|
|
111
|
-
`:(s+=i+r[1],i=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(t),s+i+(r?.[1]??"")}function
|
|
111
|
+
`:(s+=i+r[1],i=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(t),s+i+(r?.[1]??"")}function nT(t,e){let n="";for(let r=1;r<t.length-1;++r){let s=t[r];if(!(s==="\r"&&t[r+1]===`
|
|
112
112
|
`))if(s===`
|
|
113
|
-
`){let{fold:i,offset:o}=
|
|
113
|
+
`){let{fold:i,offset:o}=rT(t,r);n+=i,r=o}else if(s==="\\"){let i=t[++r],o=sT[i];if(o)n+=o;else if(i===`
|
|
114
114
|
`)for(i=t[r+1];i===" "||i===" ";)i=t[++r+1];else if(i==="\r"&&t[r+1]===`
|
|
115
|
-
`)for(i=t[++r+1];i===" "||i===" ";)i=t[++r+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];n+=
|
|
115
|
+
`)for(i=t[++r+1];i===" "||i===" ";)i=t[++r+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];n+=iT(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(s===" "||s===" "){let i=r,o=t[r+1];for(;o===" "||o===" ";)o=t[++r+1];o!==`
|
|
116
116
|
`&&!(o==="\r"&&t[r+2]===`
|
|
117
|
-
`)&&(n+=r>i?t.slice(i,r+1):s)}else n+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
117
|
+
`)&&(n+=r>i?t.slice(i,r+1):s)}else n+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function rT(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
|
118
118
|
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
119
119
|
`);)r===`
|
|
120
120
|
`&&(n+=`
|
|
121
|
-
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var
|
|
122
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
121
|
+
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var sT={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
122
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function iT(t,e,n,r){let s=t.substr(e,n),o=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}wg.resolveFlowScalar=ZA});var kg=I(Sg=>{"use strict";var pn=W(),vg=re(),oT=Su(),aT=xu();function lT(t,e,n,r){let{value:s,type:i,comment:o,range:a}=e.type==="block-scalar"?oT.resolveBlockScalar(t,e,r):aT.resolveFlowScalar(e,t.options.strict,r),l=n?t.directives.tagName(n.source,d=>r(n,"TAG_RESOLVE_FAILED",d)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[pn.SCALAR]:l?c=cT(t.schema,s,l,n,r):e.type==="scalar"?c=uT(t,s,e,r):c=t.schema[pn.SCALAR];let f;try{let d=c.resolve(s,u=>r(n??e,"TAG_RESOLVE_FAILED",u),t.options);f=pn.isScalar(d)?d:new vg.Scalar(d)}catch(d){let u=d instanceof Error?d.message:String(d);r(n??e,"TAG_RESOLVE_FAILED",u),f=new vg.Scalar(s)}return f.range=a,f.source=s,i&&(f.type=i),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function cT(t,e,n,r,s){if(n==="!")return t[pn.SCALAR];let i=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[pn.SCALAR])}function uT({atKey:t,directives:e,schema:n},r,s,i){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[pn.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(r))??n[pn.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;i(s,"TAG_RESOLVE_FAILED",f,!0)}}return o}Sg.composeScalar=lT});var Eg=I(xg=>{"use strict";function dT(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let s=e[r];switch(s.type){case"space":case"comment":case"newline":t-=s.source.length;continue}for(s=e[++r];s?.type==="space";)t+=s.source.length,s=e[++r];break}}return t}xg.emptyScalarPosition=dT});var Cg=I(Au=>{"use strict";var fT=ts(),pT=W(),hT=gg(),Ag=kg(),mT=er(),gT=Eg(),yT={composeNode:Tg,composeEmptyNode:Eu};function Tg(t,e,n,r){let s=t.atKey,{spaceBefore:i,comment:o,anchor:a,tag:l}=n,c,f=!0;switch(e.type){case"alias":c=bT(t,e,r),(a||l)&&r(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":c=Ag.composeScalar(t,e,l,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=hT.composeCollection(yT,t,e,n,r),a&&(c.anchor=a.source.substring(1));break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",d),c=Eu(t,e.offset,void 0,null,n,r),f=!1}}return a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&t.options.stringKeys&&(!pT.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),t.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Eu(t,e,n,r,{spaceBefore:s,comment:i,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:gT.emptyScalarPosition(e,n,r),indent:-1,source:""},d=Ag.composeScalar(t,f,a,c);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(d.spaceBefore=!0),i&&(d.comment=i,d.range[2]=l),d}function bT({options:t},{offset:e,source:n,end:r},s){let i=new fT.Alias(n.substring(1));i.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=mT.resolveEnd(r,o,t.strict,s);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}Au.composeEmptyNode=Eu;Au.composeNode=Tg});var _g=I(Pg=>{"use strict";var wT=bs(),Og=Cg(),vT=er(),ST=ks();function kT(t,e,{offset:n,start:r,value:s,end:i},o){let a=Object.assign({_directives:e},t),l=new wT.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=ST.resolveProps(r,{indicator:"doc-start",next:s??i?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=s?Og.composeNode(c,s,f,o):Og.composeEmptyNode(c,f.end,r,null,f,o);let d=l.contents.range[2],u=vT.resolveEnd(i,d,!1,o);return u.comment&&(l.comment=u.comment),l.range=[n,d,u.offset],l}Pg.composeDoc=kT});var Cu=I($g=>{"use strict";var xT=Ni("process"),ET=fc(),AT=bs(),xs=Ss(),Rg=W(),TT=_g(),CT=er();function Es(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Ig(t){let e="",n=!1,r=!1;for(let s=0;s<t.length;++s){let i=t[s];switch(i[0]){case"#":e+=(e===""?"":r?`
|
|
123
123
|
|
|
124
124
|
`:`
|
|
125
|
-
`)+(i.substring(1)||" "),n=!0,r=!1;break;case"%":t[s+1]?.[0]!=="#"&&(s+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var
|
|
126
|
-
${r}`:r;else if(s||e.directives.docStart||!i)e.commentBefore=r;else if(
|
|
125
|
+
`)+(i.substring(1)||" "),n=!0,r=!1;break;case"%":t[s+1]?.[0]!=="#"&&(s+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var Tu=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,s,i)=>{let o=Es(n);i?this.warnings.push(new xs.YAMLWarning(o,r,s)):this.errors.push(new xs.YAMLParseError(o,r,s))},this.directives=new ET.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:s}=Ig(this.prelude);if(r){let i=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
126
|
+
${r}`:r;else if(s||e.directives.docStart||!i)e.commentBefore=r;else if(Rg.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];Rg.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${r}
|
|
127
127
|
${a}`:r}else{let o=i.commentBefore;i.commentBefore=o?`${r}
|
|
128
|
-
${o}`:r}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
129
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new
|
|
128
|
+
${o}`:r}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ig(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let s of e)yield*this.next(s);yield*this.end(n,r)}*next(e){switch(xT.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,s)=>{let i=Es(e);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=TT.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new xs.YAMLParseError(Es(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new xs.YAMLParseError(Es(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=CT.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
129
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new xs.YAMLParseError(Es(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),s=new AT.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}};$g.Composer=Tu});var Mg=I(Io=>{"use strict";var OT=Su(),PT=xu(),_T=Ss(),Ng=os();function RT(t,e=!0,n){if(t){let r=(s,i,o)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(n)n(a,i,o);else throw new _T.YAMLParseError([a,a+1],i,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return PT.resolveFlowScalar(t,e,r);case"block-scalar":return OT.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function IT(t,e){let{implicitKey:n=!1,indent:r,inFlow:s=!1,offset:i=-1,type:o="PLAIN"}=e,a=Ng.stringifyString({type:o,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
130
130
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
131
131
|
`),f=a.substring(0,c),d=a.substring(c+1)+`
|
|
132
|
-
`,u=[{type:"block-scalar-header",offset:i,indent:r,source:f}];return
|
|
133
|
-
`}),{type:"block-scalar",offset:i,indent:r,props:u,source:d}}case'"':return{type:"double-quoted-scalar",offset:i,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:r,source:a,end:l};default:return{type:"scalar",offset:i,indent:r,source:a,end:l}}}function
|
|
132
|
+
`,u=[{type:"block-scalar-header",offset:i,indent:r,source:f}];return Lg(u,l)||u.push({type:"newline",offset:-1,indent:r,source:`
|
|
133
|
+
`}),{type:"block-scalar",offset:i,indent:r,props:u,source:d}}case'"':return{type:"double-quoted-scalar",offset:i,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:r,source:a,end:l};default:return{type:"scalar",offset:i,indent:r,source:a,end:l}}}function $T(t,e,n={}){let{afterKey:r=!1,implicitKey:s=!1,inFlow:i=!1,type:o}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Ng.stringifyString({type:o,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":NT(t,l);break;case'"':Ou(t,l,"double-quoted-scalar");break;case"'":Ou(t,l,"single-quoted-scalar");break;default:Ou(t,l,"scalar")}}function NT(t,e){let n=e.indexOf(`
|
|
134
134
|
`),r=e.substring(0,n),s=e.substring(n+1)+`
|
|
135
|
-
`;if(t.type==="block-scalar"){let i=t.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=r,t.source=s}else{let{offset:i}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:r}];
|
|
136
|
-
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:s})}}function
|
|
137
|
-
`};delete t.items,Object.assign(t,{type:n,source:e,end:[s]});break}default:{let r="indent"in t?t.indent:-1,s="end"in t&&Array.isArray(t.end)?t.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(t))i!=="type"&&i!=="offset"&&delete t[i];Object.assign(t,{type:n,indent:r,source:e,end:s})}}}
|
|
135
|
+
`;if(t.type==="block-scalar"){let i=t.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=r,t.source=s}else{let{offset:i}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:r}];Lg(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
136
|
+
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:s})}}function Lg(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Ou(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),s=e.length;t.props[0].type==="block-scalar-header"&&(s-=t.props[0].source.length);for(let i of r)i.offset+=s;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let s={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
137
|
+
`};delete t.items,Object.assign(t,{type:n,source:e,end:[s]});break}default:{let r="indent"in t?t.indent:-1,s="end"in t&&Array.isArray(t.end)?t.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(t))i!=="type"&&i!=="offset"&&delete t[i];Object.assign(t,{type:n,indent:r,source:e,end:s})}}}Io.createScalarToken=IT;Io.resolveAsScalar=RT;Io.setScalarValue=$T});var Bg=I(Dg=>{"use strict";var LT=t=>"type"in t?No(t):$o(t);function No(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=No(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=$o(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=$o(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=$o(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function $o({start:t,key:e,sep:n,value:r}){let s="";for(let i of t)s+=i.source;if(e&&(s+=No(e)),n)for(let i of n)s+=i.source;return r&&(s+=No(r)),s}Dg.stringify=LT});var qg=I(Ug=>{"use strict";var Pu=Symbol("break visit"),MT=Symbol("skip children"),jg=Symbol("remove item");function hn(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Fg(Object.freeze([]),t,e)}hn.BREAK=Pu;hn.SKIP=MT;hn.REMOVE=jg;hn.itemAtPath=(t,e)=>{let n=t;for(let[r,s]of e){let i=n?.[r];if(i&&"items"in i)n=i.items[s];else return}return n};hn.parentCollection=(t,e)=>{let n=hn.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],s=n?.[r];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function Fg(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let s of["key","value"]){let i=e[s];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=Fg(Object.freeze(t.concat([[s,o]])),i.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Pu)return Pu;a===jg&&(i.items.splice(o,1),o-=1)}}typeof r=="function"&&s==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Ug.visit=hn});var Lo=I(Ae=>{"use strict";var _u=Mg(),DT=Bg(),BT=qg(),Ru="\uFEFF",Iu="",$u="",Nu="",jT=t=>!!t&&"items"in t,FT=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function UT(t){switch(t){case Ru:return"<BOM>";case Iu:return"<DOC>";case $u:return"<FLOW_END>";case Nu:return"<SCALAR>";default:return JSON.stringify(t)}}function qT(t){switch(t){case Ru:return"byte-order-mark";case Iu:return"doc-mode";case $u:return"flow-error-end";case Nu:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
138
138
|
`:case`\r
|
|
139
|
-
`: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(t[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}
|
|
140
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
141
|
-
\r `),
|
|
139
|
+
`: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(t[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}Ae.createScalarToken=_u.createScalarToken;Ae.resolveAsScalar=_u.resolveAsScalar;Ae.setScalarValue=_u.setScalarValue;Ae.stringify=DT.stringify;Ae.visit=BT.visit;Ae.BOM=Ru;Ae.DOCUMENT=Iu;Ae.FLOW_END=$u;Ae.SCALAR=Nu;Ae.isCollection=jT;Ae.isScalar=FT;Ae.prettyToken=UT;Ae.tokenType=qT});var Du=I(Wg=>{"use strict";var As=Lo();function Xe(t){switch(t){case void 0:case" ":case`
|
|
140
|
+
`:case"\r":case" ":return!0;default:return!1}}var Jg=new Set("0123456789ABCDEFabcdef"),JT=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Mo=new Set(",[]{}"),WT=new Set(` ,[]{}
|
|
141
|
+
\r `),Lu=t=>!t||WT.has(t),Mu=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,n=!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=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
|
142
142
|
`?!0:n==="\r"?this.buffer[e+1]===`
|
|
143
143
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let s=this.buffer[r+e+1];if(s===`
|
|
144
144
|
`||!s&&!this.atEnd)return e+r+1}return n===`
|
|
145
|
-
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&
|
|
146
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
145
|
+
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Xe(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
146
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===As.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let i=e[r-1];if(i===" "||i===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let i=e[n-1];if(i===" "||i===" ")n-=1;else break}let s=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield As.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&Xe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Xe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Xe(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Lu),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&s[0]!=="#"||r===0&&(s.startsWith("---")||s.startsWith("..."))&&Xe(s[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield As.FLOW_END,yield*this.parseLineStart();let i=0;for(;s[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),s[i]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Lu),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Xe(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let i=0;for(;this.buffer[n-1-i]==="\\";)i+=1;if(i%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),s=r.indexOf(`
|
|
147
147
|
`,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=r.indexOf(`
|
|
148
|
-
`,i)}s!==-1&&(n=s-(r[s-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>
|
|
148
|
+
`,i)}s!==-1&&(n=s-(r[s-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Xe(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":n+=1;break;case`
|
|
149
149
|
`:e=i,n=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
150
150
|
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n: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(`
|
|
151
151
|
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
152
152
|
`;)r=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
|
153
|
-
`&&i>=this.pos&&i+1+n>a)e=i;else break}while(!0);return yield
|
|
153
|
+
`&&i>=this.pos&&i+1+n>a)e=i;else break}while(!0);return yield As.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){let i=this.buffer[r+1];if(Xe(i)||e&&Mo.has(i))break;n=r}else if(Xe(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===`
|
|
154
154
|
`?(r+=1,s=`
|
|
155
|
-
`,i=this.buffer[r+1]):n=r),i==="#"||e&&
|
|
156
|
-
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&
|
|
155
|
+
`,i=this.buffer[r+1]):n=r),i==="#"||e&&Mo.has(i))break;if(s===`
|
|
156
|
+
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Mo.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield As.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Lu))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(Xe(n)||e&&Mo.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!Xe(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(JT.has(n))n=this.buffer[++e];else if(n==="%"&&Jg.has(this.buffer[e+1])&&Jg.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
157
157
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
158
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};
|
|
158
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Wg.Lexer=Mu});var ju=I(Kg=>{"use strict";var Bu=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let i=n+r>>1;this.lineStarts[i]<e?n=i+1:r=i}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let s=this.lineStarts[n-1];return{line:n,col:e-s+1}}}};Kg.LineCounter=Bu});var Uu=I(Gg=>{"use strict";var KT=Ni("process"),Hg=Lo(),HT=Du();function Ft(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function zg(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Vg(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Do(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function tr(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Yg(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ft(e.start,"explicit-key-ind")&&!Ft(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Vg(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Fu=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 HT.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,KT.env.LOG_TOKENS&&console.log("|",Hg.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Hg.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Yg(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{let s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&zg(s.start)===-1&&(n.indent===0||s.start.every(i=>i.type!=="comment"||i.indent<n.indent))&&(r.type==="document"?r.end=s.start:r.items.push({start:s.start}),n.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":{zg(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=Do(this.peek(2)),r=tr(n),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:s}]};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 n=this.source.indexOf(`
|
|
159
159
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
160
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,s=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(
|
|
160
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,s=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ft(n.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(Vg(n.key)&&!Ft(n.sep,"newline")){let o=tr(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else i.length>0?n.sep=n.sep.concat(i,this.sourceToken):n.sep.push(this.sourceToken);else if(Ft(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=tr(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Ft(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);s||n.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ft(n.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 r&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Ft(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let s=Do(r),i=tr(s);Yg(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
|
161
161
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
162
|
-
`,n)+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 n=
|
|
163
|
-
`),n=e.trim();if(
|
|
162
|
+
`,n)+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 n=Do(e),r=tr(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Do(e),r=tr(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Gg.Parser=Fu});var ty=I(Cs=>{"use strict";var Xg=Cu(),zT=bs(),Ts=Ss(),YT=Ac(),VT=W(),GT=ju(),Qg=Uu();function Zg(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new GT.LineCounter||null,prettyErrors:e}}function XT(t,e={}){let{lineCounter:n,prettyErrors:r}=Zg(e),s=new Qg.Parser(n?.addNewLine),i=new Xg.Composer(e),o=Array.from(i.compose(s.parse(t)));if(r&&n)for(let a of o)a.errors.forEach(Ts.prettifyError(t,n)),a.warnings.forEach(Ts.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function ey(t,e={}){let{lineCounter:n,prettyErrors:r}=Zg(e),s=new Qg.Parser(n?.addNewLine),i=new Xg.Composer(e),o=null;for(let a of i.compose(s.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Ts.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(Ts.prettifyError(t,n)),o.warnings.forEach(Ts.prettifyError(t,n))),o}function QT(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let s=ey(t,n);if(!s)return null;if(s.warnings.forEach(i=>YT.warn(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}function ZT(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let s=Math.round(n);n=s<1?void 0:s>8?{indent:8}:{indent:s}}if(t===void 0){let{keepUndefined:s}=n??e??{};if(!s)return}return VT.isDocument(t)&&!r?t.toString(n):new zT.Document(t,r,n).toString(n)}Cs.parse=QT;Cs.parseAllDocuments=XT;Cs.parseDocument=ey;Cs.stringify=ZT});var ry=I(H=>{"use strict";var eC=Cu(),tC=bs(),nC=au(),qu=Ss(),rC=ts(),Ut=W(),sC=Mt(),iC=re(),oC=Bt(),aC=jt(),lC=Lo(),cC=Du(),uC=ju(),dC=Uu(),Bo=ty(),ny=Xr();H.Composer=eC.Composer;H.Document=tC.Document;H.Schema=nC.Schema;H.YAMLError=qu.YAMLError;H.YAMLParseError=qu.YAMLParseError;H.YAMLWarning=qu.YAMLWarning;H.Alias=rC.Alias;H.isAlias=Ut.isAlias;H.isCollection=Ut.isCollection;H.isDocument=Ut.isDocument;H.isMap=Ut.isMap;H.isNode=Ut.isNode;H.isPair=Ut.isPair;H.isScalar=Ut.isScalar;H.isSeq=Ut.isSeq;H.Pair=sC.Pair;H.Scalar=iC.Scalar;H.YAMLMap=oC.YAMLMap;H.YAMLSeq=aC.YAMLSeq;H.CST=lC;H.Lexer=cC.Lexer;H.LineCounter=uC.LineCounter;H.Parser=dC.Parser;H.parse=Bo.parse;H.parseAllDocuments=Bo.parseAllDocuments;H.parseDocument=Bo.parseDocument;H.stringify=Bo.stringify;H.visit=ny.visit;H.visitAsync=ny.visitAsync});function pC(t){try{return JSON.parse(t.trim()),!0}catch{return!1}}function hC(t){let e=t.trim();if(!e.startsWith("<"))return!1;let n=e.match(fC);return n?Gr(e,n[1])!==null:!1}function mC(t){let e=t.trim();if(!e.match(/^(---|#|\w+:|-)/)||"[{<".includes(e[0]))return!1;try{let n=sy.parse(e);return n!==null&&typeof n=="object"}catch{return!1}}function iy(t){return pC(t)||hC(t)||mC(t)}var sy,fC,Ju=S(()=>{mh();sy=wx(ry(),1),fC=/<([a-zA-Z_][\w.-]*)/});function gC(t){if(!t?.trim())return[];let e=t.replace(/\r\n/g,`
|
|
163
|
+
`),n=e.trim();if(iy(n))return[{text:n,startLine:1,endLine:e.split(`
|
|
164
164
|
`).length}];let r=e.split(`
|
|
165
165
|
`),s=[],i=0,o=-1,a=0,l=()=>{if(o>=i){let c=r.slice(i,o+1).join(`
|
|
166
|
-
`).trim();c&&s.push({text:c,startLine:i+1,endLine:o+1})}};for(let c=0;c<r.length;c++)r[c].trim()?(a>=2&&o>=i&&(l(),i=c),a=0,o=c):a++;return l(),s}function
|
|
166
|
+
`).trim();c&&s.push({text:c,startLine:i+1,endLine:o+1})}};for(let c=0;c<r.length;c++)r[c].trim()?(a>=2&&o>=i&&(l(),i=c),a=0,o=c):a++;return l(),s}function jo(t){return gC(t).map(e=>e.text)}var oy,ay=S(()=>{Ju();oy=`
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
`});function Bo(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var ay=S(()=>{});var gC,yC,Ju,ly=S(()=>{gC=[["\xDF","ss"],["\u1E9E","Ss"],["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xC0","A"],["\xC1","A"],["\xC2","A"],["\xC3","A"],["\xC4","Ae"],["\xC5","A"],["\xC6","AE"],["\xC7","C"],["\xC8","E"],["\xC9","E"],["\xCA","E"],["\xCB","E"],["\u018F","A"],["\xCC","I"],["\xCD","I"],["\xCE","I"],["\xCF","I"],["\xD0","D"],["\xD1","N"],["\xD2","O"],["\xD3","O"],["\xD4","O"],["\xD5","O"],["\xD6","Oe"],["\u014C","O"],["\u0150","O"],["\xD8","O"],["\u0152","OE"],["\xD9","U"],["\xDA","U"],["\xDB","U"],["\xDC","Ue"],["\u0170","U"],["\xDD","Y"],["\xDE","TH"],["\xDF","ss"],["\xE0","a"],["\xE1","a"],["\xE2","a"],["\xE3","a"],["\xE4","ae"],["\xE5","a"],["\xE6","ae"],["\xE7","c"],["\xE8","e"],["\xE9","e"],["\xEA","e"],["\xEB","e"],["\u0259","a"],["\xEC","i"],["\xED","i"],["\xEE","i"],["\xEF","i"],["\xF0","d"],["\xF1","n"],["\xF2","o"],["\xF3","o"],["\xF4","o"],["\xF5","o"],["\xF6","oe"],["\u014D","o"],["\u0151","o"],["\xF8","o"],["\u0153","oe"],["\xF9","u"],["\xFA","u"],["\xFB","u"],["\xFC","ue"],["\u0171","u"],["\xFD","y"],["\xFE","th"],["\xFF","y"],["\xE0","a"],["\xC0","A"],["\xE1","a"],["\xC1","A"],["\xE2","a"],["\xC2","A"],["\xE3","a"],["\xC3","A"],["\xE8","e"],["\xC8","E"],["\xE9","e"],["\xC9","E"],["\xEA","e"],["\xCA","E"],["\xEC","i"],["\xCC","I"],["\xED","i"],["\xCD","I"],["\xF2","o"],["\xD2","O"],["\xF3","o"],["\xD3","O"],["\xF4","o"],["\xD4","O"],["\xF5","o"],["\xD5","O"],["\xF9","u"],["\xD9","U"],["\xFA","u"],["\xDA","U"],["\xFD","y"],["\xDD","Y"],["\u0103","a"],["\u0102","A"],["\u0110","D"],["\u0111","d"],["\u0129","i"],["\u0128","I"],["\u0169","u"],["\u0168","U"],["\u01A1","o"],["\u01A0","O"],["\u01B0","u"],["\u01AF","U"],["\u1EA1","a"],["\u1EA0","A"],["\u1EA3","a"],["\u1EA2","A"],["\u1EA5","a"],["\u1EA4","A"],["\u1EA7","a"],["\u1EA6","A"],["\u1EA9","a"],["\u1EA8","A"],["\u1EAB","a"],["\u1EAA","A"],["\u1EAD","a"],["\u1EAC","A"],["\u1EAF","a"],["\u1EAE","A"],["\u1EB1","a"],["\u1EB0","A"],["\u1EB3","a"],["\u1EB2","A"],["\u1EB5","a"],["\u1EB4","A"],["\u1EB7","a"],["\u1EB6","A"],["\u1EB9","e"],["\u1EB8","E"],["\u1EBB","e"],["\u1EBA","E"],["\u1EBD","e"],["\u1EBC","E"],["\u1EBF","e"],["\u1EBE","E"],["\u1EC1","e"],["\u1EC0","E"],["\u1EC3","e"],["\u1EC2","E"],["\u1EC5","e"],["\u1EC4","E"],["\u1EC7","e"],["\u1EC6","E"],["\u1EC9","i"],["\u1EC8","I"],["\u1ECB","i"],["\u1ECA","I"],["\u1ECD","o"],["\u1ECC","O"],["\u1ECF","o"],["\u1ECE","O"],["\u1ED1","o"],["\u1ED0","O"],["\u1ED3","o"],["\u1ED2","O"],["\u1ED5","o"],["\u1ED4","O"],["\u1ED7","o"],["\u1ED6","O"],["\u1ED9","o"],["\u1ED8","O"],["\u1EDB","o"],["\u1EDA","O"],["\u1EDD","o"],["\u1EDC","O"],["\u1EDF","o"],["\u1EDE","O"],["\u1EE1","o"],["\u1EE0","O"],["\u1EE3","o"],["\u1EE2","O"],["\u1EE5","u"],["\u1EE4","U"],["\u1EE7","u"],["\u1EE6","U"],["\u1EE9","u"],["\u1EE8","U"],["\u1EEB","u"],["\u1EEA","U"],["\u1EED","u"],["\u1EEC","U"],["\u1EEF","u"],["\u1EEE","U"],["\u1EF1","u"],["\u1EF0","U"],["\u1EF3","y"],["\u1EF2","Y"],["\u1EF5","y"],["\u1EF4","Y"],["\u1EF7","y"],["\u1EF6","Y"],["\u1EF9","y"],["\u1EF8","Y"],["\u0621","e"],["\u0622","a"],["\u0623","a"],["\u0624","w"],["\u0625","a"],["\u0626","y"],["\u0627","a"],["\u0628","b"],["\u0629","t"],["\u062A","t"],["\u062B","th"],["\u062C","j"],["\u062D","h"],["\u062E","kh"],["\u062F","d"],["\u0630","dh"],["\u0631","r"],["\u0632","z"],["\u0633","s"],["\u0634","sh"],["\u0635","s"],["\u0636","d"],["\u0637","t"],["\u0638","z"],["\u0639","e"],["\u063A","gh"],["\u0640","_"],["\u0641","f"],["\u0642","q"],["\u0643","k"],["\u0644","l"],["\u0645","m"],["\u0646","n"],["\u0647","h"],["\u0648","w"],["\u0649","a"],["\u064A","y"],["\u064E\u200E","a"],["\u064F","u"],["\u0650\u200E","i"],["\u0660","0"],["\u0661","1"],["\u0662","2"],["\u0663","3"],["\u0664","4"],["\u0665","5"],["\u0666","6"],["\u0667","7"],["\u0668","8"],["\u0669","9"],["\u0686","ch"],["\u06A9","k"],["\u06AF","g"],["\u067E","p"],["\u0698","zh"],["\u06CC","y"],["\u06F0","0"],["\u06F1","1"],["\u06F2","2"],["\u06F3","3"],["\u06F4","4"],["\u06F5","5"],["\u06F6","6"],["\u06F7","7"],["\u06F8","8"],["\u06F9","9"],["\u067C","p"],["\u0681","z"],["\u0685","c"],["\u0689","d"],["\uFEAB","d"],["\uFEAD","r"],["\u0693","r"],["\uFEAF","z"],["\u0696","g"],["\u069A","x"],["\u06AB","g"],["\u06BC","n"],["\u06C0","e"],["\u06D0","e"],["\u06CD","ai"],["\u0679","t"],["\u0688","d"],["\u0691","r"],["\u06BA","n"],["\u06C1","h"],["\u06BE","h"],["\u06D2","e"],["\u0410","A"],["\u0430","a"],["\u0411","B"],["\u0431","b"],["\u0412","V"],["\u0432","v"],["\u0413","G"],["\u0433","g"],["\u0414","D"],["\u0434","d"],["\u044A\u0435","ye"],["\u042A\u0435","Ye"],["\u044A\u0415","yE"],["\u042A\u0415","YE"],["\u0415","E"],["\u0435","e"],["\u0401","Yo"],["\u0451","yo"],["\u0416","Zh"],["\u0436","zh"],["\u0417","Z"],["\u0437","z"],["\u0418","I"],["\u0438","i"],["\u044B\u0439","iy"],["\u042B\u0439","Iy"],["\u042B\u0419","IY"],["\u044B\u0419","iY"],["\u0419","Y"],["\u0439","y"],["\u041A","K"],["\u043A","k"],["\u041B","L"],["\u043B","l"],["\u041C","M"],["\u043C","m"],["\u041D","N"],["\u043D","n"],["\u041E","O"],["\u043E","o"],["\u041F","P"],["\u043F","p"],["\u0420","R"],["\u0440","r"],["\u0421","S"],["\u0441","s"],["\u0422","T"],["\u0442","t"],["\u0423","U"],["\u0443","u"],["\u0424","F"],["\u0444","f"],["\u0425","Kh"],["\u0445","kh"],["\u0426","Ts"],["\u0446","ts"],["\u0427","Ch"],["\u0447","ch"],["\u0428","Sh"],["\u0448","sh"],["\u0429","Sch"],["\u0449","sch"],["\u042A",""],["\u044A",""],["\u042B","Y"],["\u044B","y"],["\u042C",""],["\u044C",""],["\u042D","E"],["\u044D","e"],["\u042E","Yu"],["\u044E","yu"],["\u042F","Ya"],["\u044F","ya"],["\u0103","a"],["\u0102","A"],["\u0219","s"],["\u0218","S"],["\u021B","t"],["\u021A","T"],["\u0163","t"],["\u0162","T"],["\u015F","s"],["\u015E","S"],["\xE7","c"],["\xC7","C"],["\u011F","g"],["\u011E","G"],["\u0131","i"],["\u0130","I"],["\u0561","a"],["\u0531","A"],["\u0562","b"],["\u0532","B"],["\u0563","g"],["\u0533","G"],["\u0564","d"],["\u0534","D"],["\u0565","ye"],["\u0535","Ye"],["\u0566","z"],["\u0536","Z"],["\u0567","e"],["\u0537","E"],["\u0568","y"],["\u0538","Y"],["\u0569","t"],["\u0539","T"],["\u056A","zh"],["\u053A","Zh"],["\u056B","i"],["\u053B","I"],["\u056C","l"],["\u053C","L"],["\u056D","kh"],["\u053D","Kh"],["\u056E","ts"],["\u053E","Ts"],["\u056F","k"],["\u053F","K"],["\u0570","h"],["\u0540","H"],["\u0571","dz"],["\u0541","Dz"],["\u0572","gh"],["\u0542","Gh"],["\u0573","tch"],["\u0543","Tch"],["\u0574","m"],["\u0544","M"],["\u0575","y"],["\u0545","Y"],["\u0576","n"],["\u0546","N"],["\u0577","sh"],["\u0547","Sh"],["\u0578\u0582","u"],["\u0548\u0552","U"],["\u0548\u0582","U"],["\u0578","vo"],["\u0548","Vo"],["\u0579","ch"],["\u0549","Ch"],["\u057A","p"],["\u054A","P"],["\u057B","j"],["\u054B","J"],["\u057C","r"],["\u054C","R"],["\u057D","s"],["\u054D","S"],["\u057E","v"],["\u054E","V"],["\u057F","t"],["\u054F","T"],["\u0580","r"],["\u0550","R"],["\u0581","c"],["\u0551","C"],["\u0583","p"],["\u0553","P"],["\u0584","q"],["\u0554","Q"],["\u0585","o"],["\u0555","O"],["\u0586","f"],["\u0556","F"],["\u0587","yev"],["\u10D0","a"],["\u10D1","b"],["\u10D2","g"],["\u10D3","d"],["\u10D4","e"],["\u10D5","v"],["\u10D6","z"],["\u10D7","t"],["\u10D8","i"],["\u10D9","k"],["\u10DA","l"],["\u10DB","m"],["\u10DC","n"],["\u10DD","o"],["\u10DE","p"],["\u10DF","zh"],["\u10E0","r"],["\u10E1","s"],["\u10E2","t"],["\u10E3","u"],["\u10E4","ph"],["\u10E5","q"],["\u10E6","gh"],["\u10E7","k"],["\u10E8","sh"],["\u10E9","ch"],["\u10EA","ts"],["\u10EB","dz"],["\u10EC","ts"],["\u10ED","tch"],["\u10EE","kh"],["\u10EF","j"],["\u10F0","h"],["\u010D","c"],["\u010F","d"],["\u011B","e"],["\u0148","n"],["\u0159","r"],["\u0161","s"],["\u0165","t"],["\u016F","u"],["\u017E","z"],["\u010C","C"],["\u010E","D"],["\u011A","E"],["\u0147","N"],["\u0158","R"],["\u0160","S"],["\u0164","T"],["\u016E","U"],["\u017D","Z"],["\u0780","h"],["\u0781","sh"],["\u0782","n"],["\u0783","r"],["\u0784","b"],["\u0785","lh"],["\u0786","k"],["\u0787","a"],["\u0788","v"],["\u0789","m"],["\u078A","f"],["\u078B","dh"],["\u078C","th"],["\u078D","l"],["\u078E","g"],["\u078F","gn"],["\u0790","s"],["\u0791","d"],["\u0792","z"],["\u0793","t"],["\u0794","y"],["\u0795","p"],["\u0796","j"],["\u0797","ch"],["\u0798","tt"],["\u0799","hh"],["\u079A","kh"],["\u079B","th"],["\u079C","z"],["\u079D","sh"],["\u079E","s"],["\u079F","d"],["\u07A0","t"],["\u07A1","z"],["\u07A2","a"],["\u07A3","gh"],["\u07A4","q"],["\u07A5","w"],["\u07A6","a"],["\u07A7","aa"],["\u07A8","i"],["\u07A9","ee"],["\u07AA","u"],["\u07AB","oo"],["\u07AC","e"],["\u07AD","ey"],["\u07AE","o"],["\u07AF","oa"],["\u07B0",""],["\u03B1","a"],["\u03B2","v"],["\u03B3","g"],["\u03B4","d"],["\u03B5","e"],["\u03B6","z"],["\u03B7","i"],["\u03B8","th"],["\u03B9","i"],["\u03BA","k"],["\u03BB","l"],["\u03BC","m"],["\u03BD","n"],["\u03BE","ks"],["\u03BF","o"],["\u03C0","p"],["\u03C1","r"],["\u03C3","s"],["\u03C4","t"],["\u03C5","y"],["\u03C6","f"],["\u03C7","x"],["\u03C8","ps"],["\u03C9","o"],["\u03AC","a"],["\u03AD","e"],["\u03AF","i"],["\u03CC","o"],["\u03CD","y"],["\u03AE","i"],["\u03CE","o"],["\u03C2","s"],["\u03CA","i"],["\u03B0","y"],["\u03CB","y"],["\u0390","i"],["\u0391","A"],["\u0392","B"],["\u0393","G"],["\u0394","D"],["\u0395","E"],["\u0396","Z"],["\u0397","I"],["\u0398","TH"],["\u0399","I"],["\u039A","K"],["\u039B","L"],["\u039C","M"],["\u039D","N"],["\u039E","KS"],["\u039F","O"],["\u03A0","P"],["\u03A1","R"],["\u03A3","S"],["\u03A4","T"],["\u03A5","Y"],["\u03A6","F"],["\u03A7","X"],["\u03A8","PS"],["\u03A9","O"],["\u0386","A"],["\u0388","E"],["\u038A","I"],["\u038C","O"],["\u038E","Y"],["\u0389","I"],["\u038F","O"],["\u03AA","I"],["\u03AB","Y"],["\u0101","a"],["\u0113","e"],["\u0123","g"],["\u012B","i"],["\u0137","k"],["\u013C","l"],["\u0146","n"],["\u016B","u"],["\u0100","A"],["\u0112","E"],["\u0122","G"],["\u012A","I"],["\u0136","K"],["\u013B","L"],["\u0145","N"],["\u016A","U"],["\u010D","c"],["\u0161","s"],["\u017E","z"],["\u010C","C"],["\u0160","S"],["\u017D","Z"],["\u0105","a"],["\u010D","c"],["\u0119","e"],["\u0117","e"],["\u012F","i"],["\u0161","s"],["\u0173","u"],["\u016B","u"],["\u017E","z"],["\u0104","A"],["\u010C","C"],["\u0118","E"],["\u0116","E"],["\u012E","I"],["\u0160","S"],["\u0172","U"],["\u016A","U"],["\u040C","Kj"],["\u045C","kj"],["\u0409","Lj"],["\u0459","lj"],["\u040A","Nj"],["\u045A","nj"],["\u0422\u0441","Ts"],["\u0442\u0441","ts"],["\u0105","a"],["\u0107","c"],["\u0119","e"],["\u0142","l"],["\u0144","n"],["\u015B","s"],["\u017A","z"],["\u017C","z"],["\u0104","A"],["\u0106","C"],["\u0118","E"],["\u0141","L"],["\u0143","N"],["\u015A","S"],["\u0179","Z"],["\u017B","Z"],["\u0404","Ye"],["\u0406","I"],["\u0407","Yi"],["\u0490","G"],["\u0454","ye"],["\u0456","i"],["\u0457","yi"],["\u0491","g"],["\u0132","IJ"],["\u0133","ij"],["\xA2","c"],["\xA5","Y"],["\u07FF","b"],["\u09F3","t"],["\u0AF1","Bo"],["\u0E3F","B"],["\u20A0","CE"],["\u20A1","C"],["\u20A2","Cr"],["\u20A3","F"],["\u20A5","m"],["\u20A6","N"],["\u20A7","Pt"],["\u20A8","Rs"],["\u20A9","W"],["\u20AB","s"],["\u20AC","E"],["\u20AD","K"],["\u20AE","T"],["\u20AF","Dp"],["\u20B0","S"],["\u20B1","P"],["\u20B2","G"],["\u20B3","A"],["\u20B4","S"],["\u20B5","C"],["\u20B6","tt"],["\u20B7","S"],["\u20B8","T"],["\u20B9","R"],["\u20BA","L"],["\u20BD","P"],["\u20BF","B"],["\uFE69","$"],["\uFFE0","c"],["\uFFE5","Y"],["\uFFE6","W"],["\u{1D400}","A"],["\u{1D401}","B"],["\u{1D402}","C"],["\u{1D403}","D"],["\u{1D404}","E"],["\u{1D405}","F"],["\u{1D406}","G"],["\u{1D407}","H"],["\u{1D408}","I"],["\u{1D409}","J"],["\u{1D40A}","K"],["\u{1D40B}","L"],["\u{1D40C}","M"],["\u{1D40D}","N"],["\u{1D40E}","O"],["\u{1D40F}","P"],["\u{1D410}","Q"],["\u{1D411}","R"],["\u{1D412}","S"],["\u{1D413}","T"],["\u{1D414}","U"],["\u{1D415}","V"],["\u{1D416}","W"],["\u{1D417}","X"],["\u{1D418}","Y"],["\u{1D419}","Z"],["\u{1D41A}","a"],["\u{1D41B}","b"],["\u{1D41C}","c"],["\u{1D41D}","d"],["\u{1D41E}","e"],["\u{1D41F}","f"],["\u{1D420}","g"],["\u{1D421}","h"],["\u{1D422}","i"],["\u{1D423}","j"],["\u{1D424}","k"],["\u{1D425}","l"],["\u{1D426}","m"],["\u{1D427}","n"],["\u{1D428}","o"],["\u{1D429}","p"],["\u{1D42A}","q"],["\u{1D42B}","r"],["\u{1D42C}","s"],["\u{1D42D}","t"],["\u{1D42E}","u"],["\u{1D42F}","v"],["\u{1D430}","w"],["\u{1D431}","x"],["\u{1D432}","y"],["\u{1D433}","z"],["\u{1D434}","A"],["\u{1D435}","B"],["\u{1D436}","C"],["\u{1D437}","D"],["\u{1D438}","E"],["\u{1D439}","F"],["\u{1D43A}","G"],["\u{1D43B}","H"],["\u{1D43C}","I"],["\u{1D43D}","J"],["\u{1D43E}","K"],["\u{1D43F}","L"],["\u{1D440}","M"],["\u{1D441}","N"],["\u{1D442}","O"],["\u{1D443}","P"],["\u{1D444}","Q"],["\u{1D445}","R"],["\u{1D446}","S"],["\u{1D447}","T"],["\u{1D448}","U"],["\u{1D449}","V"],["\u{1D44A}","W"],["\u{1D44B}","X"],["\u{1D44C}","Y"],["\u{1D44D}","Z"],["\u{1D44E}","a"],["\u{1D44F}","b"],["\u{1D450}","c"],["\u{1D451}","d"],["\u{1D452}","e"],["\u{1D453}","f"],["\u{1D454}","g"],["\u{1D456}","i"],["\u{1D457}","j"],["\u{1D458}","k"],["\u{1D459}","l"],["\u{1D45A}","m"],["\u{1D45B}","n"],["\u{1D45C}","o"],["\u{1D45D}","p"],["\u{1D45E}","q"],["\u{1D45F}","r"],["\u{1D460}","s"],["\u{1D461}","t"],["\u{1D462}","u"],["\u{1D463}","v"],["\u{1D464}","w"],["\u{1D465}","x"],["\u{1D466}","y"],["\u{1D467}","z"],["\u{1D468}","A"],["\u{1D469}","B"],["\u{1D46A}","C"],["\u{1D46B}","D"],["\u{1D46C}","E"],["\u{1D46D}","F"],["\u{1D46E}","G"],["\u{1D46F}","H"],["\u{1D470}","I"],["\u{1D471}","J"],["\u{1D472}","K"],["\u{1D473}","L"],["\u{1D474}","M"],["\u{1D475}","N"],["\u{1D476}","O"],["\u{1D477}","P"],["\u{1D478}","Q"],["\u{1D479}","R"],["\u{1D47A}","S"],["\u{1D47B}","T"],["\u{1D47C}","U"],["\u{1D47D}","V"],["\u{1D47E}","W"],["\u{1D47F}","X"],["\u{1D480}","Y"],["\u{1D481}","Z"],["\u{1D482}","a"],["\u{1D483}","b"],["\u{1D484}","c"],["\u{1D485}","d"],["\u{1D486}","e"],["\u{1D487}","f"],["\u{1D488}","g"],["\u{1D489}","h"],["\u{1D48A}","i"],["\u{1D48B}","j"],["\u{1D48C}","k"],["\u{1D48D}","l"],["\u{1D48E}","m"],["\u{1D48F}","n"],["\u{1D490}","o"],["\u{1D491}","p"],["\u{1D492}","q"],["\u{1D493}","r"],["\u{1D494}","s"],["\u{1D495}","t"],["\u{1D496}","u"],["\u{1D497}","v"],["\u{1D498}","w"],["\u{1D499}","x"],["\u{1D49A}","y"],["\u{1D49B}","z"],["\u{1D49C}","A"],["\u{1D49E}","C"],["\u{1D49F}","D"],["\u{1D4A2}","g"],["\u{1D4A5}","J"],["\u{1D4A6}","K"],["\u{1D4A9}","N"],["\u{1D4AA}","O"],["\u{1D4AB}","P"],["\u{1D4AC}","Q"],["\u{1D4AE}","S"],["\u{1D4AF}","T"],["\u{1D4B0}","U"],["\u{1D4B1}","V"],["\u{1D4B2}","W"],["\u{1D4B3}","X"],["\u{1D4B4}","Y"],["\u{1D4B5}","Z"],["\u{1D4B6}","a"],["\u{1D4B7}","b"],["\u{1D4B8}","c"],["\u{1D4B9}","d"],["\u{1D4BB}","f"],["\u{1D4BD}","h"],["\u{1D4BE}","i"],["\u{1D4BF}","j"],["\u{1D4C0}","k"],["\u{1D4C1}","l"],["\u{1D4C2}","m"],["\u{1D4C3}","n"],["\u{1D4C5}","p"],["\u{1D4C6}","q"],["\u{1D4C7}","r"],["\u{1D4C8}","s"],["\u{1D4C9}","t"],["\u{1D4CA}","u"],["\u{1D4CB}","v"],["\u{1D4CC}","w"],["\u{1D4CD}","x"],["\u{1D4CE}","y"],["\u{1D4CF}","z"],["\u{1D4D0}","A"],["\u{1D4D1}","B"],["\u{1D4D2}","C"],["\u{1D4D3}","D"],["\u{1D4D4}","E"],["\u{1D4D5}","F"],["\u{1D4D6}","G"],["\u{1D4D7}","H"],["\u{1D4D8}","I"],["\u{1D4D9}","J"],["\u{1D4DA}","K"],["\u{1D4DB}","L"],["\u{1D4DC}","M"],["\u{1D4DD}","N"],["\u{1D4DE}","O"],["\u{1D4DF}","P"],["\u{1D4E0}","Q"],["\u{1D4E1}","R"],["\u{1D4E2}","S"],["\u{1D4E3}","T"],["\u{1D4E4}","U"],["\u{1D4E5}","V"],["\u{1D4E6}","W"],["\u{1D4E7}","X"],["\u{1D4E8}","Y"],["\u{1D4E9}","Z"],["\u{1D4EA}","a"],["\u{1D4EB}","b"],["\u{1D4EC}","c"],["\u{1D4ED}","d"],["\u{1D4EE}","e"],["\u{1D4EF}","f"],["\u{1D4F0}","g"],["\u{1D4F1}","h"],["\u{1D4F2}","i"],["\u{1D4F3}","j"],["\u{1D4F4}","k"],["\u{1D4F5}","l"],["\u{1D4F6}","m"],["\u{1D4F7}","n"],["\u{1D4F8}","o"],["\u{1D4F9}","p"],["\u{1D4FA}","q"],["\u{1D4FB}","r"],["\u{1D4FC}","s"],["\u{1D4FD}","t"],["\u{1D4FE}","u"],["\u{1D4FF}","v"],["\u{1D500}","w"],["\u{1D501}","x"],["\u{1D502}","y"],["\u{1D503}","z"],["\u{1D504}","A"],["\u{1D505}","B"],["\u{1D507}","D"],["\u{1D508}","E"],["\u{1D509}","F"],["\u{1D50A}","G"],["\u{1D50D}","J"],["\u{1D50E}","K"],["\u{1D50F}","L"],["\u{1D510}","M"],["\u{1D511}","N"],["\u{1D512}","O"],["\u{1D513}","P"],["\u{1D514}","Q"],["\u{1D516}","S"],["\u{1D517}","T"],["\u{1D518}","U"],["\u{1D519}","V"],["\u{1D51A}","W"],["\u{1D51B}","X"],["\u{1D51C}","Y"],["\u{1D51E}","a"],["\u{1D51F}","b"],["\u{1D520}","c"],["\u{1D521}","d"],["\u{1D522}","e"],["\u{1D523}","f"],["\u{1D524}","g"],["\u{1D525}","h"],["\u{1D526}","i"],["\u{1D527}","j"],["\u{1D528}","k"],["\u{1D529}","l"],["\u{1D52A}","m"],["\u{1D52B}","n"],["\u{1D52C}","o"],["\u{1D52D}","p"],["\u{1D52E}","q"],["\u{1D52F}","r"],["\u{1D530}","s"],["\u{1D531}","t"],["\u{1D532}","u"],["\u{1D533}","v"],["\u{1D534}","w"],["\u{1D535}","x"],["\u{1D536}","y"],["\u{1D537}","z"],["\u{1D538}","A"],["\u{1D539}","B"],["\u{1D53B}","D"],["\u{1D53C}","E"],["\u{1D53D}","F"],["\u{1D53E}","G"],["\u{1D540}","I"],["\u{1D541}","J"],["\u{1D542}","K"],["\u{1D543}","L"],["\u{1D544}","M"],["\u{1D546}","O"],["\u{1D54A}","S"],["\u{1D54B}","T"],["\u{1D54C}","U"],["\u{1D54D}","V"],["\u{1D54E}","W"],["\u{1D54F}","X"],["\u{1D550}","Y"],["\u{1D552}","a"],["\u{1D553}","b"],["\u{1D554}","c"],["\u{1D555}","d"],["\u{1D556}","e"],["\u{1D557}","f"],["\u{1D558}","g"],["\u{1D559}","h"],["\u{1D55A}","i"],["\u{1D55B}","j"],["\u{1D55C}","k"],["\u{1D55D}","l"],["\u{1D55E}","m"],["\u{1D55F}","n"],["\u{1D560}","o"],["\u{1D561}","p"],["\u{1D562}","q"],["\u{1D563}","r"],["\u{1D564}","s"],["\u{1D565}","t"],["\u{1D566}","u"],["\u{1D567}","v"],["\u{1D568}","w"],["\u{1D569}","x"],["\u{1D56A}","y"],["\u{1D56B}","z"],["\u{1D56C}","A"],["\u{1D56D}","B"],["\u{1D56E}","C"],["\u{1D56F}","D"],["\u{1D570}","E"],["\u{1D571}","F"],["\u{1D572}","G"],["\u{1D573}","H"],["\u{1D574}","I"],["\u{1D575}","J"],["\u{1D576}","K"],["\u{1D577}","L"],["\u{1D578}","M"],["\u{1D579}","N"],["\u{1D57A}","O"],["\u{1D57B}","P"],["\u{1D57C}","Q"],["\u{1D57D}","R"],["\u{1D57E}","S"],["\u{1D57F}","T"],["\u{1D580}","U"],["\u{1D581}","V"],["\u{1D582}","W"],["\u{1D583}","X"],["\u{1D584}","Y"],["\u{1D585}","Z"],["\u{1D586}","a"],["\u{1D587}","b"],["\u{1D588}","c"],["\u{1D589}","d"],["\u{1D58A}","e"],["\u{1D58B}","f"],["\u{1D58C}","g"],["\u{1D58D}","h"],["\u{1D58E}","i"],["\u{1D58F}","j"],["\u{1D590}","k"],["\u{1D591}","l"],["\u{1D592}","m"],["\u{1D593}","n"],["\u{1D594}","o"],["\u{1D595}","p"],["\u{1D596}","q"],["\u{1D597}","r"],["\u{1D598}","s"],["\u{1D599}","t"],["\u{1D59A}","u"],["\u{1D59B}","v"],["\u{1D59C}","w"],["\u{1D59D}","x"],["\u{1D59E}","y"],["\u{1D59F}","z"],["\u{1D5A0}","A"],["\u{1D5A1}","B"],["\u{1D5A2}","C"],["\u{1D5A3}","D"],["\u{1D5A4}","E"],["\u{1D5A5}","F"],["\u{1D5A6}","G"],["\u{1D5A7}","H"],["\u{1D5A8}","I"],["\u{1D5A9}","J"],["\u{1D5AA}","K"],["\u{1D5AB}","L"],["\u{1D5AC}","M"],["\u{1D5AD}","N"],["\u{1D5AE}","O"],["\u{1D5AF}","P"],["\u{1D5B0}","Q"],["\u{1D5B1}","R"],["\u{1D5B2}","S"],["\u{1D5B3}","T"],["\u{1D5B4}","U"],["\u{1D5B5}","V"],["\u{1D5B6}","W"],["\u{1D5B7}","X"],["\u{1D5B8}","Y"],["\u{1D5B9}","Z"],["\u{1D5BA}","a"],["\u{1D5BB}","b"],["\u{1D5BC}","c"],["\u{1D5BD}","d"],["\u{1D5BE}","e"],["\u{1D5BF}","f"],["\u{1D5C0}","g"],["\u{1D5C1}","h"],["\u{1D5C2}","i"],["\u{1D5C3}","j"],["\u{1D5C4}","k"],["\u{1D5C5}","l"],["\u{1D5C6}","m"],["\u{1D5C7}","n"],["\u{1D5C8}","o"],["\u{1D5C9}","p"],["\u{1D5CA}","q"],["\u{1D5CB}","r"],["\u{1D5CC}","s"],["\u{1D5CD}","t"],["\u{1D5CE}","u"],["\u{1D5CF}","v"],["\u{1D5D0}","w"],["\u{1D5D1}","x"],["\u{1D5D2}","y"],["\u{1D5D3}","z"],["\u{1D5D4}","A"],["\u{1D5D5}","B"],["\u{1D5D6}","C"],["\u{1D5D7}","D"],["\u{1D5D8}","E"],["\u{1D5D9}","F"],["\u{1D5DA}","G"],["\u{1D5DB}","H"],["\u{1D5DC}","I"],["\u{1D5DD}","J"],["\u{1D5DE}","K"],["\u{1D5DF}","L"],["\u{1D5E0}","M"],["\u{1D5E1}","N"],["\u{1D5E2}","O"],["\u{1D5E3}","P"],["\u{1D5E4}","Q"],["\u{1D5E5}","R"],["\u{1D5E6}","S"],["\u{1D5E7}","T"],["\u{1D5E8}","U"],["\u{1D5E9}","V"],["\u{1D5EA}","W"],["\u{1D5EB}","X"],["\u{1D5EC}","Y"],["\u{1D5ED}","Z"],["\u{1D5EE}","a"],["\u{1D5EF}","b"],["\u{1D5F0}","c"],["\u{1D5F1}","d"],["\u{1D5F2}","e"],["\u{1D5F3}","f"],["\u{1D5F4}","g"],["\u{1D5F5}","h"],["\u{1D5F6}","i"],["\u{1D5F7}","j"],["\u{1D5F8}","k"],["\u{1D5F9}","l"],["\u{1D5FA}","m"],["\u{1D5FB}","n"],["\u{1D5FC}","o"],["\u{1D5FD}","p"],["\u{1D5FE}","q"],["\u{1D5FF}","r"],["\u{1D600}","s"],["\u{1D601}","t"],["\u{1D602}","u"],["\u{1D603}","v"],["\u{1D604}","w"],["\u{1D605}","x"],["\u{1D606}","y"],["\u{1D607}","z"],["\u{1D608}","A"],["\u{1D609}","B"],["\u{1D60A}","C"],["\u{1D60B}","D"],["\u{1D60C}","E"],["\u{1D60D}","F"],["\u{1D60E}","G"],["\u{1D60F}","H"],["\u{1D610}","I"],["\u{1D611}","J"],["\u{1D612}","K"],["\u{1D613}","L"],["\u{1D614}","M"],["\u{1D615}","N"],["\u{1D616}","O"],["\u{1D617}","P"],["\u{1D618}","Q"],["\u{1D619}","R"],["\u{1D61A}","S"],["\u{1D61B}","T"],["\u{1D61C}","U"],["\u{1D61D}","V"],["\u{1D61E}","W"],["\u{1D61F}","X"],["\u{1D620}","Y"],["\u{1D621}","Z"],["\u{1D622}","a"],["\u{1D623}","b"],["\u{1D624}","c"],["\u{1D625}","d"],["\u{1D626}","e"],["\u{1D627}","f"],["\u{1D628}","g"],["\u{1D629}","h"],["\u{1D62A}","i"],["\u{1D62B}","j"],["\u{1D62C}","k"],["\u{1D62D}","l"],["\u{1D62E}","m"],["\u{1D62F}","n"],["\u{1D630}","o"],["\u{1D631}","p"],["\u{1D632}","q"],["\u{1D633}","r"],["\u{1D634}","s"],["\u{1D635}","t"],["\u{1D636}","u"],["\u{1D637}","v"],["\u{1D638}","w"],["\u{1D639}","x"],["\u{1D63A}","y"],["\u{1D63B}","z"],["\u{1D63C}","A"],["\u{1D63D}","B"],["\u{1D63E}","C"],["\u{1D63F}","D"],["\u{1D640}","E"],["\u{1D641}","F"],["\u{1D642}","G"],["\u{1D643}","H"],["\u{1D644}","I"],["\u{1D645}","J"],["\u{1D646}","K"],["\u{1D647}","L"],["\u{1D648}","M"],["\u{1D649}","N"],["\u{1D64A}","O"],["\u{1D64B}","P"],["\u{1D64C}","Q"],["\u{1D64D}","R"],["\u{1D64E}","S"],["\u{1D64F}","T"],["\u{1D650}","U"],["\u{1D651}","V"],["\u{1D652}","W"],["\u{1D653}","X"],["\u{1D654}","Y"],["\u{1D655}","Z"],["\u{1D656}","a"],["\u{1D657}","b"],["\u{1D658}","c"],["\u{1D659}","d"],["\u{1D65A}","e"],["\u{1D65B}","f"],["\u{1D65C}","g"],["\u{1D65D}","h"],["\u{1D65E}","i"],["\u{1D65F}","j"],["\u{1D660}","k"],["\u{1D661}","l"],["\u{1D662}","m"],["\u{1D663}","n"],["\u{1D664}","o"],["\u{1D665}","p"],["\u{1D666}","q"],["\u{1D667}","r"],["\u{1D668}","s"],["\u{1D669}","t"],["\u{1D66A}","u"],["\u{1D66B}","v"],["\u{1D66C}","w"],["\u{1D66D}","x"],["\u{1D66E}","y"],["\u{1D66F}","z"],["\u{1D670}","A"],["\u{1D671}","B"],["\u{1D672}","C"],["\u{1D673}","D"],["\u{1D674}","E"],["\u{1D675}","F"],["\u{1D676}","G"],["\u{1D677}","H"],["\u{1D678}","I"],["\u{1D679}","J"],["\u{1D67A}","K"],["\u{1D67B}","L"],["\u{1D67C}","M"],["\u{1D67D}","N"],["\u{1D67E}","O"],["\u{1D67F}","P"],["\u{1D680}","Q"],["\u{1D681}","R"],["\u{1D682}","S"],["\u{1D683}","T"],["\u{1D684}","U"],["\u{1D685}","V"],["\u{1D686}","W"],["\u{1D687}","X"],["\u{1D688}","Y"],["\u{1D689}","Z"],["\u{1D68A}","a"],["\u{1D68B}","b"],["\u{1D68C}","c"],["\u{1D68D}","d"],["\u{1D68E}","e"],["\u{1D68F}","f"],["\u{1D690}","g"],["\u{1D691}","h"],["\u{1D692}","i"],["\u{1D693}","j"],["\u{1D694}","k"],["\u{1D695}","l"],["\u{1D696}","m"],["\u{1D697}","n"],["\u{1D698}","o"],["\u{1D699}","p"],["\u{1D69A}","q"],["\u{1D69B}","r"],["\u{1D69C}","s"],["\u{1D69D}","t"],["\u{1D69E}","u"],["\u{1D69F}","v"],["\u{1D6A0}","w"],["\u{1D6A1}","x"],["\u{1D6A2}","y"],["\u{1D6A3}","z"],["\u{1D6A4}","l"],["\u{1D6A5}","j"],["\u{1D6E2}","A"],["\u{1D6E3}","B"],["\u{1D6E4}","G"],["\u{1D6E5}","D"],["\u{1D6E6}","E"],["\u{1D6E7}","Z"],["\u{1D6E8}","I"],["\u{1D6E9}","TH"],["\u{1D6EA}","I"],["\u{1D6EB}","K"],["\u{1D6EC}","L"],["\u{1D6ED}","M"],["\u{1D6EE}","N"],["\u{1D6EF}","KS"],["\u{1D6F0}","O"],["\u{1D6F1}","P"],["\u{1D6F2}","R"],["\u{1D6F3}","TH"],["\u{1D6F4}","S"],["\u{1D6F5}","T"],["\u{1D6F6}","Y"],["\u{1D6F7}","F"],["\u{1D6F8}","x"],["\u{1D6F9}","PS"],["\u{1D6FA}","O"],["\u{1D6FB}","D"],["\u{1D6FC}","a"],["\u{1D6FD}","b"],["\u{1D6FE}","g"],["\u{1D6FF}","d"],["\u{1D700}","e"],["\u{1D701}","z"],["\u{1D702}","i"],["\u{1D703}","th"],["\u{1D704}","i"],["\u{1D705}","k"],["\u{1D706}","l"],["\u{1D707}","m"],["\u{1D708}","n"],["\u{1D709}","ks"],["\u{1D70A}","o"],["\u{1D70B}","p"],["\u{1D70C}","r"],["\u{1D70D}","s"],["\u{1D70E}","s"],["\u{1D70F}","t"],["\u{1D710}","y"],["\u{1D711}","f"],["\u{1D712}","x"],["\u{1D713}","ps"],["\u{1D714}","o"],["\u{1D715}","d"],["\u{1D716}","E"],["\u{1D717}","TH"],["\u{1D718}","K"],["\u{1D719}","f"],["\u{1D71A}","r"],["\u{1D71B}","p"],["\u{1D71C}","A"],["\u{1D71D}","V"],["\u{1D71E}","G"],["\u{1D71F}","D"],["\u{1D720}","E"],["\u{1D721}","Z"],["\u{1D722}","I"],["\u{1D723}","TH"],["\u{1D724}","I"],["\u{1D725}","K"],["\u{1D726}","L"],["\u{1D727}","M"],["\u{1D728}","N"],["\u{1D729}","KS"],["\u{1D72A}","O"],["\u{1D72B}","P"],["\u{1D72C}","S"],["\u{1D72D}","TH"],["\u{1D72E}","S"],["\u{1D72F}","T"],["\u{1D730}","Y"],["\u{1D731}","F"],["\u{1D732}","X"],["\u{1D733}","PS"],["\u{1D734}","O"],["\u{1D735}","D"],["\u{1D736}","a"],["\u{1D737}","v"],["\u{1D738}","g"],["\u{1D739}","d"],["\u{1D73A}","e"],["\u{1D73B}","z"],["\u{1D73C}","i"],["\u{1D73D}","th"],["\u{1D73E}","i"],["\u{1D73F}","k"],["\u{1D740}","l"],["\u{1D741}","m"],["\u{1D742}","n"],["\u{1D743}","ks"],["\u{1D744}","o"],["\u{1D745}","p"],["\u{1D746}","r"],["\u{1D747}","s"],["\u{1D748}","s"],["\u{1D749}","t"],["\u{1D74A}","y"],["\u{1D74B}","f"],["\u{1D74C}","x"],["\u{1D74D}","ps"],["\u{1D74E}","o"],["\u{1D74F}","a"],["\u{1D750}","e"],["\u{1D751}","i"],["\u{1D752}","k"],["\u{1D753}","f"],["\u{1D754}","r"],["\u{1D755}","p"],["\u{1D756}","A"],["\u{1D757}","B"],["\u{1D758}","G"],["\u{1D759}","D"],["\u{1D75A}","E"],["\u{1D75B}","Z"],["\u{1D75C}","I"],["\u{1D75D}","TH"],["\u{1D75E}","I"],["\u{1D75F}","K"],["\u{1D760}","L"],["\u{1D761}","M"],["\u{1D762}","N"],["\u{1D763}","KS"],["\u{1D764}","O"],["\u{1D765}","P"],["\u{1D766}","R"],["\u{1D767}","TH"],["\u{1D768}","S"],["\u{1D769}","T"],["\u{1D76A}","Y"],["\u{1D76B}","F"],["\u{1D76C}","X"],["\u{1D76D}","PS"],["\u{1D76E}","O"],["\u{1D76F}","D"],["\u{1D770}","a"],["\u{1D771}","v"],["\u{1D772}","g"],["\u{1D773}","d"],["\u{1D774}","e"],["\u{1D775}","z"],["\u{1D776}","i"],["\u{1D777}","th"],["\u{1D778}","i"],["\u{1D779}","k"],["\u{1D77A}","l"],["\u{1D77B}","m"],["\u{1D77C}","n"],["\u{1D77D}","ks"],["\u{1D77E}","o"],["\u{1D77F}","p"],["\u{1D780}","r"],["\u{1D781}","s"],["\u{1D782}","s"],["\u{1D783}","t"],["\u{1D784}","y"],["\u{1D785}","f"],["\u{1D786}","x"],["\u{1D787}","ps"],["\u{1D788}","o"],["\u{1D789}","a"],["\u{1D78A}","e"],["\u{1D78B}","i"],["\u{1D78C}","k"],["\u{1D78D}","f"],["\u{1D78E}","r"],["\u{1D78F}","p"],["\u{1D790}","A"],["\u{1D791}","V"],["\u{1D792}","G"],["\u{1D793}","D"],["\u{1D794}","E"],["\u{1D795}","Z"],["\u{1D796}","I"],["\u{1D797}","TH"],["\u{1D798}","I"],["\u{1D799}","K"],["\u{1D79A}","L"],["\u{1D79B}","M"],["\u{1D79C}","N"],["\u{1D79D}","KS"],["\u{1D79E}","O"],["\u{1D79F}","P"],["\u{1D7A0}","S"],["\u{1D7A1}","TH"],["\u{1D7A2}","S"],["\u{1D7A3}","T"],["\u{1D7A4}","Y"],["\u{1D7A5}","F"],["\u{1D7A6}","X"],["\u{1D7A7}","PS"],["\u{1D7A8}","O"],["\u{1D7A9}","D"],["\u{1D7AA}","av"],["\u{1D7AB}","g"],["\u{1D7AC}","d"],["\u{1D7AD}","e"],["\u{1D7AE}","z"],["\u{1D7AF}","i"],["\u{1D7B0}","i"],["\u{1D7B1}","th"],["\u{1D7B2}","i"],["\u{1D7B3}","k"],["\u{1D7B4}","l"],["\u{1D7B5}","m"],["\u{1D7B6}","n"],["\u{1D7B7}","ks"],["\u{1D7B8}","o"],["\u{1D7B9}","p"],["\u{1D7BA}","r"],["\u{1D7BB}","s"],["\u{1D7BC}","s"],["\u{1D7BD}","t"],["\u{1D7BE}","y"],["\u{1D7BF}","f"],["\u{1D7C0}","x"],["\u{1D7C1}","ps"],["\u{1D7C2}","o"],["\u{1D7C3}","a"],["\u{1D7C4}","e"],["\u{1D7C5}","i"],["\u{1D7C6}","k"],["\u{1D7C7}","f"],["\u{1D7C8}","r"],["\u{1D7C9}","p"],["\u{1D7CA}","F"],["\u{1D7CB}","f"],["\u249C","(a)"],["\u249D","(b)"],["\u249E","(c)"],["\u249F","(d)"],["\u24A0","(e)"],["\u24A1","(f)"],["\u24A2","(g)"],["\u24A3","(h)"],["\u24A4","(i)"],["\u24A5","(j)"],["\u24A6","(k)"],["\u24A7","(l)"],["\u24A8","(m)"],["\u24A9","(n)"],["\u24AA","(o)"],["\u24AB","(p)"],["\u24AC","(q)"],["\u24AD","(r)"],["\u24AE","(s)"],["\u24AF","(t)"],["\u24B0","(u)"],["\u24B1","(v)"],["\u24B2","(w)"],["\u24B3","(x)"],["\u24B4","(y)"],["\u24B5","(z)"],["\u24B6","(A)"],["\u24B7","(B)"],["\u24B8","(C)"],["\u24B9","(D)"],["\u24BA","(E)"],["\u24BB","(F)"],["\u24BC","(G)"],["\u24BD","(H)"],["\u24BE","(I)"],["\u24BF","(J)"],["\u24C0","(K)"],["\u24C1","(L)"],["\u24C3","(N)"],["\u24C4","(O)"],["\u24C5","(P)"],["\u24C6","(Q)"],["\u24C7","(R)"],["\u24C8","(S)"],["\u24C9","(T)"],["\u24CA","(U)"],["\u24CB","(V)"],["\u24CC","(W)"],["\u24CD","(X)"],["\u24CE","(Y)"],["\u24CF","(Z)"],["\u24D0","(a)"],["\u24D1","(b)"],["\u24D2","(c)"],["\u24D3","(d)"],["\u24D4","(e)"],["\u24D5","(f)"],["\u24D6","(g)"],["\u24D7","(h)"],["\u24D8","(i)"],["\u24D9","(j)"],["\u24DA","(k)"],["\u24DB","(l)"],["\u24DC","(m)"],["\u24DD","(n)"],["\u24DE","(o)"],["\u24DF","(p)"],["\u24E0","(q)"],["\u24E1","(r)"],["\u24E2","(s)"],["\u24E3","(t)"],["\u24E4","(u)"],["\u24E5","(v)"],["\u24E6","(w)"],["\u24E7","(x)"],["\u24E8","(y)"],["\u24E9","(z)"],["\u010A","C"],["\u010B","c"],["\u0120","G"],["\u0121","g"],["\u0126","H"],["\u0127","h"],["\u017B","Z"],["\u017C","z"],["\u{1D7CE}","0"],["\u{1D7CF}","1"],["\u{1D7D0}","2"],["\u{1D7D1}","3"],["\u{1D7D2}","4"],["\u{1D7D3}","5"],["\u{1D7D4}","6"],["\u{1D7D5}","7"],["\u{1D7D6}","8"],["\u{1D7D7}","9"],["\u{1D7D8}","0"],["\u{1D7D9}","1"],["\u{1D7DA}","2"],["\u{1D7DB}","3"],["\u{1D7DC}","4"],["\u{1D7DD}","5"],["\u{1D7DE}","6"],["\u{1D7DF}","7"],["\u{1D7E0}","8"],["\u{1D7E1}","9"],["\u{1D7E2}","0"],["\u{1D7E3}","1"],["\u{1D7E4}","2"],["\u{1D7E5}","3"],["\u{1D7E6}","4"],["\u{1D7E7}","5"],["\u{1D7E8}","6"],["\u{1D7E9}","7"],["\u{1D7EA}","8"],["\u{1D7EB}","9"],["\u{1D7EC}","0"],["\u{1D7ED}","1"],["\u{1D7EE}","2"],["\u{1D7EF}","3"],["\u{1D7F0}","4"],["\u{1D7F1}","5"],["\u{1D7F2}","6"],["\u{1D7F3}","7"],["\u{1D7F4}","8"],["\u{1D7F5}","9"],["\u{1D7F6}","0"],["\u{1D7F7}","1"],["\u{1D7F8}","2"],["\u{1D7F9}","3"],["\u{1D7FA}","4"],["\u{1D7FB}","5"],["\u{1D7FC}","6"],["\u{1D7FD}","7"],["\u{1D7FE}","8"],["\u{1D7FF}","9"],["\u2460","1"],["\u2461","2"],["\u2462","3"],["\u2463","4"],["\u2464","5"],["\u2465","6"],["\u2466","7"],["\u2467","8"],["\u2468","9"],["\u2469","10"],["\u246A","11"],["\u246B","12"],["\u246C","13"],["\u246D","14"],["\u246E","15"],["\u246F","16"],["\u2470","17"],["\u2471","18"],["\u2472","19"],["\u2473","20"],["\u2474","1"],["\u2475","2"],["\u2476","3"],["\u2477","4"],["\u2478","5"],["\u2479","6"],["\u247A","7"],["\u247B","8"],["\u247C","9"],["\u247D","10"],["\u247E","11"],["\u247F","12"],["\u2480","13"],["\u2481","14"],["\u2482","15"],["\u2483","16"],["\u2484","17"],["\u2485","18"],["\u2486","19"],["\u2487","20"],["\u2488","1."],["\u2489","2."],["\u248A","3."],["\u248B","4."],["\u248C","5."],["\u248D","6."],["\u248E","7."],["\u248F","8."],["\u2490","9."],["\u2491","10."],["\u2492","11."],["\u2493","12."],["\u2494","13."],["\u2495","14."],["\u2496","15."],["\u2497","16."],["\u2498","17."],["\u2499","18."],["\u249A","19."],["\u249B","20."],["\u24EA","0"],["\u24EB","11"],["\u24EC","12"],["\u24ED","13"],["\u24EE","14"],["\u24EF","15"],["\u24F0","16"],["\u24F1","17"],["\u24F2","18"],["\u24F3","19"],["\u24F4","20"],["\u24F5","1"],["\u24F6","2"],["\u24F7","3"],["\u24F8","4"],["\u24F9","5"],["\u24FA","6"],["\u24FB","7"],["\u24FC","8"],["\u24FD","9"],["\u24FE","10"],["\u24FF","0"],["\u{1F670}","&"],["\u{1F671}","&"],["\u{1F672}","&"],["\u{1F673}","&"],["\u{1F674}","&"],["\u{1F675}","&"],["\u{1F676}",'"'],["\u{1F677}",'"'],["\u{1F678}",'"'],["\u203D","?!"],["\u{1F679}","?!"],["\u{1F67A}","?!"],["\u{1F67B}","?!"],["\u{1F67C}","/"],["\u{1F67D}","\\"],["\u{1F707}","AR"],["\u{1F708}","V"],["\u{1F709}","V"],["\u{1F706}","VR"],["\u{1F705}","VF"],["\u{1F729}","2"],["\u{1F72A}","5"],["\u{1F761}","f"],["\u{1F762}","W"],["\u{1F763}","U"],["\u{1F767}","V"],["\u{1F768}","T"],["\u{1F76A}","V"],["\u{1F76B}","MB"],["\u{1F76C}","VB"],["\u{1F772}","3B"],["\u{1F773}","3B"],["\u{1F4AF}","100"],["\u{1F519}","BACK"],["\u{1F51A}","END"],["\u{1F51B}","ON!"],["\u{1F51C}","SOON"],["\u{1F51D}","TOP"],["\u{1F51E}","18"],["\u{1F524}","abc"],["\u{1F520}","ABCD"],["\u{1F521}","abcd"],["\u{1F522}","1234"],["\u{1F523}","T&@%"],["#\uFE0F\u20E3","#"],["*\uFE0F\u20E3","*"],["0\uFE0F\u20E3","0"],["1\uFE0F\u20E3","1"],["2\uFE0F\u20E3","2"],["3\uFE0F\u20E3","3"],["4\uFE0F\u20E3","4"],["5\uFE0F\u20E3","5"],["6\uFE0F\u20E3","6"],["7\uFE0F\u20E3","7"],["8\uFE0F\u20E3","8"],["9\uFE0F\u20E3","9"],["\u{1F51F}","10"],["\u{1F170}\uFE0F","A"],["\u{1F171}\uFE0F","B"],["\u{1F18E}","AB"],["\u{1F191}","CL"],["\u{1F17E}\uFE0F","O"],["\u{1F17F}","P"],["\u{1F198}","SOS"],["\u{1F172}","C"],["\u{1F173}","D"],["\u{1F174}","E"],["\u{1F175}","F"],["\u{1F176}","G"],["\u{1F177}","H"],["\u{1F178}","I"],["\u{1F179}","J"],["\u{1F17A}","K"],["\u{1F17B}","L"],["\u{1F17C}","M"],["\u{1F17D}","N"],["\u{1F180}","Q"],["\u{1F181}","R"],["\u{1F182}","S"],["\u{1F183}","T"],["\u{1F184}","U"],["\u{1F185}","V"],["\u{1F186}","W"],["\u{1F187}","X"],["\u{1F188}","Y"],["\u{1F189}","Z"],["\u2212","-"],["\u2053","-"]],yC=new Map(gC),Ju=yC});var cy,jo,Wu,uy=S(()=>{cy=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],jo={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:cy,nb:cy,de:[["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xDF","ss"],["\u1E9E","Ss"]],tr:[["\xE2","a"],["\xC2","A"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"]],hu:[["\u0171","u"],["\u0170","U"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"],["\xE1","a"],["\xC1","A"],["\xE9","e"],["\xC9","E"],["\xED","i"],["\xCD","I"],["\xF3","o"],["\xD3","O"],["\xFA","u"],["\xDA","U"]],sr:[["\u0452","dj"],["\u0402","Dj"],["\u045F","dz"],["\u040F","Dz"],["\u0459","lj"],["\u0409","Lj"],["\u045A","nj"],["\u040A","Nj"],["\u045B","c"],["\u040B","C"],["\u0447","ch"],["\u0427","Ch"],["\u0448","sh"],["\u0428","Sh"],["\u0436","zh"],["\u0416","Zh"]]};for(let t of Object.keys(jo))jo[t]=new Map(jo[t]);Wu=jo});function Ku(t,e){if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={customReplacements:[],...e};let n=wC(e.locale),r=Ju,s=e.customReplacements.length>0||e.customReplacements.size>0;if(n||s){if(r=new Map(Ju),n)for(let[i,o]of n)r.set(i,o);for(let[i,o]of e.customReplacements)r.set(i,o)}return t=t.normalize(),t=bC(t,r),t=t.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),t=t.replaceAll(/\p{Dash_Punctuation}/gu,"-"),t}var bC,wC,dy=S(()=>{ly();uy();bC=(t,e)=>{for(let[n,r]of e)t=t.replaceAll(n,r);return t},wC=t=>{if(!t)return;let e=t.toLowerCase().replace(/^no(-|$)/,"nb$1");return Wu[e]||Wu[e.split("-")[0]]||void 0}});var vC,fy,py=S(()=>{vC=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],fy=vC});function Hu(t,e){if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let n=e.preserveLeadingUnderscore&&t.startsWith("_"),r=e.preserveTrailingDash&&t.endsWith("-");if(e.transliterate){let i=new Map([...fy,...e.customReplacements]);t=Ku(t,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)t=t.replaceAll(i,o);e.decamelize&&(t=SC(t));let s=xC(e);return e.lowercase&&(t=e.locale?t.toLocaleLowerCase(e.locale):t.toLowerCase()),t=t.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),t=t.replace(s,e.separator),t=t.replaceAll("\\",""),e.separator&&(t=kC(t,e.separator)),n&&(t=`_${t}`),r&&(t=`${t}-`),t}var SC,kC,xC,hy=S(()=>{ay();dy();py();SC=t=>t.replaceAll(/([A-Z]{2,})(\d+)/g,"$1 $2").replaceAll(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").replaceAll(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"),kC=(t,e)=>{let n=Bo(e);return t.replaceAll(new RegExp(`(?:${n}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${n})|(?:${n})$`,"g"),"")},xC=t=>{let e=String.raw`a-z\d`;if(e+=t.lowercase?"":"A-Z",t.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),t.preserveCharacters.length>0)for(let r of t.preserveCharacters){if(r===t.separator)throw new Error(`The separator character \`${t.separator}\` cannot be included in preserved characters: ${t.preserveCharacters}`);e+=Bo(r)}let n=t.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,n)}});function nr(t){return Hu(t)}var my=S(()=>{hy()});var rr,gy,yy=S(()=>{rr={local:"local",ide:"ide",published:"published",inline:"inline"},gy=Object.values(rr).map(t=>`'${t}'`).join(" | ")});var Cs,zu,by=S(()=>{Cs=` *, *::before, *::after { box-sizing: border-box; }
|
|
169
|
+
`});function Fo(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var ly=S(()=>{});var yC,bC,Wu,cy=S(()=>{yC=[["\xDF","ss"],["\u1E9E","Ss"],["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xC0","A"],["\xC1","A"],["\xC2","A"],["\xC3","A"],["\xC4","Ae"],["\xC5","A"],["\xC6","AE"],["\xC7","C"],["\xC8","E"],["\xC9","E"],["\xCA","E"],["\xCB","E"],["\u018F","A"],["\xCC","I"],["\xCD","I"],["\xCE","I"],["\xCF","I"],["\xD0","D"],["\xD1","N"],["\xD2","O"],["\xD3","O"],["\xD4","O"],["\xD5","O"],["\xD6","Oe"],["\u014C","O"],["\u0150","O"],["\xD8","O"],["\u0152","OE"],["\xD9","U"],["\xDA","U"],["\xDB","U"],["\xDC","Ue"],["\u0170","U"],["\xDD","Y"],["\xDE","TH"],["\xDF","ss"],["\xE0","a"],["\xE1","a"],["\xE2","a"],["\xE3","a"],["\xE4","ae"],["\xE5","a"],["\xE6","ae"],["\xE7","c"],["\xE8","e"],["\xE9","e"],["\xEA","e"],["\xEB","e"],["\u0259","a"],["\xEC","i"],["\xED","i"],["\xEE","i"],["\xEF","i"],["\xF0","d"],["\xF1","n"],["\xF2","o"],["\xF3","o"],["\xF4","o"],["\xF5","o"],["\xF6","oe"],["\u014D","o"],["\u0151","o"],["\xF8","o"],["\u0153","oe"],["\xF9","u"],["\xFA","u"],["\xFB","u"],["\xFC","ue"],["\u0171","u"],["\xFD","y"],["\xFE","th"],["\xFF","y"],["\xE0","a"],["\xC0","A"],["\xE1","a"],["\xC1","A"],["\xE2","a"],["\xC2","A"],["\xE3","a"],["\xC3","A"],["\xE8","e"],["\xC8","E"],["\xE9","e"],["\xC9","E"],["\xEA","e"],["\xCA","E"],["\xEC","i"],["\xCC","I"],["\xED","i"],["\xCD","I"],["\xF2","o"],["\xD2","O"],["\xF3","o"],["\xD3","O"],["\xF4","o"],["\xD4","O"],["\xF5","o"],["\xD5","O"],["\xF9","u"],["\xD9","U"],["\xFA","u"],["\xDA","U"],["\xFD","y"],["\xDD","Y"],["\u0103","a"],["\u0102","A"],["\u0110","D"],["\u0111","d"],["\u0129","i"],["\u0128","I"],["\u0169","u"],["\u0168","U"],["\u01A1","o"],["\u01A0","O"],["\u01B0","u"],["\u01AF","U"],["\u1EA1","a"],["\u1EA0","A"],["\u1EA3","a"],["\u1EA2","A"],["\u1EA5","a"],["\u1EA4","A"],["\u1EA7","a"],["\u1EA6","A"],["\u1EA9","a"],["\u1EA8","A"],["\u1EAB","a"],["\u1EAA","A"],["\u1EAD","a"],["\u1EAC","A"],["\u1EAF","a"],["\u1EAE","A"],["\u1EB1","a"],["\u1EB0","A"],["\u1EB3","a"],["\u1EB2","A"],["\u1EB5","a"],["\u1EB4","A"],["\u1EB7","a"],["\u1EB6","A"],["\u1EB9","e"],["\u1EB8","E"],["\u1EBB","e"],["\u1EBA","E"],["\u1EBD","e"],["\u1EBC","E"],["\u1EBF","e"],["\u1EBE","E"],["\u1EC1","e"],["\u1EC0","E"],["\u1EC3","e"],["\u1EC2","E"],["\u1EC5","e"],["\u1EC4","E"],["\u1EC7","e"],["\u1EC6","E"],["\u1EC9","i"],["\u1EC8","I"],["\u1ECB","i"],["\u1ECA","I"],["\u1ECD","o"],["\u1ECC","O"],["\u1ECF","o"],["\u1ECE","O"],["\u1ED1","o"],["\u1ED0","O"],["\u1ED3","o"],["\u1ED2","O"],["\u1ED5","o"],["\u1ED4","O"],["\u1ED7","o"],["\u1ED6","O"],["\u1ED9","o"],["\u1ED8","O"],["\u1EDB","o"],["\u1EDA","O"],["\u1EDD","o"],["\u1EDC","O"],["\u1EDF","o"],["\u1EDE","O"],["\u1EE1","o"],["\u1EE0","O"],["\u1EE3","o"],["\u1EE2","O"],["\u1EE5","u"],["\u1EE4","U"],["\u1EE7","u"],["\u1EE6","U"],["\u1EE9","u"],["\u1EE8","U"],["\u1EEB","u"],["\u1EEA","U"],["\u1EED","u"],["\u1EEC","U"],["\u1EEF","u"],["\u1EEE","U"],["\u1EF1","u"],["\u1EF0","U"],["\u1EF3","y"],["\u1EF2","Y"],["\u1EF5","y"],["\u1EF4","Y"],["\u1EF7","y"],["\u1EF6","Y"],["\u1EF9","y"],["\u1EF8","Y"],["\u0621","e"],["\u0622","a"],["\u0623","a"],["\u0624","w"],["\u0625","a"],["\u0626","y"],["\u0627","a"],["\u0628","b"],["\u0629","t"],["\u062A","t"],["\u062B","th"],["\u062C","j"],["\u062D","h"],["\u062E","kh"],["\u062F","d"],["\u0630","dh"],["\u0631","r"],["\u0632","z"],["\u0633","s"],["\u0634","sh"],["\u0635","s"],["\u0636","d"],["\u0637","t"],["\u0638","z"],["\u0639","e"],["\u063A","gh"],["\u0640","_"],["\u0641","f"],["\u0642","q"],["\u0643","k"],["\u0644","l"],["\u0645","m"],["\u0646","n"],["\u0647","h"],["\u0648","w"],["\u0649","a"],["\u064A","y"],["\u064E\u200E","a"],["\u064F","u"],["\u0650\u200E","i"],["\u0660","0"],["\u0661","1"],["\u0662","2"],["\u0663","3"],["\u0664","4"],["\u0665","5"],["\u0666","6"],["\u0667","7"],["\u0668","8"],["\u0669","9"],["\u0686","ch"],["\u06A9","k"],["\u06AF","g"],["\u067E","p"],["\u0698","zh"],["\u06CC","y"],["\u06F0","0"],["\u06F1","1"],["\u06F2","2"],["\u06F3","3"],["\u06F4","4"],["\u06F5","5"],["\u06F6","6"],["\u06F7","7"],["\u06F8","8"],["\u06F9","9"],["\u067C","p"],["\u0681","z"],["\u0685","c"],["\u0689","d"],["\uFEAB","d"],["\uFEAD","r"],["\u0693","r"],["\uFEAF","z"],["\u0696","g"],["\u069A","x"],["\u06AB","g"],["\u06BC","n"],["\u06C0","e"],["\u06D0","e"],["\u06CD","ai"],["\u0679","t"],["\u0688","d"],["\u0691","r"],["\u06BA","n"],["\u06C1","h"],["\u06BE","h"],["\u06D2","e"],["\u0410","A"],["\u0430","a"],["\u0411","B"],["\u0431","b"],["\u0412","V"],["\u0432","v"],["\u0413","G"],["\u0433","g"],["\u0414","D"],["\u0434","d"],["\u044A\u0435","ye"],["\u042A\u0435","Ye"],["\u044A\u0415","yE"],["\u042A\u0415","YE"],["\u0415","E"],["\u0435","e"],["\u0401","Yo"],["\u0451","yo"],["\u0416","Zh"],["\u0436","zh"],["\u0417","Z"],["\u0437","z"],["\u0418","I"],["\u0438","i"],["\u044B\u0439","iy"],["\u042B\u0439","Iy"],["\u042B\u0419","IY"],["\u044B\u0419","iY"],["\u0419","Y"],["\u0439","y"],["\u041A","K"],["\u043A","k"],["\u041B","L"],["\u043B","l"],["\u041C","M"],["\u043C","m"],["\u041D","N"],["\u043D","n"],["\u041E","O"],["\u043E","o"],["\u041F","P"],["\u043F","p"],["\u0420","R"],["\u0440","r"],["\u0421","S"],["\u0441","s"],["\u0422","T"],["\u0442","t"],["\u0423","U"],["\u0443","u"],["\u0424","F"],["\u0444","f"],["\u0425","Kh"],["\u0445","kh"],["\u0426","Ts"],["\u0446","ts"],["\u0427","Ch"],["\u0447","ch"],["\u0428","Sh"],["\u0448","sh"],["\u0429","Sch"],["\u0449","sch"],["\u042A",""],["\u044A",""],["\u042B","Y"],["\u044B","y"],["\u042C",""],["\u044C",""],["\u042D","E"],["\u044D","e"],["\u042E","Yu"],["\u044E","yu"],["\u042F","Ya"],["\u044F","ya"],["\u0103","a"],["\u0102","A"],["\u0219","s"],["\u0218","S"],["\u021B","t"],["\u021A","T"],["\u0163","t"],["\u0162","T"],["\u015F","s"],["\u015E","S"],["\xE7","c"],["\xC7","C"],["\u011F","g"],["\u011E","G"],["\u0131","i"],["\u0130","I"],["\u0561","a"],["\u0531","A"],["\u0562","b"],["\u0532","B"],["\u0563","g"],["\u0533","G"],["\u0564","d"],["\u0534","D"],["\u0565","ye"],["\u0535","Ye"],["\u0566","z"],["\u0536","Z"],["\u0567","e"],["\u0537","E"],["\u0568","y"],["\u0538","Y"],["\u0569","t"],["\u0539","T"],["\u056A","zh"],["\u053A","Zh"],["\u056B","i"],["\u053B","I"],["\u056C","l"],["\u053C","L"],["\u056D","kh"],["\u053D","Kh"],["\u056E","ts"],["\u053E","Ts"],["\u056F","k"],["\u053F","K"],["\u0570","h"],["\u0540","H"],["\u0571","dz"],["\u0541","Dz"],["\u0572","gh"],["\u0542","Gh"],["\u0573","tch"],["\u0543","Tch"],["\u0574","m"],["\u0544","M"],["\u0575","y"],["\u0545","Y"],["\u0576","n"],["\u0546","N"],["\u0577","sh"],["\u0547","Sh"],["\u0578\u0582","u"],["\u0548\u0552","U"],["\u0548\u0582","U"],["\u0578","vo"],["\u0548","Vo"],["\u0579","ch"],["\u0549","Ch"],["\u057A","p"],["\u054A","P"],["\u057B","j"],["\u054B","J"],["\u057C","r"],["\u054C","R"],["\u057D","s"],["\u054D","S"],["\u057E","v"],["\u054E","V"],["\u057F","t"],["\u054F","T"],["\u0580","r"],["\u0550","R"],["\u0581","c"],["\u0551","C"],["\u0583","p"],["\u0553","P"],["\u0584","q"],["\u0554","Q"],["\u0585","o"],["\u0555","O"],["\u0586","f"],["\u0556","F"],["\u0587","yev"],["\u10D0","a"],["\u10D1","b"],["\u10D2","g"],["\u10D3","d"],["\u10D4","e"],["\u10D5","v"],["\u10D6","z"],["\u10D7","t"],["\u10D8","i"],["\u10D9","k"],["\u10DA","l"],["\u10DB","m"],["\u10DC","n"],["\u10DD","o"],["\u10DE","p"],["\u10DF","zh"],["\u10E0","r"],["\u10E1","s"],["\u10E2","t"],["\u10E3","u"],["\u10E4","ph"],["\u10E5","q"],["\u10E6","gh"],["\u10E7","k"],["\u10E8","sh"],["\u10E9","ch"],["\u10EA","ts"],["\u10EB","dz"],["\u10EC","ts"],["\u10ED","tch"],["\u10EE","kh"],["\u10EF","j"],["\u10F0","h"],["\u010D","c"],["\u010F","d"],["\u011B","e"],["\u0148","n"],["\u0159","r"],["\u0161","s"],["\u0165","t"],["\u016F","u"],["\u017E","z"],["\u010C","C"],["\u010E","D"],["\u011A","E"],["\u0147","N"],["\u0158","R"],["\u0160","S"],["\u0164","T"],["\u016E","U"],["\u017D","Z"],["\u0780","h"],["\u0781","sh"],["\u0782","n"],["\u0783","r"],["\u0784","b"],["\u0785","lh"],["\u0786","k"],["\u0787","a"],["\u0788","v"],["\u0789","m"],["\u078A","f"],["\u078B","dh"],["\u078C","th"],["\u078D","l"],["\u078E","g"],["\u078F","gn"],["\u0790","s"],["\u0791","d"],["\u0792","z"],["\u0793","t"],["\u0794","y"],["\u0795","p"],["\u0796","j"],["\u0797","ch"],["\u0798","tt"],["\u0799","hh"],["\u079A","kh"],["\u079B","th"],["\u079C","z"],["\u079D","sh"],["\u079E","s"],["\u079F","d"],["\u07A0","t"],["\u07A1","z"],["\u07A2","a"],["\u07A3","gh"],["\u07A4","q"],["\u07A5","w"],["\u07A6","a"],["\u07A7","aa"],["\u07A8","i"],["\u07A9","ee"],["\u07AA","u"],["\u07AB","oo"],["\u07AC","e"],["\u07AD","ey"],["\u07AE","o"],["\u07AF","oa"],["\u07B0",""],["\u03B1","a"],["\u03B2","v"],["\u03B3","g"],["\u03B4","d"],["\u03B5","e"],["\u03B6","z"],["\u03B7","i"],["\u03B8","th"],["\u03B9","i"],["\u03BA","k"],["\u03BB","l"],["\u03BC","m"],["\u03BD","n"],["\u03BE","ks"],["\u03BF","o"],["\u03C0","p"],["\u03C1","r"],["\u03C3","s"],["\u03C4","t"],["\u03C5","y"],["\u03C6","f"],["\u03C7","x"],["\u03C8","ps"],["\u03C9","o"],["\u03AC","a"],["\u03AD","e"],["\u03AF","i"],["\u03CC","o"],["\u03CD","y"],["\u03AE","i"],["\u03CE","o"],["\u03C2","s"],["\u03CA","i"],["\u03B0","y"],["\u03CB","y"],["\u0390","i"],["\u0391","A"],["\u0392","B"],["\u0393","G"],["\u0394","D"],["\u0395","E"],["\u0396","Z"],["\u0397","I"],["\u0398","TH"],["\u0399","I"],["\u039A","K"],["\u039B","L"],["\u039C","M"],["\u039D","N"],["\u039E","KS"],["\u039F","O"],["\u03A0","P"],["\u03A1","R"],["\u03A3","S"],["\u03A4","T"],["\u03A5","Y"],["\u03A6","F"],["\u03A7","X"],["\u03A8","PS"],["\u03A9","O"],["\u0386","A"],["\u0388","E"],["\u038A","I"],["\u038C","O"],["\u038E","Y"],["\u0389","I"],["\u038F","O"],["\u03AA","I"],["\u03AB","Y"],["\u0101","a"],["\u0113","e"],["\u0123","g"],["\u012B","i"],["\u0137","k"],["\u013C","l"],["\u0146","n"],["\u016B","u"],["\u0100","A"],["\u0112","E"],["\u0122","G"],["\u012A","I"],["\u0136","K"],["\u013B","L"],["\u0145","N"],["\u016A","U"],["\u010D","c"],["\u0161","s"],["\u017E","z"],["\u010C","C"],["\u0160","S"],["\u017D","Z"],["\u0105","a"],["\u010D","c"],["\u0119","e"],["\u0117","e"],["\u012F","i"],["\u0161","s"],["\u0173","u"],["\u016B","u"],["\u017E","z"],["\u0104","A"],["\u010C","C"],["\u0118","E"],["\u0116","E"],["\u012E","I"],["\u0160","S"],["\u0172","U"],["\u016A","U"],["\u040C","Kj"],["\u045C","kj"],["\u0409","Lj"],["\u0459","lj"],["\u040A","Nj"],["\u045A","nj"],["\u0422\u0441","Ts"],["\u0442\u0441","ts"],["\u0105","a"],["\u0107","c"],["\u0119","e"],["\u0142","l"],["\u0144","n"],["\u015B","s"],["\u017A","z"],["\u017C","z"],["\u0104","A"],["\u0106","C"],["\u0118","E"],["\u0141","L"],["\u0143","N"],["\u015A","S"],["\u0179","Z"],["\u017B","Z"],["\u0404","Ye"],["\u0406","I"],["\u0407","Yi"],["\u0490","G"],["\u0454","ye"],["\u0456","i"],["\u0457","yi"],["\u0491","g"],["\u0132","IJ"],["\u0133","ij"],["\xA2","c"],["\xA5","Y"],["\u07FF","b"],["\u09F3","t"],["\u0AF1","Bo"],["\u0E3F","B"],["\u20A0","CE"],["\u20A1","C"],["\u20A2","Cr"],["\u20A3","F"],["\u20A5","m"],["\u20A6","N"],["\u20A7","Pt"],["\u20A8","Rs"],["\u20A9","W"],["\u20AB","s"],["\u20AC","E"],["\u20AD","K"],["\u20AE","T"],["\u20AF","Dp"],["\u20B0","S"],["\u20B1","P"],["\u20B2","G"],["\u20B3","A"],["\u20B4","S"],["\u20B5","C"],["\u20B6","tt"],["\u20B7","S"],["\u20B8","T"],["\u20B9","R"],["\u20BA","L"],["\u20BD","P"],["\u20BF","B"],["\uFE69","$"],["\uFFE0","c"],["\uFFE5","Y"],["\uFFE6","W"],["\u{1D400}","A"],["\u{1D401}","B"],["\u{1D402}","C"],["\u{1D403}","D"],["\u{1D404}","E"],["\u{1D405}","F"],["\u{1D406}","G"],["\u{1D407}","H"],["\u{1D408}","I"],["\u{1D409}","J"],["\u{1D40A}","K"],["\u{1D40B}","L"],["\u{1D40C}","M"],["\u{1D40D}","N"],["\u{1D40E}","O"],["\u{1D40F}","P"],["\u{1D410}","Q"],["\u{1D411}","R"],["\u{1D412}","S"],["\u{1D413}","T"],["\u{1D414}","U"],["\u{1D415}","V"],["\u{1D416}","W"],["\u{1D417}","X"],["\u{1D418}","Y"],["\u{1D419}","Z"],["\u{1D41A}","a"],["\u{1D41B}","b"],["\u{1D41C}","c"],["\u{1D41D}","d"],["\u{1D41E}","e"],["\u{1D41F}","f"],["\u{1D420}","g"],["\u{1D421}","h"],["\u{1D422}","i"],["\u{1D423}","j"],["\u{1D424}","k"],["\u{1D425}","l"],["\u{1D426}","m"],["\u{1D427}","n"],["\u{1D428}","o"],["\u{1D429}","p"],["\u{1D42A}","q"],["\u{1D42B}","r"],["\u{1D42C}","s"],["\u{1D42D}","t"],["\u{1D42E}","u"],["\u{1D42F}","v"],["\u{1D430}","w"],["\u{1D431}","x"],["\u{1D432}","y"],["\u{1D433}","z"],["\u{1D434}","A"],["\u{1D435}","B"],["\u{1D436}","C"],["\u{1D437}","D"],["\u{1D438}","E"],["\u{1D439}","F"],["\u{1D43A}","G"],["\u{1D43B}","H"],["\u{1D43C}","I"],["\u{1D43D}","J"],["\u{1D43E}","K"],["\u{1D43F}","L"],["\u{1D440}","M"],["\u{1D441}","N"],["\u{1D442}","O"],["\u{1D443}","P"],["\u{1D444}","Q"],["\u{1D445}","R"],["\u{1D446}","S"],["\u{1D447}","T"],["\u{1D448}","U"],["\u{1D449}","V"],["\u{1D44A}","W"],["\u{1D44B}","X"],["\u{1D44C}","Y"],["\u{1D44D}","Z"],["\u{1D44E}","a"],["\u{1D44F}","b"],["\u{1D450}","c"],["\u{1D451}","d"],["\u{1D452}","e"],["\u{1D453}","f"],["\u{1D454}","g"],["\u{1D456}","i"],["\u{1D457}","j"],["\u{1D458}","k"],["\u{1D459}","l"],["\u{1D45A}","m"],["\u{1D45B}","n"],["\u{1D45C}","o"],["\u{1D45D}","p"],["\u{1D45E}","q"],["\u{1D45F}","r"],["\u{1D460}","s"],["\u{1D461}","t"],["\u{1D462}","u"],["\u{1D463}","v"],["\u{1D464}","w"],["\u{1D465}","x"],["\u{1D466}","y"],["\u{1D467}","z"],["\u{1D468}","A"],["\u{1D469}","B"],["\u{1D46A}","C"],["\u{1D46B}","D"],["\u{1D46C}","E"],["\u{1D46D}","F"],["\u{1D46E}","G"],["\u{1D46F}","H"],["\u{1D470}","I"],["\u{1D471}","J"],["\u{1D472}","K"],["\u{1D473}","L"],["\u{1D474}","M"],["\u{1D475}","N"],["\u{1D476}","O"],["\u{1D477}","P"],["\u{1D478}","Q"],["\u{1D479}","R"],["\u{1D47A}","S"],["\u{1D47B}","T"],["\u{1D47C}","U"],["\u{1D47D}","V"],["\u{1D47E}","W"],["\u{1D47F}","X"],["\u{1D480}","Y"],["\u{1D481}","Z"],["\u{1D482}","a"],["\u{1D483}","b"],["\u{1D484}","c"],["\u{1D485}","d"],["\u{1D486}","e"],["\u{1D487}","f"],["\u{1D488}","g"],["\u{1D489}","h"],["\u{1D48A}","i"],["\u{1D48B}","j"],["\u{1D48C}","k"],["\u{1D48D}","l"],["\u{1D48E}","m"],["\u{1D48F}","n"],["\u{1D490}","o"],["\u{1D491}","p"],["\u{1D492}","q"],["\u{1D493}","r"],["\u{1D494}","s"],["\u{1D495}","t"],["\u{1D496}","u"],["\u{1D497}","v"],["\u{1D498}","w"],["\u{1D499}","x"],["\u{1D49A}","y"],["\u{1D49B}","z"],["\u{1D49C}","A"],["\u{1D49E}","C"],["\u{1D49F}","D"],["\u{1D4A2}","g"],["\u{1D4A5}","J"],["\u{1D4A6}","K"],["\u{1D4A9}","N"],["\u{1D4AA}","O"],["\u{1D4AB}","P"],["\u{1D4AC}","Q"],["\u{1D4AE}","S"],["\u{1D4AF}","T"],["\u{1D4B0}","U"],["\u{1D4B1}","V"],["\u{1D4B2}","W"],["\u{1D4B3}","X"],["\u{1D4B4}","Y"],["\u{1D4B5}","Z"],["\u{1D4B6}","a"],["\u{1D4B7}","b"],["\u{1D4B8}","c"],["\u{1D4B9}","d"],["\u{1D4BB}","f"],["\u{1D4BD}","h"],["\u{1D4BE}","i"],["\u{1D4BF}","j"],["\u{1D4C0}","k"],["\u{1D4C1}","l"],["\u{1D4C2}","m"],["\u{1D4C3}","n"],["\u{1D4C5}","p"],["\u{1D4C6}","q"],["\u{1D4C7}","r"],["\u{1D4C8}","s"],["\u{1D4C9}","t"],["\u{1D4CA}","u"],["\u{1D4CB}","v"],["\u{1D4CC}","w"],["\u{1D4CD}","x"],["\u{1D4CE}","y"],["\u{1D4CF}","z"],["\u{1D4D0}","A"],["\u{1D4D1}","B"],["\u{1D4D2}","C"],["\u{1D4D3}","D"],["\u{1D4D4}","E"],["\u{1D4D5}","F"],["\u{1D4D6}","G"],["\u{1D4D7}","H"],["\u{1D4D8}","I"],["\u{1D4D9}","J"],["\u{1D4DA}","K"],["\u{1D4DB}","L"],["\u{1D4DC}","M"],["\u{1D4DD}","N"],["\u{1D4DE}","O"],["\u{1D4DF}","P"],["\u{1D4E0}","Q"],["\u{1D4E1}","R"],["\u{1D4E2}","S"],["\u{1D4E3}","T"],["\u{1D4E4}","U"],["\u{1D4E5}","V"],["\u{1D4E6}","W"],["\u{1D4E7}","X"],["\u{1D4E8}","Y"],["\u{1D4E9}","Z"],["\u{1D4EA}","a"],["\u{1D4EB}","b"],["\u{1D4EC}","c"],["\u{1D4ED}","d"],["\u{1D4EE}","e"],["\u{1D4EF}","f"],["\u{1D4F0}","g"],["\u{1D4F1}","h"],["\u{1D4F2}","i"],["\u{1D4F3}","j"],["\u{1D4F4}","k"],["\u{1D4F5}","l"],["\u{1D4F6}","m"],["\u{1D4F7}","n"],["\u{1D4F8}","o"],["\u{1D4F9}","p"],["\u{1D4FA}","q"],["\u{1D4FB}","r"],["\u{1D4FC}","s"],["\u{1D4FD}","t"],["\u{1D4FE}","u"],["\u{1D4FF}","v"],["\u{1D500}","w"],["\u{1D501}","x"],["\u{1D502}","y"],["\u{1D503}","z"],["\u{1D504}","A"],["\u{1D505}","B"],["\u{1D507}","D"],["\u{1D508}","E"],["\u{1D509}","F"],["\u{1D50A}","G"],["\u{1D50D}","J"],["\u{1D50E}","K"],["\u{1D50F}","L"],["\u{1D510}","M"],["\u{1D511}","N"],["\u{1D512}","O"],["\u{1D513}","P"],["\u{1D514}","Q"],["\u{1D516}","S"],["\u{1D517}","T"],["\u{1D518}","U"],["\u{1D519}","V"],["\u{1D51A}","W"],["\u{1D51B}","X"],["\u{1D51C}","Y"],["\u{1D51E}","a"],["\u{1D51F}","b"],["\u{1D520}","c"],["\u{1D521}","d"],["\u{1D522}","e"],["\u{1D523}","f"],["\u{1D524}","g"],["\u{1D525}","h"],["\u{1D526}","i"],["\u{1D527}","j"],["\u{1D528}","k"],["\u{1D529}","l"],["\u{1D52A}","m"],["\u{1D52B}","n"],["\u{1D52C}","o"],["\u{1D52D}","p"],["\u{1D52E}","q"],["\u{1D52F}","r"],["\u{1D530}","s"],["\u{1D531}","t"],["\u{1D532}","u"],["\u{1D533}","v"],["\u{1D534}","w"],["\u{1D535}","x"],["\u{1D536}","y"],["\u{1D537}","z"],["\u{1D538}","A"],["\u{1D539}","B"],["\u{1D53B}","D"],["\u{1D53C}","E"],["\u{1D53D}","F"],["\u{1D53E}","G"],["\u{1D540}","I"],["\u{1D541}","J"],["\u{1D542}","K"],["\u{1D543}","L"],["\u{1D544}","M"],["\u{1D546}","O"],["\u{1D54A}","S"],["\u{1D54B}","T"],["\u{1D54C}","U"],["\u{1D54D}","V"],["\u{1D54E}","W"],["\u{1D54F}","X"],["\u{1D550}","Y"],["\u{1D552}","a"],["\u{1D553}","b"],["\u{1D554}","c"],["\u{1D555}","d"],["\u{1D556}","e"],["\u{1D557}","f"],["\u{1D558}","g"],["\u{1D559}","h"],["\u{1D55A}","i"],["\u{1D55B}","j"],["\u{1D55C}","k"],["\u{1D55D}","l"],["\u{1D55E}","m"],["\u{1D55F}","n"],["\u{1D560}","o"],["\u{1D561}","p"],["\u{1D562}","q"],["\u{1D563}","r"],["\u{1D564}","s"],["\u{1D565}","t"],["\u{1D566}","u"],["\u{1D567}","v"],["\u{1D568}","w"],["\u{1D569}","x"],["\u{1D56A}","y"],["\u{1D56B}","z"],["\u{1D56C}","A"],["\u{1D56D}","B"],["\u{1D56E}","C"],["\u{1D56F}","D"],["\u{1D570}","E"],["\u{1D571}","F"],["\u{1D572}","G"],["\u{1D573}","H"],["\u{1D574}","I"],["\u{1D575}","J"],["\u{1D576}","K"],["\u{1D577}","L"],["\u{1D578}","M"],["\u{1D579}","N"],["\u{1D57A}","O"],["\u{1D57B}","P"],["\u{1D57C}","Q"],["\u{1D57D}","R"],["\u{1D57E}","S"],["\u{1D57F}","T"],["\u{1D580}","U"],["\u{1D581}","V"],["\u{1D582}","W"],["\u{1D583}","X"],["\u{1D584}","Y"],["\u{1D585}","Z"],["\u{1D586}","a"],["\u{1D587}","b"],["\u{1D588}","c"],["\u{1D589}","d"],["\u{1D58A}","e"],["\u{1D58B}","f"],["\u{1D58C}","g"],["\u{1D58D}","h"],["\u{1D58E}","i"],["\u{1D58F}","j"],["\u{1D590}","k"],["\u{1D591}","l"],["\u{1D592}","m"],["\u{1D593}","n"],["\u{1D594}","o"],["\u{1D595}","p"],["\u{1D596}","q"],["\u{1D597}","r"],["\u{1D598}","s"],["\u{1D599}","t"],["\u{1D59A}","u"],["\u{1D59B}","v"],["\u{1D59C}","w"],["\u{1D59D}","x"],["\u{1D59E}","y"],["\u{1D59F}","z"],["\u{1D5A0}","A"],["\u{1D5A1}","B"],["\u{1D5A2}","C"],["\u{1D5A3}","D"],["\u{1D5A4}","E"],["\u{1D5A5}","F"],["\u{1D5A6}","G"],["\u{1D5A7}","H"],["\u{1D5A8}","I"],["\u{1D5A9}","J"],["\u{1D5AA}","K"],["\u{1D5AB}","L"],["\u{1D5AC}","M"],["\u{1D5AD}","N"],["\u{1D5AE}","O"],["\u{1D5AF}","P"],["\u{1D5B0}","Q"],["\u{1D5B1}","R"],["\u{1D5B2}","S"],["\u{1D5B3}","T"],["\u{1D5B4}","U"],["\u{1D5B5}","V"],["\u{1D5B6}","W"],["\u{1D5B7}","X"],["\u{1D5B8}","Y"],["\u{1D5B9}","Z"],["\u{1D5BA}","a"],["\u{1D5BB}","b"],["\u{1D5BC}","c"],["\u{1D5BD}","d"],["\u{1D5BE}","e"],["\u{1D5BF}","f"],["\u{1D5C0}","g"],["\u{1D5C1}","h"],["\u{1D5C2}","i"],["\u{1D5C3}","j"],["\u{1D5C4}","k"],["\u{1D5C5}","l"],["\u{1D5C6}","m"],["\u{1D5C7}","n"],["\u{1D5C8}","o"],["\u{1D5C9}","p"],["\u{1D5CA}","q"],["\u{1D5CB}","r"],["\u{1D5CC}","s"],["\u{1D5CD}","t"],["\u{1D5CE}","u"],["\u{1D5CF}","v"],["\u{1D5D0}","w"],["\u{1D5D1}","x"],["\u{1D5D2}","y"],["\u{1D5D3}","z"],["\u{1D5D4}","A"],["\u{1D5D5}","B"],["\u{1D5D6}","C"],["\u{1D5D7}","D"],["\u{1D5D8}","E"],["\u{1D5D9}","F"],["\u{1D5DA}","G"],["\u{1D5DB}","H"],["\u{1D5DC}","I"],["\u{1D5DD}","J"],["\u{1D5DE}","K"],["\u{1D5DF}","L"],["\u{1D5E0}","M"],["\u{1D5E1}","N"],["\u{1D5E2}","O"],["\u{1D5E3}","P"],["\u{1D5E4}","Q"],["\u{1D5E5}","R"],["\u{1D5E6}","S"],["\u{1D5E7}","T"],["\u{1D5E8}","U"],["\u{1D5E9}","V"],["\u{1D5EA}","W"],["\u{1D5EB}","X"],["\u{1D5EC}","Y"],["\u{1D5ED}","Z"],["\u{1D5EE}","a"],["\u{1D5EF}","b"],["\u{1D5F0}","c"],["\u{1D5F1}","d"],["\u{1D5F2}","e"],["\u{1D5F3}","f"],["\u{1D5F4}","g"],["\u{1D5F5}","h"],["\u{1D5F6}","i"],["\u{1D5F7}","j"],["\u{1D5F8}","k"],["\u{1D5F9}","l"],["\u{1D5FA}","m"],["\u{1D5FB}","n"],["\u{1D5FC}","o"],["\u{1D5FD}","p"],["\u{1D5FE}","q"],["\u{1D5FF}","r"],["\u{1D600}","s"],["\u{1D601}","t"],["\u{1D602}","u"],["\u{1D603}","v"],["\u{1D604}","w"],["\u{1D605}","x"],["\u{1D606}","y"],["\u{1D607}","z"],["\u{1D608}","A"],["\u{1D609}","B"],["\u{1D60A}","C"],["\u{1D60B}","D"],["\u{1D60C}","E"],["\u{1D60D}","F"],["\u{1D60E}","G"],["\u{1D60F}","H"],["\u{1D610}","I"],["\u{1D611}","J"],["\u{1D612}","K"],["\u{1D613}","L"],["\u{1D614}","M"],["\u{1D615}","N"],["\u{1D616}","O"],["\u{1D617}","P"],["\u{1D618}","Q"],["\u{1D619}","R"],["\u{1D61A}","S"],["\u{1D61B}","T"],["\u{1D61C}","U"],["\u{1D61D}","V"],["\u{1D61E}","W"],["\u{1D61F}","X"],["\u{1D620}","Y"],["\u{1D621}","Z"],["\u{1D622}","a"],["\u{1D623}","b"],["\u{1D624}","c"],["\u{1D625}","d"],["\u{1D626}","e"],["\u{1D627}","f"],["\u{1D628}","g"],["\u{1D629}","h"],["\u{1D62A}","i"],["\u{1D62B}","j"],["\u{1D62C}","k"],["\u{1D62D}","l"],["\u{1D62E}","m"],["\u{1D62F}","n"],["\u{1D630}","o"],["\u{1D631}","p"],["\u{1D632}","q"],["\u{1D633}","r"],["\u{1D634}","s"],["\u{1D635}","t"],["\u{1D636}","u"],["\u{1D637}","v"],["\u{1D638}","w"],["\u{1D639}","x"],["\u{1D63A}","y"],["\u{1D63B}","z"],["\u{1D63C}","A"],["\u{1D63D}","B"],["\u{1D63E}","C"],["\u{1D63F}","D"],["\u{1D640}","E"],["\u{1D641}","F"],["\u{1D642}","G"],["\u{1D643}","H"],["\u{1D644}","I"],["\u{1D645}","J"],["\u{1D646}","K"],["\u{1D647}","L"],["\u{1D648}","M"],["\u{1D649}","N"],["\u{1D64A}","O"],["\u{1D64B}","P"],["\u{1D64C}","Q"],["\u{1D64D}","R"],["\u{1D64E}","S"],["\u{1D64F}","T"],["\u{1D650}","U"],["\u{1D651}","V"],["\u{1D652}","W"],["\u{1D653}","X"],["\u{1D654}","Y"],["\u{1D655}","Z"],["\u{1D656}","a"],["\u{1D657}","b"],["\u{1D658}","c"],["\u{1D659}","d"],["\u{1D65A}","e"],["\u{1D65B}","f"],["\u{1D65C}","g"],["\u{1D65D}","h"],["\u{1D65E}","i"],["\u{1D65F}","j"],["\u{1D660}","k"],["\u{1D661}","l"],["\u{1D662}","m"],["\u{1D663}","n"],["\u{1D664}","o"],["\u{1D665}","p"],["\u{1D666}","q"],["\u{1D667}","r"],["\u{1D668}","s"],["\u{1D669}","t"],["\u{1D66A}","u"],["\u{1D66B}","v"],["\u{1D66C}","w"],["\u{1D66D}","x"],["\u{1D66E}","y"],["\u{1D66F}","z"],["\u{1D670}","A"],["\u{1D671}","B"],["\u{1D672}","C"],["\u{1D673}","D"],["\u{1D674}","E"],["\u{1D675}","F"],["\u{1D676}","G"],["\u{1D677}","H"],["\u{1D678}","I"],["\u{1D679}","J"],["\u{1D67A}","K"],["\u{1D67B}","L"],["\u{1D67C}","M"],["\u{1D67D}","N"],["\u{1D67E}","O"],["\u{1D67F}","P"],["\u{1D680}","Q"],["\u{1D681}","R"],["\u{1D682}","S"],["\u{1D683}","T"],["\u{1D684}","U"],["\u{1D685}","V"],["\u{1D686}","W"],["\u{1D687}","X"],["\u{1D688}","Y"],["\u{1D689}","Z"],["\u{1D68A}","a"],["\u{1D68B}","b"],["\u{1D68C}","c"],["\u{1D68D}","d"],["\u{1D68E}","e"],["\u{1D68F}","f"],["\u{1D690}","g"],["\u{1D691}","h"],["\u{1D692}","i"],["\u{1D693}","j"],["\u{1D694}","k"],["\u{1D695}","l"],["\u{1D696}","m"],["\u{1D697}","n"],["\u{1D698}","o"],["\u{1D699}","p"],["\u{1D69A}","q"],["\u{1D69B}","r"],["\u{1D69C}","s"],["\u{1D69D}","t"],["\u{1D69E}","u"],["\u{1D69F}","v"],["\u{1D6A0}","w"],["\u{1D6A1}","x"],["\u{1D6A2}","y"],["\u{1D6A3}","z"],["\u{1D6A4}","l"],["\u{1D6A5}","j"],["\u{1D6E2}","A"],["\u{1D6E3}","B"],["\u{1D6E4}","G"],["\u{1D6E5}","D"],["\u{1D6E6}","E"],["\u{1D6E7}","Z"],["\u{1D6E8}","I"],["\u{1D6E9}","TH"],["\u{1D6EA}","I"],["\u{1D6EB}","K"],["\u{1D6EC}","L"],["\u{1D6ED}","M"],["\u{1D6EE}","N"],["\u{1D6EF}","KS"],["\u{1D6F0}","O"],["\u{1D6F1}","P"],["\u{1D6F2}","R"],["\u{1D6F3}","TH"],["\u{1D6F4}","S"],["\u{1D6F5}","T"],["\u{1D6F6}","Y"],["\u{1D6F7}","F"],["\u{1D6F8}","x"],["\u{1D6F9}","PS"],["\u{1D6FA}","O"],["\u{1D6FB}","D"],["\u{1D6FC}","a"],["\u{1D6FD}","b"],["\u{1D6FE}","g"],["\u{1D6FF}","d"],["\u{1D700}","e"],["\u{1D701}","z"],["\u{1D702}","i"],["\u{1D703}","th"],["\u{1D704}","i"],["\u{1D705}","k"],["\u{1D706}","l"],["\u{1D707}","m"],["\u{1D708}","n"],["\u{1D709}","ks"],["\u{1D70A}","o"],["\u{1D70B}","p"],["\u{1D70C}","r"],["\u{1D70D}","s"],["\u{1D70E}","s"],["\u{1D70F}","t"],["\u{1D710}","y"],["\u{1D711}","f"],["\u{1D712}","x"],["\u{1D713}","ps"],["\u{1D714}","o"],["\u{1D715}","d"],["\u{1D716}","E"],["\u{1D717}","TH"],["\u{1D718}","K"],["\u{1D719}","f"],["\u{1D71A}","r"],["\u{1D71B}","p"],["\u{1D71C}","A"],["\u{1D71D}","V"],["\u{1D71E}","G"],["\u{1D71F}","D"],["\u{1D720}","E"],["\u{1D721}","Z"],["\u{1D722}","I"],["\u{1D723}","TH"],["\u{1D724}","I"],["\u{1D725}","K"],["\u{1D726}","L"],["\u{1D727}","M"],["\u{1D728}","N"],["\u{1D729}","KS"],["\u{1D72A}","O"],["\u{1D72B}","P"],["\u{1D72C}","S"],["\u{1D72D}","TH"],["\u{1D72E}","S"],["\u{1D72F}","T"],["\u{1D730}","Y"],["\u{1D731}","F"],["\u{1D732}","X"],["\u{1D733}","PS"],["\u{1D734}","O"],["\u{1D735}","D"],["\u{1D736}","a"],["\u{1D737}","v"],["\u{1D738}","g"],["\u{1D739}","d"],["\u{1D73A}","e"],["\u{1D73B}","z"],["\u{1D73C}","i"],["\u{1D73D}","th"],["\u{1D73E}","i"],["\u{1D73F}","k"],["\u{1D740}","l"],["\u{1D741}","m"],["\u{1D742}","n"],["\u{1D743}","ks"],["\u{1D744}","o"],["\u{1D745}","p"],["\u{1D746}","r"],["\u{1D747}","s"],["\u{1D748}","s"],["\u{1D749}","t"],["\u{1D74A}","y"],["\u{1D74B}","f"],["\u{1D74C}","x"],["\u{1D74D}","ps"],["\u{1D74E}","o"],["\u{1D74F}","a"],["\u{1D750}","e"],["\u{1D751}","i"],["\u{1D752}","k"],["\u{1D753}","f"],["\u{1D754}","r"],["\u{1D755}","p"],["\u{1D756}","A"],["\u{1D757}","B"],["\u{1D758}","G"],["\u{1D759}","D"],["\u{1D75A}","E"],["\u{1D75B}","Z"],["\u{1D75C}","I"],["\u{1D75D}","TH"],["\u{1D75E}","I"],["\u{1D75F}","K"],["\u{1D760}","L"],["\u{1D761}","M"],["\u{1D762}","N"],["\u{1D763}","KS"],["\u{1D764}","O"],["\u{1D765}","P"],["\u{1D766}","R"],["\u{1D767}","TH"],["\u{1D768}","S"],["\u{1D769}","T"],["\u{1D76A}","Y"],["\u{1D76B}","F"],["\u{1D76C}","X"],["\u{1D76D}","PS"],["\u{1D76E}","O"],["\u{1D76F}","D"],["\u{1D770}","a"],["\u{1D771}","v"],["\u{1D772}","g"],["\u{1D773}","d"],["\u{1D774}","e"],["\u{1D775}","z"],["\u{1D776}","i"],["\u{1D777}","th"],["\u{1D778}","i"],["\u{1D779}","k"],["\u{1D77A}","l"],["\u{1D77B}","m"],["\u{1D77C}","n"],["\u{1D77D}","ks"],["\u{1D77E}","o"],["\u{1D77F}","p"],["\u{1D780}","r"],["\u{1D781}","s"],["\u{1D782}","s"],["\u{1D783}","t"],["\u{1D784}","y"],["\u{1D785}","f"],["\u{1D786}","x"],["\u{1D787}","ps"],["\u{1D788}","o"],["\u{1D789}","a"],["\u{1D78A}","e"],["\u{1D78B}","i"],["\u{1D78C}","k"],["\u{1D78D}","f"],["\u{1D78E}","r"],["\u{1D78F}","p"],["\u{1D790}","A"],["\u{1D791}","V"],["\u{1D792}","G"],["\u{1D793}","D"],["\u{1D794}","E"],["\u{1D795}","Z"],["\u{1D796}","I"],["\u{1D797}","TH"],["\u{1D798}","I"],["\u{1D799}","K"],["\u{1D79A}","L"],["\u{1D79B}","M"],["\u{1D79C}","N"],["\u{1D79D}","KS"],["\u{1D79E}","O"],["\u{1D79F}","P"],["\u{1D7A0}","S"],["\u{1D7A1}","TH"],["\u{1D7A2}","S"],["\u{1D7A3}","T"],["\u{1D7A4}","Y"],["\u{1D7A5}","F"],["\u{1D7A6}","X"],["\u{1D7A7}","PS"],["\u{1D7A8}","O"],["\u{1D7A9}","D"],["\u{1D7AA}","av"],["\u{1D7AB}","g"],["\u{1D7AC}","d"],["\u{1D7AD}","e"],["\u{1D7AE}","z"],["\u{1D7AF}","i"],["\u{1D7B0}","i"],["\u{1D7B1}","th"],["\u{1D7B2}","i"],["\u{1D7B3}","k"],["\u{1D7B4}","l"],["\u{1D7B5}","m"],["\u{1D7B6}","n"],["\u{1D7B7}","ks"],["\u{1D7B8}","o"],["\u{1D7B9}","p"],["\u{1D7BA}","r"],["\u{1D7BB}","s"],["\u{1D7BC}","s"],["\u{1D7BD}","t"],["\u{1D7BE}","y"],["\u{1D7BF}","f"],["\u{1D7C0}","x"],["\u{1D7C1}","ps"],["\u{1D7C2}","o"],["\u{1D7C3}","a"],["\u{1D7C4}","e"],["\u{1D7C5}","i"],["\u{1D7C6}","k"],["\u{1D7C7}","f"],["\u{1D7C8}","r"],["\u{1D7C9}","p"],["\u{1D7CA}","F"],["\u{1D7CB}","f"],["\u249C","(a)"],["\u249D","(b)"],["\u249E","(c)"],["\u249F","(d)"],["\u24A0","(e)"],["\u24A1","(f)"],["\u24A2","(g)"],["\u24A3","(h)"],["\u24A4","(i)"],["\u24A5","(j)"],["\u24A6","(k)"],["\u24A7","(l)"],["\u24A8","(m)"],["\u24A9","(n)"],["\u24AA","(o)"],["\u24AB","(p)"],["\u24AC","(q)"],["\u24AD","(r)"],["\u24AE","(s)"],["\u24AF","(t)"],["\u24B0","(u)"],["\u24B1","(v)"],["\u24B2","(w)"],["\u24B3","(x)"],["\u24B4","(y)"],["\u24B5","(z)"],["\u24B6","(A)"],["\u24B7","(B)"],["\u24B8","(C)"],["\u24B9","(D)"],["\u24BA","(E)"],["\u24BB","(F)"],["\u24BC","(G)"],["\u24BD","(H)"],["\u24BE","(I)"],["\u24BF","(J)"],["\u24C0","(K)"],["\u24C1","(L)"],["\u24C3","(N)"],["\u24C4","(O)"],["\u24C5","(P)"],["\u24C6","(Q)"],["\u24C7","(R)"],["\u24C8","(S)"],["\u24C9","(T)"],["\u24CA","(U)"],["\u24CB","(V)"],["\u24CC","(W)"],["\u24CD","(X)"],["\u24CE","(Y)"],["\u24CF","(Z)"],["\u24D0","(a)"],["\u24D1","(b)"],["\u24D2","(c)"],["\u24D3","(d)"],["\u24D4","(e)"],["\u24D5","(f)"],["\u24D6","(g)"],["\u24D7","(h)"],["\u24D8","(i)"],["\u24D9","(j)"],["\u24DA","(k)"],["\u24DB","(l)"],["\u24DC","(m)"],["\u24DD","(n)"],["\u24DE","(o)"],["\u24DF","(p)"],["\u24E0","(q)"],["\u24E1","(r)"],["\u24E2","(s)"],["\u24E3","(t)"],["\u24E4","(u)"],["\u24E5","(v)"],["\u24E6","(w)"],["\u24E7","(x)"],["\u24E8","(y)"],["\u24E9","(z)"],["\u010A","C"],["\u010B","c"],["\u0120","G"],["\u0121","g"],["\u0126","H"],["\u0127","h"],["\u017B","Z"],["\u017C","z"],["\u{1D7CE}","0"],["\u{1D7CF}","1"],["\u{1D7D0}","2"],["\u{1D7D1}","3"],["\u{1D7D2}","4"],["\u{1D7D3}","5"],["\u{1D7D4}","6"],["\u{1D7D5}","7"],["\u{1D7D6}","8"],["\u{1D7D7}","9"],["\u{1D7D8}","0"],["\u{1D7D9}","1"],["\u{1D7DA}","2"],["\u{1D7DB}","3"],["\u{1D7DC}","4"],["\u{1D7DD}","5"],["\u{1D7DE}","6"],["\u{1D7DF}","7"],["\u{1D7E0}","8"],["\u{1D7E1}","9"],["\u{1D7E2}","0"],["\u{1D7E3}","1"],["\u{1D7E4}","2"],["\u{1D7E5}","3"],["\u{1D7E6}","4"],["\u{1D7E7}","5"],["\u{1D7E8}","6"],["\u{1D7E9}","7"],["\u{1D7EA}","8"],["\u{1D7EB}","9"],["\u{1D7EC}","0"],["\u{1D7ED}","1"],["\u{1D7EE}","2"],["\u{1D7EF}","3"],["\u{1D7F0}","4"],["\u{1D7F1}","5"],["\u{1D7F2}","6"],["\u{1D7F3}","7"],["\u{1D7F4}","8"],["\u{1D7F5}","9"],["\u{1D7F6}","0"],["\u{1D7F7}","1"],["\u{1D7F8}","2"],["\u{1D7F9}","3"],["\u{1D7FA}","4"],["\u{1D7FB}","5"],["\u{1D7FC}","6"],["\u{1D7FD}","7"],["\u{1D7FE}","8"],["\u{1D7FF}","9"],["\u2460","1"],["\u2461","2"],["\u2462","3"],["\u2463","4"],["\u2464","5"],["\u2465","6"],["\u2466","7"],["\u2467","8"],["\u2468","9"],["\u2469","10"],["\u246A","11"],["\u246B","12"],["\u246C","13"],["\u246D","14"],["\u246E","15"],["\u246F","16"],["\u2470","17"],["\u2471","18"],["\u2472","19"],["\u2473","20"],["\u2474","1"],["\u2475","2"],["\u2476","3"],["\u2477","4"],["\u2478","5"],["\u2479","6"],["\u247A","7"],["\u247B","8"],["\u247C","9"],["\u247D","10"],["\u247E","11"],["\u247F","12"],["\u2480","13"],["\u2481","14"],["\u2482","15"],["\u2483","16"],["\u2484","17"],["\u2485","18"],["\u2486","19"],["\u2487","20"],["\u2488","1."],["\u2489","2."],["\u248A","3."],["\u248B","4."],["\u248C","5."],["\u248D","6."],["\u248E","7."],["\u248F","8."],["\u2490","9."],["\u2491","10."],["\u2492","11."],["\u2493","12."],["\u2494","13."],["\u2495","14."],["\u2496","15."],["\u2497","16."],["\u2498","17."],["\u2499","18."],["\u249A","19."],["\u249B","20."],["\u24EA","0"],["\u24EB","11"],["\u24EC","12"],["\u24ED","13"],["\u24EE","14"],["\u24EF","15"],["\u24F0","16"],["\u24F1","17"],["\u24F2","18"],["\u24F3","19"],["\u24F4","20"],["\u24F5","1"],["\u24F6","2"],["\u24F7","3"],["\u24F8","4"],["\u24F9","5"],["\u24FA","6"],["\u24FB","7"],["\u24FC","8"],["\u24FD","9"],["\u24FE","10"],["\u24FF","0"],["\u{1F670}","&"],["\u{1F671}","&"],["\u{1F672}","&"],["\u{1F673}","&"],["\u{1F674}","&"],["\u{1F675}","&"],["\u{1F676}",'"'],["\u{1F677}",'"'],["\u{1F678}",'"'],["\u203D","?!"],["\u{1F679}","?!"],["\u{1F67A}","?!"],["\u{1F67B}","?!"],["\u{1F67C}","/"],["\u{1F67D}","\\"],["\u{1F707}","AR"],["\u{1F708}","V"],["\u{1F709}","V"],["\u{1F706}","VR"],["\u{1F705}","VF"],["\u{1F729}","2"],["\u{1F72A}","5"],["\u{1F761}","f"],["\u{1F762}","W"],["\u{1F763}","U"],["\u{1F767}","V"],["\u{1F768}","T"],["\u{1F76A}","V"],["\u{1F76B}","MB"],["\u{1F76C}","VB"],["\u{1F772}","3B"],["\u{1F773}","3B"],["\u{1F4AF}","100"],["\u{1F519}","BACK"],["\u{1F51A}","END"],["\u{1F51B}","ON!"],["\u{1F51C}","SOON"],["\u{1F51D}","TOP"],["\u{1F51E}","18"],["\u{1F524}","abc"],["\u{1F520}","ABCD"],["\u{1F521}","abcd"],["\u{1F522}","1234"],["\u{1F523}","T&@%"],["#\uFE0F\u20E3","#"],["*\uFE0F\u20E3","*"],["0\uFE0F\u20E3","0"],["1\uFE0F\u20E3","1"],["2\uFE0F\u20E3","2"],["3\uFE0F\u20E3","3"],["4\uFE0F\u20E3","4"],["5\uFE0F\u20E3","5"],["6\uFE0F\u20E3","6"],["7\uFE0F\u20E3","7"],["8\uFE0F\u20E3","8"],["9\uFE0F\u20E3","9"],["\u{1F51F}","10"],["\u{1F170}\uFE0F","A"],["\u{1F171}\uFE0F","B"],["\u{1F18E}","AB"],["\u{1F191}","CL"],["\u{1F17E}\uFE0F","O"],["\u{1F17F}","P"],["\u{1F198}","SOS"],["\u{1F172}","C"],["\u{1F173}","D"],["\u{1F174}","E"],["\u{1F175}","F"],["\u{1F176}","G"],["\u{1F177}","H"],["\u{1F178}","I"],["\u{1F179}","J"],["\u{1F17A}","K"],["\u{1F17B}","L"],["\u{1F17C}","M"],["\u{1F17D}","N"],["\u{1F180}","Q"],["\u{1F181}","R"],["\u{1F182}","S"],["\u{1F183}","T"],["\u{1F184}","U"],["\u{1F185}","V"],["\u{1F186}","W"],["\u{1F187}","X"],["\u{1F188}","Y"],["\u{1F189}","Z"],["\u2212","-"],["\u2053","-"]],bC=new Map(yC),Wu=bC});var uy,Uo,Ku,dy=S(()=>{uy=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],Uo={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:uy,nb:uy,de:[["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xDF","ss"],["\u1E9E","Ss"]],tr:[["\xE2","a"],["\xC2","A"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"]],hu:[["\u0171","u"],["\u0170","U"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"],["\xE1","a"],["\xC1","A"],["\xE9","e"],["\xC9","E"],["\xED","i"],["\xCD","I"],["\xF3","o"],["\xD3","O"],["\xFA","u"],["\xDA","U"]],sr:[["\u0452","dj"],["\u0402","Dj"],["\u045F","dz"],["\u040F","Dz"],["\u0459","lj"],["\u0409","Lj"],["\u045A","nj"],["\u040A","Nj"],["\u045B","c"],["\u040B","C"],["\u0447","ch"],["\u0427","Ch"],["\u0448","sh"],["\u0428","Sh"],["\u0436","zh"],["\u0416","Zh"]]};for(let t of Object.keys(Uo))Uo[t]=new Map(Uo[t]);Ku=Uo});function Hu(t,e){if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={customReplacements:[],...e};let n=vC(e.locale),r=Wu,s=e.customReplacements.length>0||e.customReplacements.size>0;if(n||s){if(r=new Map(Wu),n)for(let[i,o]of n)r.set(i,o);for(let[i,o]of e.customReplacements)r.set(i,o)}return t=t.normalize(),t=wC(t,r),t=t.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),t=t.replaceAll(/\p{Dash_Punctuation}/gu,"-"),t}var wC,vC,fy=S(()=>{cy();dy();wC=(t,e)=>{for(let[n,r]of e)t=t.replaceAll(n,r);return t},vC=t=>{if(!t)return;let e=t.toLowerCase().replace(/^no(-|$)/,"nb$1");return Ku[e]||Ku[e.split("-")[0]]||void 0}});var SC,py,hy=S(()=>{SC=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],py=SC});function zu(t,e){if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let n=e.preserveLeadingUnderscore&&t.startsWith("_"),r=e.preserveTrailingDash&&t.endsWith("-");if(e.transliterate){let i=new Map([...py,...e.customReplacements]);t=Hu(t,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)t=t.replaceAll(i,o);e.decamelize&&(t=kC(t));let s=EC(e);return e.lowercase&&(t=e.locale?t.toLocaleLowerCase(e.locale):t.toLowerCase()),t=t.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),t=t.replace(s,e.separator),t=t.replaceAll("\\",""),e.separator&&(t=xC(t,e.separator)),n&&(t=`_${t}`),r&&(t=`${t}-`),t}var kC,xC,EC,my=S(()=>{ly();fy();hy();kC=t=>t.replaceAll(/([A-Z]{2,})(\d+)/g,"$1 $2").replaceAll(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").replaceAll(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"),xC=(t,e)=>{let n=Fo(e);return t.replaceAll(new RegExp(`(?:${n}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${n})|(?:${n})$`,"g"),"")},EC=t=>{let e=String.raw`a-z\d`;if(e+=t.lowercase?"":"A-Z",t.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),t.preserveCharacters.length>0)for(let r of t.preserveCharacters){if(r===t.separator)throw new Error(`The separator character \`${t.separator}\` cannot be included in preserved characters: ${t.preserveCharacters}`);e+=Fo(r)}let n=t.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,n)}});function nr(t){return zu(t)}var gy=S(()=>{my()});var rr,yy,by=S(()=>{rr={local:"local",ide:"ide",published:"published",inline:"inline"},yy=Object.values(rr).map(t=>`'${t}'`).join(" | ")});var Os,Yu,wy=S(()=>{Os=` *, *::before, *::after { box-sizing: border-box; }
|
|
170
170
|
canvas { max-width: 100%; }
|
|
171
171
|
body { margin: 0; display: flow-root; font-family: system-ui, -apple-system, sans-serif; }
|
|
172
172
|
html[data-theme="dark"] { color-scheme: dark; }
|
|
173
|
-
html[data-theme="light"] { color-scheme: light; }`,
|
|
173
|
+
html[data-theme="light"] { color-scheme: light; }`,Yu=" html, body { height: 100%; }"});var vy,Sy=S(()=>{vy=`(function () {
|
|
174
174
|
var W = window, D = document;
|
|
175
175
|
var TAIL_MS = 1500, TOL = 2, THROTTLE_MS = 200;
|
|
176
176
|
var SCROLL_KEYS = { ' ': 1, ArrowUp: 1, ArrowDown: 1, PageUp: 1, PageDown: 1, Home: 1, End: 1 };
|
|
@@ -238,7 +238,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
238
238
|
top: function () { disarm(); write(0); report(0); },
|
|
239
239
|
flush: flush
|
|
240
240
|
};
|
|
241
|
-
})();`});var
|
|
241
|
+
})();`});var ky,xy=S(()=>{ky=`(function () {
|
|
242
242
|
var W = window;
|
|
243
243
|
var rtData, rtInsight, rtHasInsight = false;
|
|
244
244
|
var applyData, applyInsight, send;
|
|
@@ -292,51 +292,51 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
292
292
|
return publish();
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
|
-
})();`});var te=S(()=>{
|
|
296
|
-
\u2026[${t.length-
|
|
297
|
-
`).map(i=>i.trim()).filter(Boolean),n=e[0];if(!n)return"";let r=n.length>300?n.slice(0,300).trimEnd()+"\u2026":n,s=e.length-1;return s>0?r+
|
|
298
|
-
`);o.partial&&a.shift();let l=[];for(let u of a)if(u.trim())try{l.push(JSON.parse(u))}catch{}if(o.partial&&!l.some(u=>u.type==="user"||u.type==="assistant"))continue;let c,f;for(let u=l.length-1;u>=0&&!f;u--){let p=l[u];p?.type==="assistant"&&(c??=p,!p.isApiErrorMessage&&p.message?.usage&&(f=p))}let d=f?.message?.usage;if(s={tokens:d?(d.input_tokens??0)+(d.output_tokens??0)+(d.cache_read_input_tokens??0)+(d.cache_creation_input_tokens??0):r?.tokens,model:f?.message?.model??r?.model,effort:f?.effort??r?.effort,running:
|
|
299
|
-
`))if(e.includes('"modelId"'))try{let n=JSON.parse(e).attachment?.identity?.modelId;if(n)return n}catch{}}function
|
|
300
|
-
`):t==null?"":
|
|
295
|
+
})();`});var te=S(()=>{Di();rc();sh();lh();Ju();ay();gy();by();wy();Sy();xy();Bi()});function fe(t){let e=Math.max(0,Math.round(t/1e3));if(e<60)return`${e}s`;let n=Math.floor(e/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Ty(t,e){if(!e)return t;let n=t.replace(/\\/g,"/"),r=e.replace(/\\/g,"/").replace(/\/+$/,"");return n.toLowerCase().startsWith(r.toLowerCase()+"/")?n.slice(r.length+1):t}function Cy(t){return t.replace(/[/\\]+$/,"").split(/[/\\]/).pop()??""}function Oy(t){return!t||typeof t!="object"?"":Z(t.command)??Z(t.file_path)??Z(t.filePath)??Z(t.path)??Z(t.pattern)??Z(t.query)??Z(t.url)??Z(t.skill)??Z(t.description)??""}function Gu(t){let e=/^mcp__(.+?)__(.+)$/.exec(t);return e?`${e[1][0].toUpperCase()}${e[1].slice(1)} [${e[2]}]`:t}var Z,Ps,Ay,_s=S(()=>{"use strict";Z=t=>typeof t=="string"?t:void 0,Ps=t=>t.replace(/\u001b\[[0-9;]*m/g,""),Ay=t=>` (+${t} line${t===1?"":"s"})`});function _e(t){return t.length>Xu?t.slice(0,Xu)+`
|
|
296
|
+
\u2026[${t.length-Xu} more characters truncated]`:t}function Be(t){let e=Ps(t).split(`
|
|
297
|
+
`).map(i=>i.trim()).filter(Boolean),n=e[0];if(!n)return"";let r=n.length>300?n.slice(0,300).trimEnd()+"\u2026":n,s=e.length-1;return s>0?r+Ay(s):r}var Xu,Te,qo,Rs=S(()=>{"use strict";_s();Xu=5e4,Te=(t,e,n=e+"s")=>`${t} ${t===1?e:n}`;qo=(t,e)=>``});import{closeSync as Py,existsSync as AC,fstatSync as TC,openSync as _y,readdirSync as CC,readSync as Ry,statSync as OC}from"fs";import{join as PC}from"path";function sr(t,e){let n;try{n=_y(t,"r")}catch{return}try{let r=Buffer.alloc(e),s=Ry(n,r,0,e,0);return{text:r.subarray(0,s).toString("utf8"),bytes:s}}finally{Py(n)}}function Jo(t,e){let n;try{n=_y(t,"r")}catch{return}try{let r=TC(n).size,s=Math.min(e,r),i=Buffer.alloc(s),o=Ry(n,i,0,s,r-s);return{text:i.subarray(0,o).toString("utf8"),partial:r>s}}finally{Py(n)}}function Wo(t){if(!AC(t))return[];let e;try{e=CC(t)}catch{return[]}let n=[];for(let r of e){if(!r.endsWith(".jsonl"))continue;let s=PC(t,r);try{let i=OC(s);i.isFile()&&n.push({sessionId:r.slice(0,-6),file:s,mtime:i.mtimeMs})}catch{}}return n}var Ko=S(()=>{"use strict"});var qt,Ho=S(()=>{"use strict";qt=class{ensureHarnessSupport(){}forRead(){return this}linker(){return{link(){}}}}});import{openSync as _C,readSync as RC,closeSync as IC,statSync as My,readdirSync as Dy,readFileSync as By,existsSync as $C}from"fs";import{join as mn}from"path";import{homedir as NC}from"os";function LC(t){return t.replace(/[^a-zA-Z0-9]/g,"-")}function DC(t,e,n){let r=mn(Qu(t,e),n,MC),s;try{s=Dy(r)}catch{return[]}let i=oO(t,n),o=[];for(let a of s){if(!a.endsWith(".jsonl"))continue;let l=mn(r,a),c;try{c=My(l)}catch{continue}let f=a.slice(0,-6),d={};try{d=JSON.parse(By(mn(r,`${f}.meta.json`),"utf8"))}catch{}let u=FC(l,c.size,c.mtimeMs);o.push({id:f.startsWith("agent-")?f.slice(6):f,file:l,mtime:c.mtimeMs,started:c.birthtimeMs||void 0,tokens:u.tokens,failing:u.failing,running:!!u.running&&(i===void 0||c.mtimeMs>=i),liveSince:i,label:d.description??"",kind:d.agentType===BC?void 0:d.agentType,model:u.model?.replace(/^claude-/,"").replace(/-\d{8}$/,"")??d.model,effort:u.effort,spawnId:d.toolUseId,parentId:d.parentAgentId,depth:d.spawnDepth??1,stopped:!!d.stoppedByUser||!!u.stopped})}return o}function FC(t,e,n){let r=Iy.get(t);if(r&&r.size===e&&r.mtime===n)return r;let s={};for(let i of jC){let o=Jo(t,i);if(!o)break;let a=o.text.split(`
|
|
298
|
+
`);o.partial&&a.shift();let l=[];for(let u of a)if(u.trim())try{l.push(JSON.parse(u))}catch{}if(o.partial&&!l.some(u=>u.type==="user"||u.type==="assistant"))continue;let c,f;for(let u=l.length-1;u>=0&&!f;u--){let p=l[u];p?.type==="assistant"&&(c??=p,!p.isApiErrorMessage&&p.message?.usage&&(f=p))}let d=f?.message?.usage;if(s={tokens:d?(d.input_tokens??0)+(d.output_tokens??0)+(d.cache_read_input_tokens??0)+(d.cache_creation_input_tokens??0):r?.tokens,model:f?.message?.model??r?.model,effort:f?.effort??r?.effort,running:jy(l),failing:!!c?.isApiErrorMessage,stopped:qC(l)},!(s.tokens===void 0&&o.partial))break}return s.model??=UC(t),Iy.set(t,{size:e,mtime:n,...s}),s}function UC(t){for(let e of(sr(t,256*1024)?.text??"").split(`
|
|
299
|
+
`))if(e.includes('"modelId"'))try{let n=JSON.parse(e).attachment?.identity?.modelId;if(n)return n}catch{}}function jy(t){let e;for(let i of t)(i.type==="user"||i.type==="assistant")&&(e=i);if(!e)return!1;if(e.type==="user"){try{if(JC(e,t))return!1;let i=e.message?.content,o=typeof i=="string"?i:Array.isArray(i)?i.filter(a=>a&&a.type==="text").map(a=>a.text??"").join(""):"";if(!ed(e)&&o.trim()&&Jt(o)==="")return!1}catch{}return!0}let r=(Array.isArray(e.message?.content)?e.message.content:[]).filter(i=>i.type==="tool_use").map(i=>i.id);if(r.length===0)return!e.message?.stop_reason||e.message.stop_reason==="tool_use";let s=new Set;for(let i of t){let o=i.message?.content;if(Array.isArray(o))for(let a of o)a.type==="tool_result"&&a.tool_use_id&&s.add(a.tool_use_id)}return r.some(i=>i&&!s.has(i))}function qC(t){let e;for(let s of t)(s.type==="user"||s.type==="assistant")&&(e=s);let n=e?.type==="user"&&!ed(e)?e.message?.content:void 0,r=typeof n=="string"?n:Array.isArray(n)?n.filter(s=>s?.type==="text").map(s=>s.text??"").join(""):"";return/^\[Request interrupted by user\b/.test(r.trim())}function JC(t,e){let n=t.message?.content,r=Array.isArray(n)?n.filter(i=>i?.type==="tool_result").map(i=>i.tool_use_id):[];if(r.length===0)return!1;let s=new Set;for(let i of e){let o=i.type==="assistant"?i.message?.content:void 0;if(Array.isArray(o))for(let a of o)a?.type==="tool_use"&&a.name==="SubagentHandback"&&s.add(a.id)}return r.every(i=>s.has(i))}function Yo(t){let e=t?.type==="image"?t.source:void 0;return e?.type==="base64"&&e.data?qo(e.data,e.media_type):""}function Is(t){return typeof t=="string"?_e(t):Array.isArray(t)?t.map(e=>{if(typeof e=="string")return _e(e);let n=e;return typeof n?.text=="string"?_e(n.text):n?.content!=null?Is(n.content):Yo(n)}).join(`
|
|
300
|
+
`):t==null?"":_e(JSON.stringify(t))}function Fy(t){let e=t.trim();return!!e&&WC.some(n=>n.exec(e)?.index===0)}function KC(t){return!t.trim()||Fy(t)}function zC(t){return t.replace(HC,"")}function YC(t){let e=/^<command-name>([\s\S]*?)<\/command-name>/.exec(t)?.[1]?.trim();if(!e)return;let n=/<command-args>([\s\S]*?)<\/command-args>/.exec(t)?.[1]?.trim();return n?`${e} ${n}`:e}function Jt(t){let e=zC(t).trim();return e?YC(e)??(Fy(e)?"":e):""}function Vo(t){let e=VC.exec(t.trim());if(e)return{from:e[1],body:XC(e[2].replace(GC,""))}}function XC(t){let e=t.split(`
|
|
301
301
|
`).filter(r=>r.trim()).map(r=>r.length-r.trimStart().length),n=e.length?Math.min(...e):0;return n?t.split(`
|
|
302
302
|
`).map(r=>r.slice(n)).join(`
|
|
303
|
-
`):t}function
|
|
304
|
-
`).length,"line")}`;if(n.mode==="content")return
|
|
303
|
+
`):t}function zo(t){let e=Vo(t);return e?{type:"user",text:e.body,agent:{from:e.from}}:{type:"user",text:t}}function QC(t){let e=t.message?.content;return typeof e=="string"&&!!Vo(e)}function ZC(t){let e=t.message?.content;return typeof e=="string"&&e.startsWith($y)?e.slice($y.length).trim():void 0}function Zu(t){return t?.type==="text"&&typeof t.text=="string"?Jt(t.text):""}function tO(t){let e=t.message?.content,n=t.type==="attachment"&&t.attachment?.type==="queued_command"?Is(t.attachment.prompt):t.type==="user"&&t.isMeta&&!(Array.isArray(e)&&e.some(s=>s?.type==="tool_result"))?Is(e):"";if(!n.includes("<task-notification>"))return[];let r=[];for(let[,s]of n.matchAll(eO)){let i=/<tool-use-id>([^<]+)<\/tool-use-id>/.exec(s)?.[1],o=/<status>([^<]+)<\/status>/.exec(s)?.[1];if(!i||!o||o==="running")continue;let a=/\bexit(?: code)? (\d+)/.exec(/<summary>([\s\S]*?)<\/summary>/.exec(s)?.[1]??"")?.[1],l=/<output-file>([^<]+)<\/output-file>/.exec(s)?.[1];r.push({type:"task_done",id:i,outcome:o,exit:a===void 0?void 0:Number(a),output:l})}return r}function td(t,e){if(typeof t=="string")return Be(t);if(!t||typeof t!="object")return Be(e);let n=t;if(n.type==="text"&&typeof n.file?.numLines=="number")return Te(n.file.numLines,"line");if(n.type==="image"){let r=Ny(n.file?.originalSize);return r?`image (${r})`:"image"}if(n.type==="pdf"){let r=Ny(n.file?.originalSize);return r?`PDF (${r})`:"PDF"}if(n.type==="parts"&&typeof n.file?.count=="number")return Te(n.file.count,"page");if(n.type==="file_unchanged")return"unchanged since last read";if(n.type==="create"&&typeof n.content=="string")return`created, ${Te(n.content.split(`
|
|
304
|
+
`).length,"line")}`;if(n.mode==="content")return Te(n.numLines??0,"line");if(n.mode==="count")return`${Te(n.numMatches??0,"match","matches")} (${Te(n.numFiles??0,"file")})`;if(n.mode==="files_with_matches")return Te(n.numFiles??0,"file");if(Array.isArray(n.structuredPatch)){let r=0,s=0;for(let i of n.structuredPatch)for(let o of i?.lines??[])typeof o=="string"&&(o.startsWith("+")?r++:o.startsWith("-")&&s++);return`+${r} \u2212${s}`}return typeof n.stdout=="string"||typeof n.stderr=="string"?n.backgroundTaskId?"running in background":n.interrupted?"interrupted":Be(n.stdout||n.stderr||"")||"no output":typeof n.code=="number"&&typeof n.codeText=="string"?`${n.code} ${n.codeText}`:typeof n.searchCount=="number"?Te(n.searchCount,"search","searches"):Array.isArray(n.matches)&&typeof n.total_deferred_tools=="number"?Te(n.matches.length,"tool"):Array.isArray(n.newTodos)?Te(n.newTodos.length,"todo"):typeof n.numFiles=="number"?Te(n.numFiles,"file"):Be(e)}function $s(t){return!!t.isMeta}function iO(t){let e;try{e=_C(t,"r")}catch{return""}try{let r=65536;try{r=My(t).size}catch{}let s=(c,f)=>{if(f<=0)return"";let d=Buffer.alloc(f),u=RC(e,d,0,f,c);return d.subarray(0,u).toString("utf8")},i=(c,f,d)=>{let u="";for(let p of c.split(`
|
|
305
305
|
`)){if(!p.includes(`"${f}"`))continue;let h;try{h=JSON.parse(p)}catch{continue}let m=h?.[d];h?.type===f&&typeof m=="string"&&m&&(u=m)}return u},o=s(0,Math.min(65536,r)),a=r>65536?s(r-65536,65536):"",l=i(a,"custom-title","customTitle")||i(o,"custom-title","customTitle")||i(a,"ai-title","aiTitle")||i(o,"ai-title","aiTitle");if(l)return l.replace(/\s+/g," ").trim().slice(0,200);for(let c of o.split(`
|
|
306
|
-
`)){if(!c.trim())continue;let f;try{f=JSON.parse(c)}catch{continue}if(!f
|
|
307
|
-
`;
|
|
308
|
-
`),d=l.filter(h=>h.type==="tool_use").map(h=>({id:h.id??"",name:h.name??"",input:h.input??{}}));if(c||f||d.length){let h=Date.parse(n.timestamp??""),m=!isNaN(h)&&h>=r;o.push({type:"assistant",text:c,thinking:f,tools:d,live:m,error:n.isApiErrorMessage||void 0})}(n.message?.stop_reason==="end_turn"||d.some(h=>h.name==="SubagentHandback"))&&o.push({type:"turn_end"});for(let h of d)if(
|
|
309
|
-
`).at(-1);throw new Error(r.code==="ENOENT"?"the codex CLI is not on PATH":`the codex CLI could not report its app server (${s})`)}let e;try{e=JSON.parse(t)}catch{throw new Error(`the codex CLI's daemon report was not JSON: ${t.trim().slice(0,120)}`)}if(e.status!=="running")throw new Error(`no shared Codex app server is running (daemon status: ${e.status??"unknown"})`);if(!e.managedCodexPath||!e.socketPath)throw new Error("the codex CLI named no daemon binary or socket");return{exe:e.managedCodexPath,socket:e.socketPath}}function
|
|
306
|
+
`)){if(!c.trim())continue;let f;try{f=JSON.parse(c)}catch{continue}if(!f||$s(f)||f.type!=="user")continue;let d=f.message?.content,u="";typeof d=="string"?u=Jt(d):Array.isArray(d)&&(u=d.map(Zu).filter(Boolean).join(" "));let p=u.replace(/\s+/g," ").trim();if(p)return(p.replace(/^Continuing from a prior session\. Here is the summary of our work so far:\s*/i,"").trim()||p).slice(0,200)}return""}finally{IC(e)}}function Ns(t){let e=mn(t,"sessions"),n;try{n=Dy(e)}catch{return[]}let r=[];for(let s of n)if(s.endsWith(".json"))try{let i=JSON.parse(By(mn(e,s),"utf8"));if(!i?.sessionId)continue;process.kill(i.pid,0),r.push(i)}catch{}return r}function Ly(t,e){return Ns(t).some(n=>n.sessionId===e)}function oO(t,e){let n=Ns(t).filter(r=>r.sessionId===e).map(r=>r.startedAt);return n.length&&n.every(r=>typeof r=="number")?Math.min(...n):void 0}function aO(t){return new Set(Ns(t).filter(e=>e.status==="busy").map(e=>e.sessionId))}var ed,Qu,MC,BC,jC,Iy,WC,HC,VC,GC,$y,eO,nO,rO,sO,Ny,ir,Go=S(()=>{"use strict";Rs();Ko();Ho();_s();ed=t=>t.type==="user"&&Array.isArray(t.message?.content)&&t.message.content.some(e=>e?.type==="tool_result");Qu=(t,e)=>mn(t,"projects",LC(e)),MC="subagents";BC="general-purpose",jC=[256*1024,4*1024*1024,64*1024*1024],Iy=new Map;WC=[/\[Request interrupted by user\b/i,/\[Tool use was interrupted\]/i,/Claude Code returned an error/i,/\[ede_diagnostic\]/i,/^No response requested\.?$/i,/^<task-notification\b/i,/^<system-reminder\b/i,/^<local-command-stdout\b/i,/^<local-command-stderr\b/i];HC=/<ide_[a-z_]+>[\s\S]*?<\/ide_[a-z_]+>/gi;VC=/^(?:[^\n<][^\n]*\n)?<agent-message from="([^"]+)">\n([\s\S]*?)(?:\n?<\/agent-message>[\s\S]*)?$/,GC=/^\[[^\]\n]+\][\s\S]*?The report follows:\n/;$y=`The coordinator sent a message while you were working:
|
|
307
|
+
`;eO=/<task-notification>([\s\S]*?)<\/task-notification>/g;nO=/^(Command running in background with ID|Command did not complete within its \d+s timeout and was moved to the background|Async agent launched)/,rO=/\bID: ([A-Za-z0-9]+)/,sO=new Set(["TaskStop","KillShell"]),Ny=t=>typeof t!="number"?"":t<1024?`${t}B`:t<1048576?`${Math.round(t/1024)}KB`:`${(t/1048576).toFixed(1)}MB`;ir=class extends qt{constructor(n=mn(NC(),".claude")){super();this.root=n}displayName="Claude Mirror";detectsSelf(){return process.env.CLAUDECODE==="1"}detectsInstalled(){return $C(this.root)}sessionsDir(n){return Qu(this.root,n)}listSessionFiles(n){return Wo(Qu(this.root,n))}listChildren(n,r){return DC(this.root,n,r)}callerSessionId(){return process.env.CLAUDE_CODE_SESSION_ID||void 0}sessionCwd(n){return Ns(this.root).find(r=>r.sessionId===n)?.cwd}parseEntry(n){try{return JSON.parse(n)}catch{return null}}idOf(n){return n.uuid}parentOf(n){return n.parentUuid}linker(){let n=new Map,r=new Map;return{link(s){if(!s.uuid||n.has(s.uuid))return;let i=s.parentUuid===void 0?void 0:n.get(s.parentUuid),o=s.type==="assistant"?s.message?.id:ed(s)?i:void 0;o&&(i===o&&(s.parentUuid=r.get(o)),n.set(s.uuid,o),r.set(o,s.uuid))}}}timestampOf(n){return n.timestamp}isSidechain(n,r){return!!n.isSidechain!=(r==="child")}isLeafType(n){return n.type==="user"||n.type==="assistant"}isRecoveryNoise(n){return!!n.isApiErrorMessage}apply(n,r){let s=ZC(n);if(s)return{events:[zo(s)]};let i=tO(n);if(i.length)return{events:i};if($s(n)&&!QC(n))return{events:[]};let o=[];if(n.type==="user"){let a=n.message?.content;if(typeof a=="string"){let l=Jt(a);l&&o.push(zo(l))}else if(Array.isArray(a))for(let l of a)if(l?.type==="tool_result"){let c=Is(l.content),f=l.is_error?/^Exit code (\d+)/.exec(c)?.[1]:void 0,d=n.toolUseResult,u=nO.test(c)||!!d&&typeof d=="object"&&!!d.backgroundTaskId;o.push({type:"tool_result",id:l.tool_use_id??"",content:c,isError:!!l.is_error,digest:td(n.toolUseResult,c),exit:f===void 0?void 0:Number(f),background:u||void 0,task:u?rO.exec(c)?.[1]??Z(d?.backgroundTaskId):void 0,output:u?/Output is being written to: (\S.*?)\.?\s*$/m.exec(c)?.[1]:void 0,refused:!!l.is_error&&f===void 0||void 0})}else{let c=Zu(l)||Yo(l);c&&o.push(zo(c))}return{events:o}}if(n.type==="attachment"&&n.attachment?.type==="queued_command"){let a=Jt(Is(n.attachment.prompt));return a&&o.push(zo(a)),{events:o}}if(n.type==="assistant"){let a=n.message?.content,l=Array.isArray(a)?a:[],c=l.filter(h=>h.type==="text").map(h=>h.text??"").filter(h=>!KC(h)).join(""),f=l.filter(h=>h.type==="thinking").map(h=>h.thinking??"").join(`
|
|
308
|
+
`),d=l.filter(h=>h.type==="tool_use").map(h=>({id:h.id??"",name:h.name??"",input:h.input??{}}));if(c||f||d.length){let h=Date.parse(n.timestamp??""),m=!isNaN(h)&&h>=r;o.push({type:"assistant",text:c,thinking:f,tools:d,live:m,error:n.isApiErrorMessage||void 0})}(n.message?.stop_reason==="end_turn"||d.some(h=>h.name==="SubagentHandback"))&&o.push({type:"turn_end"});for(let h of d)if(sO.has(h.name)){let m=Z(h.input.task_id)??Z(h.input.shell_id);m&&o.push({type:"task_done",task:m,outcome:"stopped"})}let u=n.message?.usage??n.usage,p=u&&{in:u.input_tokens??0,out:u.output_tokens??0,cached:u.cache_read_input_tokens??0,cacheCreate:u.cache_creation_input_tokens??0};return{events:o,usage:p,model:n.message?.model}}return{events:o}}chainWorking(n){return jy(n)}sessionAlive(n){return Ly(this.root,n)}sessionEnded(n){return!Ly(this.root,n)}sessionsWorking(n){return aO(this.root)}sessionNames(){return new Map(Ns(this.root).filter(n=>n.name).map(n=>[n.sessionId,n.name]))}readPreview(n){return iO(n)}searchText(n){if(!n||$s(n)||n.type!=="user"&&n.type!=="assistant")return"";let r=n.message?.content,s="";if(typeof r=="string")s=Jt(r);else if(Array.isArray(r)){let i=r;s=n.type==="user"?i.map(Zu).filter(Boolean).join(" "):i.filter(o=>o.type==="text"&&typeof o.text=="string").map(o=>o.text).join(" ")}return s.replace(/\s+/g," ").trim()}}});function mt(t,e=!0){let n=[],r=0;for(let s of Ls(t).matchAll(e?/&&|\|\||[;|\n]/g:/&&|\|\||[;\n]/g))n.push({text:t.slice(r,s.index),at:r}),r=s.index+s[0].length;return n.push({text:t.slice(r),at:r}),n.filter(s=>s.text.trim())}function Xo(t){let e=[],n;for(;n=lO.exec(t);)n[1]&&e.push(n[1]),t=t.slice(n[0].length);return{dirs:e,rest:t}}function nd(t){if(/>|\btee\b/.test(Ls(t).replace(/\d?>&\d|\d?>\s*(\/dev\/null|\$null|NUL)\b/gi,"")))return!1;let e=Ms(t);for(;e.length&&(fO.has(e[0])||/^\w+=/.test(e[0]));)e=/^\w+=\$\(/.test(e[0])?[]:e.slice(1);if(!e.length)return!0;let[n,...r]=[e[0].replace(/^["'(]+/,"").toLowerCase(),...e.slice(1)];return n==="npx"&&(r=r.filter(s=>!s.startsWith("-")),n=(r.shift()??"").replace(/@.*$/,"").toLowerCase()),n==="for"?!0:n==="typebulb"?dO.has(r.find(s=>!s.startsWith("-"))??""):n==="git"?uO.has(r.find((s,i)=>!s.startsWith("-")&&!/^-[Cc]$/.test(r[i-1]??""))??""):n==="sed"?!r.some(s=>/^-[a-z]*i|^--in-place/.test(s)):n==="find"?!r.some(s=>/^-(delete|exec|execdir|ok)$/.test(s)):cO.has(n)||/^get-/.test(n)}function Uy(t){let e=[...t.matchAll(/\$\(|`/g)].map(n=>t.slice(n.index+n[0].length));return mt(t).every(n=>nd(n.text))&&e.every(n=>nd(mt(n)[0]?.text??""))}function Jy(t){if(/\bset\s+-\w*o\s+pipefail\b/.test(Ls(t)))return!1;let e=mt(mt(t,!1).at(-1)?.text??"");return e.length>1&&hO.has(Ms(e.at(-1).text)[0]?.toLowerCase()??"")}function rd(t){t=t.replace(mO,(s,i,o,a)=>`<<${i}${o}${i}${a} \u2026 ${o}`);let e=mt(t),n=e.findIndex(s=>!nd(s.text));if(/^\s*(do|then|else|elif)\b/.test(e[n]?.text??""))for(;n>0&&!/^\s*(while|until|for|if)\b/.test(e[n].text);)n--;let r=e[n]?.at??0;return r?`\u2026${t.slice(r).trim()}`:t}function Wy(t){let e=[];for(let n of mt(t)){let r=Ms(n.text),s=r.indexOf("git"),i=r[s+1];if(s<0||i!=="rm"&&i!=="mv"||r.includes("--cached"))continue;let o=r.slice(s+2).filter(l=>!l.startsWith("-"));if(i==="rm"){for(let l of o)e.push({from:l});continue}let a=o.pop();if(a)for(let l of o)e.push({from:l,to:o.length>1?`${a.replace(/\/+$/,"")}/${Cy(l)}`:a})}return e}function Ky(t){let e=zy(t),n=e.map(Yy);return e.length&&n.every(r=>r!==void 0)?n:void 0}function Hy(t){let e=new Map,n=[];for(let r of zy(t)){let s=/^\$([\w:]+)\s*=\s*(['"])([^'"]*)\2$/.exec(r);if(s){e.set(s[1].toLowerCase(),s[3]);continue}let i=Yy(r.replace(/^\$[\w:]+\s*=\s*/,"")),o=i&&/^\$([\w:]+)$/.exec(i),a=o?e.get(o[1].toLowerCase()):i;a&&!/[*?$]/.test(a)&&n.push(a)}return n}function Yy(t){let[e,...n]=mt(t).map(i=>i.text.trim());if(!e||!n.every(i=>wO.test(i)))return;let r=Ms(e);if(!gO.test(r[0]??""))return;let s=[];for(let i=1;i<r.length;i++){let o=r[i];if(yO.test(o)){i+1<r.length&&s.push(r[++i]);continue}if(bO.test(o)){i++;continue}o.startsWith("-")||/^\d+(,\d+)?p?$/.test(o)||s.push(o)}return s.length===1?s[0]:void 0}var Ls,Ms,lO,cO,uO,dO,fO,pO,qy,hO,mO,gO,yO,bO,wO,zy,sd=S(()=>{"use strict";_s();Ls=t=>t.replace(/'[^']*'|"(?:\\.|[^"\\])*"/g,e=>"_".repeat(e.length));Ms=t=>(t.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(e=>/^(['"])(.*)\1$/.exec(e)?.[2]??e),lO=/^\s*(?:(?:cd|set-location)\s+(?:-(?:literal)?path\s+)?("[^"]*"|'[^']*'|[^\s;&]+)|export\s+PATH=\S+)\s*(?:;|&&)\s*/i;cO=new Set(["grep","egrep","fgrep","rg","cat","head","tail","less","ls","wc","find","date","echo","printf","pwd","which","sort","uniq","cut","tr","awk","jq","stat","file","diff","basename","dirname","realpath","cd","pushd","popd","export","set","true","test","[","seq","ps","tasklist","time","select-string","test-path","measure-object","select-object","where-object","sort-object","format-table","format-list","write-output","write-host"]),uO=new Set(["log","status","diff","show","blame","rev-parse","ls-files","grep","branch","remote"]),dO=new Set(["status","logs","get","models","slug","predict"]),fO=new Set(["if","then","else","elif","fi","do","done","while","until","!","{","}","(",")"]);pO=new Set(["grep","egrep","fgrep","rg","findstr","select-string"]),qy=t=>pO.has(Ms(mt(t).at(-1)?.text??"")[0]?.toLowerCase()??""),hO=new Set(["tail","head","grep","egrep","fgrep","rg","sed","awk","sort","uniq","wc","cut","tr","tee","cat","less","findstr"]);mO=/<<-?\s*(['"]?)(\w+)\1([^\n]*)\n[\s\S]*?\n\s*\2\b/g;gO=/^(Get-Content|gc|cat|type|nl|bat|sed|head|tail)$/i,yO=/^-(Path|LiteralPath)$/i,bO=/^-(Encoding|TotalCount|Head|Tail|ReadCount|Delimiter)$/i,wO=/^(sed -n|head|tail|Select-Object|select)(\s|$)/i;zy=t=>mt(t,!1).map(e=>e.text.trim())});import{spawn as vO,execFile as SO}from"child_process";import{promisify as kO}from"util";import{randomBytes as Gy}from"crypto";async function EO(){let t;try{t=(await xO("codex",["app-server","daemon","version"],{shell:!0,timeout:Xy})).stdout}catch(n){let r=n,s=(r.stderr||r.message||"").trim().split(`
|
|
309
|
+
`).at(-1);throw new Error(r.code==="ENOENT"?"the codex CLI is not on PATH":`the codex CLI could not report its app server (${s})`)}let e;try{e=JSON.parse(t)}catch{throw new Error(`the codex CLI's daemon report was not JSON: ${t.trim().slice(0,120)}`)}if(e.status!=="running")throw new Error(`no shared Codex app server is running (daemon status: ${e.status??"unknown"})`);if(!e.managedCodexPath||!e.socketPath)throw new Error("the codex CLI named no daemon binary or socket");return{exe:e.managedCodexPath,socket:e.socketPath}}function Vy(t){let e=Buffer.from(t),n=Gy(4),r=e.length,s=r<126?Buffer.from([129,128|r]):r<65536?Buffer.from([129,254,r>>8,r&255]):Buffer.concat([Buffer.from([129,255]),(()=>{let i=Buffer.alloc(8);return i.writeBigUInt64BE(BigInt(r)),i})()]);return Buffer.concat([s,n,Buffer.from(e.map((i,o)=>i^n[o%4]))])}async function Qy(){let t=await EO(),e=new id(vO(t.exe,["app-server","proxy","--sock",t.socket],{stdio:["pipe","pipe","pipe"]}));return await e.call("initialize",{clientInfo:{name:"typebulb",version:"1"}}),e.notify("initialized"),e}async function od(){let t=await Qy();try{return(await t.call("thread/loaded/list",{})).data??[]}finally{t.close()}}async function Zy(t,e,n){let r=await Qy();try{await r.call("turn/start",{threadId:t,input:[],toolOutput:{name:e,output:n},turnTrigger:"typebulb"})}finally{r.close()}}var xO,Xy,id,eb=S(()=>{"use strict";xO=kO(SO),Xy=15e3;id=class{constructor(e){this.proc=e;let n,r;this.#u=new Promise((s,i)=>{n=s,r=i}),e.stderr.on("data",s=>{this.#n+=s}),e.stdout.on("data",s=>this.#c(s,n,r)),e.on("error",s=>{r(new Error(`could not reach the Codex app server socket: ${s.message}`));for(let i of this.#t.values())i({error:{message:"connection closed"}})}),e.stdin.on("error",()=>{}),e.on("exit",()=>{let s=this.#n.trim().split(`
|
|
310
310
|
`).filter(i=>i.trim()).join(" ").slice(0,300);r(new Error(`could not reach the Codex app server socket${s?`: ${s}`:""}`));for(let i of this.#t.values())i({error:{message:"connection closed"}})}),e.stdin.write(`GET / HTTP/1.1\r
|
|
311
311
|
Host: localhost\r
|
|
312
312
|
Upgrade: websocket\r
|
|
313
313
|
Connection: Upgrade\r
|
|
314
|
-
Sec-WebSocket-Key: ${
|
|
314
|
+
Sec-WebSocket-Key: ${Gy(16).toString("base64")}\r
|
|
315
315
|
Sec-WebSocket-Version: 13\r
|
|
316
316
|
\r
|
|
317
317
|
`)}#t=new Map;#o=1;#e=Buffer.alloc(0);#s=!1;#u;#n="";#c(e,n,r){if(this.#e=Buffer.concat([this.#e,e]),!this.#s){let s=this.#e.indexOf(`\r
|
|
318
318
|
\r
|
|
319
319
|
`);if(s<0)return;let i=this.#e.subarray(0,s).toString().split(`\r
|
|
320
|
-
`)[0]??"";if(!/^HTTP\/1\.[01] 101\b/.test(i)){r(new Error(`the Codex app server refused the connection: ${i}`)),this.proc.kill();return}this.#s=!0,this.#e=this.#e.subarray(s+4),n()}for(;;){if(this.#e.length<2)return;let s=this.#e[1]&127,i=2;if(s===126){if(this.#e.length<4)return;s=this.#e.readUInt16BE(2),i=4}else if(s===127){if(this.#e.length<10)return;s=Number(this.#e.readBigUInt64BE(2)),i=10}if(this.#e.length<i+s)return;let o=this.#e[0]&15,a=this.#e.subarray(i,i+s).toString();if(this.#e=this.#e.subarray(i+s),o===1)try{let l=JSON.parse(a);l.id!==void 0&&!l.method&&this.#t.has(l.id)&&(this.#t.get(l.id)(l),this.#t.delete(l.id))}catch{}}}async call(e,n){await this.#u;let r=this.#o++,s=await new Promise((i,o)=>{let a=setTimeout(()=>{this.#t.delete(r),o(new Error(`no reply to ${e}`))},
|
|
321
|
-
`):""}function
|
|
322
|
-
`))r.startsWith("+")&&!r.startsWith("+++")?e++:r.startsWith("-")&&!r.startsWith("---")&&n++;return`+${e} \u2212${n}`}function
|
|
323
|
-
`)}}function
|
|
324
|
-
`);i.partial&&o.shift();let a;for(let l=o.length-1;l>=0;l--){if(!o[l].trim())continue;let c;try{c=JSON.parse(o[l])}catch{continue}if(a===void 0){let f=Date.parse(c.timestamp??"");Number.isNaN(f)||(a=f)}if(e===void 0&&c.type==="event_msg"){let f=c.payload?.type;f==="task_started"?e=!0:(f==="task_complete"||f==="turn_aborted")&&(e=!1)}if(n===void 0&&c.type==="event_msg"&&c.payload?.type==="token_count"&&c.payload.info?.last_token_usage){let f=
|
|
325
|
-
`);if(r<0)return n.bytes>=65536?{cwd:"",subagent:!1}:void 0;try{let s=JSON.parse(n.text.slice(0,r)),i=s?.type==="session_meta"?s.payload:void 0;if(typeof i?.cwd!="string")return{cwd:"",subagent:!1};let o=typeof i.source=="object"?i.source?.subagent:void 0,a=
|
|
326
|
-
`))if(n.trim())try{let r=JSON.parse(n);if(r.type==="turn_context"&&typeof r.payload?.model=="string")return{model:r.payload.model,effort:r.payload.effort}}catch{}}var
|
|
327
|
-
`,t:" ",r:"\r",b:"\b",f:"\f",v:"\v",0:"\0"};
|
|
328
|
-
`).length:0;
|
|
329
|
-
`))if(!(!r.includes('"user_message"')&&!r.includes('"UserMessage"')))try{let s=JSON.parse(r);if(s?.type!=="event_msg")continue;let i=s.payload,a=((i?.type==="user_message"?i.message:i?.type==="item_completed"&&i.item?.type==="UserMessage"?or(i.item.content,!0):void 0)??"").replace(/\s+/g," ").trim();if(a)return a.slice(0,200)}catch{}return""}searchText(n){if(n?.type!=="response_item"||n.payload?.type!=="message")return"";let r=n.payload.role;return r!=="user"&&r!=="assistant"?"":or(n.payload.content,r==="user").replace(/\s+/g," ").trim()}},
|
|
330
|
-
`),r=[];if(n.forEach((o,a)=>{let l=
|
|
331
|
-
`)}function
|
|
320
|
+
`)[0]??"";if(!/^HTTP\/1\.[01] 101\b/.test(i)){r(new Error(`the Codex app server refused the connection: ${i}`)),this.proc.kill();return}this.#s=!0,this.#e=this.#e.subarray(s+4),n()}for(;;){if(this.#e.length<2)return;let s=this.#e[1]&127,i=2;if(s===126){if(this.#e.length<4)return;s=this.#e.readUInt16BE(2),i=4}else if(s===127){if(this.#e.length<10)return;s=Number(this.#e.readBigUInt64BE(2)),i=10}if(this.#e.length<i+s)return;let o=this.#e[0]&15,a=this.#e.subarray(i,i+s).toString();if(this.#e=this.#e.subarray(i+s),o===1)try{let l=JSON.parse(a);l.id!==void 0&&!l.method&&this.#t.has(l.id)&&(this.#t.get(l.id)(l),this.#t.delete(l.id))}catch{}}}async call(e,n){await this.#u;let r=this.#o++,s=await new Promise((i,o)=>{let a=setTimeout(()=>{this.#t.delete(r),o(new Error(`no reply to ${e}`))},Xy);this.#t.set(r,l=>{clearTimeout(a),i(l)}),this.proc.stdin.write(Vy(JSON.stringify({jsonrpc:"2.0",id:r,method:e,params:n})))});if(s.error)throw new Error(s.error.message??`${e} failed`);return s.result}notify(e){this.proc.stdin.write(Vy(JSON.stringify({jsonrpc:"2.0",method:e})))}close(){this.proc.kill()}}});import{statSync as Qo,readdirSync as AO,existsSync as TO}from"fs";import{basename as tb,join as ad,resolve as CO}from"path";import{homedir as nb}from"os";function PO(t){let e=t.trimStart();return OO.some(n=>e.startsWith(n))}function or(t,e){return Array.isArray(t)?t.map(n=>typeof n?.text=="string"?e&&PO(n.text)?"":_e(n.text):n?.type==="input_image"&&typeof n.image_url=="string"&&n.image_url.startsWith("data:")?``:"").filter(Boolean).join(`
|
|
321
|
+
`):""}function _O(t){return typeof t=="string"?_e(t):or(t,!1)}function RO(t,e){let n=e??"",r=LO(n);if(!r.length)return{name:t,input:{script:n}};let s=r.map(i=>ld(i.fn)&&Ds(i.arg)?Ky(String(i.arg.cmd??i.arg.command??"")):void 0);if(s.every(i=>i!==void 0))return{name:"read",input:rb(s.flat().map(i=>["path",i])),pending:{kind:"read"}};if(r.length===1){let{fn:i,arg:o}=r[0];if(i==="apply_patch"&&typeof o=="string"){let{files:a,diff:l}=sb(o);return{name:i,input:new Set(a).size===1?{path:a[0],patch:l}:{patch:l},pending:{kind:"patch",digest:NO(l)}}}return Ds(o)?ld(i)?{name:t,input:$O(o)}:{name:i,input:o}:typeof o=="string"?{name:i,input:{arg:o}}:{name:t,input:{script:n}}}return{name:t,input:rb(r.map(({fn:i,arg:o})=>i==="apply_patch"&&typeof o=="string"?["patch",sb(o).diff]:ld(i)&&Ds(o)?["command",o.cmd??o.command]:[i,o]))}}function $O(t){let e=Object.fromEntries(Object.entries(t).filter(([r])=>r!=="cmd"&&r!=="command"&&!IO.has(r))),n=t.command??t.cmd;return n===void 0?e:{command:n,...e}}function rb(t){let e={};for(let[n,r]of t){let s=n;for(let i=2;s in e;i++)s=`${n} (${i})`;e[s]=r}return e}function NO(t){let e=0,n=0;for(let r of t.split(`
|
|
322
|
+
`))r.startsWith("+")&&!r.startsWith("+++")?e++:r.startsWith("-")&&!r.startsWith("---")&&n++;return`+${e} \u2212${n}`}function LO(t){let e=[],n=/tools\.([A-Za-z_$][\w$]*)\s*\(/g;for(let r=n.exec(t);r;r=n.exec(t)){let s=r.index+r[0].length-1,i=ub(t,s);if(i<0)break;e.push({fn:r[1],arg:cb(t.slice(s+1,i).trim(),t)}),n.lastIndex=i+1}return e}function cb(t,e){let n=t[0];if(n==='"'||n==="'"||n==="`")return ea(t,0)===t.length-1?db(t.slice(1,-1)):t;if(n==="{"){for(let r of[t,DO(t)])try{let s=JSON.parse(r);if(Ds(s))return s}catch{}return t}if(/^[A-Za-z_$][\w$]*$/.test(t)){let r=new RegExp(`\\b(?:const|let|var)\\s+${t.replace(/\$/g,"\\$")}\\s*=\\s*`).exec(e);if(r){let s=r.index+r[0].length,i=e[s],o=i==='"'||i==="'"||i==="`"?ea(e,s):i==="{"?ub(e,s):-1;if(o>s)return cb(e.slice(s,o+1),"")}}return t}function ub(t,e){let n=0;for(let r=e;r<t.length;r++){let s=t[r];if(s==='"'||s==="'"||s==="`"){if(r=ea(t,r),r<0)return-1}else if(s==="("||s==="["||s==="{")n++;else if((s===")"||s==="]"||s==="}")&&--n===0)return r}return-1}function ea(t,e){let n=t[e];for(let r=e+1;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===n)return r;return-1}function db(t){return t.replace(/\\(?:u\{([0-9a-fA-F]+)\}|u([0-9a-fA-F]{4})|x([0-9a-fA-F]{2})|([\s\S]))/g,(e,n,r,s,i)=>n||r||s?String.fromCodePoint(parseInt(n||r||s,16)):MO[i]??i)}function DO(t){let e=/[A-Za-z_$][\w$]*(?=\s*:)/y,n=/,(?=\s*[}\]])/y,r="",s="";for(let i=0;i<t.length;i++){let o=t[i];if(o==='"'||o==="'"||o==="`"){let l=ea(t,i);if(l<0)return t;r+=JSON.stringify(db(t.slice(i+1,l))),i=l,s=o;continue}e.lastIndex=i;let a=s==="{"||s===","?e.exec(t):null;if(a){r+=`"${a[0]}"`,i+=a[0].length-1,s='"';continue}n.lastIndex=i,!n.test(t)&&(r+=o,/\s/.test(o)||(s=o))}return r}function sb(t){let e=[],n=[],r=!1;for(let s of t.split(/\r?\n/)){let i=/^\*\*\* (Update|Add|Delete) File: (.+)$/.exec(s);if(i){let o=i[2].trim();e.push(o),n.push(`--- ${i[1]==="Add"?"/dev/null":`a/${o}`}`,`+++ ${i[1]==="Delete"?"/dev/null":`b/${o}`}`),r=!0;continue}if(!/^\*\*\* (Begin|End) Patch$/.test(s)){if(s.startsWith("*** Move to:")){n.push(s);continue}r&&!s.startsWith("@@")&&n.push("@@"),r=!1,n.push(s)}}return r&&n.push("@@"),{files:e,diff:n.join(`
|
|
323
|
+
`)}}function BO(t,e){let n=/^Script (completed|failed|running with cell ID (\d+))\nWall time [^\n]*\nOutput:\n([\s\S]*)$/.exec(t);if(!n)return{content:t,isError:!1,digest:Be(t)};let r=n[3].replace(/^\n+/,"").replace(/^Script error:\n/,""),s=n[1]==="failed",i=jO(r),o=i?.exit_code;return i&&(r=i.output,i.exit_code&&(s=!0)),n[2]?{content:r,isError:s,digest:`running (cell ${n[2]})`}:e?.kind==="read"&&!s?{content:r,isError:s,digest:Te(FO(r),"line")}:e?.kind==="patch"&&!s?{content:e.digest,isError:s,digest:e.digest}:{content:r,isError:s,digest:Be(r),exit:o}}function jO(t){if(t.startsWith("{"))try{let e=JSON.parse(t);if(Ds(e)&&typeof e.output=="string")return{output:e.output,exit_code:typeof e.exit_code=="number"?e.exit_code:void 0}}catch{}}function UO(t){if(typeof t=="string"&&t)try{let e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{arguments:t??""}}function JO(t){let e,n,r;for(let s of qO){let i=Jo(t,s);if(i===void 0)return{};let o=i.text.split(`
|
|
324
|
+
`);i.partial&&o.shift();let a;for(let l=o.length-1;l>=0;l--){if(!o[l].trim())continue;let c;try{c=JSON.parse(o[l])}catch{continue}if(a===void 0){let f=Date.parse(c.timestamp??"");Number.isNaN(f)||(a=f)}if(e===void 0&&c.type==="event_msg"){let f=c.payload?.type;f==="task_started"?e=!0:(f==="task_complete"||f==="turn_aborted")&&(e=!1)}if(n===void 0&&c.type==="event_msg"&&c.payload?.type==="token_count"&&c.payload.info?.last_token_usage){let f=fb(c.payload.info.last_token_usage);n=f.in+f.out+f.cached+f.cacheCreate}if(r===void 0&&c.type==="turn_context"&&(r={model:c.payload?.model,effort:c.payload?.effort}),a!==void 0&&e!==void 0&&n!==void 0&&r!==void 0)break}if(a!==void 0)return{ms:a,running:e??!0,tokens:n,turn:r};if(!i.partial)break}return{running:e??!0,tokens:n,turn:r}}function fb(t){return{in:Math.max(0,(t.input_tokens??0)-(t.cached_input_tokens??0)),out:t.output_tokens??0,cached:t.cached_input_tokens??0,cacheCreate:t.cache_write_input_tokens??0}}function ob(t){let n=sr(t,65536);if(n===void 0)return;let r=n.text.indexOf(`
|
|
325
|
+
`);if(r<0)return n.bytes>=65536?{cwd:"",subagent:!1}:void 0;try{let s=JSON.parse(n.text.slice(0,r)),i=s?.type==="session_meta"?s.payload:void 0;if(typeof i?.cwd!="string")return{cwd:"",subagent:!1};let o=typeof i.source=="object"?i.source?.subagent:void 0,a=WO(i,o),l=lb(n.text,r),c=a&&!l&&n.bytes>=65536?sr(t,ab):void 0,f=l??(c&&lb(c.text,r)),d=!!a&&!f&&(c??n).bytes<(c?ab:65536);return{cwd:i.cwd,subagent:!!o,id:i.id,spawn:a,turn:f,modelPending:d}}catch{return{cwd:"",subagent:!1}}}function WO(t,e){let n=e?.thread_spawn;if(!n)return;let r=n.parent_thread_id??t.parent_thread_id;if(!(!t.id||!r))return{id:t.id,parent:r,path:n.agent_path??"",role:n.agent_role??void 0,depth:n.depth??1}}function lb(t,e){for(let n of t.slice(e+1).split(`
|
|
326
|
+
`))if(n.trim())try{let r=JSON.parse(n);if(r.type==="turn_context"&&typeof r.payload?.model=="string")return{model:r.payload.model,effort:r.payload.effort}}catch{}}var OO,Ds,ld,IO,MO,FO,Zo,ib,cd,ar,qO,ab,ud=S(()=>{"use strict";Rs();Ho();Ko();sd();eb();OO=["<permissions instructions>","<apps_instructions>","<plugins_instructions>","<skills_instructions>","<recommended_plugins>","<environment_context>","<node_repl_review_evidence>","# AGENTS.md instructions for "];Ds=t=>!!t&&typeof t=="object"&&!Array.isArray(t),ld=t=>t==="shell_command"||t==="exec_command",IO=new Set(["max_output_tokens","yield_time_ms","timeout_ms"]);MO={n:`
|
|
327
|
+
`,t:" ",r:"\r",b:"\b",f:"\f",v:"\v",0:"\0"};FO=t=>t?t.replace(/\r?\n$/,"").split(`
|
|
328
|
+
`).length:0;Zo=t=>{let e=CO(t);return process.platform==="win32"?e.toLowerCase():e},ib=12e4,cd=t=>t.slice(-36),ar=class t extends qt{constructor(n=ad(nb(),".codex","sessions")){super();this.root=n}displayName="Codex Mirror";#t=0;#o;#e=!1;#s;#u=0;#n=new Map;#c=new Map;#a=new Map;#d=new Map;detectsSelf(){return!!process.env.CODEX_THREAD_ID}forRead(){return new t(this.root)}callerSessionId(n){let r=process.env.CODEX_THREAD_ID;return r?this.listSessionFiles(n).find(s=>s.sessionId.endsWith(r))?.sessionId:void 0}async wakeRoute(n){try{return(await od()).includes(cd(n))?{hosted:!0}:{hosted:!1,error:"this Codex session is not hosted by the shared app server, so nothing can wake it"}}catch(r){return{error:r instanceof Error?r.message:String(r)}}}async wake(n,r,s){if(!(await od()).includes(cd(n)))throw new Error("the Codex session is not loaded by its app server now");await Zy(cd(n),r,s)}detectsInstalled(){return TO(ad(nb(),".codex"))}sessionsDir(n){return this.root}listSessionFiles(n){let r=Zo(n),s=[];for(let i of this.#f()){let o=0,a=0;try{let f=Qo(i);if(!f.isFile())continue;o=f.size,a=f.mtimeMs}catch{continue}let l=this.#n.get(i);if(l===void 0){if(l=ob(i),l===void 0)continue;this.#n.set(i,l)}if(l.subagent||Zo(l.cwd)!==r)continue;let c=tb(i,".jsonl");this.#a.set(c,i),s.push({sessionId:c,file:i,mtime:this.#r(i,o,a)})}return s}listChildren(n,r){let s=Zo(n),i=new Map,o;for(let c of this.#f()){let f=0,d=0,u;try{let b=Qo(c);if(!b.isFile())continue;f=b.size,d=b.mtimeMs,u=b.birthtimeMs||void 0}catch{continue}let p=this.#n.get(c);if(p===void 0||p.modelPending){if(p=ob(c),p===void 0)continue;this.#n.set(c,p)}if(tb(c,".jsonl")===r&&(o=p.id),!p.spawn||Zo(p.cwd)!==s)continue;let{running:h,tokens:m,turn:g}=this.#i(c,f,d);i.set(p.spawn.id,{file:c,mtime:this.#r(c,f,d),started:u,running:h,tokens:m,spawn:p.spawn,turn:g??p.turn})}if(!o)return[];let a=(c,f=new Set)=>{if(c.parent===o)return!0;if(f.has(c.id))return!1;f.add(c.id);let d=i.get(c.parent);return d?a(d.spawn,f):!1},l=[];for(let{file:c,mtime:f,started:d,running:u,tokens:p,spawn:h,turn:m}of i.values())a(h)&&l.push({id:h.id,file:c,mtime:f,started:d,tokens:p,label:h.path.split("/").filter(Boolean).pop()??h.path,kind:h.role||void 0,model:m?.model,effort:m?.effort,parentId:i.has(h.parent)?h.parent:void 0,depth:h.depth,stopped:!1,running:u});return l}sessionsWorking(n){let r=new Set,s=Date.now();for(let{sessionId:i,file:o,mtime:a}of this.listSessionFiles(n)){if(s-a>=ib)continue;let l;try{let c=Qo(o);l=this.#i(o,c.size,c.mtimeMs)}catch{continue}l.running&&r.add(i)}return r}#r(n,r,s){return Math.max(s,this.#i(n,r,s).ms??0)}#i(n,r,s){let i=this.#c.get(n);if(i&&i.size===r&&i.mtime===s)return i;let o=JO(n),a={size:r,mtime:s,...o,turn:o.turn??i?.turn};return this.#c.set(n,a),a}#f(){let n=[],r=s=>{try{return AO(s).map(i=>ad(s,i))}catch{return[]}};for(let s of r(this.root))for(let i of r(s))for(let o of r(i))for(let a of r(o))a.endsWith(".jsonl")&&n.push(a);return n}parseEntry(n){let r;try{r=JSON.parse(n)}catch{return null}return!r||typeof r.type!="string"?null:r}idOf(n){return n.ord===void 0&&(this.#l(n),n.ord=String(this.#t++),n.parent=this.#o,this.#o=n.ord),n.ord}#l(n){let r=n.payload;if(n.type==="session_meta"){if(++this.#u===1){let s=typeof r?.source=="object"?r.source?.subagent?.thread_spawn:void 0;this.#s=s?.agent_path,this.#e=!!s}}else this.#u=0,this.#e&&r?.type==="agent_message"&&r.recipient===this.#s&&(this.#e=!1);n.inherited=this.#e}parentOf(n){return n.parent}timestampOf(n){return n.timestamp}isSidechain(n,r){return r==="child"&&!!n.inherited}isLeafType(n){return!0}isRecoveryNoise(n){return!1}apply(n,r){let s=[],i=n.payload;if(!i)return{events:s};let o=()=>{let a=Date.parse(n.timestamp??"");return!isNaN(a)&&a>=r};if(n.type==="response_item"){if(i.type==="message"){if(i.role==="user"){let a=or(i.content,!0).trim();a&&s.push({type:"user",text:a})}else if(i.role==="assistant"){let a=or(i.content,!1);a&&s.push({type:"assistant",text:a,thinking:"",tools:[],live:o()})}return{events:s}}if(i.type==="reasoning"){let a=or(i.summary,!1);return a&&s.push({type:"assistant",text:"",thinking:a,tools:[],live:o()}),{events:s}}if(i.type==="custom_tool_call"||i.type==="function_call"){let a=i.call_id??"",{pending:l,...c}=i.type==="custom_tool_call"?RO(i.name??"",i.input):{name:i.name??"",input:UO(i.arguments)};return l&&this.#d.set(a,l),s.push({type:"assistant",text:"",thinking:"",tools:[{id:a,...c}],live:o()}),{events:s}}if(i.type==="custom_tool_call_output"||i.type==="function_call_output"){let a=i.call_id??"",l=this.#d.get(a);return this.#d.delete(a),s.push({type:"tool_result",id:a,...BO(_O(i.output),l)}),{events:s}}return{events:s}}if(n.type==="event_msg"){if(i.type==="token_count"){let a=i.info?.last_token_usage;return a?{events:s,usage:fb(a)}:{events:s}}return i.type==="task_complete"&&s.push({type:"turn_end"}),{events:s}}return n.type==="turn_context"?{events:s,model:i.model}:{events:s}}chainWorking(n){let r=!1;for(let s of n){if(s.type!=="event_msg")continue;let i=s.payload?.type;i==="task_started"?r=!0:(i==="task_complete"||i==="turn_aborted")&&(r=!1)}return r}sessionAlive(n){let r=this.#a.get(n);if(!r)return;let s;try{let i=Qo(r);s=this.#r(r,i.size,i.mtimeMs)}catch{return}return Date.now()-s<ib}readPreview(n){for(let r of(sr(n,256*1024)?.text??"").split(`
|
|
329
|
+
`))if(!(!r.includes('"user_message"')&&!r.includes('"UserMessage"')))try{let s=JSON.parse(r);if(s?.type!=="event_msg")continue;let i=s.payload,a=((i?.type==="user_message"?i.message:i?.type==="item_completed"&&i.item?.type==="UserMessage"?or(i.item.content,!0):void 0)??"").replace(/\s+/g," ").trim();if(a)return a.slice(0,200)}catch{}return""}searchText(n){if(n?.type!=="response_item"||n.payload?.type!=="message")return"";let r=n.payload.role;return r!=="user"&&r!=="assistant"?"":or(n.payload.content,r==="user").replace(/\s+/g," ").trim()}},qO=[64*1024,1024*1024];ab=512*1024});import{realpathSync as KO}from"fs";import{createHash as HO}from"crypto";import{join as ta,resolve as zO}from"path";import{homedir as YO}from"os";function Re(){let t=process.env.TYPEBULB_SERVERS_DIR;return t?ta(t,".."):ta(YO(),".typebulb")}function gt(){pb||(pb=!0,console.error(`${Re()} not writable \u2014 continuing stateless: ports won't stick, caches stay cold, and typebulb logs/wait/send/stop may not see this run`))}function yt(){return process.env.TYPEBULB_SERVERS_DIR||ta(Re(),"servers")}function hb(t){let e=se(t),n=e.slice(e.lastIndexOf("/")+1).replace(/\.bulb\.md$/,"");return ta(Re(),"canvas",`${n}-${Bs(t)}.png`)}function Bs(t){return HO("sha1").update(se(t)).digest("hex").slice(0,8)}function se(t){let e=zO(t),n=e;try{n=KO.native(e)}catch{}return(process.platform==="win32"?n.toLowerCase():n).replace(/\\/g,"/")}function mb(t,e){let n=se(t),r=se(e);return n.startsWith(r.endsWith("/")?r:r+"/")?!n.includes("/node_modules/"):!1}var pb,je=S(()=>{"use strict";pb=!1});import*as bb from"net";import{mkdir as VO,readFile as GO,writeFile as wb}from"fs/promises";import{existsSync as XO}from"fs";import{join as vb}from"path";function xb(){return vb(Re(),"blocks")}function dd(t){return vb(xb(),`${t}.json`)}function ra(t){return new Promise(e=>{let n=bb.createServer();n.once("error",()=>e(!1)),n.listen(t,"127.0.0.1",()=>n.close(()=>e(!0)))})}async function tP(t){for(let e=t;e<65535;e++)if(await ra(e))return e;throw new Error(`No free port found above ${t}`)}async function fd(t){let{listBulbServers:e}=await Promise.resolve().then(()=>(Ie(),Eb)),n=(await e()).find(s=>s.port===t),r=n?` (pid ${n.pid}, ${n.agent?`agent:${n.agent}`:n.file})`:"";console.error(`port ${t} in use${r}`),process.exit(1)}async function sa(t){try{let e=JSON.parse(await GO(dd(t),"utf8"));return e&&typeof e.cwd=="string"?{cwd:e.cwd,slots:e.slots??{},mirrors:e.mirrors??{}}:void 0}catch{return}}async function ia(t,e){try{return await wb(dd(t),JSON.stringify(e,null,2)),!0}catch{return gt(),!1}}async function nP(t){let e=se(t);try{await VO(xb(),{recursive:!0})}catch{return}let n=[];for(let o=0;o<kb;o++)n.push(Sb+o*gn);let r=await Promise.all(n.map(async o=>({base:o,block:await sa(o)})));for(let{base:o,block:a}of r)if(a?.cwd===e)return o;let s={cwd:e,slots:{},mirrors:{}};for(let{base:o,block:a}of r){if(!a)try{return await wb(dd(o),JSON.stringify(s,null,2),{flag:"wx"}),o}catch(l){if((await sa(o))?.cwd===e)return o;l.code!=="EEXIST"&>();continue}if(!XO(a.cwd))return await ia(o,s)?o:void 0}let i=r.filter(o=>!!o.block).sort((o,a)=>gb(o.block)-gb(a.block))[0];if(i)return await ia(i.base,s)?i.base:void 0}function gb(t){return Object.values(t.slots).reduce((e,n)=>Math.max(e,n.usedAt??0),0)}async function rP(t,e){let n=await sa(t)??{cwd:"",slots:{},mirrors:{}};if(e.kind==="mirror"){let i=n.mirrors[e.agent];if(i!==void 0)return i;let o=yb(n),a=o.has(0)?ZO:0;for(;a>na&&o.has(a);)a--;return n.mirrors[e.agent]=a,await ia(t,n),a}let r=se(e.file),s=n.slots[r]?.offset;if(s===void 0){let i=yb(n);for(s=na;s<gn&&i.has(s);)s++;if(s>=gn){let o=Object.entries(n.slots).sort((a,l)=>(a[1].usedAt??0)-(l[1].usedAt??0))[0];s=o?o[1].offset:na,o&&delete n.slots[o[0]]}}return n.slots[r]={offset:s,usedAt:Date.now()},await ia(t,n),s}function yb(t){return new Set([...Object.values(t.mirrors),...Object.values(t.slots).map(e=>e.offset)])}async function lr(t,e){let n=await nP(e);return n===void 0?void 0:n+await rP(n,t)}async function yn(t){let e=se(t);for(let n=0;n<kb;n++){let r=await sa(Sb+n*gn);if(r?.cwd===e)return s=>r.slots[se(s)]?.usedAt??0}return()=>0}async function oa(t){if(t.explicit!==void 0)return await ra(t.explicit)||await fd(t.explicit),t.target.kind==="bulb"&&await lr(t.target,t.cwd),{port:t.explicit};let e=await lr(t.target,t.cwd);if(e!==void 0){let r=e-e%gn,s=Date.now()+eP;do{if(await ra(e))return{port:e};await new Promise(i=>setTimeout(i,150))}while(Date.now()<s);for(let i=na;i<gn;i++){let o=r+i;if(o!==e&&await ra(o))return{port:o,note:`(slot ${e} was busy)`}}}return{port:await tP(QO),note:e===void 0?"(no port block available)":"(this project's block was full)"}}var Sb,gn,kb,QO,na,ZO,eP,bn=S(()=>{"use strict";je();Sb=20100,gn=100,kb=19,QO=23e3,na=1,ZO=gn-1,eP=3e3});var Ce,aa=S(()=>{"use strict";Ce="0.62.7"});var Eb={};Li(Eb,{agentViewerCommand:()=>Nb,bulbServerCommand:()=>$b,clearServerLog:()=>yd,findProjectViewer:()=>ua,isAlive:()=>Wt,isMirror:()=>ye,isProjectBulb:()=>kd,isProjectMirror:()=>dr,launchAgentViewer:()=>Us,launchBulbServer:()=>Sn,listBulbServers:()=>G,probePageCount:()=>Ed,readServerLog:()=>Qe,readWaitCursor:()=>ca,recordDenial:()=>Sd,registerServer:()=>vd,relayOpen:()=>xd,runMarker:()=>bd,serverLogPath:()=>ur,serversForBulb:()=>vn,sliceRunLog:()=>wd,startServerLog:()=>Fs,stopBulbServer:()=>cr,stopServer:()=>bt,stopServersForBulb:()=>da,typebulbBinPath:()=>fr,unregisterServer:()=>wn,writeWaitCursor:()=>js});import{spawn as Ab}from"child_process";import{readdir as sP,readFile as Ob,writeFile as Pb,unlink as pd,mkdir as iP}from"fs/promises";import{mkdirSync as _b,writeFileSync as la,appendFileSync as oP,readFileSync as hd}from"fs";import*as $e from"path";import{fileURLToPath as aP}from"url";function md(t){return $e.join(yt(),`${t}.json`)}function ur(t){return $e.join(yt(),`${t}.log`)}function gd(t){return $e.join(yt(),`${t}.wait.json`)}function Rb(t){try{let e=JSON.parse(hd(gd(t),"utf8"));return e.cursors&&typeof e.cursors=="object"?e.cursors:{}}catch{return{}}}function ca(t,e=""){let n=Rb(t)[e];return typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0}function js(t,e,n=""){try{_b(yt(),{recursive:!0});let r=Rb(t);r[n]=e,la(gd(t),JSON.stringify({cursors:r}))}catch{}}function Fs(t){let e=ur(t);try{_b(yt(),{recursive:!0}),la(e,"")}catch{return()=>{}}let n=process.stdout.write.bind(process.stdout),r=process.stderr.write.bind(process.stderr),s=0,i=!1,o=a=>{if(!i)try{let l=typeof a=="string"?Buffer.from(a,"utf8"):Buffer.from(a);if(oP(e,l),s+=l.length,s>2*Tb){let c=hd(e),f=c.subarray(Math.max(0,c.length-Tb));la(e,f),s=f.length}}catch{i=!0}};return process.stdout.write=((a,...l)=>(o(a),n(a,...l))),process.stderr.write=((a,...l)=>(o(a),r(a,...l))),()=>{process.stdout.write=n,process.stderr.write=r}}function yd(t){try{la(ur(t),"")}catch{}}function Qe(t,e=0){try{let n=hd(ur(t)),r=e>=0&&e<=n.length?e:0;return{text:n.subarray(r).toString("utf8"),offset:n.length}}catch{return{text:"",offset:0}}}function bd(t){return`\u2500\u2500 run ${t} \u2500\u2500 ${new Date().toTimeString().slice(0,8)}`}function cP(t){let e=lP.exec(t);return e?Number(e[1]):void 0}function wd(t,e){let n=t.split(`
|
|
330
|
+
`),r=[];if(n.forEach((o,a)=>{let l=cP(o);l!==void 0&&r.push({id:l,idx:a})}),!r.length)return e==="latest"?t:"";let s=e==="latest"?r[r.length-1]:r.find(o=>o.id===e);if(!s)return"";let i=r.find(o=>o.idx>s.idx);return n.slice(s.idx,i?i.idx:n.length).join(`
|
|
331
|
+
`)}function Wt(t){try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function vd(t){try{await iP(yt(),{recursive:!0}),await Pb(md(t.pid),JSON.stringify({version:Ce,...t}))}catch{gt()}}async function Sd(t,e){let n=md(t);try{let r=JSON.parse(await Ob(n,"utf8"));if(r.denied===e)return;r.denied=e,await Pb(n,JSON.stringify(r))}catch{}}async function wn(t){await pd(md(t)).catch(()=>{}),await pd(ur(t)).catch(()=>{}),await pd(gd(t)).catch(()=>{})}function ye(t){return t.agent!=null}function dr(t,e){return ye(t)&&t.cwd!=null&&se(t.cwd)===se(e)}function kd(t,e){return!ye(t)&&mb(t.file,e)}async function G(t){let e;try{e=await sP(yt())}catch{return[]}let n=[];return await Promise.all(e.map(async s=>{if(!/^\d+\.json$/.test(s))return;let i=parseInt(s,10),o;try{o=JSON.parse(await Ob($e.join(yt(),s),"utf8"))}catch{await wn(i);return}o&&typeof o.pid=="number"&&Wt(o.pid)?n.push(o):await wn(i)})),(t?n.filter(s=>kd(s,t)):n).sort((s,i)=>s.startedAt-i.startedAt)}async function ua(t,e){return(await G()).find(n=>dr(n,t)&&(e?n.agent===e:!0))}async function xd(t,e){let n=new URL(t).port,r=(await G()).filter(a=>String(a.port)!==n),s=r.filter(a=>dr(a,e)),i=r.filter(a=>kd(a,e)),o=0;for(let a of[...s,...i])try{let l=await fetch(`${a.url}/__open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t}),signal:AbortSignal.timeout(2e3)});if(!l.ok)continue;let{opened:c,pages:f}=await l.json();if(c)return{where:"editor",via:a.agent?"the agent mirror":`${$e.basename(a.file)}'s page`};ye(a)&&(o+=f??0)}catch{}return o>0?{where:"external"}:void 0}async function cr(t){try{process.kill(t,"SIGTERM")}catch{}await wn(t)}async function Ed(t){try{let e=await fetch(`${t.url}/__pages`,{signal:AbortSignal.timeout(uP)});if(!e.ok)return;let{pages:n}=await e.json();return typeof n=="number"?n:void 0}catch{return}}async function bt(t,e=ye(t)?"keep":"close"){try{let n=await fetch(`${t.url}/__stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pages:e}),signal:AbortSignal.timeout(Cb)});if(!n.ok)throw new Error(`/__stop ${n.status}`);let{closed:r=0,stuck:s=0}=await n.json(),i=Date.now()+Cb;for(;Wt(t.pid)&&Date.now()<i;)await Ib(100);return Wt(t.pid)?(await cr(t.pid),"killed"):(await wn(t.pid),{closed:r,stuck:s})}catch{return await cr(t.pid),"killed"}}function vn(t,e){let n=se(e);return t.filter(r=>!ye(r)&&r.pid!==process.pid&&se(r.file)===n)}async function da(t,e){let n=vn(await G(),t);for(let r of n)await bt(r,e!==void 0&&r.port===e?"keep":"close");return n}function dP(t,e,n){(process.platform==="win32"?Ab("cmd",["/c","start","","/b",t,...e],{cwd:n,stdio:"ignore",windowsHide:!0}):Ab(t,e,{cwd:n,detached:!0,stdio:"ignore"})).unref()}function fr(){return $e.join($e.dirname(aP(import.meta.url)),"index.js")}function $b(t,e={}){return{command:process.execPath,args:[fr(),...e.trust?["--trust"]:[],...e.noTrust?["--no-trust"]:[],...e.mode?["--mode",e.mode]:[],...e.watch===!1?["--no-watch"]:[],...e.replace?["--replace",e.replace]:[],t,...e.open===!1?["--no-open"]:[]]}}function Nb(t){return{command:process.execPath,args:[fr(),`agent:${t}`,"--no-open"]}}async function Lb(t,e,n,r){let s=await t();if(s)return s;dP(e.command,e.args,n);let i=Date.now()+2e4;for(;Date.now()<i;){await Ib(150);let o=await t();if(o)return o}throw new Error(`Launched ${r} but it did not register within 20s.`)}async function Sn(t,e={}){let n=e.cwd??process.cwd(),r=$e.resolve(n,t),s=await lr({kind:"bulb",file:r},n),[i]=await da(r,s),o={...e,mode:e.mode??i?.mode};return Lb(async()=>vn(await G(),r)[0],$b(t,o),n,$e.basename(t))}async function Us(t,e=process.cwd()){return Lb(()=>ua(e,t),Nb(t),e,`the ${t} mirror`)}var Tb,lP,Cb,uP,Ib,Ie=S(()=>{"use strict";je();bn();aa();Tb=1e6;lP=/^── run (\d+) ── /;Cb=6e3,uP=500;Ib=t=>new Promise(e=>setTimeout(e,t))});function pr(t){return{...Qp(t),server:t.files.get("server.ts")??""}}function fa(t){return!!t.server&&!t.code}var qs=S(()=>{"use strict";te();te()});function pa(t){let e=/^---[^\n]*\n([\s\S]*?)\n---/.exec(t),n=e?/^\s*name:\s*(.+?)\s*$/m.exec(e[1]):null;return n?n[1].replace(/^["']|["']$/g,""):void 0}function Ad(t){return nr(pa(t)??"bulb")||"bulb"}var Td=S(()=>{"use strict";te()});import{readdirSync as fP,readFileSync as pP,statSync as hP}from"fs";import{join as Mb,basename as mP}from"path";function Bb(t,e,n){if(e>8)return n;let r;try{r=fP(t,{withFileTypes:!0})}catch{return n}for(let s of r)if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;Bb(Mb(t,s.name),e+1,n)}else s.isFile()&&s.name.endsWith(".bulb.md")&&n.push(Mb(t,s.name));return n}function gP(t,e){let n,r=!1;try{let s=pP(t,"utf8");n=pa(s.slice(0,1024));let i=Ve(s);r=!!i&&fa(pr(i))}catch{}return{mtime:e,name:n??mP(t).replace(/\.bulb\.md$/,""),serverOnly:r}}function ha(t){let e=new Map,n=Bb(t,0,[]).map(r=>{let s=0;try{s=hP(r).mtimeMs}catch{}let i=s?Db.get(r):void 0,o=i?.mtime===s?i:gP(r,s);return s&&e.set(r,o),{path:r,...o}});return Db=e,n}var Db,jb=S(()=>{"use strict";te();qs();Td();Db=new Map});function hr(t){if(t.server.trim())return"server-side code (server.ts)";let e=t.code;if(/\btb\s*\.\s*fs\b/.test(e)||e.includes("/__fs"))return"the filesystem";if(/\btb\s*\.\s*ai\b/.test(e)||e.includes("/__ai")||t.infer.trim()||/\btb\s*\.\s*infer\b/.test(e))return"AI (your API keys)";if(/\btb\s*\.\s*server\s*\.\s*\w/.test(e)||e.includes("/__api"))return"server-side code (server.ts)"}var ma=S(()=>{"use strict"});import{readFile as yP}from"fs/promises";async function Cd(t){try{let e=Ve(await yP(t,"utf-8"));return e?hr(pr(e)):void 0}catch{return}}var Fb=S(()=>{"use strict";qs();ma()});function Od(t){let e=t.split(""),n=(i,o)=>{for(let a=i;a<o&&a<e.length;a++)e[a]!==`
|
|
332
332
|
`&&(e[a]=" ")},r=0,s="";for(;r<t.length;){let i=t[r],o=t[r+1];if(i==="/"&&o==="/"){let a=r;for(;a<t.length&&t[a]!==`
|
|
333
|
-
`;)a++;n(r,a),r=a}else if(i==="/"&&o==="*"){let a=r+2;for(;a<t.length&&!(t[a]==="*"&&t[a+1]==="/");)a++;n(r,Math.min(a+2,t.length)),r=a+2}else if(i==="/"&&
|
|
333
|
+
`;)a++;n(r,a),r=a}else if(i==="/"&&o==="*"){let a=r+2;for(;a<t.length&&!(t[a]==="*"&&t[a+1]==="/");)a++;n(r,Math.min(a+2,t.length)),r=a+2}else if(i==="/"&&bP.has(s)){let a=r+1,l=!1;for(;a<t.length&&t[a]!==`
|
|
334
334
|
`;){let c=t[a];if(c==="\\")a++;else if(c==="[")l=!0;else if(c==="]")l=!1;else if(c==="/"&&!l)break;a++}r=a+1,s="/"}else if(i==='"'||i==="'"){let a=r+1;for(;a<t.length&&t[a]!==i&&t[a]!==`
|
|
335
|
-
`;)t[a]==="\\"&&a++,a++;r=a+1,s=i}else if(i==="`"){let a=
|
|
336
|
-
`).length-1}));return r}function
|
|
337
|
-
`),a=
|
|
338
|
-
`);for(let l=0;l<o.length;l++){let c=a[l],f=l+1+s;for(let d of
|
|
339
|
-
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+r;return{type:"UNDECLARED_IMPORT",severity:"error",message:
|
|
335
|
+
`;)t[a]==="\\"&&a++,a++;r=a+1,s=i}else if(i==="`"){let a=Ub(t,r);n(r,a),r=a,s="`"}else/\s/.test(i)||(s=i),r++}return e.join("")}function Ub(t,e){let n=e+1,r=0;for(;n<t.length;){let s=t[n];if(s==="\\"){n+=2;continue}if(s==="`"){if(r===0)return n+1;n=Ub(t,n);continue}if(s==="$"&&t[n+1]==="{"){r++,n+=2;continue}if(s==="}"&&r>0){r--,n++;continue}n++}return t.length}var bP,qb=S(()=>{bP=new Set(["","(",",","=",":","[","!","&","|","?",";","{"])});function SP(t){if(/^[./]/.test(t)||/^[a-z][a-z0-9+.-]*:/i.test(t))return;let e=t.split("/");return t.startsWith("@")?e.slice(0,2).join("/"):e[0]}function Jb(t){let e=[];for(let s of vP)for(let i of t.matchAll(s)){let o=SP(i[1]);o&&e.push({root:o,index:i.index??0})}e.sort((s,i)=>s.index-i.index);let n=new Set,r=[];for(let{root:s,index:i}of e)n.has(s)||(n.add(s),r.push({root:s,lineIndex:t.slice(0,i).split(`
|
|
336
|
+
`).length-1}));return r}function Wb(t){return Jb(Od(t)).map(e=>e.root)}function Js(t,e){if(!t)return[];let{target:n,dependencies:r}=e,s=(e.lineOffset??1)-1,i=[],o=t.split(`
|
|
337
|
+
`),a=Od(t).split(`
|
|
338
|
+
`);for(let l=0;l<o.length;l++){let c=a[l],f=l+1+s;for(let d of wP)d.targets.includes(n)&&d.pattern.test(c)&&i.push({type:d.type,severity:"error",message:EP(d.type,f),lineNumber:f,lineContent:o[l]})}return n==="client"&&r&&i.push(...kP(a,o,r,s)),i}function kP(t,e,n,r){let s=new Set(Object.keys(n));return Jb(t.join(`
|
|
339
|
+
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+r;return{type:"UNDECLARED_IMPORT",severity:"error",message:xP(i,a),lineNumber:a,lineContent:e[o]}})}function xP(t,e){return`Import "${t}" is not declared in config.json dependencies! Found on line ${e}.
|
|
340
340
|
|
|
341
341
|
**CRITICAL**: Every bare import in code.tsx must be declared in the **config.json** "dependencies" block. A bulb that imports a package it doesn't declare is incomplete \u2014 it won't type-check, its versions aren't pinned, and it can't be reliably re-run or ported to typebulb.com.
|
|
342
342
|
|
|
@@ -350,7 +350,7 @@ Sec-WebSocket-Version: 13\r
|
|
|
350
350
|
}
|
|
351
351
|
\`\`\`
|
|
352
352
|
|
|
353
|
-
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${t}" \u2014 and for every other bare import in code.tsx. Pin a real version where you can (e.g. "react": "^19.2.7").`}function
|
|
353
|
+
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${t}" \u2014 and for every other bare import in code.tsx. Pin a real version where you can (e.g. "react": "^19.2.7").`}function EP(t,e){return t==="URL_IMPORT"?`Direct URL imports are not supported! Found on line ${e}.
|
|
354
354
|
|
|
355
355
|
**CRITICAL**: Import packages by name only. Do NOT use CDN URLs:
|
|
356
356
|
|
|
@@ -504,22 +504,22 @@ import { something } from 'module-name'
|
|
|
504
504
|
const something = require('module-name') // NOT SUPPORTED!
|
|
505
505
|
\`\`\`
|
|
506
506
|
|
|
507
|
-
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var
|
|
508
|
-
`)}var gr,
|
|
507
|
+
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var kn,xn,wP,vP,ga=S(()=>{qb();kn=["client"],xn=["client","server"],wP=[{type:"DYNAMIC_IMPORT",pattern:/\bimport\s*\(\s*['"`]/,targets:kn},{type:"COMMONJS_REQUIRE",pattern:/\brequire\s*\(\s*['"`]/,targets:xn},{type:"JS_EXTENSION_IMPORT",pattern:/from\s+['"][^'"]*\/[^'"]*\.js['"]/,targets:kn},{type:"URL_IMPORT",pattern:/from\s+['"]https?:\/\//,targets:kn},{type:"VERSION_SPECIFIER_IMPORT",pattern:/from\s+['"][^'"]*@[\d^~]/,targets:kn},{type:"REDUNDANT_TB_DECLARATION",pattern:/declare\s+(const|var|let)\s+tb\b/,targets:xn},{type:"CONST_ENUM",pattern:/\bconst\s+enum\b/,targets:xn},{type:"NAMESPACE_DECLARATION",pattern:/\bnamespace\s+\w+/,targets:xn},{type:"COMMONJS_EXPORT_EQUALS",pattern:/\bexport\s*=/,targets:xn},{type:"COMMONJS_IMPORT_EQUALS",pattern:/\bimport\s+\w+\s*=/,targets:xn},{type:"MODULE_DECLARATION",pattern:/\bmodule\s+\w+\s*\{/,targets:xn},{type:"CSS_FILE_IMPORT",pattern:/(?:from|import)\s+['"][^'"]*\.css['"]/,targets:kn},{type:"NAVIGATION",pattern:/window\.(location\.(reload|assign|replace)\s*\(|open\s*\()/,targets:kn},{type:"NAVIGATION",pattern:/window\.location(\.href)?\s*=[^=]/,targets:kn}],vP=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});function Pd(t){let e=Ve(t);if(!e)return t;let n=e.files.get("code.tsx");if(!n)return t;let r=Wb(n);if(!r.length)return t;let s=e.files.get("config.json"),i={};if(s)try{let c=JSON.parse(s);c&&typeof c=="object"&&(i=c)}catch{}let o=i.dependencies&&typeof i.dependencies=="object"?{...i.dependencies}:{},a=r.filter(c=>!(c in o));if(!a.length)return t;for(let c of a)o[c]="latest";i.dependencies=o;let l={name:e.frontmatter.name};for(let[c,f]of e.files){let d=Hp(c);d&&(l[d]=f)}return l.config=JSON.stringify(i,null,2),th(l)}var Kb=S(()=>{"use strict";te();ga()});import{spawn as Hb}from"child_process";import{basename as AP}from"path";function TP(){return process.env.TYPEBULB_EDITOR||"code"}function OP(t,e,n){return n==null?[e]:CP.test(AP(t))?["-g",`${e}:${n}`]:[`+${n}`,e]}function PP(t,e){let n=TP();return{command:n,args:OP(n,t,e)}}function _d(t,e){let{command:n,args:r}=PP(t,e),s=process.platform==="win32"?Hb("cmd.exe",["/d","/s","/c",n,...r],{detached:!0,stdio:"ignore",windowsHide:!0}):Hb(n,r,{detached:!0,stdio:"ignore"});s.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),s.unref()}var CP,zb=S(()=>{"use strict";CP=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i});import{readFileSync as _P,writeFileSync as RP,mkdirSync as IP,statSync as $P}from"fs";import{join as NP}from"path";function Rd(){return NP(Re(),"trust.json")}function Id(){try{let t=Rd(),e=$P(t).mtimeMs;if(Ws?.mtime!==e){let n=JSON.parse(_P(t,"utf8"));Ws={mtime:e,set:new Set(Array.isArray(n)?n:[])}}return Ws.set}catch{return Ws=void 0,new Set}}function LP(t){try{IP(Re(),{recursive:!0}),RP(Rd(),JSON.stringify([...t])),Ws=void 0}catch(e){throw new Error(`can't write ${Rd()} \u2014 trust not remembered (unwritable home; sandboxed shell?): ${e.message}`)}}function En(t){return Id().has(se(t))}function mr(t,e){let n=new Set(Id()),r=se(t);(e?n.has(r):!n.has(r))||(e?n.add(r):n.delete(r),LP(n))}function $d(){return[...Id()]}var Ws,Ks=S(()=>{"use strict";je()});function yr(t){return(t.includes("://")?t:`http://${t}`).replace(/\/+$/,"")}function Nd(){return zs}async function wt(){let[t,e]=await Promise.all([Vb(),qP()]);return UP([...JP(e),...t],process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL)}function UP(t,e,n){return!e||!n?t:t.map(r=>r.provider===e&&r.name===n?{...r,default:!0}:r)}async function Yb(){let t;try{t=await fetch(MP,{signal:AbortSignal.timeout(BP)})}catch(e){zs=`catalog fetch failed: ${e?.message??e}`;return}if(!t.ok){zs=`catalog fetch failed: HTTP ${t.status}`;return}try{return await t.json()}catch(e){zs=`catalog returned an unreadable body: ${e?.message??e}`;return}}async function qP(){if(Hs&&Date.now()-Hs.fetchedAt<=DP)return Hs.models;let t=await Yb()??await Yb();return t?(Hs={models:t,fetchedAt:Date.now()},zs=void 0,t):Hs?.models??[]}async function Vb(){if(ya&&Date.now()-ya.fetchedAt<=jP)return ya.models;let t=yr(process.env.OLLAMA_HOST??"http://localhost:11434"),e=[];try{let n=await fetch(new URL("/api/tags",t).toString(),{signal:AbortSignal.timeout(FP)});n.ok&&(e=((await n.json()).models??[]).map(s=>s.name).filter(s=>!!s).map(s=>({provider:"ollama",name:s,friendlyName:s,providerName:"Ollama"})))}catch{}return ya={models:e,fetchedAt:Date.now()},e}function JP(t){let e=new Set(Object.entries(gr).filter(([,n])=>!!process.env[n]).map(([n])=>n));return t.filter(n=>e.has(n.provider))}function Ld(){return Object.values(gr).some(t=>!!process.env[t])}async function ba(){return Ld()||process.env.TB_AI_BASE_URL||(await Vb()).length>0?"own":"none"}function Gb(t,e,n){let r=Math.max(...t.map(o=>o.name.length)),s=Math.max(...t.map(o=>o.friendlyName.length)),i=["Models available to tb.ai (filtered by your .env keys):",""];for(let o of t)i.push(` ${o.name.padEnd(r)} ${o.friendlyName.padEnd(s)} (${o.provider})`);return i.push("","Pass an id as the `model` in tb.ai({ provider, model })."),e&&n&&i.push(`Default (from .env): ${e} / ${n}`),i.join(`
|
|
508
|
+
`)}var gr,MP,DP,BP,jP,FP,Hs,ya,zs,An=S(()=>{"use strict";gr={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};MP="https://api.typebulb.com/api/models",DP=1440*60*1e3,BP=5e3,jP=60*1e3,FP=1500});var Xb,Qb,lt,Tn=S(()=>{Xb=t=>t!=null&&t>=0&&t<=4?t:void 0,Qb=(t,e)=>{let n={...t};for(let r of["input","output","reasoning","cacheRead"])e[r]!==void 0&&(n[r]=e[r]);return n},lt=t=>t===void 0||t.input===void 0&&t.output===void 0?void 0:{input:t.input??0,output:t.output??0,reasoning:t.reasoning,cacheRead:t.cacheRead}});var Ne,Ze,br=S(()=>{Ne=class extends Error{constructor(e,n="unknown",r=!1){super(e),this.code=n,this.retryable=r}},Ze=class{getPath(e,n){return this.path}parseError(e,n){return this.parseJsonError(e,n)}parseStreamChunk(e){return this.checkAndThrowError(e),this.parseProviderStreamChunk(e)}extractSystemMessages(e,n=`
|
|
509
509
|
|
|
510
|
-
`){let r=e.filter(s=>s.role==="system").map(s=>s.content);return{system:r.length?r.join(n):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,n){if(!e)return{message:`HTTP ${n}`};try{let r=JSON.parse(e);return r.error&&typeof r.error=="object"?{message:r.error.message||`HTTP ${n}`,type:r.error.type}:r.message?{message:r.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let n=e;if(n.type==="error"&&"message"in n){let r=n.code||"unknown";throw new
|
|
511
|
-
`)),!n&&s.type==="message"&&s.content&&(n=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:n,reasoning:r,usage:this.mapUsage(e.usage)}}parseProviderStreamChunk(e){if(this.isResponsesApiEvent(e))switch(e.type){case"response.failed":{let r=e.response?.error,s=r?.message||"Response failed",i=r?.code==="insufficient_quota"||r?.code==="rate_limit_exceeded";throw new
|
|
510
|
+
`){let r=e.filter(s=>s.role==="system").map(s=>s.content);return{system:r.length?r.join(n):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,n){if(!e)return{message:`HTTP ${n}`};try{let r=JSON.parse(e);return r.error&&typeof r.error=="object"?{message:r.error.message||`HTTP ${n}`,type:r.error.type}:r.message?{message:r.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let n=e;if(n.type==="error"&&"message"in n){let r=n.code||"unknown";throw new Ne(n.message,r,!!n.retryable)}if(n.error){let r=n.error,s=typeof r=="object"&&r!==null?String(r.type??r.code??""):"",i=/rate_limit|too_many_requests/i.test(s),o=/overloaded|server_error|unavailable/i.test(s),a=/context_length/i.test(s);throw new Ne(this.extractErrorMessage(n.error),i?"rate_limit":a?"context_exceeded":"unknown",i||o)}}extractErrorMessage(e){if(typeof e=="string")try{let n=JSON.parse(e);return n.error?.message||n.message||e}catch{return e}return typeof e=="object"&&e!==null?e.message||JSON.stringify(e):`${this.providerName} returned an error`}}});var wa,Md=S(()=>{Tn();br();wa=class extends Ze{constructor(){super(...arguments),this.providerName="OpenAI",this.defaultBaseUrl="https://api.openai.com",this.path="/v1/responses",this.effortMap={0:"none",1:"low",2:"medium",3:"high",4:"xhigh"}}buildHeaders(e){return{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"}}buildPayload(e,n,r,s){let i=this.convertMessagesToInput(e),o={model:n,input:i,stream:s};if(r?.webSearch===!0&&(o.tools=[{type:"web_search"}]),r?.effort!==void 0){let a=this.effortMap[r.effort];o.reasoning=a==="none"?{effort:a}:{effort:a,summary:"auto"}}return r?.maxOutputTokens!==void 0&&(o.max_output_tokens=r.maxOutputTokens),o}parseNonStreamingResponse(e){if(!this.isResponsesApiResponse(e))return{text:""};let n=e.output_text||"",r;if(e.output&&Array.isArray(e.output))for(let s of e.output)s.type==="reasoning"&&s.summary&&(r=s.summary.map(i=>i.text).join(`
|
|
511
|
+
`)),!n&&s.type==="message"&&s.content&&(n=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:n,reasoning:r,usage:this.mapUsage(e.usage)}}parseProviderStreamChunk(e){if(this.isResponsesApiEvent(e))switch(e.type){case"response.failed":{let r=e.response?.error,s=r?.message||"Response failed",i=r?.code==="insufficient_quota"||r?.code==="rate_limit_exceeded";throw new Ne(s,i?"rate_limit":"unknown",i)}case"response.output_text.delta":return{text:e.delta};case"response.reasoning_summary_text.delta":return{reasoning:e.delta};case"response.completed":{let n=this.mapUsage(e.response?.usage);return n?{usage:n}:void 0}default:return}}mapUsage(e){if(e)return lt({input:e.input_tokens,output:e.output_tokens,reasoning:e.output_tokens_details?.reasoning_tokens,cacheRead:e.input_tokens_details?.cached_tokens})}convertMessagesToInput(e){return e.map(n=>n.role==="system"?`System: ${n.content}`:n.role==="user"?`User: ${n.content}`:n.role==="assistant"?`Assistant: ${n.content}`:n.content).join(`
|
|
512
512
|
|
|
513
|
-
`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}}});var wr,
|
|
513
|
+
`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}}});var wr,va=S(()=>{Tn();br();wr=class extends Ze{parseNonStreamingResponse(e){if(!this.hasChoices(e))return{text:""};let n=e,r=n.choices[0],s=r?.message,i=s?.content??r?.text??"",o=s?.reasoning??s?.reasoning_content??n.reasoning;return{text:i,reasoning:o,usage:this.mapUsage(n.usage)}}parseProviderStreamChunk(e){if(!this.hasChoices(e))return;let n=e,r=this.mapUsage(n.usage),s=n.choices[0]?.delta||n.choices[0]?.message,i=s?.content||void 0,o=s?.reasoning||s?.reasoning_content||void 0;if(!(!i&&!o&&!r))return{text:i,reasoning:o,usage:r}}hasChoices(e){return typeof e=="object"&&e!==null&&"choices"in e&&Array.isArray(e.choices)}mapUsage(e){if(e)return lt({input:e.prompt_tokens,output:e.completion_tokens,reasoning:e.completion_tokens_details?.reasoning_tokens,cacheRead:e.prompt_tokens_details?.cached_tokens})}}});var Dd,Sa,Bd=S(()=>{va();Dd={"HTTP-Referer":"https://typebulb.com","X-OpenRouter-Title":"Typebulb"},Sa=class extends wr{constructor(){super(...arguments),this.providerName="OpenRouter",this.defaultBaseUrl="https://openrouter.ai",this.path="/api/v1/chat/completions",this.effortMap={0:"none",1:"low",2:"medium",3:"high",4:"xhigh"}}buildHeaders(e){return{Authorization:`Bearer ${e}`,"x-api-key":e,"Content-Type":"application/json",Accept:"application/json",...Dd}}buildPayload(e,n,r,s){let i={model:n,messages:e,stream:s};s&&(i.stream_options={include_usage:!0}),r?.webSearch===!0&&(i.plugins=[{id:"web"}]);let o=r?.effort;return o!==void 0&&(i.reasoning={effort:this.effortMap[o]}),r?.maxOutputTokens!==void 0&&(i.max_tokens=r.maxOutputTokens),i}}});var ka,jd=S(()=>{Tn();br();ka=class extends Ze{constructor(){super(...arguments),this.providerName="Anthropic",this.defaultBaseUrl="https://api.anthropic.com",this.path="/v1/messages"}buildHeaders(e){return{"x-api-key":e,"anthropic-version":"2023-06-01","Content-Type":"application/json",Accept:"application/json"}}buildPayload(e,n,r,s){let{system:i,conversationMessages:o}=this.extractSystemMessages(e),a={model:n,max_tokens:Math.min(this.getMaxTokens(n),r?.maxOutputTokens??1/0),messages:this.withTailMessagesCached(o),stream:s};r?.webSearch===!0&&(a.tools=[{type:"web_search_20250305",name:"web_search"}]),i&&(a.system=[{type:"text",text:i,cache_control:{type:"ephemeral"}}]);let l=r?.effort;if(l!==void 0){if(this.isModernModel(n))if(l===0)this.alwaysThinks(n)||(a.thinking={type:"disabled"}),a.output_config={effort:"low"};else{let c={1:"low",2:"medium",3:"high",4:"max"};a.thinking={type:"adaptive",display:"summarized"},a.output_config={effort:c[l]}}else if(l!==0){let c={1:2048,2:4096,3:8192,4:16384};a.thinking={type:"enabled",budget_tokens:c[l]}}}return a}parseNonStreamingResponse(e){if(!this.isAnthropicResponse(e))return{text:""};let n=e.content.filter(s=>s.type==="text").map(s=>s.text).join(""),r=e.content.filter(s=>s.type==="thinking").map(s=>s.thinking).join(`
|
|
514
514
|
|
|
515
|
-
`);return{text:n,reasoning:r||void 0,usage:
|
|
515
|
+
`);return{text:n,reasoning:r||void 0,usage:lt(this.mapUsage(e.usage))}}parseProviderStreamChunk(e){if(this.isAnthropicEvent(e))switch(e.type){case"content_block_delta":return e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:void 0;case"message_start":{let n=this.mapUsage(e.message?.usage);return n?{usage:n}:void 0}case"message_delta":{let n=this.mapUsage(e.usage);return n?{usage:n}:void 0}default:return}}mapUsage(e){if(typeof e!="object"||e===null)return;let n=e,r=c=>typeof c=="number"?c:void 0,s=r(n.input_tokens),i=r(n.cache_read_input_tokens),o=r(n.cache_creation_input_tokens),a=r(n.output_tokens),l=s!==void 0||i!==void 0||o!==void 0?(s??0)+(i??0)+(o??0):void 0;if(!(l===void 0&&a===void 0))return{input:l,output:a,cacheRead:i}}withTailMessagesCached(e){let n=Math.max(0,e.length-2);return e.map((r,s)=>s>=n?{role:r.role,content:[{type:"text",text:r.content,cache_control:{type:"ephemeral"}}]}:r)}isAnthropicResponse(e){return typeof e=="object"&&e!==null&&e.type==="message"&&Array.isArray(e.content)}isAnthropicEvent(e){return typeof e=="object"&&e!==null&&"type"in e}isModernModel(e){let n=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!n)return!1;let r=+n[1],s=n[2]?+n[2]:0;return r>4||r===4&&s>=6}alwaysThinks(e){return/^claude-(fable|mythos)\b/i.test(e)}getMaxTokens(e){return this.isModernModel(e)?64e3:32e3}}});var xa,Fd=S(()=>{Tn();br();xa=class extends Ze{constructor(){super(...arguments),this.providerName="Gemini",this.defaultBaseUrl="https://generativelanguage.googleapis.com",this.path="/v1beta/models",this.budgetMap={0:0,1:1024,2:8192,3:-1,4:-1}}getPath(e,n){return`/v1beta/models/${e}:${n?"streamGenerateContent":"generateContent"}${n?"?alt=sse":""}`}buildHeaders(e){return{"Content-Type":"application/json","x-goog-api-key":e}}buildPayload(e,n,r,s){let{system:i,conversationMessages:o}=this.extractSystemMessages(e,`
|
|
516
516
|
`),l={contents:o.map(f=>({role:f.role==="assistant"?"model":"user",parts:[{text:f.content}]}))};r?.webSearch===!0&&(l.tools=[{google_search:{}}]),i&&(l.systemInstruction={role:"system",parts:[{text:i}]});let c=r?.effort;if(c!==void 0){let f=this.geminiVersion(n),d=f!==void 0&&f>=3?{thinkingLevel:this.thinkingLevelFor(f,c)}:{thinkingBudget:this.budgetMap[c]};l.generationConfig={thinkingConfig:c===0?d:{includeThoughts:!0,...d}}}return r?.maxOutputTokens!==void 0&&(l.generationConfig={...l.generationConfig,maxOutputTokens:r.maxOutputTokens}),l}parseError(e,n){if(!e)return{message:`HTTP ${n}`};try{let r=JSON.parse(e),s=Array.isArray(r)?r[0]?.error:r?.error;return s&&typeof s=="object"?{message:(s.message||`HTTP ${n}`).split(`
|
|
517
|
-
`)[0],type:s.status,code:s.code?.toString()}:r.message?{message:r.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let n=this.extractParts(e).text||"",r=e.candidates?.[0]?.finishReason,s="complete";return r==="MAX_TOKENS"?s="interrupted":(r==="SAFETY"||r==="RECITATION")&&(s="failed"),{text:n,status:s,usage:this.mapUsage(e.usageMetadata)}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return;let n=this.extractParts(e),r=this.mapUsage(e.usageMetadata);return r&&(n.usage=r),n.text||n.reasoning||n.usage?n:void 0}mapUsage(e){if(!e)return;let n=e.candidatesTokenCount!==void 0||e.thoughtsTokenCount!==void 0;return
|
|
517
|
+
`)[0],type:s.status,code:s.code?.toString()}:r.message?{message:r.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let n=this.extractParts(e).text||"",r=e.candidates?.[0]?.finishReason,s="complete";return r==="MAX_TOKENS"?s="interrupted":(r==="SAFETY"||r==="RECITATION")&&(s="failed"),{text:n,status:s,usage:this.mapUsage(e.usageMetadata)}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return;let n=this.extractParts(e),r=this.mapUsage(e.usageMetadata);return r&&(n.usage=r),n.text||n.reasoning||n.usage?n:void 0}mapUsage(e){if(!e)return;let n=e.candidatesTokenCount!==void 0||e.thoughtsTokenCount!==void 0;return lt({input:e.promptTokenCount,output:n?(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0):void 0,reasoning:e.thoughtsTokenCount,cacheRead:e.cachedContentTokenCount})}geminiVersion(e){let n=e.match(/^gemini-(\d+(?:\.\d+)?)/);return n?Number(n[1]):void 0}thinkingLevelFor(e,n){let r=["minimal","low","medium","high","high"][n];return r==="minimal"&&e<3.5?"low":r}isGeminiResponse(e){return typeof e=="object"&&e!==null&&"candidates"in e&&Array.isArray(e.candidates)}extractParts(e){let n=e.candidates?.[0]?.content?.parts;if(!n)return{};let r="",s="";for(let i of n)i.text&&(i.thought?s+=i.text:r+=i.text);return{text:r||void 0,reasoning:s||void 0}}checkGeminiError(e){if(this.isGeminiResponse(e)&&e.promptFeedback?.blockReason){let n=e.promptFeedback.blockReason;throw new Ne(`Prompt blocked: ${n}`)}}}});var Ea,Ud=S(()=>{va();Ea=class extends wr{constructor(){super(...arguments),this.providerName="Ollama",this.defaultBaseUrl="http://localhost:11434",this.path="/chat/completions"}buildHeaders(e){let n={"Content-Type":"application/json",Accept:"application/json"};return e&&(n.Authorization=`Bearer ${e}`),n}buildPayload(e,n,r,s){return s?{model:n,messages:e,stream:s,stream_options:{include_usage:!0}}:{model:n,messages:e,stream:s}}}});function Cn(t){let e=WP.get(t);if(!e)throw new Error(`Unsupported protocol: ${t}`);return e}function KP(t,e){return t.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)}async function qd(t,e){let n=Cn(t.protocol),r=n.getPath(t.model,e.stream),s=KP(t.baseUrl,r),i=n.buildHeaders(t.apiKey),o=n.buildPayload(e.messages,t.model,{effort:e.effort,webSearch:e.webSearch,maxOutputTokens:e.maxOutputTokens},e.stream);return fetch(s,{method:"POST",headers:i,body:JSON.stringify(o),signal:e.signal})}function HP(t){return/prompt is too long|context[_ ](length|window)|maximum context|token count exceeds|too many tokens/i.test(t)}async function vr(t,e){let n=Cn(e),r=await t.text().catch(()=>""),{message:s}=n.parseError(r,t.status),i=t.status,o="unknown";return i===429?o="rate_limit":(i===413||HP(s))&&(o="context_exceeded"),{code:o,message:s,retryable:i===429||i>=500}}var Zb,WP,Jd=S(()=>{Md();Bd();jd();Fd();Ud();Zb=new Ea,WP=new Map([["openai",new wa],["openrouter",new Sa],["anthropic",new ka],["gemini",new xa],["ollama",Zb],["openai-compat",Zb]])});function ew(t){let e=t.indexOf(`\r
|
|
518
518
|
\r
|
|
519
519
|
`),n=t.indexOf(`
|
|
520
520
|
|
|
521
|
-
`);return e!==-1&&(n===-1||e<n)?{pos:e,len:4}:n!==-1?{pos:n,len:2}:{pos:-1,len:0}}function
|
|
522
|
-
`).trim();if(r){if(r==="[DONE]")return"done";try{return JSON.parse(r)}catch{return}}}async function*
|
|
521
|
+
`);return e!==-1&&(n===-1||e<n)?{pos:e,len:4}:n!==-1?{pos:n,len:2}:{pos:-1,len:0}}function Wd(t){let n=t.split(/\r?\n/).filter(s=>s.startsWith("data:"));if(!n.length)return;let r=n.map(s=>s.replace(/^data:\s?/,"")).join(`
|
|
522
|
+
`).trim();if(r){if(r==="[DONE]")return"done";try{return JSON.parse(r)}catch{return}}}async function*tw(t,e,n){let r=new TextDecoder,s="",i,o=e?new Promise((a,l)=>{e.aborted&&l(new Error("Aborted")),i=()=>l(new Error("Aborted")),e.addEventListener("abort",i,{once:!0})}):void 0;o?.catch(()=>{});try{for(;;){let{done:a,value:l}=o?await Promise.race([t.read(),o]):await t.read();if(a){if(s.trim()){let d=Wd(s);d!==void 0&&d!=="done"&&(yield d)}return}n?.(),s+=r.decode(l,{stream:!0});let{pos:c,len:f}=ew(s);for(;c!==-1;){let d=s.slice(0,c);s=s.slice(c+f);let u=Wd(d);if(u==="done")return;u!==void 0&&(yield u),{pos:c,len:f}=ew(s)}}}finally{i&&e?.removeEventListener("abort",i);try{await t.cancel()}catch{}}}async function Kd(t,e){return(await Sr(t,e)).text}async function Sr(t,e){if(!t.body)throw new Error("Response body is missing");let n="",r;for await(let s of On(t,e))s.kind==="text"?n+=s.text:s.kind==="usage"&&(r=s.usage);return{text:n,usage:r}}async function*On(t,e){let n=e??(t.headers.get("X-Provider-Protocol")||"openai"),r=Cn(n);if(!t.body)return;let s=t.body.getReader(),i;for await(let a of tw(s)){let l=r.parseStreamChunk(a);l?.reasoning&&(yield{kind:"reasoning",text:l.reasoning}),l?.text&&(yield{kind:"text",text:l.text}),l?.usage&&(i=Qb(i,l.usage))}let o=lt(i);o&&(yield{kind:"usage",usage:o})}var nw=S(()=>{Tn();Jd()});import{strToU8 as zP,strFromU8 as YP,deflateSync as VP,inflateSync as GP}from"fflate";function zd(t,e){let n=[];if(n.push(`You are a data processor. Follow the instructions to analyze the provided data. Output valid JSON that the code can consume.
|
|
523
523
|
|
|
524
524
|
---
|
|
525
525
|
Instructions:
|
|
@@ -537,13 +537,13 @@ ${r}
|
|
|
537
537
|
</data>`)}return n.push(`
|
|
538
538
|
Output only valid JSON. No explanation, no markdown fences, just the JSON object. Every number must be a JSON literal \u2014 never an expression like 2 * pi; write the computed decimal instead.`),n.join(`
|
|
539
539
|
|
|
540
|
-
`)}function
|
|
541
|
-
`)){let n=e.trim();if(!n||n.startsWith("#"))continue;let r=n.indexOf("=");if(r===-1)continue;let s=n.slice(0,r).trim(),i=n.slice(r+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function
|
|
540
|
+
`)}function Ys(t){try{return JSON.parse(t)}catch{return}}function rw(t,e){let n="",r=0,s=!1,i=!1;for(let o=0;o<t.length;o++){let a=t[o];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}a==='"'&&(s?(n+=t.slice(r,o+1),r=o+1):(n+=e(t.slice(r,o))+'"',r=o+1),s=!s)}return n+=s?t.slice(r):e(t.slice(r)),n}function QP(t){let e=rw(t,n=>n.replace(/,(\s*[}\]])/g,"$1"));return e!==t?e:void 0}function ZP(t){let e=rw(t,n=>n.replace(/\bpi\b/g,"3.141592653589793").replace(/\be\b/g,"2.718281828459045").replace(/-?\d[\d.\s+\-*/()]*\d|\(-?\d[\d.\s+\-*/()]*\d\)/g,r=>{if(!/[+\-*/]/.test(r.replace(/^-/,""))||r.length>64||!/^[\d\s.+\-*/()]+$/.test(r))return r;try{let s=Function(`"use strict"; return (${r})`)();return typeof s=="number"&&Number.isFinite(s)?String(s):r}catch{return r}}));return e!==t?e:void 0}function e_(t,e){let n=0,r=!1,s=!1;for(let i=e;i<t.length;i++){let o=t[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(o==='"'){r=!r;continue}if(!r){if(o==="{"||o==="[")n++;else if((o==="}"||o==="]")&&(n--,n===0))return i}}return-1}function t_(t){let e,n=0;for(;n<t.length;){let r=t[n];if(r==="{"||r==="["){let s=e_(t,n);if(s!==-1){let i=t.slice(n,s+1),o=Ys(i);o!==void 0&&(e={parsed:o,json:i}),n=s+1;continue}}n++}return e}function Yd(t){let e=[],n=t.trim();n.startsWith("```")&&(n=n.replace(/^```(?:json)?\s*\n?/,"").replace(/\n?```\s*$/,""),e.push("markdown fences"));let r=Ys(n);if(r!==void 0)return{parsed:r,json:n,fixesApplied:e};let s=n.match(/```(?:json)?\s*\n([\s\S]*?)\n?```\s*$/);if(s&&(n=s[1].trim(),e.push("preamble before fenced JSON"),r=Ys(n),r!==void 0))return{parsed:r,json:n,fixesApplied:e};if(!n.startsWith("{")&&!n.startsWith("[")){let o=n.indexOf("{"),a=n.indexOf("["),l=o>=0&&a>=0?Math.min(o,a):o>=0?o:a;if(l>0&&(n=n.slice(l),e.push("preamble text"),r=Ys(n),r!==void 0))return{parsed:r,json:n,fixesApplied:e}}for(let[o,a]of XP){let l=a(n);if(l!==void 0){let c=Ys(l);if(c!==void 0)return{parsed:c,json:l,fixesApplied:[...e,o]}}}let i=t_(t);return i!==void 0?{...i,fixesApplied:[...e,"extracted last JSON value"]}:{parsed:void 0,json:n,fixesApplied:e}}function Vd(t){try{let e={};if(t.insight!==void 0&&(e.i=t.insight),t.data!==void 0&&(e.d=t.data),e.i===void 0&&e.d===void 0)return"";let n=JSON.stringify(e),r=VP(zP(n),{level:9}),s=r_(r),i=`${sw}:${s}`;return i.length>n_?"":"#"+Hd+i}catch{return""}}function Gd(t){try{let e=t.startsWith("#")?t.slice(1):t;if(!e.startsWith(Hd))return;let n=e.slice(Hd.length),r=n.indexOf(":");if(r===-1||n.slice(0,r)!==sw)return;let s=s_(n.slice(r+1)),i=JSON.parse(YP(GP(s)));if(!i||typeof i!="object")return;let o=i.i!==void 0,a=Array.isArray(i.d);if(!o&&!a)return;let l={};return o&&(l.insight=i.i,l.insightJson=JSON.stringify(i.i,null,2)),a&&(l.data=i.d),l}catch{return}}function r_(t){let e="";for(let n=0;n<t.length;n+=32768)e+=String.fromCharCode(...t.subarray(n,n+32768));return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function s_(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";let n=atob(e),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}var XP,Hd,sw,n_,iw=S(()=>{XP=[["orphan quote",t=>{let e=t.replace(/^[ \t]*"[ \t]*\r?\n/gm,"");return e!==t?e:void 0}],["trailing }",t=>t.endsWith("}}")?t.slice(0,-1):void 0],["trailing ]",t=>t.endsWith("]]")?t.slice(0,-1):void 0],["trailing },",t=>t.endsWith("},")?t.slice(0,-1):void 0],["trailing ],",t=>t.endsWith("],")?t.slice(0,-1):void 0],["trailing commas",QP],["arithmetic constants",ZP]];Hd="tb=",sw="1",n_=6e4});var Kt=S(()=>{Tn();br();Jd();nw();iw();va();jd();Fd();Md();Bd();Ud()});import{readFileSync as ow,existsSync as i_}from"fs";import*as ct from"path";function aw(t){return[...t?[`.env.${t}.local`,`.env.${t}`]:[],".env.local",".env"]}function be(t,e=process.cwd()){let n={},r=[];for(let s of aw(t)){let i;try{i=ow(ct.resolve(e,s),"utf-8")}catch{continue}r.push(s);for(let[o,a]of lw(i))process.env[o]===void 0&&(process.env[o]=a,n[o]=s)}return{mode:t,sources:n,loaded:r}}function*lw(t){for(let e of t.split(`
|
|
541
|
+
`)){let n=e.trim();if(!n||n.startsWith("#"))continue;let r=n.indexOf("=");if(r===-1)continue;let s=n.slice(0,r).trim(),i=n.slice(r+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function Aa(t,e=process.cwd()){for(let n of aw()){let r;try{r=ow(ct.resolve(e,n),"utf-8")}catch{continue}for(let[s,i]of lw(r))if(s===t)return i}return process.env[t]}function o_(t){let e=new Set,n=/process\.env\.([A-Za-z_$][\w$]*)|process\.env\[\s*['"]([^'"]+)['"]\s*\]/g;for(let r;r=n.exec(t);)e.add(r[1]??r[2]);return[...e]}function cw(){return`.env loads from ${process.cwd()} (the directory you ran from, not the bulb's)`}function Ht(t,e,n){let{sources:r,mode:s,loaded:i}=t,o=process.cwd(),a=ct.dirname(e),l=`(mode: ${s??"none"})`,c=n?o_(n):[],f=c.filter(p=>r[p]).map(p=>`${p} \u2190 ${r[p]}`);f.length?console.log(`env: ${f.join(", ")} ${l}`):i.length&&console.log(`env: loaded ${i.join(", ")} ${l}`),s&&!i.some(p=>p===`.env.${s}`||p===`.env.${s}.local`)&&console.log(`env: mode=${s} \u2014 no .env.${s} found; using .env`);let d=ct.resolve(a)!==ct.resolve(o);if(d)for(let p of[".env.local",".env"])i_(ct.join(a,p))&&console.log(`env: ${ct.join(a,p)} present but not loaded (cwd is ${o})`);let u=c.filter(p=>process.env[p]===void 0);if(u.length){let p=d?` \u2014 try running from ${a}`:"";console.log(`env: server.ts reads ${u.join(", ")} but ${u.length>1?"they are":"it's"} unset${p}`)}}var et=S(()=>{"use strict"});function vt(t,e){let n=t??process.env.TB_AI_PROVIDER,r=e??process.env.TB_AI_MODEL;if(!n)return"No provider specified. Set TB_AI_PROVIDER in your .env file or pass provider in the tb.ai() call.";if(!r)return"No model specified. Set TB_AI_MODEL in your .env file or pass model in the tb.ai() call.";let s;try{s=Cn(n)}catch{return`Unknown provider '${n}'.`}if(n==="ollama")return{apiKey:"",baseUrl:`${yr(process.env.OLLAMA_HOST??s.defaultBaseUrl)}/v1`,protocol:n,model:r,isFreeModel:!1};if(n==="openai-compat"){let a=process.env.TB_AI_BASE_URL;return a?{apiKey:process.env.TB_AI_API_KEY??"",baseUrl:a,protocol:n,model:r,isFreeModel:!1}:"No base URL for openai-compat. Set TB_AI_BASE_URL (the OpenAI-style base ending in /v1, e.g. http://localhost:1234/v1) in your .env file."}let i=gr[n];if(!i)return`Unknown provider '${n}'.`;let o=process.env[i];return o?{apiKey:o,baseUrl:s.defaultBaseUrl,protocol:n,model:r,isFreeModel:!1}:`No API key for '${n}'. Set ${i} \u2014 ${cw()}.`}function zt(t,e){let n=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(r=>({role:r.role,content:r.content}))];return qd(t,{messages:n,stream:!0,effort:Xb(e.effort),webSearch:e.webSearch,signal:e.signal})}var Ta=S(()=>{"use strict";Kt();Kt();et();An()});import{readFileSync as RF,existsSync as a_}from"fs";import*as kr from"path";import{fileURLToPath as l_}from"url";function c_(){let t=kr.dirname(l_(import.meta.url));for(;!a_(kr.join(t,"package.json"));){let e=kr.dirname(t);if(e===t)break;t=e}return t}function Vs(){return kr.join(c_(),"SKILL.md")}var Xd=S(()=>{"use strict"});import{transform as u_}from"sucrase";function Qd(t,e={}){let n=e.serverOnly?["typescript"]:["typescript","jsx"];try{let{code:r}=u_(t,{transforms:n,jsxRuntime:"automatic",jsxImportSource:e.jsxImportSource||"react",production:!0});return{code:r}}catch(r){return{code:"",error:String(r)}}}var uw=S(()=>{});function d_(t){return t.map(e=>`${e.type} (line ${e.lineNumber}): ${e.message.split(`
|
|
542
542
|
`)[0]}`).join(`
|
|
543
|
-
`)}function
|
|
544
|
-
${u_(n)}`)}var dw=S(()=>{"use strict";ma()});var zt,Ys,Qd,Vs=S(()=>{zt="https://esm.sh",Ys="https://cdn.jsdelivr.net/npm/",Qd="https://data.jsdelivr.com/v1/package/npm/"});function fw(t){let e=(t||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var F,xr,pw,Gs=S(()=>{Vs();F=class t{constructor(e,n,r){let s=typeof e=="string"?t.parse(e):e;this.name=s.name,this.version=xr(n??s.version),this.subpath=xr(r??s.subpath)}static parse(e){let n=fw(e||"");if(!n.length)return new t({name:""});if(n[0].startsWith("@")){let s=n[0],[i,o]=pw(n[1]??""),a=xr(n.slice(2).join("/"));return new t({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=pw(n[0]),o=xr(n.slice(1).join("/"));return new t({name:s,version:i,subpath:o})}}static fromUrl(e){try{let n=new URL(e),r=new URL(zt).host,s=new URL(Ys).host;if(n.host===r){let i=fw(n.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return t.parse(o)}if(n.host===s){let i=n.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return t.parse(o)}return}catch{return}}format(){let e=this.version?`${this.name}@${this.version}`:this.name;return this.subpath?`${e}/${this.subpath}`:e}root(){return this.name}static rootOf(e){return t.parse(e).name}withVersion(e){return new t({name:this.name,version:xr(e),subpath:this.subpath})}static isBare(e){return!e||e.startsWith(".")||e.startsWith("/")?!1:!/^[a-z][a-z0-9+.-]*:/i.test(e)}},xr=t=>t&&t.length?t:void 0,pw=t=>{let e=t.indexOf("@");return e<0?[t,void 0]:[t.slice(0,e),xr(t.slice(e+1))]}});async function Pe(t){try{return await t()}catch{return}}var Ta=S(()=>{});function On(t){let e=t||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function Zd(t){return t.startsWith("./")?t:`./${t}`}var Xs,ef=S(()=>{Gs();Ta();Vs();Xs=class{constructor(e,n){this.cache=e,this.http=n,this.pinMs=1e4,this.versionsIndexMs=1440*60*1e3,this.metaTtlMs=10080*60*1e3,this.pinCache=new Map}baseDir(e){let n=typeof e=="string"?new F(e):e;return`${Ys}${n.name}${n.version?`@${n.version}`:""}/`}file(e,n){return new URL(On(n),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,n={}){let{target:r="es2022",bundle:s=!1,external:i}=n,o=new URLSearchParams({target:r});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${zt}/${e}?${o.toString()}`}async resolveExactVersion(e){let n=Date.now(),r=this.pinCache.get(e);if(r&&n-r.ts<this.pinMs)return r.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${zt}/${e}`]);return this.pinCache.set(e,{value:s,ts:n}),s}async tryResolveFromUrls(e){for(let n of e){let r=await Pe(()=>this.http.head(n)),s=this.parseVersionFromUrl(r?.url||n);if(s)return s}}async fetchVersionsIndex(e){if(await this.cache.isNegative(e))return;let n=await this.cache.getIndex(e);if(n&&Date.now()-n.updatedAt<this.versionsIndexMs)return{versions:n.versions,distTags:n.distTags};let r=await Pe(()=>this.http.getJson(`${Qd}${encodeURIComponent(e)}`));if(!r?.versions?.length){await this.cache.recordNegative(e);return}await this.cache.clearNegative(e);let s=r.tags&&Object.keys(r.tags).length?r.tags:void 0;return await this.cache.setIndex(e,r.versions,s),{versions:r.versions,distTags:s}}parseVersionFromUrl(e){let n=F.fromUrl(e)?.version;return n&&/\d+\.\d+\.\d+/.test(n)?n:void 0}async fetchPackageMeta(e,n){let r=await this.cache.getMeta(e,n);if(r&&Date.now()-r.updatedAt<this.metaTtlMs){let{dependencies:f,peerDependencies:d,peerDependenciesMeta:u}=r;return{name:e,version:n,dependencies:f,peerDependencies:d,peerDependenciesMeta:u}}let s=this.packageJson(new F(`${e}@${n}`)),i=await Pe(()=>this.http.getJson(s));if(!i)return;let o=f=>f&&Object.keys(f).length?f:void 0,a=o(i.dependencies),l=o(i.peerDependencies),c=o(i.peerDependenciesMeta);return await this.cache.setMeta(e,n,a,l,c),{name:e,version:n,dependencies:a,peerDependencies:l,peerDependenciesMeta:c}}}});var hw,Qs,tf,d_,Zs,Ca=S(()=>{hw=t=>t.startsWith("@types/"),Qs=t=>Object.keys(t?.peerDependencies||{}).filter(e=>!hw(e)),tf=t=>Object.keys(t?.dependencies||{}).filter(e=>!hw(e)),d_=t=>Qs(t).filter(e=>!t?.peerDependenciesMeta?.[e]?.optional),Zs=class{constructor(e){this.cdn=e}async resolve(e,n){let r=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(r,n),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:n,version:r})=>({name:n,version:r,meta:await this.cdn.fetchPackageMeta(n,r)})))}async expandWithPeers(e,n){let r=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of d_(i.meta))!r.has(o)&&!s.some(a=>a.name===o)&&s.push({name:o,requiredBy:i.name});for(let{name:i,requiredBy:o}of s)try{let a=await n(i),l=await this.cdn.fetchPackageMeta(i,a);r.set(i,{name:i,version:a,meta:l})}catch(a){console.warn(`[typebulb] Failed to resolve peer "${i}" for "${o}":`,a)}return{allRoots:[...r.values()],autoAddedPeers:s.filter(i=>r.has(i.name))}}computeFlags(e){let n=new Set(e.flatMap(i=>Qs(i.meta))),r=new Map;for(let i of e)for(let o of tf(i.meta))r.set(o,(r.get(o)||0)+1);let s=new Set([...r.entries()].filter(([,i])=>i>=2).map(([i])=>i));return new Map(e.map(i=>[i.name,{isPeerRoot:n.has(i.name),hasPeers:Qs(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var ei,nf=S(()=>{Gs();Ta();ei=class{constructor(e,n,r){this.cache=e,this.cdn=n,this.semver=r}async learnExactVersion(e){let n=await Pe(()=>this.cdn.fetchVersionsIndex(e));if(n?.versions?.length){let r=this.semver.selectBestVersion(n.versions,{distTags:n.distTags});if(r)return r}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,n){if(!n)return this.learnExactVersion(e);let r=a=>!this.semver.isRange(n)||this.semver.satisfies(n,a),s=await this.cache.getPinnedExact(e,n);if(s){if(this.semver.isExactVersion(s)&&r(s))return s;console.debug("[typebulb] cached version for",e,"is not exact or not in",n,"(",s,"); re-resolving from registry")}let i=async a=>{if(a&&this.semver.isExactVersion(a)&&r(a))return await this.cache.setPinnedExact(e,n,a),a},o=await Pe(()=>this.cdn.fetchVersionsIndex(e));if(o?.versions?.length){let a=this.semver.selectBestVersion(o.versions,{range:n,distTags:o.distTags});if(a){let l=await i(a);if(l)return l}else{console.debug("[typebulb] refreshing version cache for",e,"(",n,"not in cached set \u2014 likely a new release)"),await this.cache.invalidateVersionsCache(e);let l=await Pe(()=>this.cdn.fetchVersionsIndex(e));if(l?.versions?.length){let c=await i(this.semver.selectBestVersion(l.versions,{range:n,distTags:l.distTags}));if(c)return c}}}return i(await this.cdn.resolveExactVersion(`${e}@${n}`))}async effectivePackage(e,n){let r=new F(e),s=r.root(),i=n[s],o=i?await Pe(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?r.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as f_,parse as p_}from"es-module-lexer";var Er,rf=S(()=>{Gs();Vs();Ca();Er=class t{constructor(e,n,r){this.version=e,this.cdn=n,this.peer=r}extractImportsSync(e){let n=new Set;for(let r of t.importPatterns){r.lastIndex=0;for(let s of e.matchAll(r))F.isBare(s[1])&&n.add(s[1])}return Array.from(n)}async extractImports(e){let n=new Set,r=s=>{F.isBare(s)&&n.add(s)};try{await f_;let[s]=p_(e);s.forEach(i=>r(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(n)}async buildImportMap(e,n,r){let s=(await this.extractImports(e)).filter(d=>!r?.has(F.rootOf(d))),i=[...new Set(s.map(F.rootOf))],o=await Promise.all(i.map(async d=>({name:d,version:await this.resolveVersion(d,n)}))),{allRoots:a,flags:l,autoAddedPeers:c}=await this.peer.resolve(o,d=>this.resolveVersion(d,n)),f=this.buildEntries([...s,...c.map(d=>d.name)],a,l);return{importMap:{imports:Object.fromEntries(f)},prefetchUrls:f.map(([,d])=>d)}}async resolveVersion(e,n){let r=n[e],s=await this.version.resolveExactForRoot(e,r);if(!s)throw new Error(`Cannot resolve ${r?`${e}@${r}`:e}: no matching version is published (the package or version may not exist, or the registry was unreachable).`);return s}buildEntries(e,n,r){let s=new Map(n.map(p=>[p.name,p])),i=p=>{let h=s.get(F.rootOf(p));return new F(p).withVersion(h.version).format()},o=new Set([...r.entries()].filter(([,p])=>p.isPeerRoot||p.isSharedDep).map(([p])=>p)),a=new Set(e.filter(p=>p!==F.rootOf(p)).map(F.rootOf)),l=[],c=new Set,f=new Set(e.filter(p=>p===F.rootOf(p))),d=new Set;for(let p of e){let h=F.rootOf(p),m=s.get(h),{isPeerRoot:g,hasPeers:b,isSharedDep:C}=r.get(h),T=a.has(h),E=p!==h,P=!(g||C)&&(T||!b),_=this.singletonDepsOf(m,o),k=E&&f.has(h);k&&d.add(h);let N=k?[..._,h]:_.length?_:void 0;l.push([p,this.cdn.buildEsmUrl(i(p),{bundle:P,external:N})]),c.add(p)}let u=new Set([...o,...d]);for(let p of u)s.has(p)&&(c.has(p)||l.push([p,this.cdn.buildEsmUrl(i(p),{})]),l.push([`${p}/`,`${zt}/${i(p)}/`]));return l}singletonDepsOf(e,n){return[...new Set([...Qs(e.meta),...tf(e.meta)])].filter(r=>n.has(r))}};Er.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as mw,satisfies as h_,maxSatisfying as gw,major as m_,valid as g_,validRange as y_}from"semver";var Oa,Pn,sf=S(()=>{Oa=class{cmp(e,n){return e===n?0:mw(e,n)?1:mw(n,e)?-1:0}satisfies(e,n){return!e||!e.trim()?!0:!!h_(n,e,{includePrerelease:!0})}selectBestVersion(e,n){if(!e?.length)return;let r=n?.range?.trim()||"*",s=n?.preferStable??!0,i=n?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(r,i))return i;if(s){let a=gw(e,r,{includePrerelease:!1});if(a)return a}return gw(e,r,{includePrerelease:!0})??void 0}majorOf(e){return m_(e)}isExactVersion(e){return g_(e)!==null}isRange(e){return y_(e)!==null}},Pn=new Oa});function b_(t){return Math.min(9e5*Math.pow(2,Math.max(0,t-1)),864e5)}var _n,yw=S(()=>{Ta();_n=class{constructor(e){this.store=e}async isNegative(e){let n=await Pe(()=>this.store.get(e));return!!n&&n.until>Date.now()}async recordNegative(e){let r=((await Pe(()=>this.store.get(e)))?.attempts||0)+1;await Pe(()=>this.store.set(e,{until:Date.now()+b_(r),attempts:r}))}async clearNegative(e){await Pe(()=>this.store.delete(e))}}});function bw(t,e){let n=new Xs(t,e),r=new Zs(n),s=new ei(t,n,Pn);return{packageService:new Er(s,n,r),versionResolver:s,cdnClient:n,peerResolver:r}}var vt=S(()=>{ef();Ca();nf();rf();sf();Gs();sf();Vs();ef();Ca();nf();rf();yw()});import*as of from"fs/promises";import*as ww from"crypto";function et(t){return ww.createHash("sha1").update(t).digest("hex")}async function St(t){try{return JSON.parse(await of.readFile(t,"utf8"))}catch{return}}async function Pa(t){try{return await of.readFile(t,"utf8")}catch{return}}var Ar=S(()=>{"use strict"});import*as Vt from"fs/promises";import*as kt from"path";import*as Sw from"os";function ne(){return af||(af=v_().catch(()=>mt())),af}function Ra(t,e){return kt.join(w_,et(t),e)}async function v_(){await Vt.mkdir(Yt,{recursive:!0});let t=kt.join(Yt,"version.json");if((await St(t))?.version===vw)return;let n=await Vt.readdir(Yt).catch(()=>[]);await Promise.all(n.map(r=>Vt.rm(kt.join(Yt,r),{recursive:!0,force:!0}))),await Vt.writeFile(t,JSON.stringify({version:vw})+`
|
|
545
|
-
`,"utf8")}var
|
|
546
|
-
${
|
|
543
|
+
`)}function dw(t,e){let n=Js(t,{target:"client",dependencies:e}).filter(r=>r.type==="UNDECLARED_IMPORT");if(n.length)throw new Error(`Lint failed:
|
|
544
|
+
${d_(n)}`)}var fw=S(()=>{"use strict";ga()});var Yt,Gs,Zd,Xs=S(()=>{Yt="https://esm.sh",Gs="https://cdn.jsdelivr.net/npm/",Zd="https://data.jsdelivr.com/v1/package/npm/"});function pw(t){let e=(t||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var F,xr,hw,Qs=S(()=>{Xs();F=class t{constructor(e,n,r){let s=typeof e=="string"?t.parse(e):e;this.name=s.name,this.version=xr(n??s.version),this.subpath=xr(r??s.subpath)}static parse(e){let n=pw(e||"");if(!n.length)return new t({name:""});if(n[0].startsWith("@")){let s=n[0],[i,o]=hw(n[1]??""),a=xr(n.slice(2).join("/"));return new t({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=hw(n[0]),o=xr(n.slice(1).join("/"));return new t({name:s,version:i,subpath:o})}}static fromUrl(e){try{let n=new URL(e),r=new URL(Yt).host,s=new URL(Gs).host;if(n.host===r){let i=pw(n.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return t.parse(o)}if(n.host===s){let i=n.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return t.parse(o)}return}catch{return}}format(){let e=this.version?`${this.name}@${this.version}`:this.name;return this.subpath?`${e}/${this.subpath}`:e}root(){return this.name}static rootOf(e){return t.parse(e).name}withVersion(e){return new t({name:this.name,version:xr(e),subpath:this.subpath})}static isBare(e){return!e||e.startsWith(".")||e.startsWith("/")?!1:!/^[a-z][a-z0-9+.-]*:/i.test(e)}},xr=t=>t&&t.length?t:void 0,hw=t=>{let e=t.indexOf("@");return e<0?[t,void 0]:[t.slice(0,e),xr(t.slice(e+1))]}});async function Oe(t){try{return await t()}catch{return}}var Ca=S(()=>{});function Pn(t){let e=t||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function ef(t){return t.startsWith("./")?t:`./${t}`}var Zs,tf=S(()=>{Qs();Ca();Xs();Zs=class{constructor(e,n){this.cache=e,this.http=n,this.pinMs=1e4,this.versionsIndexMs=1440*60*1e3,this.metaTtlMs=10080*60*1e3,this.pinCache=new Map}baseDir(e){let n=typeof e=="string"?new F(e):e;return`${Gs}${n.name}${n.version?`@${n.version}`:""}/`}file(e,n){return new URL(Pn(n),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,n={}){let{target:r="es2022",bundle:s=!1,external:i}=n,o=new URLSearchParams({target:r});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${Yt}/${e}?${o.toString()}`}async resolveExactVersion(e){let n=Date.now(),r=this.pinCache.get(e);if(r&&n-r.ts<this.pinMs)return r.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${Yt}/${e}`]);return this.pinCache.set(e,{value:s,ts:n}),s}async tryResolveFromUrls(e){for(let n of e){let r=await Oe(()=>this.http.head(n)),s=this.parseVersionFromUrl(r?.url||n);if(s)return s}}async fetchVersionsIndex(e){if(await this.cache.isNegative(e))return;let n=await this.cache.getIndex(e);if(n&&Date.now()-n.updatedAt<this.versionsIndexMs)return{versions:n.versions,distTags:n.distTags};let r=await Oe(()=>this.http.getJson(`${Zd}${encodeURIComponent(e)}`));if(!r?.versions?.length){await this.cache.recordNegative(e);return}await this.cache.clearNegative(e);let s=r.tags&&Object.keys(r.tags).length?r.tags:void 0;return await this.cache.setIndex(e,r.versions,s),{versions:r.versions,distTags:s}}parseVersionFromUrl(e){let n=F.fromUrl(e)?.version;return n&&/\d+\.\d+\.\d+/.test(n)?n:void 0}async fetchPackageMeta(e,n){let r=await this.cache.getMeta(e,n);if(r&&Date.now()-r.updatedAt<this.metaTtlMs){let{dependencies:f,peerDependencies:d,peerDependenciesMeta:u}=r;return{name:e,version:n,dependencies:f,peerDependencies:d,peerDependenciesMeta:u}}let s=this.packageJson(new F(`${e}@${n}`)),i=await Oe(()=>this.http.getJson(s));if(!i)return;let o=f=>f&&Object.keys(f).length?f:void 0,a=o(i.dependencies),l=o(i.peerDependencies),c=o(i.peerDependenciesMeta);return await this.cache.setMeta(e,n,a,l,c),{name:e,version:n,dependencies:a,peerDependencies:l,peerDependenciesMeta:c}}}});var mw,ei,nf,f_,ti,Oa=S(()=>{mw=t=>t.startsWith("@types/"),ei=t=>Object.keys(t?.peerDependencies||{}).filter(e=>!mw(e)),nf=t=>Object.keys(t?.dependencies||{}).filter(e=>!mw(e)),f_=t=>ei(t).filter(e=>!t?.peerDependenciesMeta?.[e]?.optional),ti=class{constructor(e){this.cdn=e}async resolve(e,n){let r=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(r,n),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:n,version:r})=>({name:n,version:r,meta:await this.cdn.fetchPackageMeta(n,r)})))}async expandWithPeers(e,n){let r=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of f_(i.meta))!r.has(o)&&!s.some(a=>a.name===o)&&s.push({name:o,requiredBy:i.name});for(let{name:i,requiredBy:o}of s)try{let a=await n(i),l=await this.cdn.fetchPackageMeta(i,a);r.set(i,{name:i,version:a,meta:l})}catch(a){console.warn(`[typebulb] Failed to resolve peer "${i}" for "${o}":`,a)}return{allRoots:[...r.values()],autoAddedPeers:s.filter(i=>r.has(i.name))}}computeFlags(e){let n=new Set(e.flatMap(i=>ei(i.meta))),r=new Map;for(let i of e)for(let o of nf(i.meta))r.set(o,(r.get(o)||0)+1);let s=new Set([...r.entries()].filter(([,i])=>i>=2).map(([i])=>i));return new Map(e.map(i=>[i.name,{isPeerRoot:n.has(i.name),hasPeers:ei(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var ni,rf=S(()=>{Qs();Ca();ni=class{constructor(e,n,r){this.cache=e,this.cdn=n,this.semver=r}async learnExactVersion(e){let n=await Oe(()=>this.cdn.fetchVersionsIndex(e));if(n?.versions?.length){let r=this.semver.selectBestVersion(n.versions,{distTags:n.distTags});if(r)return r}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,n){if(!n)return this.learnExactVersion(e);let r=a=>!this.semver.isRange(n)||this.semver.satisfies(n,a),s=await this.cache.getPinnedExact(e,n);if(s){if(this.semver.isExactVersion(s)&&r(s))return s;console.debug("[typebulb] cached version for",e,"is not exact or not in",n,"(",s,"); re-resolving from registry")}let i=async a=>{if(a&&this.semver.isExactVersion(a)&&r(a))return await this.cache.setPinnedExact(e,n,a),a},o=await Oe(()=>this.cdn.fetchVersionsIndex(e));if(o?.versions?.length){let a=this.semver.selectBestVersion(o.versions,{range:n,distTags:o.distTags});if(a){let l=await i(a);if(l)return l}else{console.debug("[typebulb] refreshing version cache for",e,"(",n,"not in cached set \u2014 likely a new release)"),await this.cache.invalidateVersionsCache(e);let l=await Oe(()=>this.cdn.fetchVersionsIndex(e));if(l?.versions?.length){let c=await i(this.semver.selectBestVersion(l.versions,{range:n,distTags:l.distTags}));if(c)return c}}}return i(await this.cdn.resolveExactVersion(`${e}@${n}`))}async effectivePackage(e,n){let r=new F(e),s=r.root(),i=n[s],o=i?await Oe(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?r.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as p_,parse as h_}from"es-module-lexer";var Er,sf=S(()=>{Qs();Xs();Oa();Er=class t{constructor(e,n,r){this.version=e,this.cdn=n,this.peer=r}extractImportsSync(e){let n=new Set;for(let r of t.importPatterns){r.lastIndex=0;for(let s of e.matchAll(r))F.isBare(s[1])&&n.add(s[1])}return Array.from(n)}async extractImports(e){let n=new Set,r=s=>{F.isBare(s)&&n.add(s)};try{await p_;let[s]=h_(e);s.forEach(i=>r(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(n)}async buildImportMap(e,n,r){let s=(await this.extractImports(e)).filter(d=>!r?.has(F.rootOf(d))),i=[...new Set(s.map(F.rootOf))],o=await Promise.all(i.map(async d=>({name:d,version:await this.resolveVersion(d,n)}))),{allRoots:a,flags:l,autoAddedPeers:c}=await this.peer.resolve(o,d=>this.resolveVersion(d,n)),f=this.buildEntries([...s,...c.map(d=>d.name)],a,l);return{importMap:{imports:Object.fromEntries(f)},prefetchUrls:f.map(([,d])=>d)}}async resolveVersion(e,n){let r=n[e],s=await this.version.resolveExactForRoot(e,r);if(!s)throw new Error(`Cannot resolve ${r?`${e}@${r}`:e}: no matching version is published (the package or version may not exist, or the registry was unreachable).`);return s}buildEntries(e,n,r){let s=new Map(n.map(p=>[p.name,p])),i=p=>{let h=s.get(F.rootOf(p));return new F(p).withVersion(h.version).format()},o=new Set([...r.entries()].filter(([,p])=>p.isPeerRoot||p.isSharedDep).map(([p])=>p)),a=new Set(e.filter(p=>p!==F.rootOf(p)).map(F.rootOf)),l=[],c=new Set,f=new Set(e.filter(p=>p===F.rootOf(p))),d=new Set;for(let p of e){let h=F.rootOf(p),m=s.get(h),{isPeerRoot:g,hasPeers:b,isSharedDep:C}=r.get(h),T=a.has(h),E=p!==h,O=!(g||C)&&(T||!b),P=this.singletonDepsOf(m,o),k=E&&f.has(h);k&&d.add(h);let L=k?[...P,h]:P.length?P:void 0;l.push([p,this.cdn.buildEsmUrl(i(p),{bundle:O,external:L})]),c.add(p)}let u=new Set([...o,...d]);for(let p of u)s.has(p)&&(c.has(p)||l.push([p,this.cdn.buildEsmUrl(i(p),{})]),l.push([`${p}/`,`${Yt}/${i(p)}/`]));return l}singletonDepsOf(e,n){return[...new Set([...ei(e.meta),...nf(e.meta)])].filter(r=>n.has(r))}};Er.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as gw,satisfies as m_,maxSatisfying as yw,major as g_,valid as y_,validRange as b_}from"semver";var Pa,_n,of=S(()=>{Pa=class{cmp(e,n){return e===n?0:gw(e,n)?1:gw(n,e)?-1:0}satisfies(e,n){return!e||!e.trim()?!0:!!m_(n,e,{includePrerelease:!0})}selectBestVersion(e,n){if(!e?.length)return;let r=n?.range?.trim()||"*",s=n?.preferStable??!0,i=n?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(r,i))return i;if(s){let a=yw(e,r,{includePrerelease:!1});if(a)return a}return yw(e,r,{includePrerelease:!0})??void 0}majorOf(e){return g_(e)}isExactVersion(e){return y_(e)!==null}isRange(e){return b_(e)!==null}},_n=new Pa});function w_(t){return Math.min(9e5*Math.pow(2,Math.max(0,t-1)),864e5)}var Rn,bw=S(()=>{Ca();Rn=class{constructor(e){this.store=e}async isNegative(e){let n=await Oe(()=>this.store.get(e));return!!n&&n.until>Date.now()}async recordNegative(e){let r=((await Oe(()=>this.store.get(e)))?.attempts||0)+1;await Oe(()=>this.store.set(e,{until:Date.now()+w_(r),attempts:r}))}async clearNegative(e){await Oe(()=>this.store.delete(e))}}});function ww(t,e){let n=new Zs(t,e),r=new ti(n),s=new ni(t,n,_n);return{packageService:new Er(s,n,r),versionResolver:s,cdnClient:n,peerResolver:r}}var St=S(()=>{tf();Oa();rf();sf();of();Qs();of();Xs();tf();Oa();rf();sf();bw()});import*as af from"fs/promises";import*as vw from"crypto";function tt(t){return vw.createHash("sha1").update(t).digest("hex")}async function kt(t){try{return JSON.parse(await af.readFile(t,"utf8"))}catch{return}}async function _a(t){try{return await af.readFile(t,"utf8")}catch{return}}var Ar=S(()=>{"use strict"});import*as Gt from"fs/promises";import*as xt from"path";import*as kw from"os";function ne(){return lf||(lf=S_().catch(()=>gt())),lf}function Ia(t,e){return xt.join(v_,tt(t),e)}async function S_(){await Gt.mkdir(Vt,{recursive:!0});let t=xt.join(Vt,"version.json");if((await kt(t))?.version===Sw)return;let n=await Gt.readdir(Vt).catch(()=>[]);await Promise.all(n.map(r=>Gt.rm(xt.join(Vt,r),{recursive:!0,force:!0}))),await Gt.writeFile(t,JSON.stringify({version:Sw})+`
|
|
545
|
+
`,"utf8")}var Sw,Vt,ri,si,Ra,v_,lf,Tr=S(()=>{"use strict";Ar();je();Sw=1,Vt=xt.join(kw.homedir(),".typebulb","cache"),ri=xt.join(Vt,"packages"),si=xt.join(Vt,"proxy"),Ra=xt.join(Vt,"dts"),v_=xt.join(Vt,"emit")});import*as Xt from"fs/promises";import*as xw from"path";async function Fe(t,e){let n=`${t}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;try{await Xt.mkdir(xw.dirname(t),{recursive:!0}),await Xt.writeFile(n,e,"utf8")}catch{gt();return}await Xt.rename(n,t).catch(async()=>{await Xt.rm(n,{force:!0}).catch(()=>{})})}var ii=S(()=>{"use strict";je()});var Cr,cf=S(()=>{"use strict";ii();Ar();Cr=class{constructor(e){this.filePath=e}mem;loadPromise;load(){return this.mem?Promise.resolve(this.mem):(this.loadPromise||(this.loadPromise=kt(this.filePath).then(e=>(this.mem=new Map(Object.entries(e??{})),this.mem))),this.loadPromise)}async get(e){return(await this.load()).get(e)}async set(e,n){let r=await this.load();r.set(e,n),await this.persist(r)}async delete(e){let n=await this.load();n.delete(e)&&await this.persist(n)}async persist(e){await Fe(this.filePath,JSON.stringify(Object.fromEntries(e)))}}});import*as Tw from"fs/promises";import*as nt from"path";function Aw(t,e){return nt.join(k_,$a(t),encodeURIComponent(e)+".json")}function $a(t){return t.replace(/\//g,"__")}var uf,Ew,k_,x_,Na,Cw=S(()=>{"use strict";St();Tr();ii();cf();Ar();uf=nt.join(ri,"indexes"),Ew=nt.join(ri,"pinned"),k_=nt.join(ri,"meta"),x_=nt.join(ri,"negative.json"),Na=class{pinnedMem=new Map;indexMem=new Map;metaMem=new Map;negativeCache=new Rn(new Cr(x_));async getPinnedExact(e,n){let r=`${e}@${n}`;if(this.pinnedMem.has(r))return this.pinnedMem.get(r);await ne();let s=await _a(nt.join(Ew,tt(r)+".txt"));return this.pinnedMem.set(r,s),s}async setPinnedExact(e,n,r){let s=`${e}@${n}`;this.pinnedMem.set(s,r),await ne(),await Fe(nt.join(Ew,tt(s)+".txt"),r)}async getIndex(e){if(this.indexMem.has(e))return this.indexMem.get(e);await ne();let n=await kt(nt.join(uf,$a(e)+".json"));return this.indexMem.set(e,n),n}async setIndex(e,n,r){let s={versions:n,distTags:r,updatedAt:Date.now()};this.indexMem.set(e,s),await ne(),await Fe(nt.join(uf,$a(e)+".json"),JSON.stringify(s))}async invalidateVersionsCache(e){this.indexMem.delete(e),await Tw.rm(nt.join(uf,$a(e)+".json"),{force:!0}).catch(()=>{})}async isNegative(e){return await ne(),this.negativeCache.isNegative(e)}async recordNegative(e){await ne(),await this.negativeCache.recordNegative(e)}async clearNegative(e){await this.negativeCache.clearNegative(e)}async getMeta(e,n){let r=`${e}@${n}`;if(this.metaMem.has(r))return this.metaMem.get(r);await ne();let s=await kt(Aw(e,n));return this.metaMem.set(r,s),s}async setMeta(e,n,r,s,i){let o={dependencies:r,peerDependencies:s,peerDependenciesMeta:i,updatedAt:Date.now()};this.metaMem.set(`${e}@${n}`,o),await ne(),await Fe(Aw(e,n),JSON.stringify(o))}}});var Ow,Pw=S(()=>{"use strict";Ow={async getJson(t){try{let e=await fetch(t,{redirect:"follow"});return e.ok?await e.json():void 0}catch{return}},async head(t){try{let e=await fetch(t,{method:"HEAD",redirect:"follow"});return{ok:e.ok,url:e.url}}catch{return}}}});var E_,La,_w,Rw,B2,df=S(()=>{"use strict";St();Cw();Pw();E_=new Na,{packageService:La,versionResolver:_w,cdnClient:Rw,peerResolver:B2}=ww(E_,Ow)});function Ma(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Iw(){return` <script>
|
|
546
|
+
${vy}
|
|
547
547
|
(function () {
|
|
548
548
|
try {
|
|
549
549
|
var key = function () { return 'tb-scroll:' + location.pathname + location.search; };
|
|
@@ -556,14 +556,14 @@ ${wy}
|
|
|
556
556
|
});
|
|
557
557
|
} catch (e) {}
|
|
558
558
|
})();
|
|
559
|
-
</script>`}function
|
|
559
|
+
</script>`}function Da(t,e){return` <script>
|
|
560
560
|
(function() {
|
|
561
561
|
try {
|
|
562
|
-
var KEY = ${
|
|
562
|
+
var KEY = ${Et(JSON.stringify("tb-theme:"+t))};
|
|
563
563
|
var doc = document.documentElement;
|
|
564
564
|
var mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
565
565
|
var os = function() { return mq.matches ? 'dark' : 'light'; };
|
|
566
|
-
var FORCED = ${
|
|
566
|
+
var FORCED = ${Et(JSON.stringify(e??null))};
|
|
567
567
|
var stored = function() {
|
|
568
568
|
try { var v = localStorage.getItem(KEY); return (v === 'dark' || v === 'light') ? v : undefined; }
|
|
569
569
|
catch (e) { return undefined; }
|
|
@@ -601,7 +601,7 @@ ${wy}
|
|
|
601
601
|
});
|
|
602
602
|
} catch (e) {}
|
|
603
603
|
})();
|
|
604
|
-
</script>`}var
|
|
604
|
+
</script>`}var Et,$w,ff,A_,T_,Ba,Or=S(()=>{"use strict";te();te();Et=t=>t.replace(/<\/script/gi,"<\\/script");$w=30*6e4,ff=1e3,A_=6e4,T_=3e4,Ba=(t="'/__reload'")=>`
|
|
605
605
|
let es = null;
|
|
606
606
|
let bootId = null;
|
|
607
607
|
let firstErrorAt = 0;
|
|
@@ -616,9 +616,9 @@ ${wy}
|
|
|
616
616
|
es.onerror = () => {
|
|
617
617
|
if (!firstErrorAt) firstErrorAt = Date.now();
|
|
618
618
|
// Inside the replace window, EventSource's own retry is faster than anything we'd schedule.
|
|
619
|
-
if (Date.now() - firstErrorAt <= ${
|
|
619
|
+
if (Date.now() - firstErrorAt <= ${A_}) return;
|
|
620
620
|
es.close();
|
|
621
|
-
backoff = Math.min(${
|
|
621
|
+
backoff = Math.min(${T_}, backoff ? backoff * 2 : ${ff} * 2);
|
|
622
622
|
setTimeout(tbConnect, backoff);
|
|
623
623
|
};
|
|
624
624
|
};
|
|
@@ -634,7 +634,7 @@ ${wy}
|
|
|
634
634
|
// A relay open (TB-VSCode-Browser.md): the CLI asks a page of ours inside VS Code to open a URL,
|
|
635
635
|
// since its integrated browser honors a gesture-less window.open and keeps the new tab in-editor.
|
|
636
636
|
tbOn('open-url', (e) => { window.open(e.data, '_blank', 'noopener'); });
|
|
637
|
-
tbConnect();`});var
|
|
637
|
+
tbConnect();`});var Nw,Lw=S(()=>{"use strict";Or();te();Nw=`
|
|
638
638
|
(() => {
|
|
639
639
|
// Inline (bulb-in-a-bulb): runs inside a sandboxed iframe with no parent
|
|
640
640
|
// bridge, so privileged tb.* (AI, fs, server RPC) can't reach a host and would
|
|
@@ -1507,7 +1507,7 @@ ${wy}
|
|
|
1507
1507
|
if (relayed) history.replaceState(null, '', location.pathname + location.search);
|
|
1508
1508
|
const tbStreamUrl = '/__reload?bulb=' + encodeURIComponent(window.__TB_BULB__ || '')
|
|
1509
1509
|
+ (relayed ? '&relay=' + Math.random().toString(36).slice(2) : '');
|
|
1510
|
-
${
|
|
1510
|
+
${Ba("tbStreamUrl")}
|
|
1511
1511
|
// Told to go, the page goes: it closes the tab, and where the browser refuses a script the close
|
|
1512
1512
|
// (a tab that wasn't script-opened and has history) it replaces itself with a note naming the
|
|
1513
1513
|
// reason. The note is a blob document, never a served route \u2014 a note that needs the server
|
|
@@ -1594,20 +1594,20 @@ ${Da("tbStreamUrl")}
|
|
|
1594
1594
|
});
|
|
1595
1595
|
}
|
|
1596
1596
|
})();
|
|
1597
|
-
`});function
|
|
1598
|
-
`+
|
|
1597
|
+
`});function Mw(t){let{name:e,code:n,css:r,html:s,data:i,insight:o,importMap:a,theme:l,inline:c,dir:f,source:d,bulbKey:u,compileError:p}=t,h=s.trim()||'<div id="app"></div>',m=c?"":`
|
|
1598
|
+
`+Yu,g={imports:R_(a.imports)};return`<!DOCTYPE html>
|
|
1599
1599
|
<html>
|
|
1600
1600
|
<head>
|
|
1601
1601
|
<meta charset="utf-8">
|
|
1602
1602
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1603
|
-
<title>${
|
|
1604
|
-
${
|
|
1605
|
-
${c?"":
|
|
1603
|
+
<title>${Ma(e)} - typebulb</title>
|
|
1604
|
+
${Da(e,l)}
|
|
1605
|
+
${c?"":Iw()}
|
|
1606
1606
|
<script type="importmap">
|
|
1607
1607
|
${JSON.stringify(g,null,2)}
|
|
1608
1608
|
</script>
|
|
1609
1609
|
<style>
|
|
1610
|
-
${
|
|
1610
|
+
${Os}${m}
|
|
1611
1611
|
</style>
|
|
1612
1612
|
<style>
|
|
1613
1613
|
${r}
|
|
@@ -1616,27 +1616,27 @@ ${r}
|
|
|
1616
1616
|
<body>
|
|
1617
1617
|
${h}
|
|
1618
1618
|
|
|
1619
|
-
${i.length>0?`<script>window.__TB_DATA__ = ${
|
|
1620
|
-
${o?`<script>window.__TB_INSIGHT__ = ${
|
|
1621
|
-
${f?`<script>window.__TB_DIR__ = ${
|
|
1622
|
-
${u?`<script>window.__TB_BULB__ = ${
|
|
1623
|
-
${p?`<script>window.__TB_COMPILE_ERROR__ = ${
|
|
1619
|
+
${i.length>0?`<script>window.__TB_DATA__ = ${Et(JSON.stringify(i))};</script>`:""}
|
|
1620
|
+
${o?`<script>window.__TB_INSIGHT__ = ${Et(JSON.stringify(o))};</script>`:""}
|
|
1621
|
+
${f?`<script>window.__TB_DIR__ = ${Et(JSON.stringify(f))};</script>`:""}
|
|
1622
|
+
${u?`<script>window.__TB_BULB__ = ${Et(JSON.stringify(u))};</script>`:""}
|
|
1623
|
+
${p?`<script>window.__TB_COMPILE_ERROR__ = ${Et(JSON.stringify(p))};</script>`:""}
|
|
1624
1624
|
|
|
1625
1625
|
<script>
|
|
1626
|
-
${
|
|
1627
|
-
${
|
|
1626
|
+
${ky}
|
|
1627
|
+
${Nw}
|
|
1628
1628
|
</script>
|
|
1629
1629
|
|
|
1630
|
-
${
|
|
1630
|
+
${__}
|
|
1631
1631
|
|
|
1632
|
-
${
|
|
1632
|
+
${O_(n,d)}
|
|
1633
1633
|
</body>
|
|
1634
|
-
</html>`}function
|
|
1635
|
-
`);return`<script type="module">${s}${
|
|
1636
|
-
</script>`}function
|
|
1634
|
+
</html>`}function O_(t,e){let n=["",...C_],r=e?Array(Math.max(0,e.codeLine-n.length-1)).fill(""):[],s=[...n,...r,Et(t)].join(`
|
|
1635
|
+
`);return`<script type="module">${s}${P_(e,s)}
|
|
1636
|
+
</script>`}function P_(t,e){if(!t)return"";let n=e.split(`
|
|
1637
1637
|
`).length,r={version:3,file:t.file,sources:[`/__source/${t.file}`],names:[],mappings:["AAAA",...Array(Math.max(0,n-1)).fill("AACA")].join(";")};return`
|
|
1638
1638
|
//# sourceURL=${t.file.replace(/\s/g,"%20")}
|
|
1639
|
-
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(r))}`}function
|
|
1639
|
+
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(r))}`}function R_(t){let e={};for(let[n,r]of Object.entries(t))e[n]=r.startsWith("https://")?"/proxy/"+r:r;return e}var C_,__,Dw=S(()=>{"use strict";te();Lw();Or();C_=["globalThis.__tbEntryRan = true; /* import graph resolved \u2014 the load-failure backstop's signal (imports hoist above this line) */","await globalThis.__tbBoot; /* #tb= fragment restore, set by the shim when present (TB-Inference.md) */"];__=`<script>
|
|
1640
1640
|
(function () {
|
|
1641
1641
|
var framed = window.parent !== window;
|
|
1642
1642
|
var post = function (m) { try { parent.postMessage(m, '*'); } catch (e) {} }; /* framed only */
|
|
@@ -1735,20 +1735,20 @@ ${C_(n,d)}
|
|
|
1735
1735
|
}
|
|
1736
1736
|
});
|
|
1737
1737
|
})();
|
|
1738
|
-
</script>`});import*as
|
|
1739
|
-
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await
|
|
1740
|
-
Expected <origin>/u/<user>/<slug>`);let l=a[1],c=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:l,slug:c,dest:
|
|
1741
|
-
A pull target must be a bulb URL, or a local file at typebulbs/u/<user>/<slug>.bulb.md \u2014 the path is its remote identity.`);return{origin:n,...s,dest:r}}async function
|
|
1742
|
-
`),r=
|
|
1738
|
+
</script>`});import*as Fa from"fs/promises";import*as ja from"path";import{existsSync as Bw,readFileSync as I_}from"fs";import{execFile as $_}from"child_process";import{promisify as N_}from"util";import{builtinModules as L_}from"node:module";import{satisfies as M_}from"semver";async function Ua(t,e,n,r){let i=t.map(c=>F_(c,n)).filter(c=>!U_(c,e));if(i.length===0)return;let o=i.filter(c=>!j_.test(c));if(o.length)throw new Error(`Refusing to install npm spec(s) with unsupported characters: ${o.join(", ")}
|
|
1739
|
+
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await Fa.mkdir(e,{recursive:!0});let a=ja.join(e,"package.json");Bw(a)||await Fa.writeFile(a,JSON.stringify({name:"typebulb-server",private:!0})),console.log(` Installing: ${i.join(", ")}`);let l=["--no-audit","--no-fund",...r?.ignoreScripts?["--ignore-scripts"]:[]];await D_("npm",["install",...l,...i],{cwd:e,shell:!0})}function F_(t,e){if(!e||F.parse(t).version)return t;let n=e[t];return n?`${t}@${n}`:t}function U_(t,e){let{name:n,version:r}=F.parse(t),s=ja.join(e,"node_modules",n);if(!Bw(s))return!1;if(!r)return!0;try{let i=JSON.parse(I_(ja.join(s,"package.json"),"utf-8")).version;return M_(i,r)}catch{return!1}}function qa(t){let e=new Set,n=/\bimport\s+(?:[\s\S]*?\s+from\s+)?['"]([^./][^'"]*)['"]/g,r;for(;r=n.exec(t);){let s=r[1];if(s.includes(":"))continue;let i=F.rootOf(s);B_.has(i)||e.add(i)}return[...e]}var D_,B_,j_,pf=S(()=>{"use strict";St();D_=N_($_),B_=new Set(L_),j_=/^(@[a-z0-9._-]+\/)?[a-z0-9._-]+(@[a-zA-Z0-9.^~*x-]+)?$/i});import*as Ue from"fs/promises";import*as Le from"path";function Pr(t,e){let n=Le.resolve(e,t),r=Le.normalize(e),s=Le.normalize(n);if(s!==r&&!s.startsWith(r+Le.sep))throw new Error("Path traversal detected - access denied");return n}async function oi(t,e){return Ue.readFile(Pr(t,e))}async function Ja(t,e,n){let r=Pr(t,n);await Ue.mkdir(Le.dirname(r),{recursive:!0}),await Ue.writeFile(r,typeof e=="string"?e:Buffer.from(e))}async function Wa(t,e){let n=Pr(t,e),r=await Ue.readdir(n,{withFileTypes:!0});return Promise.all(r.map(async s=>{let i=await Ue.stat(Le.join(n,s.name)).then(o=>o.mtimeMs).catch(()=>0);return{name:s.name,dir:s.isDirectory(),mtime:i}}))}async function Ka(t,e){let n=Pr(t,e);if(Le.normalize(n)===Le.normalize(e))throw new Error("Cannot remove the bulb's folder itself: remove its contents instead");await Ue.rm(n,{recursive:!0})}var hf=S(()=>{"use strict"});async function jw(t){let e=vt(t.provider,t.model);if(typeof e=="string")throw new Error(e);let n=await zt(e,t);if(!n.ok){let r=await vr(n,e.protocol);throw new Error(r.message)}return{response:n,protocol:e.protocol}}async function q_(t){let{response:e,protocol:n}=await jw(t);return Sr(e,n)}async function*J_(t){let{response:e,protocol:n}=await jw(t);yield*On(e,n)}function Fw(t){let e=Object.assign(q_,{stream:J_}),n={read:async r=>{let s=await oi(r,t);try{return new TextDecoder("utf-8",{fatal:!0}).decode(s)}catch{throw new Error(`File is not valid UTF-8 text: ${r} \u2014 use tb.fs.readBytes() for binary files.`)}},readBytes:async r=>new Uint8Array(await oi(r,t)),write:async(r,s)=>(await Ja(r,s,t),!0),list:async(r=".")=>Wa(r,t),remove:async r=>(await Ka(r,t),!0)};globalThis.tb=Object.freeze({log:(...r)=>{console.log(...r)},ai:e,fs:n,dir:t,models:()=>wt(),aiAccess:ba,mode:rr.local})}var Uw=S(()=>{"use strict";Kt();te();Ta();An();hf()});import*as Qt from"fs/promises";import*as pe from"path";import{pathToFileURL as W_}from"url";async function qw(t){let n=(await Qt.readdir(t)).find(r=>r.endsWith(".bulb.md"));return n?pe.join(t,n):void 0}function _r(t){let e=pe.resolve(t);return pe.join(pe.dirname(e),pe.basename(e).replace(/\.bulb\.md$/,""))}function Rr(t){let[e,n,r,s]=t.split(pe.sep).slice(-4);if(!(e!=="typebulbs"||n!=="u"||!r||!s?.endsWith(".bulb.md")))return{userSlug:r,slug:s.slice(0,-8)}}async function rt(t){let e=await Qt.readFile(t,"utf-8"),n=Wn(e),r=pr(n);return{bulb:r,config:Yr(r.config),warnings:Xp(e),starts:n.starts}}function mf(t){let e=pe.basename(t).replace(/\.bulb\.md$/i,"");return pe.join(pe.dirname(t),".typebulb",`${e}.server.mjs`)}async function ai(t,e,n,r){let s=Qd(t,{serverOnly:!0});if(s.error)throw new Error(`Server compilation error: ${s.error}`);let i=s.code;n&&(i=await Kp(i,n));let o=pe.join(pe.dirname(e),".typebulb");await Qt.mkdir(o,{recursive:!0});let a=qa(i);a.length>0&&await Ua(a,o,r);let l=mf(e);return await Qt.writeFile(l,i,"utf-8"),Fw(_r(e)),await import(`${W_(l).href}?t=${Date.now()}`)}async function gf(t,e,n,r){let{bulb:s,config:i,starts:o}=await rt(t),a=jo(s.data),l,c=h=>{l??=h instanceof Error?h.message:String(h)};try{dw(s.code,i.dependencies??{})}catch(h){c(h)}let f=Qd(s.code,{jsxImportSource:i.ts?.jsxImportSource});f.error&&c(f.error);let d={imports:{}};if(!l)try{({importMap:d}=await La.buildImportMap(f.code,i.dependencies??{},r?new Set([r.name]):void 0))}catch(h){c(`Dependency resolution failed: ${h instanceof Error?h.message:String(h)}`)}l&&console.error("Build error:",l),r&&(d.imports[r.name]=r.entryUrl);let u=Mw({name:s.name,code:l?"":f.code,css:s.css,html:s.html,data:a,insight:s.insight,importMap:d,dir:_r(t),watch:e,source:{file:pe.basename(t),codeLine:o.get("code.tsx")??1},bulbKey:Bs(t),compileError:l}),p;return s.server&&n&&(p=await ai(s.server,t,r,i.dependencies)),{html:u,bulb:s,serverExports:p,buildError:l}}var In,At=S(()=>{"use strict";qs();uw();fw();df();Dw();pf();Mi();je();Uw();In=t=>pe.join(_r(t),"assets")});import*as Me from"fs/promises";import*as qe from"path";import{createHash as K_}from"crypto";async function bf(t,e,n){let r=[...t],s=async()=>{for(let i=r.shift();i!==void 0;i=r.shift())await n(i)};await Promise.all(Array.from({length:Math.min(e,t.length)},s))}function Ir(t){try{return JSON.parse(t).error||t}catch{return t}}async function vf(t,e){try{let n=await fetch(li(t),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});return n.ok?n.headers.get("content-type")?.includes("json")?{entries:await n.json()}:{error:"manifest response is not JSON \u2014 wrong origin?"}:{error:`manifest request failed (${n.status}): ${Ir(await n.text())}`}}catch(n){return{error:n instanceof Error?n.message:String(n)}}}function Sf(t,e){be(e);let n=process.env.TYPEBULB_ORIGIN||H_;try{return Ya(t,process.cwd(),n)}catch(r){console.error(r instanceof Error?r.message:String(r)),process.exit(1)}}function Ya(t,e,n){if(/^https?:\/\//i.test(t)){let i=new URL(t),o=i.pathname.split("/").filter(Boolean).map(decodeURIComponent),a=o[0]==="api"&&o[1]==="scripts"?o.slice(2):o;if(a[0]!=="u"||!a[1]||!a[2])throw new Error(`Not a bulb URL: ${t}
|
|
1740
|
+
Expected <origin>/u/<user>/<slug>`);let l=a[1],c=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:l,slug:c,dest:qe.join(e,Ha(l,c))}}let r=qe.resolve(e,t),s=Rr(r);if(!s)throw new Error(`Not a conventional bulb path: ${t}
|
|
1741
|
+
A pull target must be a bulb URL, or a local file at typebulbs/u/<user>/<slug>.bulb.md \u2014 the path is its remote identity.`);return{origin:n,...s,dest:r}}async function z_(t,e){let n=await vf(t,e);if("error"in n||!n.entries.length)return{kind:"none"};let r=n.entries,s=In(t.dest),i=[],o=[],a=0;for(let l of r){let c=await Me.readFile(qe.join(s,...l.path.split("/"))).catch(()=>{});c===void 0?i.push(l.path):wf(c)===l.md5?a++:e.force?i.push(l.path):o.push(l.path)}return o.length?{kind:"conflict",paths:o}:{kind:"plan",toGet:i,unchanged:a}}async function Y_(t,e,n){let r=In(t.dest),s=[],i=0;return await bf(e.toGet,4,async o=>{try{let a=await fetch(`${li(t)}/${za(o)}`,{headers:n.token?{Authorization:`Bearer ${n.token}`}:{},signal:AbortSignal.timeout(n.timeoutMs??3e4)});if(!a.ok){s.push(`${o}: HTTP ${a.status}`);return}let l=qe.join(r,...o.split("/"));await Me.mkdir(qe.dirname(l),{recursive:!0}),await Me.writeFile(l,new Uint8Array(await a.arrayBuffer())),i++}catch(a){s.push(`${o}: ${a instanceof Error?a.message:String(a)}`)}}),{downloaded:i,unchanged:e.unchanged,errors:s}}async function Va(t,e={}){let n=await fetch(yf(t),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});if(!n.ok)return{kind:"http-error",status:n.status};let r=n.headers.get("content-type");if(!r?.includes("text/markdown"))return{kind:"not-markdown",contentType:r??void 0};let s=await n.text(),i;try{i=await Me.readFile(t.dest,"utf-8")}catch{}let o=i!==void 0&&V_(i,s);if(i!==void 0&&!o&&!e.force){let{mtime:c}=await Me.stat(t.dest);return{kind:"conflict",dest:t.dest,localMtime:c,remoteLastModified:n.headers.get("last-modified")??void 0}}let a=await z_(t,e);if(a.kind==="conflict")return{kind:"asset-conflict",dest:t.dest,paths:a.paths};if(!o){await Me.mkdir(qe.dirname(t.dest),{recursive:!0}),await Me.writeFile(t.dest,s);let c=new Date(n.headers.get("last-modified")??"");isNaN(c.getTime())||await Me.utimes(t.dest,new Date,c)}let l=a.kind==="plan"?await Y_(t,a,e):void 0;return o?{kind:"up-to-date",dest:t.dest,assets:l}:{kind:"written",dest:t.dest,created:i===void 0,assets:l}}function V_(t,e){let n=i=>i.replace(/\r\n/g,`
|
|
1742
|
+
`),r=Ve(n(t)),s=Ve(n(e));return!r||!s?n(t)===n(e):r.frontmatter.name===s.frontmatter.name&&Ye.every(i=>(r.files.get(de[i].path)||"")===(s.files.get(de[i].path)||""))}async function Ww(t,e){t||(console.error("Usage: typebulb pull <bulb url | typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1));let n=Sf(t,e.mode),r=`${n.origin}/u/${n.userSlug}/${n.slug}`,s;try{s=await Va(n,{force:e.force,token:process.env.TYPEBULB_TOKEN})}catch(o){console.error(`Could not reach ${n.origin}: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1;return}let i=qe.relative(process.cwd(),n.dest)||n.dest;switch(s.kind){case"written":console.log(`pulled ${r} \u2192 ${i}${s.created?"":" (overwritten)"}`),Jw(s.assets);return;case"up-to-date":console.log(`up to date: ${i}`),Jw(s.assets);return;case"conflict":console.error(`Refusing to overwrite ${i} \u2014 it differs from ${r}
|
|
1743
1743
|
local file modified ${s.localMtime.toISOString()}
|
|
1744
1744
|
remote last saved ${s.remoteLastModified??"unknown"}
|
|
1745
1745
|
Re-run with --force to overwrite the local file.`),process.exitCode=1;return;case"asset-conflict":console.error(`Refusing to overwrite local assets that differ from the hosted copies:
|
|
1746
1746
|
`+s.paths.map(o=>` assets/${o}`).join(`
|
|
1747
1747
|
`)+`
|
|
1748
|
-
Re-run with --force to overwrite them.`),process.exitCode=1;return;case"http-error":s.status===404?console.error(`Bulb not found: ${r}`):s.status===401||s.status===403?console.error(`This bulb is private (${s.status}) \u2014 pulling it needs a TYPEBULB_TOKEN for its owner.`):console.error(`Pull failed: ${n.origin} responded ${s.status}`),process.exitCode=1;return;case"not-markdown":console.error(`${r}.md did not return bulb markdown (got ${s.contentType??"no content-type"}) \u2014 is ${n.origin} a typebulb host?`),process.exitCode=1}}function
|
|
1748
|
+
Re-run with --force to overwrite them.`),process.exitCode=1;return;case"http-error":s.status===404?console.error(`Bulb not found: ${r}`):s.status===401||s.status===403?console.error(`This bulb is private (${s.status}) \u2014 pulling it needs a TYPEBULB_TOKEN for its owner.`):console.error(`Pull failed: ${n.origin} responded ${s.status}`),process.exitCode=1;return;case"not-markdown":console.error(`${r}.md did not return bulb markdown (got ${s.contentType??"no content-type"}) \u2014 is ${n.origin} a typebulb host?`),process.exitCode=1}}function Jw(t){if(!(!t||!t.downloaded&&!t.errors.length)){console.log(`assets: ${t.downloaded} downloaded${t.unchanged?`, ${t.unchanged} unchanged`:""}`);for(let e of t.errors)console.error(` asset failed \u2014 ${e} (a re-pull retries just the missing ones)`);t.errors.length&&(process.exitCode=1)}}var H_,Ha,yf,za,li,wf,Ga=S(()=>{"use strict";et();te();At();H_="https://typebulb.com",Ha=(t,e)=>qe.join("typebulbs","u",t,`${e}.bulb.md`),yf=t=>`${t.origin}/u/${encodeURIComponent(t.userSlug)}/${encodeURIComponent(t.slug)}.md`,za=t=>t.split("/").map(encodeURIComponent).join("/"),li=t=>`${t.origin}/u/${encodeURIComponent(t.userSlug)}/${encodeURIComponent(t.slug)}/assets`;wf=t=>K_("md5").update(t).digest("hex")});import*as ut from"fs/promises";import*as ci from"path";async function Kw(t,e=""){let n=await ut.readdir(t,{withFileTypes:!0}).catch(()=>[]),r=[];for(let s of n)s.isDirectory()?r.push(...await Kw(ci.join(t,s.name),`${e}${s.name}/`)):s.isFile()&&r.push(e+s.name);return r}async function G_(t,e){let n=e.timeoutMs??3e4,r=li(t),s={Authorization:`Bearer ${e.token}`},i=In(t.dest);if(!await ut.stat(i).then(h=>h.isDirectory()).catch(()=>!1))return{kind:"skipped"};let o=await Kw(i),a=await vf(t,{token:e.token,timeoutMs:n});if("error"in a)return{kind:"sync-error",message:a.error};let l=a.entries;if(!o.length&&!l.length)return{kind:"skipped"};let c=new Map(l.map(h=>[h.path,h.md5])),f=new Set(o),d=l.map(h=>h.path).filter(h=>!f.has(h)),u=0,p=0;try{await bf(o,4,async h=>{let m=await ut.readFile(ci.join(i,...h.split("/")));if(c.get(h)===wf(m)){p++;return}let g=await fetch(`${r}/${za(h)}`,{method:"PUT",body:new Uint8Array(m),headers:s,signal:AbortSignal.timeout(n)});if(!g.ok)throw new Error(`upload of '${h}' refused (${g.status}): ${Ir(await g.text())}`);u++})}catch(h){return{kind:"sync-error",message:h instanceof Error?h.message:String(h)}}return{kind:"synced",uploaded:u,unchanged:p,toDelete:d,base:Fi(t.userSlug,t.slug)}}async function X_(t,e,n){let r=n.timeoutMs??3e4,s=li(t),i=[];for(let o of e)try{let a=await fetch(`${s}/${za(o)}`,{method:"DELETE",headers:{Authorization:`Bearer ${n.token}`},signal:AbortSignal.timeout(r)});if(!a.ok)return{deleted:i,error:`delete of '${o}' refused (${a.status}): ${Ir(await a.text())}`};i.push(o)}catch(a){return{deleted:i,error:a instanceof Error?a.message:String(a)}}return{deleted:i}}async function Xa(t,e){let n=await ut.readFile(t.dest,"utf-8"),{mtime:r}=await ut.stat(t.dest),s=await G_(t,{token:e.token,timeoutMs:e.timeoutMs});if(s.kind==="sync-error")return{kind:"asset-error",message:s.message};let i=s.kind==="synced"?{uploaded:s.uploaded,unchanged:s.unchanged,deleted:[],base:s.base}:void 0,o={Authorization:`Bearer ${e.token}`,"Content-Type":"text/markdown; charset=utf-8"};e.force||(o["If-Unmodified-Since"]=r.toUTCString());let a=await fetch(yf(t),{method:"PUT",body:n,headers:o,signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0}),l=await a.text();if(a.status===409)return{kind:"conflict",message:Ir(l),assets:i};if(!a.ok)return{kind:"http-error",status:a.status,message:Ir(l),assets:i};let c=JSON.parse(l);if(await ut.utimes(t.dest,new Date,new Date(c.updatedAt)),i&&s.kind==="synced"&&s.toDelete.length){let f=await X_(t,s.toDelete,{token:e.token,timeoutMs:e.timeoutMs});i.deleted=f.deleted,f.error&&(i.pruneError=f.error)}return{kind:"pushed",created:c.created,serverStripped:c.serverStripped,updatedAt:c.updatedAt,assets:i}}async function Hw(t,e){t||(console.error("Usage: typebulb push <typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1)),/^https?:\/\//i.test(t)&&(console.error("push takes a local .bulb.md file, not a URL (the path is its remote identity)"),process.exit(1));let n=Sf(t,e.mode),r=process.env.TYPEBULB_TOKEN;r||(console.error("push needs TYPEBULB_TOKEN in your .env \u2014 create one on your typebulb.com settings page."),process.exit(1));let s=`${n.origin}/u/${n.userSlug}/${n.slug}`,i=ci.relative(process.cwd(),n.dest)||n.dest,o;try{o=await Xa(n,{token:r,force:e.force})}catch(a){let l=a instanceof Error?a.message:String(a);console.error(a?.code==="ENOENT"?`File not found: ${i}`:`Could not push to ${n.origin}: ${l}`),process.exitCode=1;return}switch(o.kind!=="asset-error"&&o.assets&&console.log(`assets: ${o.assets.uploaded} uploaded, ${o.assets.unchanged} unchanged \u2192 ${o.assets.base}`),o.kind){case"asset-error":console.error(`assets sync failed: ${o.message}
|
|
1749
1749
|
push refused: the bulb text was not pushed.`),process.exitCode=1;return;case"pushed":{console.log(`pushed ${i} \u2192 ${s}/full`),o.created&&(console.log(" created a new bulb, unlisted \u2014 nothing existed at this URL before"),console.log(" if you renamed this file, its previous bulb is still live at the old URL")),o.serverStripped&&console.log("note: the server.ts block was stripped on the server copy (CLI-only); your local file is untouched.");for(let a of o.assets?.deleted??[])console.log(` deleted ${a} (no longer in assets/)`);o.assets?.pruneError&&console.log(`note: asset cleanup incomplete \u2014 ${o.assets.pruneError}; the next push will retry.`);return}case"conflict":console.error(`${o.message}
|
|
1750
1750
|
pull to see the remote: typebulb pull ${i}
|
|
1751
|
-
or overwrite it: typebulb push ${i} --force`),process.exitCode=1;return;case"http-error":o.status===401?console.error("The server rejected TYPEBULB_TOKEN (401) \u2014 it may be revoked; mint a new one on the settings page."):console.error(`Push failed: ${n.origin} responded ${o.status}${o.message?` \u2014 ${o.message}`:""}`),process.exitCode=1}}var
|
|
1751
|
+
or overwrite it: typebulb push ${i} --force`),process.exitCode=1;return;case"http-error":o.status===401?console.error("The server rejected TYPEBULB_TOKEN (401) \u2014 it may be revoked; mint a new one on the settings page."):console.error(`Push failed: ${n.origin} responded ${o.status}${o.message?` \u2014 ${o.message}`:""}`),process.exitCode=1}}var kf=S(()=>{"use strict";te();Ga();At()});var $n=S(()=>{"use strict";Ie();jb();bn();Fb();Td();Kb();zb();Ks();An();An();Ta();Xd();Ie();Ga();kf();et();je()});import{existsSync as Q_,mkdirSync as Z_,readFileSync as eR,rmSync as tR,writeFileSync as nR}from"fs";import{homedir as rR}from"os";import*as $r from"path";function aR(){return oR.replace('"__TB_SKILL_PATH__"',JSON.stringify(Vs())).replace('"__TB_BIN_PATH__"',JSON.stringify(fr()))}function zw(){try{if(!Q_(xf()))return}catch{return}try{let t=sR(),e=aR(),n;try{n=eR(t,"utf8")}catch{}n!==e&&(Z_($r.dirname(t),{recursive:!0}),nR(t,e))}catch{}for(let t of iR())try{tR(t,{force:!0})}catch{}}var xf,sR,iR,oR,Yw=S(()=>{"use strict";$n();xf=()=>$r.join(rR(),".pi","agent"),sR=()=>$r.join(xf(),"extensions","typebulb.ts"),iR=()=>["typebulb-wait.ts","matchu-patchu.ts"].map(t=>$r.join(xf(),"extensions",t)),oR=String.raw`// Generated by typebulb — do not edit; overwritten on each run.
|
|
1752
1752
|
import { spawn } from "node:child_process";
|
|
1753
1753
|
import { existsSync } from "node:fs";
|
|
1754
1754
|
|
|
@@ -2016,23 +2016,23 @@ export default function (pi) {
|
|
|
2016
2016
|
try { pi.on("session_shutdown", () => { stopping = true; if (watcher) { try { watcher.kill(); } catch (e) {} watcher = null; } for (const c of pending) { try { c.kill(); } catch (e) {} } pending.clear(); }); } catch (e) {}
|
|
2017
2017
|
} catch (e) { logErr("load", e && e.message); }
|
|
2018
2018
|
}
|
|
2019
|
-
`});function V(t){return t?.message??String(t)}var X,
|
|
2020
|
-
`))>=0;){let o=r.slice(0,i);r=r.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var
|
|
2021
|
-
`)}catch{}await Promise.race([this.#x,
|
|
2019
|
+
`});function V(t){return t?.message??String(t)}var X,Zt=S(()=>{"use strict";X=process.cwd()});import{spawn as Vw}from"child_process";import{StringDecoder as lR}from"string_decoder";function hR(t,e){let n=new lR("utf8"),r="";t.on("data",s=>{r+=typeof s=="string"?s:n.write(s);let i;for(;(i=r.indexOf(`
|
|
2020
|
+
`))>=0;){let o=r.slice(0,i);r=r.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var cR,Gw,Xw,Ef,Qw,uR,dR,fR,Zw,pR,Qa,Za,ev,tv=S(()=>{"use strict";Zt();cR=3e4,Gw=18e4,Xw="starting pi\u2026",Ef=5e3,Qw=2e3,uR=2e3,dR=12e4,fR=8e3,Zw=15e3,pR=new Set(["get_state","get_commands","get_available_models","set_model","set_thinking_level","cycle_thinking_level","get_session_stats","compact","set_auto_compaction","get_fork_messages","fork","clone","set_session_name","export_html","bash","abort_bash"]),Qa=new Set;process.on("exit",()=>{for(let t of Qa)try{t.kill()}catch{}});Za=class{#t;#o=!1;#e=0;#s=!1;#u=0;#n=!1;#c=null;#a=[];#d=null;#r=null;#i=null;#f=new Map;#l=[];#b=null;#k=null;#w=null;#m;#g;#v="";#_=1;#p=new Map;#x;#S;constructor(e,n,r=(s,i)=>Vw(s,{cwd:i,shell:!0,stdio:["pipe","pipe","pipe"],env:{...process.env,TYPEBULB_MIRROR:"1"}})){if(this.#x=new Promise(o=>{this.#S=o}),n?.includes('"')){this.#g="session path contains a quote \u2014 cannot drive it",this.#S();return}let s=n?`pi --mode rpc --session "${n}"`:"pi --mode rpc",i;try{i=r(s,e)}catch(o){this.#g=`could not start pi: ${V(o)}`,this.#S();return}this.#t=i,this.#m=n,this.#s=!0,this.#u=Date.now()+Gw,this.#r={text:Xw,kind:"info"},Qa.add(i),i.stdout&&hR(i.stdout,o=>this.#I(o)),i.stderr&&i.stderr.on("data",o=>{this.#v=(this.#v+o.toString()).slice(-uR)}),i.on("error",o=>this.#O(`could not start pi: ${o.message}`)),i.on("exit",o=>{this.#t===i&&this.#O(o?`pi exited (code ${o})${this.#v.trim()?`: ${this.#v.trim()}`:""}`:"pi exited"),Qa.delete(i),this.#S()}),this.#h({type:"get_state"}).then(o=>{let a=o.data?.sessionFile;typeof a=="string"&&a&&(this.#m=a);let l=o.data?.model;l&&typeof l.id=="string"&&l.id&&(this.#w=l.id)}).catch(()=>{}).finally(()=>this.#R())}#R(){this.#s&&(this.#s=!1,this.#r?.text===Xw&&(this.#r=null),this.#i&&(this.#i.until=Date.now()+Zw),!this.#o&&Date.now()<this.#e&&(this.#e=Date.now()+Ef),this.#T())}get streaming(){return this.#o||Date.now()<this.#e}get draft(){return this.#c}get echo(){return this.#d}get queue(){return this.#b}get stats(){return this.#k}get model(){return this.#w}get sessionFile(){return this.#m}get error(){return this.#g}get status(){if(this.#r)return this.#r;if(this.#i){if(Date.now()<this.#i.until)return{text:this.#i.text,kind:this.#i.kind};this.#i=null}return this.#f.size?{text:[...this.#f.values()].join(" \xB7 "),kind:"info"}:null}get dialog(){let e=Date.now();for(;this.#l.length;){let n=this.#l[0];if(e<n.until)return n.req;this.#l.shift(),n.ownTimeout||this.#E({type:"extension_ui_response",id:n.req.id,cancelled:!0})}return null}notice(e,n){this.#y(e,n)}respondUi(e,n){let r=this.#l.findIndex(o=>o.req.id===e);if(r<0)return{ok:!1,error:"dialog expired or already answered"};let[s]=this.#l.splice(r,1),i={type:"extension_ui_response",id:e};return n.cancelled?i.cancelled=!0:s.req.method==="confirm"?i.confirmed=!!n.confirmed:i.value=n.value??"",this.#E(i),{ok:!0}}async rpc(e){if(!pR.has(e.type))return{ok:!1,error:`command not allowed: ${e.type}`};try{let n=await this.#h(e);if(n.success&&e.type==="set_model"){let r=n.data?.id;typeof r=="string"&&r&&(this.#w=r)}if(n.success&&(e.type==="fork"||e.type==="clone")){try{let s=(await this.#h({type:"get_state"})).data?.sessionFile;typeof s=="string"&&s&&(this.#m=s)}catch{}return{ok:!0,data:{...n.data??{},sessionFile:this.#m}}}return n.success?{ok:!0,data:n.data}:{ok:!1,error:n.error??`pi rejected ${e.type}`}}catch(n){return{ok:!1,error:V(n)}}}async send(e,n){let r=this.streaming,s=e.trimStart().startsWith("/"),i=r?s?{type:"prompt",message:e,streamingBehavior:n?.followUp?"followUp":"steer"}:{type:n?.followUp?"follow_up":"steer",message:e}:{type:"prompt",message:e},o=l=>{r||(this.#e=l,s||(this.#d=e))};if(this.#s)return this.#h(i).catch(()=>{}),o(this.#u+Ef),{ok:!0};let a;try{a=await this.#h(i)}catch(l){return{ok:!1,error:V(l)}}return a.success&&o(Date.now()+Ef),a.success?{ok:!0}:{ok:!1,error:a.error??"pi rejected the message"}}async stop(){if(this.#t){if(this.#s){this.#E({type:"abort"}),this.#e=0;return}try{await this.#h({type:"abort"})}catch{}}}clearCompletedDraft(){this.#n||(this.#c=null)}clearEcho(){this.#d=null}async dispose(){let e=this.#t;if(e){if(this.#t=void 0,this.#s=!1,this.#o){try{e.stdin?.write(JSON.stringify({type:"abort"})+`
|
|
2021
|
+
`)}catch{}await Promise.race([this.#x,ev(Qw)])}try{e.stdin?.end()}catch{}if(await Promise.race([this.#x,ev(Qw)]),e.exitCode===null&&!e.killed)if(process.platform==="win32"&&e.pid)try{Vw("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"})}catch{}else try{e.kill("SIGKILL")}catch{}Qa.delete(e),this.#l=[],this.#P("pi was shut down")}}#E(e){try{this.#t?.stdin?.write(JSON.stringify(e)+`
|
|
2022
2022
|
`)}catch{}}#C(){let e=this.#a[this.#a.length-1];this.#c={text:this.#a.filter(n=>n?.kind==="text").map(n=>n.text).join(""),thinking:this.#a.filter(n=>n?.kind==="thinking").map(n=>n.text).join(`
|
|
2023
|
-
`),tool:e?.kind==="tool"?e.name:void 0}}#A(e){let n=Array.isArray(e?.content)?e.content:[];this.#a=n.map(r=>({kind:r.type==="thinking"?"thinking":r.type==="toolCall"?"tool":"text",text:(r.type==="thinking"?r.thinking:r.text)??"",name:r.name})),this.#C()}#y(e,n){let r=e.length>200?e.slice(0,200)+"\u2026":e;r&&(this.#i={text:r,kind:n,until:Date.now()+(n==="info"?
|
|
2024
|
-
`)}catch(l){clearTimeout(a),this.#p.delete(s),o(new Error(V(l)))}})}#I(e){let n;try{n=JSON.parse(e)}catch{return}switch(n.type){case"response":{let r=n,s=r.id?this.#p.get(r.id):void 0;s&&(this.#p.delete(r.id),clearTimeout(s.timer),s.resolve(r));return}case"agent_start":this.#o=!0,this.#e=0;return;case"agent_end":this.#o=!1,this.#e=0,this.#n=!1,this.#r=null,this.#b=null,this.#T();return;case"message_start":{let r=n.message;if(r?.role!=="assistant")return;this.#n=!0,this.#A(r);return}case"message_update":{if(!this.#n)return;if(n.message){this.#A(n.message);return}let r=n.assistantMessageEvent;if(!r||typeof r.contentIndex!="number")return;let s=r.type.startsWith("thinking")?"thinking":r.type.startsWith("toolcall")?"tool":"text",i=this.#a[r.contentIndex]??={kind:s,text:""};i.kind=s,typeof r.delta=="string"&&s!=="tool"&&(i.text+=r.delta),typeof r.content=="string"&&(i.text=r.content),r.toolCall?.name&&(i.name=r.toolCall.name),this.#C();return}case"message_end":if(!this.#n)return;n.message&&this.#A(n.message),this.#n=!1;return;case"auto_retry_start":this.#r={text:`retrying after a transient error (attempt ${Number(n.attempt)||1}/${Number(n.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#r=null,n.success===!1&&this.#y(`retries exhausted: ${String(n.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#r={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#r=null;let r=n.result;typeof n.errorMessage=="string"&&n.errorMessage?this.#y(`compaction failed: ${n.errorMessage}`,"error"):r?.tokensBefore&&this.#y(`compacted: ~${Math.round(r.tokensBefore/1e3)}k \u2192 ~${Math.round((r.estimatedTokensAfter??0)/1e3)}k tokens`,"info"),this.#T();return}case"queue_update":{let r=Array.isArray(n.steering)?n.steering.map(String):[],s=Array.isArray(n.followUp)?n.followUp.map(String):[];this.#b=r.length||s.length?{steering:r,followUp:s}:null;return}case"extension_ui_request":{let r=String(n.method??"");if(r==="select"||r==="confirm"||r==="input"||r==="editor"){let s=typeof n.timeout=="number"&&n.timeout>0?n.timeout:void 0;this.#l.push({req:{id:String(n.id??""),method:r,title:typeof n.title=="string"?n.title:void 0,message:typeof n.message=="string"?n.message:void 0,options:Array.isArray(n.options)?n.options.map(String):void 0,placeholder:typeof n.placeholder=="string"?n.placeholder:void 0,prefill:typeof n.prefill=="string"?n.prefill:void 0},until:Date.now()+(s??
|
|
2025
|
-
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function
|
|
2026
|
-
`),l=i.filter(u=>u.type==="toolCall").map(u=>({id:u.id??"",name:u.name??"",input:u.arguments??{}}));if(o||a||l.length){let u=Date.parse(e.timestamp??""),p=!isNaN(u)&&u>=n;r.push({type:"assistant",text:o,thinking:a,tools:l,live:p})}let c=s.usage,f=c?(c.input??0)+(c.output??0)+(c.cacheRead??0)+(c.cacheWrite??0):0,d=c&&f>0&&s.stopReason!=="aborted"&&s.stopReason!=="error"?{in:c.input??0,out:c.output??0,cached:c.cacheRead??0,cacheCreate:c.cacheWrite??0}:void 0;return{events:r,usage:d,model:s.model,cost:c?.cost?.total}}return{events:r}}chainWorking(e){let n;for(let a of e)
|
|
2023
|
+
`),tool:e?.kind==="tool"?e.name:void 0}}#A(e){let n=Array.isArray(e?.content)?e.content:[];this.#a=n.map(r=>({kind:r.type==="thinking"?"thinking":r.type==="toolCall"?"tool":"text",text:(r.type==="thinking"?r.thinking:r.text)??"",name:r.name})),this.#C()}#y(e,n){let r=e.length>200?e.slice(0,200)+"\u2026":e;r&&(this.#i={text:r,kind:n,until:Date.now()+(n==="info"?fR:Zw)})}#T(){this.#h({type:"get_session_stats"}).then(e=>{if(!e.success||!e.data)return;let n=e.data;this.#k={cost:typeof n.cost=="number"?n.cost:0,contextTokens:typeof n.contextUsage?.tokens=="number"?n.contextUsage.tokens:null,contextPercent:typeof n.contextUsage?.percent=="number"?n.contextUsage.percent:null}}).catch(()=>{})}#h(e){let n=this.#t;if(!n?.stdin?.writable)return Promise.reject(new Error(this.#g??"pi is not running"));let r=this.#s?Gw:cR,s=`tb-${this.#_++}`;return new Promise((i,o)=>{let a=setTimeout(()=>{this.#p.delete(s),o(new Error(`pi did not respond (${Math.round(r/1e3)}s)`))},r);a.unref?.(),this.#p.set(s,{resolve:i,timer:a});try{n.stdin.write(JSON.stringify({id:s,...e})+`
|
|
2024
|
+
`)}catch(l){clearTimeout(a),this.#p.delete(s),o(new Error(V(l)))}})}#I(e){let n;try{n=JSON.parse(e)}catch{return}switch(n.type){case"response":{let r=n,s=r.id?this.#p.get(r.id):void 0;s&&(this.#p.delete(r.id),clearTimeout(s.timer),s.resolve(r));return}case"agent_start":this.#o=!0,this.#e=0;return;case"agent_end":this.#o=!1,this.#e=0,this.#n=!1,this.#r=null,this.#b=null,this.#T();return;case"message_start":{let r=n.message;if(r?.role!=="assistant")return;this.#n=!0,this.#A(r);return}case"message_update":{if(!this.#n)return;if(n.message){this.#A(n.message);return}let r=n.assistantMessageEvent;if(!r||typeof r.contentIndex!="number")return;let s=r.type.startsWith("thinking")?"thinking":r.type.startsWith("toolcall")?"tool":"text",i=this.#a[r.contentIndex]??={kind:s,text:""};i.kind=s,typeof r.delta=="string"&&s!=="tool"&&(i.text+=r.delta),typeof r.content=="string"&&(i.text=r.content),r.toolCall?.name&&(i.name=r.toolCall.name),this.#C();return}case"message_end":if(!this.#n)return;n.message&&this.#A(n.message),this.#n=!1;return;case"auto_retry_start":this.#r={text:`retrying after a transient error (attempt ${Number(n.attempt)||1}/${Number(n.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#r=null,n.success===!1&&this.#y(`retries exhausted: ${String(n.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#r={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#r=null;let r=n.result;typeof n.errorMessage=="string"&&n.errorMessage?this.#y(`compaction failed: ${n.errorMessage}`,"error"):r?.tokensBefore&&this.#y(`compacted: ~${Math.round(r.tokensBefore/1e3)}k \u2192 ~${Math.round((r.estimatedTokensAfter??0)/1e3)}k tokens`,"info"),this.#T();return}case"queue_update":{let r=Array.isArray(n.steering)?n.steering.map(String):[],s=Array.isArray(n.followUp)?n.followUp.map(String):[];this.#b=r.length||s.length?{steering:r,followUp:s}:null;return}case"extension_ui_request":{let r=String(n.method??"");if(r==="select"||r==="confirm"||r==="input"||r==="editor"){let s=typeof n.timeout=="number"&&n.timeout>0?n.timeout:void 0;this.#l.push({req:{id:String(n.id??""),method:r,title:typeof n.title=="string"?n.title:void 0,message:typeof n.message=="string"?n.message:void 0,options:Array.isArray(n.options)?n.options.map(String):void 0,placeholder:typeof n.placeholder=="string"?n.placeholder:void 0,prefill:typeof n.prefill=="string"?n.prefill:void 0},until:Date.now()+(s??dR),ownTimeout:s!==void 0})}else if(r==="notify"){let s=n.notifyType==="warning"?"warning":n.notifyType==="error"?"error":"info";this.#y(String(n.message??""),s),console.log(`[composer] pi extension: ${String(n.message??"")}`)}else if(r==="setStatus"){let s=String(n.statusKey??"");typeof n.statusText=="string"&&n.statusText?this.#f.set(s,n.statusText):this.#f.delete(s)}return}default:return}}#O(e){this.#g=e,this.#s=!1,this.#o=!1,this.#e=0,this.#n=!1,this.#c=null,this.#a=[],this.#d=null,this.#r=null,this.#i=null,this.#f.clear(),this.#l=[],this.#b=null,this.#k=null,this.#w=null,this.#t=void 0,this.#P(e)}#P(e){for(let[,n]of this.#p)clearTimeout(n.timer),n.resolve({type:"response",success:!1,error:e});this.#p.clear()}},ev=t=>new Promise(e=>{setTimeout(e,t).unref?.()})});import{existsSync as nv,readFileSync as mR,realpathSync as gR}from"fs";import{join as Nn,dirname as ov,resolve as yR}from"path";import{homedir as rv}from"os";function wR(t,e){let n=Nn(t,".pi");if(bR.some(s=>nv(Nn(n,s))))return!0;let r=Nn(e,".agents","skills");for(let s=t;;){let i=Nn(s,".agents","skills");if(i!==r&&nv(i))return!0;let o=ov(s);if(o===s)return!1;s=o}}function vR(t,e){for(let n=e;;){if(t[n]===!0||t[n]===!1)return!0;let r=ov(n);if(r===n)return!1;n=r}}function av(t,e){try{let n=e?.agentDir??Nn(rv(),".pi","agent"),r=sv(e?.home??process.env.HOME??rv()),s=sv(yR(t));if(!wR(s,r))return null;let i=iv(Nn(n,"settings.json")).defaultProjectTrust;return i==="always"||i==="never"||vR(iv(Nn(n,"trust.json")),s)?null:"pi has no trust decision for this project \u2014 running untrusted; run `pi` once in a terminal to grant it"}catch{return null}}var bR,sv,iv,lv=S(()=>{"use strict";bR=["settings.json","extensions","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"],sv=t=>{try{return gR(t)}catch{return t}},iv=t=>{try{return JSON.parse(mR(t,"utf8"))}catch{return{}}}});import{statSync as SR,openSync as kR,readSync as xR,closeSync as ER,existsSync as uv}from"fs";import{join as el}from"path";import{homedir as Af}from"os";import{execFile as AR}from"child_process";async function CR(t){let e=el(Af(),".pi","agent","bin",process.platform==="win32"?"fd.exe":"fd");for(let n of["fd","fdfind",...uv(e)?[e]:[]]){let r=await new Promise(s=>{AR(n,["--base-directory",t,"--type","f","--follow","--hidden","--exclude",".git"],{maxBuffer:67108864},(i,o)=>s(i?null:o))});if(r!==null)return r.split(`
|
|
2025
|
+
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function OR(t){return`--${t.replace(/^[/\\]/,"").replace(/[/\\:]/g,"-")}--`}function cv(t){return t.type==="message"?PR(t.message?.role):t.type==="custom_message"?t.display!==!1:!1}var TR,PR,Nr,Tf=S(()=>{"use strict";Rs();Ko();Ho();Yw();tv();lv();TR=el(Af(),".pi","agent","sessions");PR=t=>t==="user"||t==="assistant"||t==="toolResult"||t==="bashExecution";Nr=class extends qt{displayName="Pi Mirror";detectsSelf(){return process.env.PI_CODING_AGENT==="true"}detectsInstalled(){return uv(el(Af(),".pi","agent"))}ensureHarnessSupport(){zw()}createDriver(e,n){let r=new Za(e,n),s=av(e);return s&&r.notice(s,"warning"),r}walkFiles(e){return CR(e)}sessionsDir(e){return el(TR,OR(e))}listSessionFiles(e){return Wo(this.sessionsDir(e))}parseEntry(e){let n;try{n=JSON.parse(e)}catch{return null}return!n||n.type==="session"||!n.id?null:n}idOf(e){return e.id}parentOf(e){return e.parentId??void 0}timestampOf(e){return e.timestamp}isSidechain(e){return!1}isLeafType(e){return cv(e)}isRecoveryNoise(e){return!1}apply(e,n){let r=[];if(e.type==="custom_message"){if(e.display===!1)return{events:r};let i=this.contentText(e.content).trim();return i&&r.push({type:"user",text:i}),{events:r}}if(e.type!=="message"||!e.message)return{events:r};let s=e.message;if(s.role==="user"){let i=this.contentText(s.content).trim();return i&&r.push({type:"user",text:i}),{events:r}}if(s.role==="toolResult"){let i=this.contentText(s.content);return r.push({type:"tool_result",id:s.toolCallId??"",content:i,isError:!!s.isError,digest:Be(i)}),{events:r}}if(s.role==="bashExecution")return s.command&&!s.excludeFromContext&&r.push({type:"user",text:`$ ${s.command}`}),{events:r};if(s.role==="assistant"){let i=Array.isArray(s.content)?s.content:[],o=i.filter(u=>u.type==="text").map(u=>u.text??"").join(""),a=i.filter(u=>u.type==="thinking").map(u=>u.thinking??"").join(`
|
|
2026
|
+
`),l=i.filter(u=>u.type==="toolCall").map(u=>({id:u.id??"",name:u.name??"",input:u.arguments??{}}));if(o||a||l.length){let u=Date.parse(e.timestamp??""),p=!isNaN(u)&&u>=n;r.push({type:"assistant",text:o,thinking:a,tools:l,live:p})}let c=s.usage,f=c?(c.input??0)+(c.output??0)+(c.cacheRead??0)+(c.cacheWrite??0):0,d=c&&f>0&&s.stopReason!=="aborted"&&s.stopReason!=="error"?{in:c.input??0,out:c.output??0,cached:c.cacheRead??0,cacheCreate:c.cacheWrite??0}:void 0;return{events:r,usage:d,model:s.model,cost:c?.cost?.total}}return{events:r}}chainWorking(e){let n;for(let a of e)cv(a)&&(n=a);if(!n||n.type==="custom_message")return!1;let r=n.message.role;if(r==="user"||r==="toolResult"||r==="bashExecution")return!0;if(r!=="assistant")return!1;let i=(Array.isArray(n.message.content)?n.message.content:[]).filter(a=>a.type==="toolCall").map(a=>a.id);if(!i.length)return!1;let o=new Set;for(let a of e)a.type==="message"&&a.message?.role==="toolResult"&&a.message.toolCallId&&o.add(a.message.toolCallId);return i.some(a=>a&&!o.has(a))}sessionAlive(){}readPreview(e){let n;try{n=kR(e,"r")}catch{return""}try{let s=65536;try{s=SR(e).size}catch{}let i=(d,u)=>{let p=Buffer.alloc(u),h=xR(n,p,0,u,d);return p.subarray(0,h).toString("utf8")},o=i(0,Math.min(65536,s)),a=s>65536?i(s-65536,65536):"",l=d=>{let u="";for(let p of d.split(`
|
|
2027
2027
|
`))if(p.includes('"session_info"'))try{let h=JSON.parse(p);h?.type==="session_info"&&typeof h.name=="string"&&h.name&&(u=h.name)}catch{}return u},c="";for(let d of o.split(`
|
|
2028
|
-
`))if(!(c||!d.includes('"type"')))try{let u=JSON.parse(d);u?.type==="message"&&u.message?.role==="user"&&(c=this.contentText(u.message.content).replace(/\s+/g," ").trim())}catch{}let f=l(a)||l(o)||c;return f?f.slice(0,200):""}finally{
|
|
2029
|
-
`):""}}});var
|
|
2028
|
+
`))if(!(c||!d.includes('"type"')))try{let u=JSON.parse(d);u?.type==="message"&&u.message?.role==="user"&&(c=this.contentText(u.message.content).replace(/\s+/g," ").trim())}catch{}let f=l(a)||l(o)||c;return f?f.slice(0,200):""}finally{ER(n)}}searchText(e){if(e?.type!=="message")return"";let n=e.message?.role;if(n!=="user"&&n!=="assistant")return"";let r=e.message?.content,s="";return typeof r=="string"?s=r:Array.isArray(r)&&(s=r.filter(i=>i.type==="text"&&typeof i.text=="string").map(i=>i.text).join(" ")),s.replace(/\s+/g," ").trim()}contentText(e){return typeof e=="string"?_e(e):Array.isArray(e)?e.map(n=>typeof n?.text=="string"?_e(n.text):n?.type==="image"&&n.data?qo(n.data,n.mimeType):"").filter(Boolean).join(`
|
|
2029
|
+
`):""}}});var tl,dv=S(()=>{"use strict";tl=class{#t=new Map;accept(e,n){return this.#t.get(e)===n?!1:(this.#t.set(e,n),!0)}}});import{execFile as _R}from"child_process";import{promisify as RR}from"util";import{readFile as IR}from"fs/promises";import{resolve as fv,sep as $R}from"path";async function we(t,e){let{stdout:n}=await NR("git",t,{cwd:e,maxBuffer:67108864});return n}async function Ln(){if(nl)return nl;try{nl=(await we(["rev-parse","--show-toplevel"],X)).trim()}catch{}return nl}function LR(t,e){let n=e===" "?t:e;return n==="?"?"U":n}async function Of(){let t=await Ln();if(!t)return{repo:!1,root:"",files:[]};try{let e=await we(["status","--porcelain","-z"],t),n=[],r=e.split("\0");for(let s=0;s<r.length;s++){let i=r[s];i.length<4||((i[0]==="R"||i[0]==="C")&&s++,n.push({path:i.slice(3),status:LR(i[0],i[1])}))}try{let s=await we(["diff","--numstat","-z","HEAD"],t),i=new Map,o=s.split("\0");for(let a=0;a<o.length;a++){let l=/^(\d+|-)\t(\d+|-)\t(.*)$/.exec(o[a]);if(!l)continue;let c=l[3]||o[a+=2];c&&i.set(c,{add:+l[1]||0,del:+l[2]||0,binary:l[1]==="-"})}for(let a of n){let l=i.get(a.path);l&&(l.binary?a.binary=!0:(a.add=l.add,a.del=l.del))}}catch{}return n.sort((s,i)=>s.path.localeCompare(i.path)),{repo:!0,root:t,files:n}}catch(e){return{repo:!1,root:"",files:[],error:V(e)}}}async function Pf(t){let e=await Ln();if(!e)return{ok:!1,error:"not a git repository"};try{if((await we(["status","--porcelain","-z","--",t],e)).startsWith("??")){let s=fv(e,t);if(!s.startsWith(fv(e)+$R))return{ok:!1,error:"outside repository"};let i=await IR(s);return i.includes(0)?Cf("Binary file (not shown)",!1):Cf(i.toString("utf8"),!0)}let r;try{r=await we(["diff","--no-color","--unified=999999","HEAD","--",t],e)}catch{r=await we(["diff","--no-color","--unified=999999","--",t],e)}return Cf(r,!1)}catch(n){return{ok:!1,error:V(n)}}}var NR,pv,nl,Cf,Lr=S(()=>{"use strict";Zt();NR=RR(_R),pv=2e6;Cf=(t,e)=>({ok:!0,text:t.slice(0,pv),untracked:e,truncated:t.length>pv})});function ui(t,e){let n=0,r="";for(let s of t){let i=s.lower.indexOf(e);if(!(i<0)&&(n++,!r)){let o=Math.max(0,i-110),a=Math.min(s.text.length,i+e.length+110);r=(o>0?"\u2026":"")+s.text.slice(o,a)+(a<s.text.length?"\u2026":"")}}return{hitCount:n,snippet:r}}var _f=S(()=>{"use strict"});function hv(){return MR.map(([t,e])=>vt(t,e)).filter(t=>typeof t!="string")}function mv(){return hv().length>0}async function rl(t,e,n=0){let r=AbortSignal.timeout(e);for(let s of hv()){try{let i=await zt(s,{messages:[{role:"user",content:t}],effort:n,webSearch:!1,signal:r});if(i.ok){let o=(await Kd(i,s.protocol)).trim();if(o)return o}}catch{}if(r.aborted)return}}var MR,Rf=S(()=>{"use strict";Kt();$n();MR=[["openrouter","anthropic/claude-haiku-5.5"],["anthropic","claude-haiku-5-5"],["openai","gpt-6-luna"]]});var sl,il,Tt,ol,Mr=S(()=>{"use strict";sl=".typebulb/paste",il={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp"},Tt=t=>t.label||t.kind||"agent",ol=t=>t.failing&&t.state!=="stopped"?"failing":t.state});import{existsSync as DR,mkdirSync as BR,writeFileSync as jR,readFileSync as FR}from"fs";import{join as al}from"path";function gv(){let t=new Date,e=n=>String(n).padStart(2,"0");return`${t.getFullYear()}${e(t.getMonth()+1)}${e(t.getDate())}-${e(t.getHours())}${e(t.getMinutes())}${e(t.getSeconds())}`}function JR(t){return t.trim().toLowerCase().replace(/\.[a-z0-9]{1,4}$/,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}async function WR(t){let e=await rl(`Reply with ONLY a short kebab-case filename (2-5 words, lowercase, no extension) describing this text:
|
|
2030
2030
|
|
|
2031
|
-
${t.slice(0,
|
|
2032
|
-
`+
|
|
2031
|
+
${t.slice(0,qR)}`,UR);return e&&JR(e)||void 0}async function yv(t,e){if(!e||e.kind!=="image"&&e.kind!=="text")return{ok:!1,error:"bad paste kind"};if(typeof e.data!="string"||!e.data)return{ok:!1,error:"empty paste"};let n=al(t,sl);try{BR(n,{recursive:!0})}catch(a){return{ok:!1,error:V(a)}}let r,s,i;if(e.kind==="image"){if(r=`img-${gv()}`,s=Object.keys(il).find(a=>il[a]===e.mime)??"png",i=Buffer.from(e.data,"base64"),!i.length)return{ok:!1,error:"empty image data"}}else r=await WR(e.data)??`paste-${gv()}`,s="md",i=e.data;let o=`${r}.${s}`;for(let a=2;DR(al(n,o));a++)o=`${r}-${a}.${s}`;try{jR(al(n,o),i)}catch(a){return{ok:!1,error:V(a)}}return{ok:!0,path:`${sl}/${o}`}}function bv(t,e){if(!/^[\w-]+(\.[\w-]+)*$/.test(e))return{ok:!1,error:"bad name"};let n=e.slice(e.lastIndexOf(".")+1).toLowerCase(),r=il[n];if(!r)return{ok:!1,error:"not an image"};try{return{ok:!0,mime:r,base64:FR(al(t,sl,e)).toString("base64")}}catch{return{ok:!1,error:"not found"}}}var UR,qR,wv=S(()=>{"use strict";Rf();Zt();Mr();UR=4e3,qR=4e3});async function kv(t,e=""){let n=t.trim();if(!n)return{ok:!1,error:"nothing to summarize"};if(!mv())return zR;let r=e.trim()?Sv+`CONTEXT \u2014 the user message this reply answers. It is context only: never summarize it, and never report it as the reply's content.
|
|
2032
|
+
`+HR(e.trim())+`
|
|
2033
2033
|
|
|
2034
2034
|
REPLY TO SUMMARIZE:
|
|
2035
|
-
`+n.slice(0,
|
|
2035
|
+
`+n.slice(0,vv):Sv+n.slice(0,vv),s=await rl(r,KR,1);return s?{ok:!0,text:s}:YR}var KR,vv,Sv,HR,zR,YR,xv=S(()=>{"use strict";Rf();KR=2e4,vv=24e3,Sv=`Summarize this assistant reply for someone who wants its substance without the prose.
|
|
2036
2036
|
|
|
2037
2037
|
- Markdown. Start with the direct answer, recommendation, result, or status. If it is qualified, put the qualification in that same opening sentence; do not make the reader infer it from later bullets.
|
|
2038
2038
|
- Preserve material limits and conditions that change the answer: exceptions, tradeoffs, prerequisites, uncertainty, incomplete validation, and clauses such as but, only when, unless, or if. Cut only filler hedges (for example, "I think" or "arguably") that change nothing.
|
|
@@ -2047,34 +2047,34 @@ Reply with the summary alone.
|
|
|
2047
2047
|
|
|
2048
2048
|
---
|
|
2049
2049
|
|
|
2050
|
-
`,
|
|
2050
|
+
`,HR=(t,e=4e3)=>{if(t.length<=e)return t;let n=Math.floor(e/2)-20;return t.slice(0,n)+`
|
|
2051
2051
|
|
|
2052
2052
|
[snipped for brevity]
|
|
2053
2053
|
|
|
2054
|
-
`+t.slice(t.length-n)},
|
|
2055
|
-
`),n),l=[],c=new Set;for(let u=a;u&&!c.has(u);){let p=i.get(u);if(!p)break;c.add(u),l.push(p),u=r.parentOf(p)}let f=[],d=Date.now();for(let u of l.reverse())if(!r.isSidechain(u,n))try{f.push(...
|
|
2056
|
-
`).find(h=>h.trim());p&&a.push({text:
|
|
2057
|
-
`).map(n=>n.trim()).filter(n=>/[\p{L}\p{N}]/u.test(n));return/^exit(?: code)?:? \d+$/i.test(e[0]??"")&&e.shift(),{first:
|
|
2058
|
-
`)){let
|
|
2054
|
+
`+t.slice(t.length-n)},zR={ok:!1,error:"Summary needs OPENROUTER_API_KEY or OPENAI_API_KEY in this project\u2019s .env.",setup:!0},YR={ok:!1,error:"the model call failed or timed out"}});import{readFileSync as VR,statSync as GR}from"fs";function ll(t,e,n,r){let s=t.apply(e,r),i=Date.parse(t.timestampOf(e)??""),o=s.events.map(a=>{let l=n==="child"&&a.type==="user"?{...a,authored:!0}:a;return!isNaN(i)&&(l.type==="user"||l.type==="assistant"||l.type==="tool_result"||l.type==="task_done"||l.type==="turn_end")&&(l.at=i),l});return{...s,events:o}}function cl(t){let e=new Map,n=t.linker();return{entries:e,add(r,s){let i;for(let o of r){if(!o.trim())continue;let a=t.parseEntry(o);if(!a)continue;n.link(a);let l=t.idOf(a);l&&(e.set(l,a),!t.isSidechain(a,s)&&t.isLeafType(a)&&(i=l))}return i}}}function Ev(t,e,n){let r=t.forRead(),s;try{s=VR(e,"utf8")}catch{return[]}let{entries:i,add:o}=cl(r),a=o(s.split(`
|
|
2055
|
+
`),n),l=[],c=new Set;for(let u=a;u&&!c.has(u);){let p=i.get(u);if(!p)break;c.add(u),l.push(p),u=r.parentOf(p)}let f=[],d=Date.now();for(let u of l.reverse())if(!r.isSidechain(u,n))try{f.push(...ll(r,u,n,d).events)}catch{}return f}function ul(t,e,n,r){let s=t.sessionAlive(e,n);if(s!==void 0)return s;if(!r)return!1;try{return Date.now()-GR(r).mtimeMs<1e4}catch{return!1}}function di(t,e){return t.stopped?"stopped":t.running&&e?"running":"done"}var If=S(()=>{"use strict"});function XR(t,...e){return t.slice().sort((n,r)=>{for(let{key:s,desc:i}of e){let o=s(n),a=s(r);if(o!==a)return o==null?i?-1:1:a==null||o<a?i?1:-1:i?-1:1}return 0})}function Av(t){let e=new Set(t.map(o=>o.id)),n=new Map;for(let o of t){let a=o.parentId&&e.has(o.parentId)?o.parentId:"",l=n.get(a);l?l.push(o):n.set(a,[o])}let r=[],s=new Set,i=o=>{for(let a of n.get(o)??[])s.has(a.id)||(s.add(a.id),r.push(a),i(a.id))};i("");for(let o of t)s.has(o.id)||r.push(o);return r}var fi,$f=S(()=>{"use strict";fi=(t,e)=>XR(t,{key:e,desc:!0})});function _v(t){let e=[],n=new Map,r=new Map,s=[],i=[],o=[],a=[],l,c=!1,f=0;for(let d of t){if(d.type==="cleared"){e=[],n=new Map,r=new Map,s=[],i=[],o=[],a=[],l=void 0,c=!1;continue}let u="at"in d?d.at:void 0;if(u!==void 0&&(f=Math.max(f,u)),d.type==="user")l===void 0&&!d.agent?l=u:u!==void 0&&s.push(u),c=!1;else if(d.type==="assistant"){u!==void 0&&i.push(u);let p=d.error?void 0:d.text.split(`
|
|
2056
|
+
`).find(h=>h.trim());p&&a.push({text:Mn(p,200),calls:e.length});for(let h of d.tools){let m={id:h.id,name:h.name,input:h.input,at:u,isError:!1};e.push(m),n.set(h.id,m)}}else if(d.type==="tool_result"){let p=n.get(d.id);if(!p)continue;Object.assign(p,{result:d.content,isError:d.isError,exit:d.exit,background:d.background,refused:d.refused,doneAt:u}),d.output&&(p.output=d.output),d.task&&r.set(d.task,p),u!==void 0&&i.push(u)}else if(d.type==="task_done"){let p=d.id?n.get(d.id):d.task?r.get(d.task):void 0;if(!p?.background||p.endAt!==void 0)continue;Object.assign(p,{endAt:u??f,outcome:d.outcome,output:d.output??p.output}),d.exit!==void 0&&(p.exit=d.exit),c&&u!==void 0&&(s.push(u),c=!1)}else d.type==="turn_end"&&(!c&&u!==void 0&&o.push(u),c=!0)}return{calls:e,turnEnds:o,narration:a,lastAt:f,...ZR(e,s,i,l,f)}}function ZR(t,e,n,r,s){let i=r??t[0]?.at??s,o=[];for(let f of e){let d=-1/0;for(let p of n)p<=f&&p>d&&(d=p);let u=t.some(p=>p.at!==void 0&&p.at<f&&(p.doneAt??1/0)>f);d>-1/0&&!u&&f-d>=QR&&o.push([d,f])}let a=o.reduce((f,[d,u])=>f+Math.max(0,Math.min(s,u)-d),0),l=0,c=-1/0;for(let f of t.filter(d=>d.at!==void 0).sort((d,u)=>d.at-u.at)){let d=f.doneAt??s;d>c&&(l+=d-Math.max(f.at,c),c=d)}return{span:Math.max(0,s-i-a),idle:a,toolMs:l}}function Mf(t,e){if(Lf(t))return;let n=Rv(t),r=t.background?t.endAt:t.doneAt,s=mi(t),i=!n&&(t.exit!==void 0?t.exit!==0&&!(t.exit===1&&s&&qy(Xo(s).rest)):t.background?t.outcome==="failed":t.isError),o=t.background?t.output?e?.(t.output)??"":"":t.result??"";return{id:t.id,at:t.at,open:n,failed:i,hidden:!n&&!i&&!!s&&Jy(s)||void 0,exit:t.exit,outcome:t.background?t.outcome:void 0,ms:t.at!==void 0&&r!==void 0?r-t.at:void 0,...eI(o)}}function eI(t){let e=Ps(t).split(`
|
|
2057
|
+
`).map(n=>n.trim()).filter(n=>/[\p{L}\p{N}]/u.test(n));return/^exit(?: code)?:? \d+$/i.test(e[0]??"")&&e.shift(),{first:Mn(e[0]??"",120),last:e.length>1?Mn(e.at(-1),120):""}}function rI(t,e,n=hi){let r=new Map,s=0;for(let o of t.calls){let a=mi(o),l=a&&Mf(o,e);if(!l)continue;let c=Pv(a).trim();if(Uy(c)){s++;continue}r.set(c,[...r.get(c)??[],l])}let i=[...r].map(([o,a])=>{let l=0;for(let d of a.filter(u=>!u.open&&!u.hidden).reverse()){if(!d.failed)break;l++}let c=Ls(o),f=[tI.test(c)?"stops a process":"",nI.test(c)?"git write":""].filter(Boolean);return{cmd:Mn(rd(o),100),runs:a.length,open:a.filter(d=>d.open).length,failed:a.filter(d=>d.failed).length,hidden:a.filter(d=>d.hidden).length,streak:l,long:a.some(d=>(d.ms??0)>n)?`over ${n%6e4?`${Math.round(n/1e3)}s`:fe(n)}`:"",ms:a.reduce((d,u)=>d+(u.ms??0),0),tags:f,latest:a.at(-1)}}).sort((o,a)=>(a.latest.at??0)-(o.latest.at??0));return{runs:i.reduce((o,a)=>o+a.runs,0),failed:i.reduce((o,a)=>o+a.failed,0),lookups:s,groups:i}}function lI(t){let e=t.filter(Boolean),n=e.slice(Math.max(0,e.map(aI).lastIndexOf(!0)));if(n.some(s=>s.includes("$")||/^~|^-$/.test(s)))return;let r=[];for(let s of n.join("/").split("/"))s===".."&&r.length&&!/^(\.\.|[a-zA-Z]:)?$/.test(r.at(-1))?r.pop():s!=="."&&(s||!r.length)&&r.push(s);return r.join("/")}function Iv(t,e){let n=new Map,r=[],s=[],i=[],o=c=>c.trim().replace(/^["']|["']$/g,"").replace(/\\/g,"/").replace(/^\/([a-zA-Z])\//,"$1:/"),a=c=>{let f=Ty(o(c),e).replace(/^\.\//,"");return!f||/^([a-zA-Z]:)?\//.test(f)?void 0:f},l=c=>a(c)??(o(c)||void 0);for(let c of t.calls){if(c.isError||c.result===void 0)continue;let f=c.doneAt??c.at??0,d=(O,P={},k=!1)=>{let L=a(O);if(!L)return;let j=n.get(L)??{path:L};j.deleted=P.deleted,P.from&&(j.from=P.from),n.set(L,j),r.push({path:L,at:f,whole:k})},u=(O,P)=>{let k=a(O),L=k?n.get(k):void 0;k&&(n.delete(k),r.push({path:k,at:f})),d(P,{from:L?.from??k})},p=c.input??{},h=!1;for(let[O,P]of Object.entries(p)){if(O==="command"||O==="cmd"||typeof P!="string"||!/^(---|\+\+\+) /m.test(P))continue;let k;for(let L of P.split(`
|
|
2058
|
+
`)){let j=/^(---|\+\+\+) (?:[ab]\/)?(.+?)\s*$/.exec(L);if(j?.[1]==="---"){k=j[2];continue}if(j?.[1]==="+++"){h=!0,j[2]==="/dev/null"?k&&k!=="/dev/null"&&d(k,{deleted:!0}):d(j[2]);continue}let Q=/^\*\*\* Move to: (.+?)\s*$/.exec(L);Q&&k&&u(k,Q[1])}}let m=Z(p.file_path)??Z(p.filePath)??Z(p.path),g=oI.some(O=>O in p);!h&&m&&g&&d(m,{},typeof p.content=="string");let b=Z(p.file_path)??Z(p.filePath);if(b&&!g&&!h){let O=l(b);O&&s.push({path:O,at:f})}let C=O=>Object.entries(p).filter(([P,k])=>typeof k=="string"&&(P===O||P.startsWith(`${O} (`))).map(([,P])=>P);if(c.name==="read")for(let O of C("path")){let P=l(O);P&&s.push({path:P,at:f})}let T=Z(p.workdir),E=O=>{let{dirs:P,rest:k}=Xo(O);return{rest:k,at:L=>lI([e,T??"",...P,L].map(o))}};for(let O of[...C("command"),...C("cmd")]){let P=E(O);for(let k of Hy(P.rest)){let L=P.at(k),j=L&&l(L);j&&i.push({path:j,at:f})}}let $=mi(c);if($){let O=E($);for(let P of Wy(O.rest)){let k=O.at(P.from),L=P.to&&O.at(P.to);k&&L?u(k,L):k&&!P.to&&d(k,{deleted:!0})}}}return{edited:[...n.values()],writes:r,reads:s,shellReads:i}}function $v(t){let e=new Map;for(let s of t)for(let i of s.writes)e.set(i.path,[...e.get(i.path)??[],{id:s.id,at:i.at,whole:i.whole}]);let n=new Map,r=new Map;for(let[s,i]of e){i.sort((a,l)=>a.at-l.at);let o=new Map;for(let a of i)o.set(a.id,a.at);n.set(s,[...o].map(([a,l])=>({id:a,at:l})).sort((a,l)=>a.at-l.at)),i.forEach((a,l)=>{if(!a.whole)return;let c=i.slice(0,l).reverse().find(u=>u.id!==a.id);if(!c)return;let f=t.find(u=>u.id===a.id);[...f.reads,...f.writes].some(u=>u.path===s&&u.at>c.at&&u.at<a.at)||r.set(`${s}
|
|
2059
2059
|
${a.id}
|
|
2060
|
-
${c.id}`,{path:s,by:a.id,over:c.id,at:a.at,overAt:c.at})})}return{writers:n,blind:[...r.values()]}}function
|
|
2061
|
-
`)}function
|
|
2062
|
-
`)}function
|
|
2063
|
-
${r(n-
|
|
2064
|
-
`)){if(u.startsWith("@")){d=Number(u.slice(1))*1e3;continue}let p=u.trim()&&i(u.trim());p&&!c.has(p)&&c.set(p,d)}}let f=new Set(n.length?(await
|
|
2065
|
-
`).map(d=>r(d.trim())).filter(Boolean):[]);return{uncommitted:d=>a.has(r(d)),ignored:d=>f.has(r(d)),since:d=>c.get(r(d))??0}}catch{return
|
|
2066
|
-
`);if(v<0)return;let
|
|
2067
|
-
`),y.thread);if(y.partial=y.partial.slice(v+1),!
|
|
2068
|
-
`).filter(Boolean):await t.walkFiles?.(e.cwd)??[];return(await Promise.all(x.map(async
|
|
2069
|
-
`)){if(!
|
|
2070
|
-
`)){let c=l.replace(/\s+/g," ").trim();c&&i.push({text:c,lower:c.toLowerCase()})}let{hitCount:o,snippet:a}=
|
|
2071
|
-
${t}`;return
|
|
2072
|
-
`)}function
|
|
2060
|
+
${c.id}`,{path:s,by:a.id,over:c.id,at:a.at,overAt:c.at})})}return{writers:n,blind:[...r.values()]}}function Nv(t,e,n,r,s,i,o,a=Df,l=hi){let c=b=>`"${s.get(b)??b}"`,f=e.calls.filter(b=>!Lf(b)&&Rv(b)).map(b=>({id:b.id,label:Nf(b),short:Mn(Z(b.input?.description)??"",80)||Nf(b),at:b.at,background:!!b.background,interrupted:!i||t.liveSince!==void 0&&(b.at??0)<t.liveSince,said:EI(Mf(b,o))})),d=new Map;for(let b of[...n.reads,...n.shellReads].sort((C,T)=>C.at-T.at)){let C=d.get(b.path)??{path:b.path,times:0,at:0};d.delete(b.path),d.set(b.path,{...C,times:C.times+1,at:Math.max(C.at,b.at)})}let u=t.state==="running"&&!f.length?e.calls.filter(b=>!Lf(b)).at(-1):void 0,p=u&&Mf(u),h=ol(t),m=h==="done"?"finished":h,g=m==="finished"&&e.narration.at(-1)?.calls===e.calls.length;return{id:t.id,name:Tt(t),state:m,asOf:e.lastAt,activeMs:e.span,idleMs:e.idle,toolMs:e.toolMs,open:f,commands:cI(rI(e,o,l),f),files:n.edited.map(b=>{let C=a.since(b.path);return{...b,committed:!a.ignored(b.path)&&!a.uncommitted(b.path),ignored:a.ignored(b.path),also:(r.writers.get(b.path)??[]).filter(T=>T.id!==t.id&&T.at>C).map(T=>({name:s.get(T.id)??T.id,at:T.at})),blind:r.blind.filter(T=>T.path===b.path&&(T.by===t.id||T.over===t.id)&&T.overAt>C).map(T=>T.by===t.id?`\u26A0 written at ${Dr(T.at)} over ${c(T.over)}'s ${Dr(T.overAt)} write without reading it`:`\u26A0 ${c(T.by)} wrote over this agent's ${Dr(T.overAt)} write at ${Dr(T.at)} without reading it`)}}),read:[...d.values()].sort((b,C)=>b.at-C.at),narration:(g?e.narration.slice(0,-1):e.narration).map(b=>b.text),latest:u&&p?{id:u.id,label:Nf(u),run:p}:void 0}}function cI(t,e){let n=new Set(e.filter(r=>r.interrupted).map(r=>r.id));return{...t,groups:t.groups.map(r=>n.has(r.latest.id)?{...r,latest:{...r.latest,interrupted:!0}}:r)}}function Mv(t,e){let n=t.state==="finished"?Br(t).filter(r=>r.background):[];return n.length?`finished, background call running ${fe(e-(n[0].at??e))}${n.length>1?` (+${n.length-1} more)`:""}`:t.state}function hI(t,e){if(!t.open.length)return[`Now: ${pI(t,e)}`,...t.latest?[`Latest: ${t.latest.label} \xB7 ${Fv(t.latest.run)}${t.latest.run.ms!==void 0?` after ${fe(t.latest.run.ms)}`:""}`]:[]];let n=(r,s)=>r.said?[`${s}"${r.said}"`]:[];return t.open.length===1?[`Now: ${Ov(t.open[0],e)}`,...n(t.open[0]," ")]:["Now:",...t.open.flatMap(r=>[` ${Ov(r,e)}`,...n(r," ")])]}function mI(t,e){let n=t.latest;return`latest: ${n.interrupted?"interrupted":n.open?`running ${fe(e-(n.at??e))}`:`${Fv(n)}${n.ms!==void 0?` after ${fe(n.ms)}`:""}`}${t.streak>=2?`, failed ${t.streak} in a row`:""}`}function Dv(t,e){let n=[`Sub-agent "${t.name}" (${t.id}): ${fI(t,e)}${t.asOf?` \xB7 as of ${Dr(t.asOf)}`:""}`,""];n.push(...hI(t,e));let r=t.commands;n.push(`Commands: ${sI(r)}`);let{shown:s,more:i}=vI(r);for(let l of s){let c=xI(l);n.push(` ${l.cmd} \xD7${l.runs}${l.failed?`, ${l.failed} failed`:""}${c?` \xB7 ${c}`:""}`,` ${mI(l,e)}`);let f=[l.latest.first,l.latest.last].filter(Boolean).map(d=>`"${d}"`).join(" \u2026 ");f&&n.push(` ${f}`)}i&&n.push(` ${SI(i)}`),jv(r).runs&&n.push(` ${kI(r)}`),t.activeMs&&n.push(`Time: ${bI(t,e)}`),t.narration.length&&n.push("Narration:",...t.narration.map(l=>` ${l}`)),n.push(`Files written: ${gI(t)}`);for(let l of t.files){let c=l.also.length?` also ${wI(l)}`:"";n.push(` ${AI(l)}${l.ignored?" (ignored)":l.committed?" (committed)":""}${c}`,...l.blind.map(f=>` ${f}`))}let{shown:o,earlier:a}=CI(t);return n.push(`Files read: ${t.read.length||"none"}`,...a?[` +${a} earlier`]:[],...o.map(l=>` ${TI(l)}`)),n.join(`
|
|
2061
|
+
`)}function yI(t,e){let n=t.toolMs+(Br(t).some(r=>!r.background)?Lv(t,e):0);return{tools:n,model:Math.max(0,Bf(t,e)-n)}}function Uv(t,e,n,r){let s=e.filter(pi).length,i=Math.max(0,...e.map(u=>u.asOf)),o=[s?`Session ${t}: ${s} of ${e.length} agents running.`:`Session ${t}: No agent running for ${fe(r-i)} (${e.length} agents).`];if(n.length){o.push("","Files to check before git add:");for(let u of n)o.push(` ${u.path} ${u.writers.map(p=>`"${p.name}"${p.running?" (running)":p.stopped?" (stopped)":""}`).join(", ")}${u.blind.length?" \u26A0":""}`)}o.push("","Agents:");let a=e.filter(u=>pi(u)||u.state==="failing"||n.some(p=>p.writers.some(h=>h.id===u.id))),l=new Set(a.map(u=>u.id));for(let u of a){let p=Br(u)[0],h=u.state==="finished"?Br(u).filter(E=>E.background):[],m=Mv(u,r).padEnd(8),g=h.length?h[0].short:p?`waiting ${fe(r-(p.at??r))} on ${p.short}`:"",b=uI(u),C=[g,b>=2?`failed ${b} in a row`:"",n.some(E=>E.blind.includes(u.id))?"\u26A0":""].filter(Boolean),T=u.parentId&&l.has(u.parentId)?" ".repeat(Math.max(0,u.depth-1)):"";o.push(` ${T}${u.id} ${m} ${`${fe(Bf(u,r))} active`.padStart(10)} ${u.name}${C.length?` \xB7 ${C.join(" \xB7 ")}`:""}`)}let c=e.filter(u=>!l.has(u.id)),f=c.filter(u=>u.state==="stopped").length,d=[c.length-f?`${c.length-f} finished`:"",f?`${f} stopped`:""].filter(Boolean).join(", ");return c.length&&o.push(` ${a.length?"+":""}${d}, nothing to check`),o.push("","Run `typebulb status <id>` for one agent's report, or `typebulb babysit` in the background to be woken when an agent needs attention."),o.join(`
|
|
2062
|
+
`)}function qv(t,e,n=!1,r=hi){let s=new Map,i=a=>`"${t.find(l=>l.id===a)?.name??a}"`,o=Math.max(0,...t.map(a=>a.asOf));t.length&&!n&&!t.some(pi)&&e-o>=OI&&s.set("idle",`No agent running for ${fe(e-o)} (${t.length} agents).`);for(let a of t){for(let l of Br(a).filter(c=>e-(c.at??e)>=r)){let c=a.state==="finished"&&l.background;s.set(`${c?"background":"slow"}:${l.id}`,`${i(a.id)}: ${c?"finished, background call":"call"} running ${fe(e-(l.at??e))}: ${l.short}`)}for(let l of a.commands.groups.filter(c=>c.streak>=2))s.set(`streak:${a.id}:${l.cmd}`,`${i(a.id)}: failed ${l.streak} in a row: ${l.cmd}`)}return s}var QR,Tv,Cv,hi,Mn,Pv,mi,Dr,Nf,Rv,Lf,tI,nI,sI,iI,oI,aI,Df,Br,pi,uI,Lv,Bf,dI,fI,Ov,pI,gI,bI,wI,Bv,vI,SI,jv,kI,xI,EI,Fv,AI,TI,CI,OI,dl=S(()=>{"use strict";Mr();_s();sd();QR=6e4,Tv=8,Cv=30,hi=3*6e4,Mn=(t,e)=>(t=Ps(t).replace(/\s+/g," ").trim(),t.length>e?t.slice(0,e)+"\u2026":t),Pv=t=>Xo(t).rest,mi=t=>Z(t.input?.command)??Z(t.input?.cmd),Dr=t=>new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),Nf=t=>{let e=mi(t);if(e)return Mn(rd(Pv(e).trim()),100);let n=Mn(Oy(t.input),80);return n?`${Gu(t.name)}: ${n}`:Gu(t.name)};Rv=t=>t.result===void 0||!!t.background&&t.endAt===void 0,Lf=t=>!!t.refused&&mi(t)!==void 0;tI=/(^|[\s;|&(])(kill|pkill|killall|taskkill|stop-process)\b/i,nI=/\bgit\s+(-C\s+\S+\s+)?(commit|stash|checkout|reset|push|clean|restore|rebase|merge|cherry-pick|revert)(?![\w-])/;sI=t=>[t.runs?`${t.runs} run, ${t.failed} failed`:"",iI(t)].filter(Boolean).join(", ")||"none",iI=t=>t.lookups?`${t.lookups} ${t.lookups===1?"lookup":"lookups"}`:"",oI=["content","diff","new_string","new_source","edits"],aI=t=>/^([a-zA-Z]:)?\//.test(t);Df={uncommitted:()=>!0,ignored:()=>!1,since:()=>0};Br=t=>t.open.filter(e=>!e.interrupted),pi=t=>t.state==="running"||Br(t).length>0,uI=t=>Math.max(0,...t.commands.groups.map(e=>e.streak)),Lv=(t,e)=>t.state==="running"?Math.max(0,e-t.asOf):0,Bf=(t,e)=>t.activeMs+Lv(t,e);dI=(t,e)=>({state:Mv(t,e),active:`${fe(Bf(t,e))} active`,idle:t.idleMs?`${fe(t.idleMs)} idle`:""}),fI=(t,e)=>{let n=dI(t,e);return[n.state,n.active,n.idle].filter(Boolean).join(" \xB7 ")},Ov=(t,e)=>t.interrupted?`${t.label}: interrupted, its process has ended`:`${t.label}, ${fe(e-(t.at??e))}${t.background?" (background)":""}`,pI=(t,e)=>`nothing open, last entry ${fe(e-t.asOf)} ago`;gI=t=>{let e=t.files.filter(n=>!n.committed&&!n.ignored).length;return t.files.length?`${t.files.length} (${e} uncommitted)`:"none"};bI=(t,e)=>{let n=yI(t,e);return`${fe(n.tools)} in tools, ${fe(n.model)} in the model`},wI=t=>t.also.map(e=>`"${e.name}" ${Dr(e.at)}`).join(", "),Bv=t=>t.failed>0||!!t.long||t.runs>=3||t.tags.length>0,vI=t=>{let e=t.groups.filter(Bv);return{shown:e.slice(0,Tv),more:Math.max(0,e.length-Tv)}},SI=t=>`+${t} more like these`,jv=t=>{let e=t.groups.filter(n=>!Bv(n));return{runs:e.reduce((n,r)=>n+r.runs-r.open,0),hidden:e.reduce((n,r)=>n+r.hidden,0),ms:e.reduce((n,r)=>n+r.ms,0)}},kI=(t,e=!0)=>{let n=jv(t),r=n.runs-n.hidden,s=e?" other":"",i=l=>l===1?"run":"runs",o=`with ${n.hidden===1?"its":"their"} exit hidden by a pipe`;return`${r?`${r}${s} ${i(r)} passed${n.hidden?`, ${n.hidden} ${o}`:""}`:`${n.hidden}${s} ${i(n.hidden)} ${o}`}, ${fe(n.ms)} in all`},xI=t=>[...t.tags,t.long].filter(Boolean).join(", "),EI=t=>t?t.last||t.first:"",Fv=t=>t.hidden?"exit hidden":t.outcome&&t.outcome!=="completed"&&t.outcome!=="failed"&&t.exit===void 0?t.outcome:t.exit!==void 0?`exit ${t.exit}`:t.failed?"error":"ok",AI=t=>t.deleted?`${t.path} (deleted)`:t.from?`${t.path} (moved from ${t.from})`:t.path,TI=t=>t.times>1?`${t.path} \xD7${t.times}`:t.path,CI=t=>({shown:t.read.slice(-Cv),earlier:Math.max(0,t.read.length-Cv)});OI=5*6e4});import{openSync as PI,readSync as _I,closeSync as RI,fstatSync as II,statSync as $I,readFileSync as NI,writeFileSync as LI,mkdirSync as MI}from"fs";import{join as Jv}from"path";function*hl(t,e){if(!t.listChildren)return;let n=t.callerSessionId?.(e),r=fi(t.listSessionFiles(e),s=>s.mtime).sort((s,i)=>+(i.sessionId===n)-+(s.sessionId===n));for(let s of r){let i=t.listChildren(e,s.sessionId);i.length&&(yield Wv(t,e,s.sessionId,s.file,i))}}function Wv(t,e,n,r,s){let i=ul(t,n,e,r);return{sessionId:n,live:i,children:s.map(o=>({...o,state:di(o,i)}))}}function gi(t,e){let n=t.callerSessionId?.(e);return{sessionId:n,cwd:n&&t.sessionCwd?.(n)||e}}function Kv(t,e){let n=gi(t,e);return n.sessionId?n:{sessionId:hl(t,e).next().value?.sessionId,cwd:e}}function ml(t,e,n){let r=t.listSessionFiles(e).find(s=>s.sessionId===n)?.file;return Wv(t,e,n,r,t.listChildren?.(e,n)??[])}function Hv(t,e){let n=e.trim().toLowerCase(),r=t.children.filter(s=>s.id.toLowerCase()===n);return r.length?r:t.children.filter(s=>s.id.toLowerCase().startsWith(n)||Tt(s).toLowerCase().includes(n))}function en(t,e){let n=Jv(Re(),"slow",t);if(e)try{MI(Jv(n,".."),{recursive:!0}),LI(n,String(e))}catch{}let r=0;try{r=Number(NI(n,"utf8"))}catch{}return e||r||hi}function DI(t,e,n){let r={size:-1,mtimeMs:-1};try{r=$I(e)}catch{}let s=pl.get(e);if(s&&s.size===r.size&&s.mtime===r.mtimeMs&&s.cwd===n)return s;let i=_v(Ev(t,e,"child")),o={size:r.size,mtime:r.mtimeMs,cwd:n,d:i,touches:Iv(i,n)};return pl.set(e,o),o}function BI(t){let e;try{e=PI(t,"r")}catch{return}try{let n=II(e).size,r=(s,i)=>{let o=Buffer.alloc(i);return o.subarray(0,_I(e,o,0,i,s)).toString("utf8")};return n<=2*fl?r(0,n):`${r(0,fl)}
|
|
2063
|
+
${r(n-fl,fl)}`}catch{return}finally{RI(e)}}async function Dn(t,e,n,r){let s=Av([...n.children].sort((u,p)=>(u.started??u.mtime)-(p.started??p.mtime))),i=en(n.sessionId),o=s.map(u=>DI(t,u.file,e)),a=new Set(s.map(u=>u.file));for(let u of pl.keys())a.has(u)||pl.delete(u);let l=$v(s.map((u,p)=>({id:u.id,writes:o[p].touches.writes,reads:o[p].touches.reads}))),c=await FI(e,Math.min(1/0,...[...l.writers.values()].flat().map(u=>u.at)),[...l.writers.keys()]),f=new Map(s.map(u=>[u.id,Tt(u)])),d=s.flatMap((u,p)=>r&&u.id!==r?[]:[{...Nv(u,o[p].d,o[p].touches,l,f,n.live,BI,c,i),depth:u.depth,parentId:u.parentId}]);return{reports:d,files:r?[]:jI(d,l,c)}}function jI(t,e,n){let r=new Set(t.filter(pi).map(a=>a.id)),s=new Set(t.filter(a=>a.state==="stopped").map(a=>a.id)),i=new Map(t.map(a=>[a.id,a.name]));return[...e.writers].filter(([a])=>n.uncommitted(a)).map(([a,l])=>{let c=n.since(a),f=l.filter(u=>u.at>c);if(f.length<2&&!f.some(u=>r.has(u.id)||s.has(u.id)))return;let d=e.blind.filter(u=>u.path===a&&u.overAt>c).flatMap(u=>[u.by,u.over]);return{path:a,writers:f.map(u=>({id:u.id,name:i.get(u.id)??u.id,running:r.has(u.id),stopped:s.has(u.id)})),blind:[...new Set(d)]}}).filter(a=>!!a).sort((a,l)=>a.path.localeCompare(l.path))}async function FI(t,e,n){let r=s=>process.platform==="win32"?s.toLowerCase():s;try{let s=(await we(["rev-parse","--show-prefix"],t)).trim(),i=d=>d.startsWith(s)?r(d.slice(s.length)):void 0,o=await we(["status","--porcelain","-z","--untracked-files=all"],t),a=new Set,l=o.split("\0");for(let d=0;d<l.length;d++){let u=l[d];if(u.length<4)continue;(u[0]==="R"||u[0]==="C")&&d++;let p=i(u.slice(3));p&&a.add(p)}let c=new Map;if(Number.isFinite(e)){let d=0;for(let u of(await we(["log",`--since=${new Date(e).toISOString()}`,"--format=@%ct","--name-only","--","."],t)).split(`
|
|
2064
|
+
`)){if(u.startsWith("@")){d=Number(u.slice(1))*1e3;continue}let p=u.trim()&&i(u.trim());p&&!c.has(p)&&c.set(p,d)}}let f=new Set(n.length?(await we(["check-ignore","--",...n],t).catch(()=>"")).split(`
|
|
2065
|
+
`).map(d=>r(d.trim())).filter(Boolean):[]);return{uncommitted:d=>a.has(r(d)),ignored:d=>f.has(r(d)),since:d=>c.get(r(d))??0}}catch{return Df}}var pl,fl,gl=S(()=>{"use strict";Lr();If();Mr();$f();dl();$n();pl=new Map;fl=4096});import{existsSync as zv,openSync as UI,readSync as qI,closeSync as JI,statSync as yi,readdirSync as Yv,watchFile as WI,unwatchFile as Vv,mkdirSync as KI,writeFileSync as HI,readFileSync as jf,unlinkSync as zI,rmSync as YI}from"fs";import{stat as VI}from"fs/promises";import{dirname as GI,join as Bn,resolve as Gv}from"path";function e$(t){if(!Number.isInteger(t))return!0;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}function jr(t){let e={cwd:X,sessionId:"",sessionStartMs:Date.now(),buffer:[],partial:"",offset:0,latest:{in:0,out:0,cached:0,cacheCreate:0},latestModel:null,everAttached:!1,index:cl(t),thread:"main"},n;function r(y,x){let v={offset:x,text:""},_;try{_=yi(y).size}catch{return v}if(_<=x)return v;let N;try{N=UI(y,"r")}catch{return v}try{let q=_-x,B=Buffer.alloc(q),z=0;for(;z<q;){let ee=qI(N,B,z,q-z,x+z);if(!ee)break;z+=ee}return{offset:x+z,text:B.subarray(0,z).toString("utf8")}}finally{JI(N)}}let s=new Set,i,o=0;function a(){if(e.file){for(let y of s)if(y.file===e.file)return y;return}return i}function l(y){let x={d:t.createDriver(e.cwd,y),file:y,id:`new:${++o}`,startedAt:Date.now()};return s.add(x),e.file||(i=x),x}function c(){let y=[...s].filter(v=>v.file);if(!y.length)return[];let x=new Map(t.listSessionFiles(e.cwd).map(v=>[v.file,v.sessionId]));return y.map(v=>{let _=x.get(v.file);return{rec:v,sessionId:_??v.id,pending:_===void 0}})}let f=()=>c().filter(y=>y.pending&&y.rec.prompt!==void 0);async function d(y){s.delete(y),i===y&&(i=void 0);try{await y.d.dispose()}catch(x){console.error("[composer] dispose:",V(x))}}function u(){let y=a(),x=new Set(f().map(v=>v.rec));for(let v of[...s])v!==y&&(x.has(v)||v.d.streaming||v.d.queue||v.d.error||d(v))}function p(){for(let y of s)y.d.sessionFile&&y.file!==y.d.sessionFile&&(y.file=y.d.sessionFile);if(i&&!e.file&&i.file){let y=t.listSessionFiles(e.cwd).find(x=>x.file===i.file);y&&j(y)}i&&!e.file&&i.prompt!==void 0&&e.sessionId!==i.id&&(L(void 0,i.id),e.everAttached=!0)}let h=y=>Bn(y,QI),m=(y,x)=>Bn(h(y),`${x}.lock`);function g(y,x){try{let v=m(y,x);if(Date.now()-yi(v).mtimeMs>=Xv)return!1;try{let _=parseInt(jf(v,"utf8").trim(),10);if(_===process.pid||!e$(_))return!1}catch{}return!0}catch{return!1}}function b(y,x){if(x)try{KI(h(y),{recursive:!0}),HI(m(y,x),String(process.pid))}catch(v){console.error("[lock] claim failed:",V(v))}}function C(y){try{YI(Bn(y,".claude-bulb"),{recursive:!0,force:!0})}catch{}}function T(y){let x=h(y);if(!zv(x))return;let v;try{v=Yv(x)}catch{return}let _=Date.now();for(let N of v){if(!N.endsWith(".lock"))continue;let q=Bn(x,N);try{let B=yi(q);_-B.mtimeMs>ZI&&zI(q)}catch{}}}function E(y){try{return yi(y),!1}catch(x){return x.code==="ENOENT"}}function $(){let y=e;if(y.file&&!E(y.file)){b(y.cwd,y.sessionId);return}let x=O(y);x&&j(x)}function O(y){if(!y.everAttached)return P(y.cwd)??k(y.cwd,()=>!0)}function P(y){let x=h(y);if(!zv(x))return;let v;try{v=Yv(x)}catch{return}let _;for(let q of v)if(q.endsWith(".lock"))try{let B=yi(Bn(x,q));if(Date.now()-B.mtimeMs>=Xv||parseInt(jf(Bn(x,q),"utf8").trim(),10)!==process.pid)continue;(!_||B.mtimeMs>_.mtime)&&(_={sessionId:q.slice(0,-5),mtime:B.mtimeMs})}catch{}if(!_)return;let N=t.listSessionFiles(y).find(q=>q.sessionId===_.sessionId);if(!(!N||E(N.file)))return N}function k(y,x){return t.listSessionFiles(y).sort((v,_)=>_.mtime-v.mtime).find(v=>!g(y,v.sessionId)&&x(v))}function L(y,x){let v=e;if(v.file)try{Vv(v.file)}catch{}v.file=y,v.sessionId=x,v.partial="",v.offset=0,v.latest={in:0,out:0,cached:0,cacheCreate:0},v.latestModel=null,v.index=cl(t),v.chainLastId=void 0,v.buffer.push({type:"cleared"}),v.buffer.push({type:"session",sessionId:x})}function j(y){let x=e;i=void 0,$i(),n=y.file,L(y.file,y.sessionId),x.everAttached=!0,b(x.cwd,y.sessionId),Q(y.file)}function Q(y){if(ie(),!!y){try{Vv(y)}catch{}WI(y,{interval:200},()=>ie())}}function U(){$i(),n=void 0,L(void 0,"")}function ie(){let y=e;if(!y.file)return;let x=r(y.file,y.offset);if(!x.text)return;y.offset=x.offset,y.partial+=x.text;let v=y.partial.lastIndexOf(`
|
|
2066
|
+
`);if(v<0)return;let _=y.index.add(y.partial.slice(0,v).split(`
|
|
2067
|
+
`),y.thread);if(y.partial=y.partial.slice(v+1),!_)return;let N=[],{entries:q}=y.index,B=q.get(_),z=!1;for(;B;){if(N.push(B),t.idOf(B)===y.chainLastId){z=!0;break}let ee=t.parentOf(B);B=ee?q.get(ee):void 0}if(z)for(let ee=N.length-2;ee>=0;ee--)ae(N[ee]);else{y.chainLastId!==void 0&&(y.buffer.push({type:"cleared"}),y.buffer.push({type:"session",sessionId:y.sessionId}),y.latest={in:0,out:0,cached:0,cacheCreate:0});let ee=new Set(N.map(He=>t.idOf(He))),ft=oe(q);for(let He=N.length-1;He>=0;He--)ae(N[He]),ge(t.idOf(N[He]),ft,ee)}y.chainLastId=_}function oe(y){let x=new Map;for(let v of y.values()){let _=t.parentOf(v);if(!_)continue;let N=x.get(_);N?N.push(v):x.set(_,[v])}return x}function ge(y,x,v){if(!y)return;let _=x.get(y);if(!_)return;let N=_.filter(ee=>!t.isSidechain(ee,e.thread));if(N.length<2)return;let q=N.filter(ee=>!v.has(t.idOf(ee)));if(!q.length)return;let B=[],z=0;for(let ee of q){let ft=Se(ee,x);B.push(...ft.events),z+=ft.count}z>0&&e.buffer.push({type:"fork",atId:y,count:z,events:B})}function Se(y,x){let v=[],_=[y];for(;_.length;){let B=_.pop();if(t.isSidechain(B,e.thread))continue;v.push(B);let z=x.get(t.idOf(B)??"");if(z)for(let ee of z)_.push(ee)}v.sort((B,z)=>(Date.parse(t.timestampOf(B)??"")||0)-(Date.parse(t.timestampOf(z)??"")||0));let N=[];for(let B of v)t.isRecoveryNoise(B)||N.push(...ll(t,B,e.thread,e.sessionStartMs).events);return{count:N.reduce((B,z)=>B+(z.type==="user"||z.type==="assistant"?1:0),0),events:N}}function ae(y){if(!t.isSidechain(y,e.thread))try{let{events:x,usage:v,model:_,cost:N}=ll(t,y,e.thread,e.sessionStartMs);for(let q of x)e.buffer.push(q);x.some(q=>q.type==="assistant")&&a()?.d.clearCompletedDraft(),x.some(q=>q.type==="user")&&a()?.d.clearEcho(),_&&(e.latestModel=_),v&&(e.latest=v),(v||N)&&e.buffer.push({type:"usage",...e.latest,cost:N})}catch(x){console.error("[mirror] skipped malformed entry:",V(x))}}async function ke(){return{cwd:e.cwd,pid:process.pid,composer:!!t.createDriver,children:!!t.listChildren,elsewhere:await _t()}}async function _t(){if(t.listSessionFiles(e.cwd).length)return;let y=await Ln();if(!y)return;let x=Gv(y).toLowerCase();for(let v=Gv(e.cwd);v.toLowerCase()!==x;){let _=GI(v);if(_===v)return;v=_;let N=t.listSessionFiles(v).length;if(N)return{dir:v,count:N}}}_t().then(y=>{y&&console.log(`No sessions for ${e.cwd} \u2014 ${y.count} exist for ${y.dir}. Launched from a subfolder? Relaunch from the project root.`)}).catch(()=>{});let w=new tl;async function A(y,x){e.thread!=="child"&&w.accept(y,x)&&console.log(x)}function R(){return ul(t,e.sessionId,e.cwd,e.file)}function M(){return t.chainWorking([...e.index.entries.values()])&&R()}function D(){!t.createDriver||a()||e.latestModel||M()||l(e.file)}async function K(y){let x=e;$(),p(),D(),u();let v=a();for(let B of s)B!==v&&B.d.dialog;let _=c().filter(B=>B.rec.d.streaming).map(B=>B.sessionId),N=M(),q=t.createDriver?{streaming:!!v?.d.streaming,foreign:!v&&N,draft:v?.d.draft??null,echo:v?.d.echo??null,status:v?.d.status??null,dialog:v?.d.dialog??null,queue:v?.d.queue??null,stats:v?.d.stats??null,model:v?.d.model??null,error:v?.d.error}:void 0;return{events:x.buffer.slice(y),cursor:x.buffer.length,working:!!v?.d.streaming||N,latestModel:x.latestModel,child:x.child?.id??null,composer:q,busy:_}}async function J(){$(),p();let y=a();if(y?.d.error&&!y.d.streaming&&(await d(y),y=void 0),!y){if(M())return{ok:!1,error:"the agent is mid-turn in a terminal \u2014 watch only"};y=l(e.file)}let x=y;return{ok:!0,d:x.d,markSent:v=>{x.prompt===void 0&&(x.prompt=v)}}}async function Ke(y,x){if(!t.createDriver)return{ok:!1,error:"not supported"};let v=String(y??"").trim();if(!v)return{ok:!1,error:"empty message"};let _=await J();if(!_.ok)return _;let N=await _.d.send(v,x);return N.ok&&_.markSent(v),N}async function Y(y,x){let v=a();return v?v.d.respondUi(String(y??""),x??{}):{ok:!1,error:"no dialog pending"}}async function ue(y,x){if(!t.createDriver)return{ok:!1,error:"not supported"};if(!y||typeof y.type!="string")return{ok:!1,error:"bad command"};if(x?.spawn){let _=await J();return _.ok?_.d.rpc(y):_}let v=a();return!v||v.d.error?{ok:!1,error:"not running"}:v.d.rpc(y)}async function Pe(){let y=a();if(y)try{await y.d.stop()}catch(x){console.error("[composer] stop:",V(x))}return{ok:!0}}async function Hr(){return t.createDriver?(p(),!e.file&&i&&i.prompt===void 0&&!i.d.streaming&&!i.d.error?{ok:!0}:(i?.d.error&&await d(i),i=void 0,U(),l(void 0),u(),{ok:!0})):{ok:!1,error:"not supported"}}async function ln(){if(!t.createDriver)return[];let y=await we(["ls-files","--cached","--others","--exclude-standard"],e.cwd).catch(()=>null),x=y!==null?y.split(`
|
|
2068
|
+
`).filter(Boolean):await t.walkFiles?.(e.cwd)??[];return(await Promise.all(x.map(async _=>{try{return{f:_,m:(await VI(Bn(e.cwd,_))).mtimeMs}}catch{return{f:_,m:0}}}))).sort((_,N)=>N.m-_.m).map(_=>_.f)}function Rt(){for(let y of[...s])d(y)}async function Yl(y){return t.createDriver?yv(e.cwd,y):{ok:!1,error:"not supported"}}async function Vl(y){return bv(e.cwd,String(y??""))}async function rx(y,x){return kv(String(y??""),String(x??""))}async function sx(y){let x=t.listChildren?.(e.cwd,e.sessionId)??[],v=R(),{reports:[_]}=await Dn(t,e.cwd,{sessionId:e.sessionId,live:v,children:x.map(N=>({...N,state:di(N,v)}))},y);return _?{ok:!0,report:_}:{ok:!1,error:"child not found"}}async function ix(){let y=t.sessionsWorking?.(e.cwd),x=t.sessionNames?.(),v=t.listSessionFiles(e.cwd).map(({sessionId:N,file:q,mtime:B})=>({sessionId:N,mtime:B,preview:t.readPreview(q),working:y?.has(N),name:x?.get(N)})),_=f().map(N=>({sessionId:N.sessionId,mtime:N.rec.startedAt,preview:N.rec.prompt??"",pending:!0}));return fi([...v,..._],N=>N.mtime)}let Mp=new Map;function Dp(y,x){let v=Mp.get(y);if(v&&v.mtime===x)return v.turns;let _=[],N="";try{N=jf(y,"utf8")}catch{return[]}for(let q of N.split(`
|
|
2069
|
+
`)){if(!q.trim())continue;let B=t.parseEntry(q);if(!B)continue;let z=t.searchText(B);z&&_.push({text:z,lower:z.toLowerCase()})}return Mp.set(y,{mtime:x,turns:_}),_}async function ox(y){let x=y.toLowerCase(),v=[],_=0,N=t.sessionsWorking?.(e.cwd),q=t.sessionNames?.();for(let{sessionId:B,file:z,mtime:ee}of t.listSessionFiles(e.cwd).sort((ft,He)=>He.mtime-ft.mtime)){let ft=ui(Dp(z,ee),x),He=(t.listChildren?.(e.cwd,B)??[]).map(ze=>({c:ze,hit:ui(Dp(ze.file,ze.mtime),x)})).filter(ze=>ze.hit.hitCount);if(!(!ft.hitCount&&!He.length)){for(let{c:ze,hit:dx}of fi(He,fx=>fx.c.mtime))v.push({sessionId:B,mtime:ze.mtime,preview:Tt(ze),...dx,child:{id:ze.id,kind:ze.kind,depth:ze.depth}});if(v.push({sessionId:B,mtime:ee,preview:t.readPreview(z),working:N?.has(B),name:q?.get(B),...ft}),++_>=t$)break}}return v}async function ax(y){let x=e,v=t.listSessionFiles(x.cwd).find(_=>_.sessionId===y);if(!v){let _=f().find(N=>N.sessionId===y)?.rec;return _?((i!==_||x.sessionId!==_.id)&&(i=_,$i(),n=void 0,L(void 0,_.id),x.everAttached=!0,u()),{ok:!0}):{ok:!1,error:"session not found"}}return v.file===x.file?{ok:!0}:(j(v),p(),u(),{ok:!0})}async function lx(){if(!t.listChildren||!e.sessionId)return[];let y=R();return t.listChildren(e.cwd,e.sessionId).map(x=>({...x,state:di(x,y)}))}async function cx(y){let x=e;if(!t.listChildren)return{ok:!1,error:"this harness has no child transcripts"};let v=t.listChildren(x.cwd,x.sessionId).find(_=>_.id===y);return v?(x.thread="child",x.child=v,L(v.file,x.sessionId),Q(v.file),{ok:!0}):{ok:!1,error:"child not found"}}async function ux(){let y=n;return!$i()||!y?{ok:!0}:(L(y,e.sessionId),Q(y),{ok:!0})}function $i(){let y=e;return y.thread==="main"?!1:(y.thread="main",y.child=void 0,!0)}return C(e.cwd),T(e.cwd),$(),{info:ke,poll:K,logInlineStatus:A,listSessions:ix,searchSessions:ox,attach:ax,listChildren:lx,openChild:cx,closeChild:ux,composerSend:Ke,composerStop:Pe,composerNew:Hr,composerFiles:ln,composerUiRespond:Y,composerRpc:ue,composerPaste:Yl,composerPasteRead:Vl,summarizeTurn:rx,childStatus:sx,shutdownComposer:Rt}}var XI,QI,Xv,ZI,t$,yl=S(()=>{"use strict";Zt();dv();Lr();_f();wv();xv();If();gl();$f();Mr();XI=".typebulb",QI=`${XI}/locks`,Xv=5e3,ZI=6e4;t$=50});import{existsSync as Jf,mkdirSync as n$,readFileSync as Qv,writeFileSync as r$}from"fs";import{join as jn,isAbsolute as s$}from"path";async function Kf(t,e){let n=s$(t)?t:jn(X,t);return Jf(n)?(_d(n,e),{ok:!0}):{ok:!1,error:"file not found"}}async function Hf(t){let e=X,n=Pd(t),r=jn(e,"typebulbs");n$(r,{recursive:!0});let s=Ad(n),i=`${s}.bulb.md`;for(let c=2;Jf(jn(r,i))&&Qv(jn(r,i),"utf8")!==n;c++)i=`${s}-${c}.bulb.md`;let o=jn(r,i);Jf(o)||r$(o,n);let a=jn("typebulbs",i),l=await Sn(a,{cwd:e,open:!1});return{ok:!0,file:a,pid:l.pid,url:l.url}}async function zf(){return G(X)}async function Yf(t){let e=(await G()).find(n=>n.pid===t);return e?{ok:!0,outcome:await bt(e)}:(await cr(t),{ok:!0})}async function Vf(){let t=await yn(X);return ha(X).filter(e=>!e.serverOnly).map(e=>({...e,trusted:En(e.path),lastRunAt:t(e.path)}))}async function Gf(t){let e=t.toLowerCase(),n=[];for(let r of ha(X).filter(s=>!s.serverOnly).sort((s,i)=>i.mtime-s.mtime)){let s="";try{s=Qv(r.path,"utf8")}catch{continue}let i=[];for(let l of s.split(`
|
|
2070
|
+
`)){let c=l.replace(/\s+/g," ").trim();c&&i.push({text:c,lower:c.toLowerCase()})}let{hitCount:o,snippet:a}=ui(i,e);o&&n.push({path:r.path,hitCount:o,snippet:a})}return n}async function Xf(t,e){let n=X;e!=null&&mr(t,e);let r=await Sn(t,{cwd:n,open:!1,trust:e});return{ok:!0,file:r.file,pid:r.pid,url:r.url,trust:!!r.trust}}async function Qf(t){return{cap:await Cd(t)}}async function Zf(t,e){return mr(t,e),{ok:!0}}async function ep(t,e){return Qe(t,e)}async function tp(){return bi&&Date.now()-bi.fetchedAt<=o$?bi.samples:(Ff??=a$().finally(()=>{Ff=null}),Ff)}async function a$(){try{let t=await fetch(`${i$}/api/scripts/u/samples?stubs`,{signal:AbortSignal.timeout(eS)});if(!t.ok)throw new Error(`HTTP ${t.status}`);let e=await t.json(),n=i=>i.order??Number.MAX_SAFE_INTEGER,r=i=>Date.parse(i.createdAt??"")||0,s=e.filter(i=>i.slug!=="welcome").sort((i,o)=>n(i)-n(o)||r(o)-r(i)).map(i=>({slug:i.slug,name:i.name,description:sc(i.config)}));return bi={samples:s,fetchedAt:Date.now()},s}catch{return bi?.samples??[]}}async function np(t){return Wf.test(t)?nS(Zv,"samples",t,!0):{ok:!1,error:"bad slug"}}async function sp(){let t=rp();if(!t)return{bulbs:[]};let e=`${bl()}
|
|
2071
|
+
${t}`;return tn?.key===e&&Date.now()-tn.fetchedAt<=l$?{user:tn.user,bulbs:tn.bulbs}:(Uf??=c$(e,t).finally(()=>{Uf=null}),Uf)}async function qf(t,e,n){let r=await fetch(`${t}${e}`,{headers:n,signal:AbortSignal.timeout(eS)});if(!r.ok)throw new Error(`HTTP ${r.status}`);if(!r.headers.get("content-type")?.includes("json"))throw new Error("not json");return r.json()}async function c$(t,e){let n={Authorization:`Bearer ${e}`};try{let r=bl(),s;try{s=await qf(r,"/api/me",n)}catch{let a=new URL(r);r=`${a.protocol}//api.${a.host}`,s=await qf(r,"/api/me",n)}let o=(await qf(r,"/api/scripts/list",n)).filter(a=>a.userSlug===s.slug&&!a.isTemplate).map(a=>({slug:a.slug,name:a.name,description:sc(a.config)}));return tn={key:t,user:s.slug,bulbs:o,fetchedAt:Date.now()},{user:s.slug,bulbs:o}}catch{return tn?.key===t?{user:tn.user,bulbs:tn.bulbs}:{bulbs:[]}}}async function ip(t,e,n=!1){return!Wf.test(e)||!Wf.test(t)?{ok:!1,error:"bad slug"}:nS(bl(),t,e,n)}async function nS(t,e,n,r){let s=Ha(e,n);try{let i=await Va({origin:t,userSlug:e,slug:n,dest:jn(X,s)},{force:r,token:rp(),timeoutMs:tS});return i.kind==="conflict"?{ok:!1,conflict:!0,error:"local file differs from the site copy"}:i.kind==="asset-conflict"?{ok:!1,conflict:!0,error:`local assets differ from the site copies (${i.paths.join(", ")})`}:i.kind==="http-error"?{ok:!1,error:`HTTP ${i.status}`}:i.kind==="not-markdown"?{ok:!1,error:`not a bulb (${i.contentType??"no content-type"})`}:{ok:!0,file:s,upToDate:i.kind==="up-to-date"}}catch(i){return{ok:!1,error:i?.message??String(i)}}}async function op(t,e=!1){let n=rp();if(!n)return{ok:!1,error:"no TYPEBULB_TOKEN in .env"};try{let r=Ya(t,X,bl()),s=await Xa(r,{token:n,force:e,timeoutMs:tS});return s.kind==="conflict"?{ok:!1,conflict:!0,error:s.message}:s.kind==="asset-error"?{ok:!1,error:`assets sync failed: ${s.message}`}:s.kind==="http-error"?{ok:!1,error:`HTTP ${s.status}: ${s.message}`}:{ok:!0,created:s.created,serverStripped:s.serverStripped}}catch(r){return{ok:!1,error:r?.message??String(r)}}}var i$,Zv,o$,eS,tS,bi,Ff,Wf,l$,tn,Uf,bl,rp,wl=S(()=>{"use strict";$n();Zt();_f();te();i$="https://api.typebulb.com",Zv="https://typebulb.com",o$=3600*1e3,eS=5e3,tS=15e3,bi=null,Ff=null;Wf=/^[a-z0-9][a-z0-9-]*$/,l$=300*1e3,tn=null,Uf=null,bl=()=>Aa("TYPEBULB_ORIGIN",X)||Zv,rp=()=>Aa("TYPEBULB_TOKEN",X)});import{readFileSync as cp,writeFileSync as sS,mkdirSync as u$,appendFileSync as iS,rmSync as rS}from"fs";import{join as kl,dirname as d$}from"path";import{createServer as f$}from"http";function nn(t){try{return JSON.parse(cp(t,"utf8"))}catch{return null}}function Sl(t,e){u$(d$(t),{recursive:!0}),sS(t,JSON.stringify(e,null,2)+`
|
|
2072
|
+
`)}function aS(t,e,n){let r=kl(t,".gitignore"),s="";try{s=cp(r,"utf8")}catch{}let i=new Set(s.split(/\r?\n/).map(l=>l.trim())),o=e.filter(l=>!i.has(l));if(!o.length)return;let a=s&&!s.endsWith(`
|
|
2073
2073
|
`)?`
|
|
2074
|
-
`:"";try{
|
|
2074
|
+
`:"";try{iS(r,a+n+`
|
|
2075
2075
|
`+o.join(`
|
|
2076
2076
|
`)+`
|
|
2077
|
-
`)}catch(l){console.error("[switcher] .gitignore update failed",V(l))}}function
|
|
2077
|
+
`)}catch(l){console.error("[switcher] .gitignore update failed",V(l))}}function y$(t){let e=i=>{let o=i.exec(t);return o?Number(o[1]):0},n=e(/"cache_read_input_tokens":\s*(\d+)/),r=e(/"cache_creation_input_tokens":\s*(\d+)/),s=e(/"input_tokens":\s*(\d+)/);n>0||r>0?Si="live":s>g$&&(Si="uncached")}function cS(t,e){let n={"content-type":"application/json",authorization:`Bearer ${e}`,"anthropic-version":t.headers["anthropic-version"]||"2023-06-01",...Dd},r=t.headers["anthropic-beta"];return typeof r=="string"&&(n["anthropic-beta"]=r),n}function b$(t){if(Array.isArray(t?.messages))for(let e of t.messages){if(!Array.isArray(e?.content))continue;let n=e.content.filter(r=>r?.type!=="thinking"&&r?.type!=="redacted_thinking");n.length&&n.length!==e.content.length&&(e.content=n)}}function uS(t){let e;try{e=JSON.parse(t)}catch{return t}vi=typeof e?.model=="string"?e.model:null,dt&&(e.model=dt),Un&&(e.provider=lS(Un));let n=/haiku/i.test(vi||"");return ki!=null&&!n&&(e.reasoning={effort:ap[ki]}),delete e.thinking,e.output_config&&delete e.output_config.effort,b$(e),JSON.stringify(e)}function w$(){let t="",e=0,n=new Map,r=new Set(["thinking","redacted_thinking"]),s=i=>{let o=/^data: (.*)$/m.exec(i);if(!o)return i;let a;try{a=JSON.parse(o[1])}catch{return i}switch(a.type){case"message_start":return n.clear(),e=0,i;case"content_block_start":{if(r.has(a.content_block?.type))return n.set(a.index,null),null;let l=e++;return n.set(a.index,l),a.index=l,`event: ${a.type}
|
|
2078
2078
|
data: ${JSON.stringify(a)}
|
|
2079
2079
|
|
|
2080
2080
|
`}case"content_block_delta":case"content_block_stop":{let l=n.get(a.index);return l==null?null:(a.index=l,`event: ${a.type}
|
|
@@ -2082,11 +2082,11 @@ data: ${JSON.stringify(a)}
|
|
|
2082
2082
|
|
|
2083
2083
|
`)}default:return i}};return i=>{t+=i;let o="",a;for(;(a=t.indexOf(`
|
|
2084
2084
|
|
|
2085
|
-
`))!==-1;){let l=t.slice(0,a);if(t=t.slice(a+2),!l.trim())continue;let c=s(l);c!==null&&(o+=c)}return o}}function
|
|
2085
|
+
`))!==-1;){let l=t.slice(0,a);if(t=t.slice(a+2),!l.trim())continue;let c=s(l);c!==null&&(o+=c)}return o}}function v$(t){return new Promise(e=>{let n=[];t.on("data",r=>n.push(r)),t.on("end",()=>e(Buffer.concat(n).toString("utf8"))),t.on("error",()=>e(Buffer.concat(n).toString("utf8")))})}function wi(t,e,n,r){t.writableEnded||(t.writeHead(e,{"content-type":"application/json"}),t.end(JSON.stringify({type:"error",error:{type:n,message:r}})))}async function S$(t,e,n){if(!dt){wi(e,400,"invalid_request_error",m$);return}let r=process.env.OPENROUTER_API_KEY;if(!r){wi(e,401,"authentication_error","OPENROUTER_API_KEY not set in the typebulb proxy");return}let s=new AbortController;e.on("close",()=>{e.writableEnded||s.abort()});let i;try{i=await fetch(up,{method:"POST",headers:cS(t,r),body:uS(n),signal:s.signal})}catch(d){wi(e,502,"api_error",`proxy upstream failed: ${V(d)}`);return}let o=i.headers.get("content-type")||"application/json";if(e.writeHead(i.status,{"content-type":o}),!i.body){e.end();return}let a=o.includes("event-stream"),l=i.body.getReader(),c=new TextDecoder,f=a?w$():null;try{for(;;){let{done:d,value:u}=await l.read();if(d)break;if(u)if(f){let p=c.decode(u,{stream:!0});y$(p);let h=f(p);h&&e.write(h)}else e.write(Buffer.from(u))}}catch{}finally{e.writableEnded||e.end()}}async function k$(t,e,n){let r=process.env.OPENROUTER_API_KEY,s=()=>{e.writeHead(200,{"content-type":"application/json"}),e.end(JSON.stringify({input_tokens:Math.max(1,Math.ceil(n.length/4))}))};if(!dt||!r)return s();try{let i=await fetch(`${up}/count_tokens`,{method:"POST",headers:cS(t,r),body:uS(n)});if(!i.ok)return s();let o=await i.text();e.writeHead(200,{"content-type":"application/json"}),e.end(o)}catch{s()}}function x$(t,e){let n=t.url||"/";if(t.method==="HEAD"){e.writeHead(200),e.end();return}if(t.method!=="POST"){wi(e,404,"not_found_error",n);return}v$(t).then(r=>{if(n.includes("count_tokens"))return k$(t,e,r);if(n.includes("/v1/messages"))return S$(t,e,r);wi(e,404,"not_found_error",n)})}function E$(){return Fr&&Fn?Promise.resolve(Fn):new Promise((t,e)=>{let n=f$(x$);n.on("error",e),n.listen(0,"127.0.0.1",()=>{Fr=n,Fn=n.address().port,console.log(`[switcher] wire proxy listening on ${vl(Fn)}`),t(Fn)})})}function A$(){try{Fr?.close()}catch{}Fr=null,Fn=null}function T$(t,e){let n=xl(t),r=nn(n),s=r||{};if((!s.env||typeof s.env!="object")&&(s.env={}),s.env.ANTHROPIC_BASE_URL===vl(e)&&s.env.ANTHROPIC_AUTH_TOKEN)return;let i=El(t);if(!nn(i)){let a={};for(let l of oS)a[l]=l in s.env?s.env[l]:null;Sl(i,{managedBy:"agent-switcher",fileExisted:r!==null,snapshot:a,active:null})}s.env.ANTHROPIC_BASE_URL=vl(e),s.env.ANTHROPIC_AUTH_TOKEN=h$,Sl(n,s),aS(t,[".claude/settings.local.json",".claude/.cc-switcher.json"],"# agent switcher (local Claude Code model override)")}function C$(t,e,n){let r=El(t),s=nn(r)||{managedBy:"agent-switcher",fileExisted:!1,snapshot:{}};s.active={model:e,provider:n},Sl(r,s)}function dS(t){let e=xl(t),n=El(t),r=nn(n),s=nn(e);if(s?.env){let i=r?.snapshot||{};for(let o of oS){let a=i[o];a==null?delete s.env[o]:s.env[o]=a}if(Object.keys(s.env).length===0&&delete s.env,r?.fileExisted===!1&&Object.keys(s).length===0)try{rS(e,{force:!0})}catch{}else Sl(e,s)}try{rS(n,{force:!0})}catch{}}async function O$(){let t=!!process.env.OPENROUTER_API_KEY,e=[];try{e=(await wt()).filter(r=>r.provider==="openrouter"&&!dp(r.name)).map(r=>({id:r.name,label:r.friendlyName||r.name}))}catch(r){console.error("[switcher] model list failed",V(r))}let n=e.length?void 0:Nd()??void 0;return{hasKey:t,models:e,error:n}}async function P$(){if(Fr&&dt)return{active:!0,managed:!0,model:dt,port:Fn,provider:Un,routedModel:vi,caching:Si,reasoning:ki,externalBaseUrl:null};let t=nn(xl(X))?.env||{};return{active:!1,managed:!1,model:null,port:null,provider:null,routedModel:null,caching:"unknown",reasoning:ki,externalBaseUrl:t.ANTHROPIC_BASE_URL||null}}async function fS(t,e){let n=await E$();return dt=t,Un=e,T$(X,n),n}async function _$({model:t}){if(!process.env.OPENROUTER_API_KEY)return{ok:!1,error:"OPENROUTER_API_KEY not set \u2014 add a key first"};if(!t)return{ok:!1,error:"no model given"};if(dp(t))return{ok:!1,error:"Refusing to route an Anthropic model through OpenRouter \u2014 that bills full API rate with no caching. Use it on your Anthropic subscription instead."};try{await fS(t,fp[t]??null),vi=null,Si="unknown",C$(X,t,Un)}catch(e){return{ok:!1,error:`failed to start the wire proxy: ${V(e)}`}}return{ok:!0}}async function R$({level:t}){return t!=null&&(!Number.isInteger(t)||t<0||t>=ap.length)?{ok:!1,error:`reasoning level must be 0\u2013${ap.length-1} or null`}:(ki=t,{ok:!0,level:t})}async function I$(){return dS(X),dt=null,Un=null,vi=null,Si="unknown",{ok:!0}}async function $$({key:t}){let e=(t||"").trim();if(!e)return{ok:!1,error:"empty key"};let n=X,r=kl(n,".env"),s="";try{s=cp(r,"utf8")}catch{}try{if(/^\s*OPENROUTER_API_KEY\s*=/m.test(s))sS(r,s.replace(/^\s*OPENROUTER_API_KEY\s*=.*$/m,`OPENROUTER_API_KEY=${e}`));else{let i=s&&!s.endsWith(`
|
|
2086
2086
|
`)?`
|
|
2087
|
-
`:"";
|
|
2088
|
-
`)}}catch(i){return{ok:!1,error:V(i)}}return process.env.OPENROUTER_API_KEY=e,
|
|
2089
|
-
`)}catch(o){return{ok:!1,error:`could not write ${t}: ${V(o)}`}}return{ok:!0,count:e.length}}var
|
|
2087
|
+
`:"";iS(r,i+`OPENROUTER_API_KEY=${e}
|
|
2088
|
+
`)}}catch(i){return{ok:!1,error:V(i)}}return process.env.OPENROUTER_API_KEY=e,aS(n,[".env"],"# secrets"),{ok:!0}}function N$(){if(!(!Fr&&!dt)){try{dS(X)}catch{}A$()}}function L$(t,e){return pS.test(e)?"blocked by your OpenRouter data policy":t===401||t===403||/unauthor|invalid api key|no auth|forbidden/i.test(e)?"auth rejected \u2014 check your OpenRouter key":t===404||/not a valid model|no such model|unknown model|model not found/i.test(e)?"model not found on this route":t===429||/rate limit/i.test(e)?"rate limited":t===402||/insufficient|credit|quota|balance/i.test(e)?"out of credits / quota":e.slice(0,160)}function M$(t){if(pS.test(t))return"This model's only provider(s) require prompt logging/training, which your OpenRouter account disallows by default. Allow it (or that provider) at openrouter.ai/settings/privacy, then probe again."}function D$(t,e,n){if(!t)return{works:null,read:0,note:n?`couldn't re-test on ${n} \u2014 caching unconfirmed`:"caching unconfirmed"};let r=lp(e?.cache_read_input_tokens)||lp(e?.prompt_tokens_details?.cached_tokens),s=e?.cache_read_input_tokens!==void 0||e?.cache_creation_input_tokens!==void 0||e?.prompt_tokens_details!==void 0;return r>0?{works:!0,read:r,note:`${r} tokens read from cache on the 2nd call`}:s?{works:!1,read:r,note:"no cache reads after a warm call \u2014 every turn re-bills the full context"}:{works:null,read:r,note:"route doesn't report cache usage \u2014 caching almost certainly not honored"}}async function B$({model:t}){let e=process.env.OPENROUTER_API_KEY;if(!e)return{ok:!1,error:"OPENROUTER_API_KEY not set \u2014 add a key first"};if(!t)return{ok:!1,error:"no model given"};if(dp(t))return{ok:!1,error:"Anthropic model \u2014 not offered or probed via OpenRouter"};let n=Date.now(),r=Array(350).fill("Caching probe filler sentence; its only purpose is to exceed the prompt-cache minimum token threshold.").join(" "),s={"content-type":"application/json",authorization:`Bearer ${e}`,"anthropic-version":"2023-06-01"},i={model:t,max_tokens:64,system:[{type:"text",text:r,cache_control:{type:"ephemeral"}}],messages:[{role:"user",content:"Reply with exactly: ok"}]},o=async a=>{let l=new AbortController,c=setTimeout(()=>l.abort(),2e4);try{let f=JSON.stringify(a?{...i,provider:lS(a)}:i),d=await fetch(up,{method:"POST",signal:l.signal,headers:s,body:f}),u=await d.json().catch(()=>({}));return{r:d,j:u}}finally{clearTimeout(c)}};try{let{r:a,j:l}=await o();if(!a.ok){let b=l?.error?.message||l?.message||JSON.stringify(l).slice(0,300);return{ok:!0,callable:!1,status:a.status,ms:Date.now()-n,error:L$(a.status,b),restriction:M$(b)}}let c=typeof l?.provider=="string"?l.provider:void 0,f=l?.content?.find?.(b=>b.type==="text")?.text??l?.content?.[0]?.text??"ok",d=lp(l?.usage?.cache_creation_input_tokens),{r:u,j:p}=await o(c),{works:h,read:m,note:g}=D$(u.ok,p?.usage,c);return h===!0&&c&&(fp[t]=c,dt===t&&(Un=c)),{ok:!0,callable:!0,status:a.status,ms:Date.now()-n,provider:c,sample:String(f).trim().slice(0,60),cache:{works:h,created:d,read:m,note:g}}}catch(a){let l=V(a);return{ok:!0,callable:!1,ms:Date.now()-n,error:/abort/i.test(l)?"timed out (20s)":l}}}var p$,up,h$,m$,oS,g$,ap,xl,El,vl,dp,Fr,Fn,dt,Un,vi,Si,ki,fp,lp,lS,pS,hS=S(()=>{"use strict";$n();Zt();Kt();p$="https://openrouter.ai/api",up=`${p$}/v1/messages`,h$="typebulb-proxy-managed",m$="The typebulb model override was reverted to Anthropic, but this Claude Code session still points at the now-idle proxy. Reload the window (VS Code/Cursor: \u201CDeveloper: Reload Window\u201D) or relaunch `claude` in a terminal to return to your Anthropic subscription.",oS=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],g$=5e3,ap=["low","medium","high"],xl=t=>kl(t,".claude","settings.local.json"),El=t=>kl(t,".claude",".cc-switcher.json"),vl=t=>`http://127.0.0.1:${t}`;dp=t=>/^anthropic\//i.test(t)||/claude/i.test(t),Fr=null,Fn=null,dt=null,Un=null,vi=null,Si="unknown",ki=1,fp={},lp=t=>typeof t=="number"?t:0,lS=t=>({order:[t],allow_fallbacks:!1});pS=/data policy|no endpoints|no allowed providers|privacy|requires.*(training|logging|data)/i;(async function(){try{let e=nn(El(X)),n=e?.active?.model;if(!n)return;let s=(nn(xl(X))?.env||{}).ANTHROPIC_BASE_URL||"";if(!/127\.0\.0\.1|localhost/.test(s))return;let i=await fS(n,e.active.provider??fp[n]??null);console.log(`[switcher] re-adopted override after restart: ${n} via ${vl(i)}`)}catch(e){console.error("[switcher] boot reconcile failed",V(e))}})()});var gS={};Li(gS,{agentMessage:()=>Vo,attach:()=>K$,blockToMarkdown:()=>Yo,breakout:()=>Hf,capText:()=>_e,childStatus:()=>X$,cleanUserText:()=>Jt,clearSwitchModel:()=>I$,closeChild:()=>Y$,composerPasteRead:()=>V$,displayName:()=>j$,downloadSample:()=>np,firstLineDigest:()=>Be,git:()=>we,gitChangedFiles:()=>Of,gitDiff:()=>Pf,info:()=>F$,isHiddenTurn:()=>$s,launchBulb:()=>Xf,listBreakouts:()=>zf,listBulbFiles:()=>Vf,listChildren:()=>H$,listMyBulbs:()=>sp,listSamples:()=>tp,listSessions:()=>J$,listSwitchModels:()=>O$,logInlineStatus:()=>q$,openChild:()=>z$,openFile:()=>Kf,poll:()=>U$,predictTrustOf:()=>Qf,probeModel:()=>B$,pullRemoteBulb:()=>ip,pushLocalBulb:()=>op,readBulbLog:()=>ep,repoRoot:()=>Ln,saveOpenRouterKey:()=>$$,searchBulbs:()=>Gf,searchSessions:()=>W$,setBulbTrust:()=>Zf,setReasoning:()=>R$,setSwitchModel:()=>_$,shutdownSwitcher:()=>N$,stopBreakout:()=>Yf,summarizeTurn:()=>G$,switchState:()=>P$,toolResultDigest:()=>td});var mS,j$,F$,U$,q$,J$,W$,K$,H$,z$,Y$,V$,G$,X$,yS=S(()=>{"use strict";yl();Go();wl();Lr();hS();Go();Rs();mS=new ir,j$=mS.displayName,{info:F$,poll:U$,logInlineStatus:q$,listSessions:J$,searchSessions:W$,attach:K$,listChildren:H$,openChild:z$,closeChild:Y$,composerPasteRead:V$,summarizeTurn:G$,childStatus:X$}=jr(mS)});var wS={};Li(wS,{attach:()=>s1,breakout:()=>Hf,childStatus:()=>u1,closeChild:()=>a1,composerPasteRead:()=>l1,displayName:()=>Q$,downloadSample:()=>np,git:()=>we,gitChangedFiles:()=>Of,gitDiff:()=>Pf,info:()=>Z$,launchBulb:()=>Xf,listBreakouts:()=>zf,listBulbFiles:()=>Vf,listChildren:()=>i1,listMyBulbs:()=>sp,listSamples:()=>tp,listSessions:()=>n1,logInlineStatus:()=>t1,openChild:()=>o1,openFile:()=>Kf,poll:()=>e1,predictTrustOf:()=>Qf,pullRemoteBulb:()=>ip,pushLocalBulb:()=>op,readBulbLog:()=>ep,repoRoot:()=>Ln,searchBulbs:()=>Gf,searchSessions:()=>r1,setBulbTrust:()=>Zf,stopBreakout:()=>Yf,summarizeTurn:()=>c1});var bS,Q$,Z$,e1,t1,n1,r1,s1,i1,o1,a1,l1,c1,u1,vS=S(()=>{"use strict";yl();ud();wl();Lr();bS=new ar,Q$=bS.displayName,{info:Z$,poll:e1,logInlineStatus:t1,listSessions:n1,searchSessions:r1,attach:s1,listChildren:i1,openChild:o1,closeChild:a1,composerPasteRead:l1,summarizeTurn:c1,childStatus:u1}=jr(bS)});import{readFileSync as d1,writeFileSync as f1,mkdirSync as p1}from"fs";import{homedir as h1}from"os";import*as Al from"path";async function xS(){try{let t=await fetch(new URL("/api/tags",kS()).toString(),{signal:AbortSignal.timeout(m1)});return t.ok?((await t.json()).models??[]).map(n=>n.name).filter(n=>!!n):[]}catch{return[]}}function ES(t){let e;try{e=d1(t,"utf-8")}catch{return{json:void 0,unreadable:!1}}try{let n=JSON.parse(e);if(n&&typeof n=="object"&&!Array.isArray(n)){let r=n;return{json:r,unreadable:"providers"in r&&!pp(r)}}}catch{}return{json:void 0,unreadable:!0}}function pp(t){let e=t?.providers;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function g1(t){let e=pp(t);if(!e||!("ollama"in e))return null;let n=e.ollama?.models;return Array.isArray(n)?n.map(r=>r?.id).filter(r=>typeof r=="string"):[]}async function AS(){let{json:t,unreadable:e}=ES(SS());return e?{installed:[],configured:null}:{installed:await xS(),configured:g1(t)}}async function TS(){let t=await xS();return t.length?y1(SS(),t,kS()):{ok:!1,error:"Ollama is not running (or has no models installed)"}}function y1(t,e,n){let{json:r,unreadable:s}=ES(t);if(s)return{ok:!1,error:`could not parse ${t} \u2014 edit the ollama provider there yourself`};let i={...r??{},providers:{...pp(r)??{},ollama:{baseUrl:`${n}/v1`,api:"openai-completions",apiKey:"ollama",models:e.map(o=>({id:o}))}}};try{p1(Al.dirname(t),{recursive:!0}),f1(t,JSON.stringify(i,null,2)+`
|
|
2089
|
+
`)}catch(o){return{ok:!1,error:`could not write ${t}: ${V(o)}`}}return{ok:!0,count:e.length}}var m1,SS,kS,CS=S(()=>{"use strict";Zt();$n();m1=1500,SS=()=>Al.join(h1(),".pi","agent","models.json"),kS=()=>yr(process.env.OLLAMA_HOST??"http://localhost:11434")});var PS={};Li(PS,{attach:()=>E1,breakout:()=>Hf,closeChild:()=>C1,composerFiles:()=>R1,composerNew:()=>_1,composerPaste:()=>N1,composerPasteRead:()=>L1,composerRpc:()=>$1,composerSend:()=>O1,composerStop:()=>P1,composerUiRespond:()=>I1,displayName:()=>b1,downloadSample:()=>np,git:()=>we,gitChangedFiles:()=>Of,gitDiff:()=>Pf,info:()=>w1,launchBulb:()=>Xf,listBreakouts:()=>zf,listBulbFiles:()=>Vf,listChildren:()=>A1,listMyBulbs:()=>sp,listSamples:()=>tp,listSessions:()=>k1,logInlineStatus:()=>S1,ollamaOffer:()=>AS,ollamaSync:()=>TS,openChild:()=>T1,openFile:()=>Kf,poll:()=>v1,predictTrustOf:()=>Qf,pullRemoteBulb:()=>ip,pushLocalBulb:()=>op,readBulbLog:()=>ep,repoRoot:()=>Ln,searchBulbs:()=>Gf,searchSessions:()=>x1,setBulbTrust:()=>Zf,shutdownComposer:()=>D1,stopBreakout:()=>Yf,summarizeTurn:()=>M1});var OS,b1,w1,v1,S1,k1,x1,E1,A1,T1,C1,O1,P1,_1,R1,I1,$1,N1,L1,M1,D1,_S=S(()=>{"use strict";yl();Tf();wl();Lr();CS();OS=new Nr,b1=OS.displayName,{info:w1,poll:v1,logInlineStatus:S1,listSessions:k1,searchSessions:x1,attach:E1,listChildren:A1,openChild:T1,closeChild:C1,composerSend:O1,composerStop:P1,composerNew:_1,composerFiles:R1,composerUiRespond:I1,composerRpc:$1,composerPaste:N1,composerPasteRead:L1,summarizeTurn:M1,shutdownComposer:D1}=jr(OS)});import*as nx from"fs/promises";import*as Pt from"path";Mi();te();function Vu(t){if(!Ye.includes(t))throw new Error(`Unknown block kind '${t}' (one of: ${Ye.join(", ")})`);return t}function Ey(t){let e=[];for(let n of t){let r=n.indexOf("=");if(r<=0||r===n.length-1)throw new Error(`Expected <kind>=<source>, got '${n}' (e.g. data=results.json, or data=- for stdin)`);let s=Vu(n.slice(0,r));if(e.some(i=>i.kind===s))throw new Error(`Duplicate block kind '${s}' \u2014 each block can be written once per invocation`);e.push({kind:s,source:n.slice(r+1)})}if(e.filter(n=>n.source==="-").length>1)throw new Error("Only one <kind>=- can read stdin");return e}Go();ud();Tf();var Tl={claude:{adapter:()=>new ir,server:()=>Promise.resolve().then(()=>(yS(),gS))},codex:{adapter:()=>new ar,server:()=>Promise.resolve().then(()=>(vS(),wS))},pi:{adapter:()=>new Nr,server:()=>Promise.resolve().then(()=>(_S(),PS))}};function RS(t){return t in Tl}function Ur(){return Object.keys(Tl)}function qr(){return Object.fromEntries(Object.entries(Tl).map(([t,e])=>[t,e.adapter]))}function IS(t){return Tl[t].server()}var xi=qr();function $S(){for(let t of Object.values(xi))try{t().ensureHarnessSupport()}catch{}}function st(){for(let t of Object.keys(xi))try{if(xi[t]().detectsSelf())return t}catch{}}function NS(t){let e=Ur(),n=new Map(e.filter(i=>xi[i]).map(i=>[i,xi[i]()]));for(let[i,o]of n)if(o.detectsSelf())return{name:i};let r=[...n].filter(([,i])=>i.detectsInstalled()).map(([i])=>i);if(r.length===0)return{name:e[0]};if(r.length===1)return{name:r[0]};let s=i=>n.get(i).listSessionFiles(t).length>0;return{ambiguous:[...r].sort((i,o)=>Number(s(o))-Number(s(i)))}}var mp=5e3;function hp(t){try{return t()}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}}function B1(t){let e=/^(\d+(?:\.\d+)?)([smh]?)$/.exec(t??""),n=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,"":6e4}[e[2]]:0;return n>0?n:void 0}function LS(t){let n={subcommand:"run",file:"",watch:!0,open:process.env.TERM_PROGRAM==="vscode"||st()!==void 0?"link":"window",server:!1,trust:!1,noTrust:!1,force:!1,follow:!1,clear:!1,help:!1,version:!1,callArgs:[],hasArgsFlag:!1},r=["call","check","predict","logs","wait","stop","restart","trust","untrust","models","slug","send","pull","push","get","put","status","babysit"],s=t[0];if(s==="agent"||s?.startsWith("agent:")){n.subcommand="agent";let o=s.indexOf(":");if(o!==-1){let a=s.slice(o+1);a&&(n.agentTarget=a)}t=t.slice(1)}else s&&r.includes(s)&&(n.subcommand=s,t=t.slice(1));let i=[];for(let o=0;o<t.length;o++){let a=t[o];if(a==="--help"||a==="-h")n.help=!0;else if(a==="--version"||a==="-V")n.version=!0;else if(a==="--no-watch")n.watch=!1;else if(a==="--open")n.open="window";else if(a==="--no-open")n.open="none";else if(a==="--server")n.server=!0;else if(a==="--trust")n.trust=!0;else if(a==="--no-trust")n.noTrust=!0;else if(a==="--force")n.force=!0;else if(a==="--mode"){let l=t[++o];(!l||l.startsWith("-"))&&(console.error("Missing value for --mode (e.g. --mode staging)"),process.exit(1)),n.mode=l}else if(a==="--follow"||a==="-f")n.follow=!0;else if(a==="--clear")n.clear=!0;else if(a==="--run"){let l=t[++o];if(l==="latest")n.run="latest";else{let c=parseInt(l,10);(isNaN(c)||c<1)&&(console.error(`Invalid --run value: ${l} (a run number, or 'latest')`),process.exit(1)),n.run=c}}else if(a==="--bulbs")n.stopScope="bulbs";else if(a==="--agent")n.stopScope="agent";else if(a==="--global")n.stopScope="global";else if(a==="--wake")n.wake=!0;else if(a==="--match"){let l=t[++o];l===void 0&&(console.error("Missing value for --match (a literal substring new log lines must contain)"),process.exit(1)),n.match=l}else if(a==="--timeout"){let l=parseInt(t[++o],10);(isNaN(l)||l<=0)&&(console.error(`Invalid --timeout value: ${t[o]} (seconds)`),process.exit(1)),n.timeoutSec=l}else if(a==="--slow"){let l=B1(t[++o]);l===void 0&&(console.error(`Invalid --slow value: ${t[o]} (a duration, e.g. 90s, 8m, 1h)`),process.exit(1)),n.slowMs=l}else if(a==="--wait"||a.startsWith("--wait="))if(a.startsWith("--wait=")){let l=parseInt(a.slice(7),10);(isNaN(l)||l<=0)&&(console.error(`Invalid --wait value: ${a.slice(7)} (milliseconds)`),process.exit(1)),n.sendWaitMs=l}else n.sendWaitMs=mp;else if(a==="--lines"||a==="-n"){let l=parseInt(t[++o],10);(isNaN(l)||l<0)&&(console.error(`Invalid --lines value: ${t[o]}`),process.exit(1)),n.lines=l}else if(a==="--port"||a==="-p"){let l=t[++o],c=parseInt(l,10);isNaN(c)&&(console.error(`Invalid port: ${l}`),process.exit(1)),n.port=c}else if(a==="--replace"||a.startsWith("--replace=")){let l=a.startsWith("--replace=")?a.slice(10):t[++o]??"",c=hp(()=>Jp(l));n.local&&(console.error(`--replace can only be used once (got '${n.local.name}' and '${c.name}')`),process.exit(1)),n.local=c}else if(a==="--args"||a.startsWith("--args=")){n.hasArgsFlag=!0;let l=a.startsWith("--args=")?a.slice(7):t[++o];l===void 0&&(console.error("Missing value for --args (a JSON array, or - to read it from stdin)"),process.exit(1)),n.argsJson=l}else if(!a.startsWith("-")||a==="-"&&n.subcommand==="send")["call","send","get","put","slug","status"].includes(n.subcommand)?i.push(a):n.file=a;else{let l=n.subcommand==="call"?" (for a negative or dash-leading argument, use --args '<json-array>')":"";console.error(`Unknown option: ${a}${l}`),process.exit(1)}}return n.subcommand==="call"&&(i.length<2&&(console.error("Usage: typebulb call <file> <fn> [arg\u2026]"),process.exit(1)),n.file=i[0],n.fn=i[1],n.callArgs=i.slice(2)),n.subcommand==="send"&&(i.length<1&&(console.error("Usage: typebulb send <file> [message]"),process.exit(1)),n.file=i[0],n.sendMessage=i[1]),n.subcommand==="slug"&&(i.length||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1)),n.slugName=i.join(" ")),n.subcommand==="status"&&i.length&&(n.statusQuery=i.join(" ")),n.subcommand==="get"&&(i.length!==2&&(console.error("Usage: typebulb get <file> <kind>"),process.exit(1)),n.file=i[0],n.blockKind=hp(()=>Vu(i[1]))),n.subcommand==="put"&&(i.length<2&&(console.error("Usage: typebulb put <file> <kind>=<source> [<kind>=<source> \u2026]"),process.exit(1)),n.file=i[0],n.blockPairs=hp(()=>Ey(i.slice(1)))),n}function MS(){console.log(`
|
|
2090
2090
|
typebulb - Local bulb runner for Typebulb
|
|
2091
2091
|
|
|
2092
2092
|
Usage:
|
|
@@ -2182,9 +2182,9 @@ Usage:
|
|
|
2182
2182
|
id or a piece of its description; no arg: the
|
|
2183
2183
|
session's overview. Claude Code, Codex.
|
|
2184
2184
|
typebulb babysit Watch your sub-agents and stay silent until one
|
|
2185
|
-
needs you (an idle stall, a
|
|
2186
|
-
running, a failure streak,
|
|
2187
|
-
|
|
2185
|
+
needs you (an idle stall, a slow call, a
|
|
2186
|
+
background call left running, a failure streak),
|
|
2187
|
+
then print it and exit.
|
|
2188
2188
|
Run it in the background; the exit is your
|
|
2189
2189
|
wake-up. Run it again after handling it.
|
|
2190
2190
|
Both take --slow (below).
|
|
@@ -2204,7 +2204,7 @@ Options:
|
|
|
2204
2204
|
--timeout <sec> Give up after this long; exit 2 \u2014 bounds only a
|
|
2205
2205
|
manual (foreground) bulb wait, default 1800 (wait)
|
|
2206
2206
|
--slow <dur> When a call is slow: listed in Status, and a wake
|
|
2207
|
-
once
|
|
2207
|
+
once one runs past it (default 3m). Kept for the
|
|
2208
2208
|
session, the mirror's view included (status, babysit)
|
|
2209
2209
|
--wait[=ms] For 'send': bound the whole exchange \u2014 retry while
|
|
2210
2210
|
no page is connected (a hot reload's gap), then
|
|
@@ -2278,7 +2278,7 @@ Examples:
|
|
|
2278
2278
|
typebulb my-editor.bulb.md
|
|
2279
2279
|
typebulb --no-watch my-editor.bulb.md
|
|
2280
2280
|
typebulb .
|
|
2281
|
-
`)}
|
|
2281
|
+
`)}At();qs();Mi();Ks();At();import*as We from"path";import{spawn as fN,execSync as pN}from"child_process";import{createRequire as hN}from"module";import{existsSync as mN}from"fs";import*as xe from"fs/promises";import*as ve from"path";var gp=[{name:"es5"},{name:"es2015.core"},{name:"es2015.collection"},{name:"es2015.promise"},{name:"es2015.iterable"},{name:"es2015.symbol"},{name:"es2015.symbol.wellknown"},{name:"es2015.generator"},{name:"es2015.proxy"},{name:"es2015.reflect"},{name:"es2016.array.include"},{name:"es2016.intl"},{name:"es2017.object"},{name:"es2017.string"},{name:"es2017.sharedmemory"},{name:"es2017.typedarrays"},{name:"es2017.date"},{name:"es2017.intl"},{name:"es2018.asynciterable"},{name:"es2018.asyncgenerator"},{name:"es2018.promise"},{name:"es2018.regexp"},{name:"es2018.intl"},{name:"es2019.array"},{name:"es2019.object"},{name:"es2019.string"},{name:"es2019.symbol"},{name:"es2019.intl"},{name:"es2020.bigint"},{name:"es2020.promise"},{name:"es2020.string"},{name:"es2020.sharedmemory"},{name:"es2020.date"},{name:"es2020.number"},{name:"es2020.symbol.wellknown"},{name:"es2020.intl"},{name:"es2021.promise"},{name:"es2021.string"},{name:"es2021.weakref"},{name:"es2021.intl"},{name:"es2022.array"},{name:"es2022.object"},{name:"es2022.error"},{name:"es2022.string"},{name:"es2022.regexp"},{name:"es2022.intl"},{name:"es2023.array"},{name:"es2023.collection"},{name:"es2023.intl",since:"5.5"},{name:"es2024.arraybuffer",since:"5.5"},{name:"es2024.collection",since:"5.5"},{name:"es2024.object",since:"5.5"},{name:"es2024.promise",since:"5.5"},{name:"es2024.regexp",since:"5.5"},{name:"es2024.sharedmemory",since:"5.5"},{name:"es2024.string",since:"5.5"},{name:"esnext.array",since:"5.5"},{name:"esnext.collection"},{name:"esnext.decorators"},{name:"esnext.disposable"},{name:"esnext.error",since:"5.5"},{name:"esnext.float16",since:"5.5"},{name:"esnext.iterator",since:"5.5"},{name:"esnext.object"},{name:"esnext.promise"},{name:"esnext.sharedmemory",since:"5.5"},{name:"esnext.intl"}],yp=[{name:"dom"},{name:"dom.iterable"},{name:"dom.asynciterable"}];function bp(t,e){if(!e)return t.filter(s=>!s.since);let n={"5.0":0,"5.5":1},r=n[e];return t.filter(s=>!s.since||n[s.since]<=r)}te();var j1=`
|
|
2282
2282
|
/**
|
|
2283
2283
|
* Get raw data chunk from the Data tab.
|
|
2284
2284
|
* @param index - Chunk index (0-based). Separate chunks with 2 blank lines.
|
|
@@ -2289,7 +2289,7 @@ Examples:
|
|
|
2289
2289
|
* @param index - Chunk index (0-based)
|
|
2290
2290
|
* @throws If chunk is not valid JSON/JSON-ish
|
|
2291
2291
|
*/
|
|
2292
|
-
json<T = unknown>(index: number): T;`,
|
|
2292
|
+
json<T = unknown>(index: number): T;`,F1=`
|
|
2293
2293
|
/**
|
|
2294
2294
|
* Get the insight data produced by the inference layer.
|
|
2295
2295
|
*
|
|
@@ -2298,7 +2298,7 @@ Examples:
|
|
|
2298
2298
|
*
|
|
2299
2299
|
* @returns The parsed insight JSON, or undefined if no insight is available
|
|
2300
2300
|
*/
|
|
2301
|
-
insight<T = unknown>(): T | undefined;`,
|
|
2301
|
+
insight<T = unknown>(): T | undefined;`,U1=`
|
|
2302
2302
|
/**
|
|
2303
2303
|
* Replace the data this run is working on.
|
|
2304
2304
|
*
|
|
@@ -2321,7 +2321,7 @@ Examples:
|
|
|
2321
2321
|
*
|
|
2322
2322
|
* @param value - Any JSON-serializable value
|
|
2323
2323
|
*/
|
|
2324
|
-
setInsight(value: unknown): Promise<void>;`,
|
|
2324
|
+
setInsight(value: unknown): Promise<void>;`,DS=`options: {
|
|
2325
2325
|
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
2326
2326
|
system?: string;
|
|
2327
2327
|
/** Reasoning effort: 0=minimal, 1=low, 2=med, 3=high, 4=xhigh. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking level, Anthropic adaptive thinking). 0 reaches the vendor's explicit off switch, and floors to a little thinking only on always-thinking models. 4 reaches the rung above high where the vendor has one (OpenAI/OpenRouter xhigh, Anthropic max) and clamps to high where it doesn't (Gemini) \u2014 never an error. Pin 1 (low) for most work; pick 0 deliberately, when you want the raw model or latency is the constraint. Omitting is NOT off \u2014 it buys the model's own default (medium on GPT-5.6), which reasons and bills invisibly. Ignored on the courtesy model, which runs at the level Typebulb sets. */
|
|
@@ -2332,7 +2332,7 @@ Examples:
|
|
|
2332
2332
|
webSearch?: boolean;
|
|
2333
2333
|
/** Abort the request. On abort the promise rejects / the stream ends. */
|
|
2334
2334
|
signal?: AbortSignal;
|
|
2335
|
-
}`,
|
|
2335
|
+
}`,BS=`
|
|
2336
2336
|
/** Provider-reported token counts for one call \u2014 real usage from the API, never an estimate.
|
|
2337
2337
|
* \`output\` is total billed output (reasoning included); \`reasoning\` is the itemized subset where
|
|
2338
2338
|
* the provider splits it (OpenAI, Gemini, OpenRouter \u2014 Anthropic doesn't); \`cacheRead\` is the
|
|
@@ -2344,10 +2344,10 @@ type AiChunk =
|
|
|
2344
2344
|
| { kind: "text"; text: string }
|
|
2345
2345
|
| { kind: "reasoning"; text: string }
|
|
2346
2346
|
| { kind: "usage"; usage: AiUsage };
|
|
2347
|
-
`,
|
|
2347
|
+
`,jS=`
|
|
2348
2348
|
/** What backs \`tb.ai\`: the user's own keys, the quota-limited courtesy model, or nothing. */
|
|
2349
2349
|
type AiAccess = "own" | "courtesy" | "none";
|
|
2350
|
-
`,
|
|
2350
|
+
`,FS=`
|
|
2351
2351
|
/**
|
|
2352
2352
|
* General-purpose AI call. \`tb.ai(opts)\` resolves with the full text; \`tb.ai.stream(opts)\`
|
|
2353
2353
|
* returns an async iterable of {@link AiChunk} deltas you consume with \`for await\`.
|
|
@@ -2357,7 +2357,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2357
2357
|
* @throws On rate limit, network error, or provider error
|
|
2358
2358
|
*/
|
|
2359
2359
|
ai: {
|
|
2360
|
-
(${
|
|
2360
|
+
(${DS}): Promise<{ text: string; usage?: AiUsage }>;
|
|
2361
2361
|
/**
|
|
2362
2362
|
* Streaming counterpart of \`tb.ai()\`. Yields \`{ kind: "text" | "reasoning", text }\` deltas
|
|
2363
2363
|
* as they arrive, then one final \`{ kind: "usage", usage }\` chunk with the call's token
|
|
@@ -2374,8 +2374,8 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2374
2374
|
* if (c.kind === "text") answer += c.text;
|
|
2375
2375
|
* }
|
|
2376
2376
|
*/
|
|
2377
|
-
stream(${
|
|
2378
|
-
};`,
|
|
2377
|
+
stream(${DS}): AsyncIterable<AiChunk>;
|
|
2378
|
+
};`,US=`
|
|
2379
2379
|
/**
|
|
2380
2380
|
* Returns AI models available to the current user.
|
|
2381
2381
|
* Models are filtered by the user's configured API keys.
|
|
@@ -2405,7 +2405,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2405
2405
|
* \`tb.mode\` or the length of \`tb.models()\` \u2014 which hosts offer a courtesy
|
|
2406
2406
|
* model is the host's business and changes without your bulb changing.
|
|
2407
2407
|
*/
|
|
2408
|
-
aiAccess(): Promise<AiAccess>;`,
|
|
2408
|
+
aiAccess(): Promise<AiAccess>;`,q1="\n /**\n * The bulb's theme override (`<html data-theme>`).\n *\n * - Get: the current override \u2014 `'dark'` | `'light'`, or `undefined` when\n * following the OS preference.\n * - Set `'dark'`/`'light'` to force and persist it (per-bulb); set\n * `undefined` to clear the override and follow the OS again.\n *\n * Drives `<html data-theme>`, so render off `html[data-theme=\"\u2026\"]` selectors\n * (or observe the attribute) rather than reading `tb.theme`.\n */\n theme: 'light' | 'dark' | undefined;",qS=`
|
|
2409
2409
|
/**
|
|
2410
2410
|
* The mode this bulb is running in.
|
|
2411
2411
|
*
|
|
@@ -2415,7 +2415,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2415
2415
|
* - \`'inline'\` \u2014 Running inline in an agent's transcript, rendered by the mirror
|
|
2416
2416
|
* (sandboxed, client-only: AI, filesystem, and server RPC are unavailable)
|
|
2417
2417
|
*/
|
|
2418
|
-
mode: ${
|
|
2418
|
+
mode: ${yy};`,JS=`
|
|
2419
2419
|
/**
|
|
2420
2420
|
* Local filesystem access (CLI only).
|
|
2421
2421
|
*
|
|
@@ -2436,7 +2436,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2436
2436
|
list(path?: string): Promise<Array<{ name: string; dir: boolean; mtime: number }>>;
|
|
2437
2437
|
/** Remove a file, or a folder and everything in it. Throws if the path does not exist; the bulb's folder itself cannot be removed. */
|
|
2438
2438
|
remove(path: string): Promise<boolean>;
|
|
2439
|
-
};`,
|
|
2439
|
+
};`,WS=`
|
|
2440
2440
|
/**
|
|
2441
2441
|
* The bulb's folder \u2014 absolute path to \`<bulb-dir>/<filename-stem>/\`
|
|
2442
2442
|
*
|
|
@@ -2444,7 +2444,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2444
2444
|
* \`tb.fs\` already resolves relative paths against it, so bulb code writing
|
|
2445
2445
|
* its own files never needs it. CLI only \u2014 throws in ide/published/inline mode.
|
|
2446
2446
|
*/
|
|
2447
|
-
readonly dir: string;`,
|
|
2447
|
+
readonly dir: string;`,J1=`
|
|
2448
2448
|
/**
|
|
2449
2449
|
* Async value inspector for tensor-like objects.
|
|
2450
2450
|
*
|
|
@@ -2497,49 +2497,49 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2497
2497
|
*
|
|
2498
2498
|
* @returns The full canonical URL
|
|
2499
2499
|
*/
|
|
2500
|
-
url(): Promise<string>;`,
|
|
2500
|
+
url(): Promise<string>;`,W1="\n /**\n * Subscribe to a value pushed from the terminal via `typebulb send <file> [message]`.\n *\n * The dual of `tb.log` (data out): a value sent *in* from the CLI, no `--trust` required.\n * Use it to start expensive work on demand instead of on load \u2014 e.g. `tb.onMessage(() => start())`\n * \u2014 so hot reloads don't re-trigger it while you edit, and an agent kicks off one run when ready.\n *\n * The message is the JSON-parsed value of what `send` was given (or the raw string if it isn't\n * JSON; `undefined` for a bare `typebulb send <file>`). A non-`undefined` return value (awaited)\n * becomes the reply `send --wait` prints on stdout \u2014 JSON-serializable, at most one handler\n * replying \u2014 the structured read-back for self-tests. Returns an unsubscribe function. Inert in\n * an inline bulb (no sender) \u2014 the handler is registered but never fires.\n *\n * @param handler - Called with each pushed message; may return a JSON-serializable reply.\n * @returns An unsubscribe function.\n */\n onMessage(handler: (message: any) => unknown): () => void;",K1="\n /**\n * Print to the CLI's stdout \u2014 the bulb's log channel, read back with `typebulb logs <file>`.\n *\n * Ungated: needs no `server.ts` block and no `--trust`, so a Restricted client-only bulb can\n * instrument itself. Args cross to the CLI as JSON; where no CLI serves the page (web, inline,\n * or a transport failure) it falls back to the browser console. Works in `server.ts` too (same\n * as `console.log` there).\n */\n log(...args: any[]): void;",H1="\n /**\n * Server-side function proxy.\n *\n * In the CLI, calls exported functions from the `**server.ts**` section.\n *\n * A normal export is awaited for its result (`await tb.server.fn()`). An `async function*`\n * export streams: `for await (const chunk of tb.server.gen())`. The call object supports both;\n * break the `for await` to cancel and tear down the server generator.\n */\n server: Record<string, (...args: any[]) => Promise<any> & AsyncIterable<any>>;",wp=`${BS}${jS}
|
|
2501
2501
|
/**
|
|
2502
2502
|
* Typebulb utilities namespace.
|
|
2503
2503
|
* Type \`tb.\` to discover available helpers.
|
|
2504
2504
|
*/
|
|
2505
|
-
declare const tb: {${
|
|
2505
|
+
declare const tb: {${j1}${J1}${F1}${U1}${K1}${H1}${W1}${FS}${JS}${WS}${US}${q1}${qS}
|
|
2506
2506
|
};
|
|
2507
|
-
`,
|
|
2507
|
+
`,z1=`
|
|
2508
2508
|
/**
|
|
2509
2509
|
* Print to the CLI's stdout \u2014 the same channel as \`console.log\` here (the server's console IS
|
|
2510
2510
|
* the bulb's log). One log verb across blocks: page-side \`tb.log\` reaches this same stdout.
|
|
2511
2511
|
*/
|
|
2512
|
-
log(...args: any[]): void;`,
|
|
2512
|
+
log(...args: any[]): void;`,vp=`${BS}${jS}
|
|
2513
2513
|
/**
|
|
2514
2514
|
* Typebulb utilities namespace (server-side).
|
|
2515
2515
|
* Type \`tb.\` to discover available helpers.
|
|
2516
2516
|
*/
|
|
2517
|
-
declare const tb: {${
|
|
2517
|
+
declare const tb: {${z1}${FS}${JS}${WS}${US}${qS}
|
|
2518
2518
|
};
|
|
2519
|
-
`;
|
|
2519
|
+
`;St();import X1 from"p-limit";St();import{resolve as HS}from"resolve.exports";var Ct={maxRelativeTypeRefs:500,maxBareDeps:8,maxBareDepth:3,prefetchConcurrency:4,negativeTtlMs:1e4},Ei=["index.d.ts","index.d.mts"],Sp=/\.d\.(ts|mts|cts)$/i;function Cl(t){return/\.d\.(ts|mts|cts)(?:[?#].*)?$/i.test(t)||/[?&]dts(?:[&#]|$)/i.test(t)}function KS(t){return[`${t}.d.ts`,`${t}.d.mts`]}function rn(t){if(!t||t==="./"||t==="/")return[...Ei];let e=t.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),n=KS(e),r=e.endsWith("/")?e:`${e}/`;return n.push(...KS(`${r}index`)),n}async function Jr(t,{retries:e=2,timeoutMs:n=15e3,init:r}={}){for(let s=0;s<=e;s++){let i=new AbortController,o=setTimeout(()=>i.abort(),n);try{let a=await fetch(t,{...r,signal:i.signal});if(Y1(a.status)&&s<e)continue;return a}catch{if(s<e)continue;return}finally{clearTimeout(o)}}}function Y1(t){return t===408||t===429||t>=500&&t<600}var Ol=class{constructor(e,n){this.fetchDts=e,this.cdnClient=n}async tryUrls(e){for(let n of e){let r=await this.fetchDts(n);if(r&&(this.looksLikeDts(r.dts)||Cl(r.url)))return r}}looksLikeDts(e){return/^\s*export\s*\{\s*\}\s*;?\s*$/m.test(e)?!0:/declare\s+(module|namespace|class|interface|function|const|var|let)/.test(e)||/interface\s+\w+/.test(e)||/type\s+\w+\s*=/.test(e)}async loadPackageAtVersionedRoot(e,n){let r=this.cdnClient.packageJson(new F({name:e,version:n})),s=await Jr(r);if(!s?.ok)return;let i;try{i=await s.json()}catch{return}if(i)return{pkg:i,baseDir:this.cdnClient.baseDir(new F({name:e,version:n??i.version})),version:n}}extractPathFromResult(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.find(n=>typeof n=="string")}async tryUntilSuccess(e,n){for(let r of e){let s=await n(r);if(s)return s}}async resolveFromSelected(e,n,r){if(e.kind==="types"){let o=Pn(e.path);if(!o||o==="/"||o===".")return this.tryUntilSuccess([...Ei],n);if(!Sp.test(o)){let a=await this.tryUntilSuccess(rn(o),n);if(a)return a}return n(o)}let s=rn(e.path),i=r?.subpath?[...s,...Ei]:[...Ei,...s];return this.tryUntilSuccess(i,n)}toResolutionResult(e){return{kind:Sp.test(e)?"types":"probe",path:e}}resolveExportsPath(e,n){let r=n||".",s=e;try{let i=this.extractPathFromResult(HS(s,r,{conditions:["types"]}));if(i)return i}catch{}try{return this.extractPathFromResult(HS(s,r,{browser:!0,conditions:["import","default","module","browser","node"]}))}catch{return}}async resolve(e){try{let n=F.parse(e),{pkg:r,baseDir:s}=await this.loadPackageAtVersionedRoot(n.name,n.version)||{};if(!r||!s)return;let i={name:n.name,version:n.version},o=new F(i).format(),a=new F({...i,subpath:n.subpath}).format(),l=d=>this.fetchCandidateFrom(s,n.name,d);if(n.subpath){let d=ef(n.subpath),u=this.resolveExportsPath(r,d);if(u){let h=await this.resolveFromSelected(this.toResolutionResult(u),l,{subpath:!0});if(h)return{...h,resolvedPkg:a}}let p=await this.tryUntilSuccess(rn(d),l);if(p)return{...p,resolvedPkg:a}}let c=r.types??r.typings;if(c){let d=await this.resolveFromSelected({kind:"types",path:c},l);if(d)return{...d,resolvedPkg:o}}let f=this.resolveExportsPath(r,".");if(f){let d=await this.resolveFromSelected(this.toResolutionResult(f),l);if(d)return{...d,resolvedPkg:o}}return}catch{return}}async fetchCandidateFrom(e,n,r){let s=Pn(r),i=new URL(s,e).toString(),o=await this.tryUrls([i]);return o?{dts:o.dts,url:o.url,resolvedPkg:n}:void 0}};St();import{gunzipSync as V1}from"fflate";var Pl=class{async fetchAndExtract(e,n){let r=this.getTarballUrl(e,n),s=await Jr(r,{timeoutMs:3e4});if(!s?.ok)return new Map;let i=new Uint8Array(await s.arrayBuffer());return this.extractDtsFiles(i)}getTarballUrl(e,n){return`https://registry.npmjs.org/${e.replace("/","%2F")}/-/${e.split("/").pop()}-${n}.tgz`}normalizeTarPath(e){let n=e.replace(/^package\//,""),r=n.indexOf("/");return r>0?n.substring(r+1):n}extractDtsFiles(e){let n=new Map;try{let r=V1(e),s=new TextDecoder("utf-8"),i=0;for(;i<r.length-512;){let o=r.slice(i,i+512);if(o[0]===0)break;let a=o.slice(0,100),l=a.indexOf(0),c=s.decode(a.slice(0,l>0?l:100)).trim(),f=o.slice(124,136),d=s.decode(f).trim().replace(/\0/g,""),u=parseInt(d,8)||0,p=String.fromCharCode(o[156]);if(i+=512,(p==="0"||p==="\0")&&(c.endsWith(".d.ts")||c.endsWith(".d.mts"))){let h=r.slice(i,i+u);n.set(this.normalizeTarPath(c),s.decode(h))}i+=Math.ceil(u/512)*512}}catch{}return n}};var _l=class{constructor(e,n,r=new Pl){this.cdnClient=e,this.cache=n,this.tarballFetcher=r}typesNameCandidates(e){let n=e.startsWith("@")?e.slice(1).replace("/","__"):e;return n.includes(".")?[n,n.split(".").join("-"),n.split(".").join("")]:[n]}selectTypesVersion(e,n,r){try{if(r){let i=_n.majorOf(r),o=e.filter(a=>_n.majorOf(a)===i);if(o.length)return o.sort((a,l)=>_n.cmp(l,a))[0]}let s=n?.latest;return s&&e.includes(s)?s:e[0]}catch{return e[0]}}subpathCandidates(e){let n=e.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),r=rn(e);return n!==e&&r.push(`${e}.d.ts`,`${e}/index.d.ts`),r}async fetchFromVersionedRoot(e,n){let r=new F(e),s=r.version;if(!s)return;let i;try{i=await this.tarballFetcher.fetchAndExtract(r.name,s)}catch{return}if(!i||i.size===0)return;for(let[a,l]of i.entries()){let c=this.cdnClient.file(e,a);try{await this.cache.setCachedFile(c,l)}catch{}}let o=n.subpath?this.subpathCandidates(n.subpath):["index.d.ts"];for(let a of o){let l=i.get(a);if(l)return{dts:l,url:this.cdnClient.file(e,a),resolvedPkg:n.subpath?new F(n).format():n.name}}}async resolve(e){let n=F.parse(e);if(n.name)for(let r of this.typesNameCandidates(n.name)){let s=`@types/${r}`,i;try{i=await this.cdnClient.fetchVersionsIndex(s)}catch{continue}if(!i?.versions?.length)continue;let o=this.selectTypesVersion(i.versions,i.distTags,n.version),a=await this.fetchFromVersionedRoot(`${s}@${o}`,n);if(a)return a}}};var Rl=class{collectRelativeTypeRefs(e){return this.collectRefs(e).filter(n=>n.startsWith("./")||n.startsWith("../"))}collectBareModuleRefs(e){return this.collectRefs(e).filter(n=>this.isBare(n))}collectRefs(e){let n=e.split(`
|
|
2520
2520
|
`).filter(s=>{let i=s.trimStart();return!(i.startsWith("*")||i.startsWith("//")||i.startsWith("/*"))}).join(`
|
|
2521
|
-
`),r=new Set;for(let s of n.matchAll(/(import|export)\s+[^'"\n]*from\s*['"]([^'"\n]+)['"]/g))r.add(s[2]);for(let s of n.matchAll(/export\s*\*\s*from\s*['"]([^'"\n]+)['"]/g))r.add(s[1]);return Array.from(r)}isBare(e){return!(e.startsWith("./")||e.startsWith("../")||e.startsWith("file:")||e.startsWith("http://")||e.startsWith("https://"))}};
|
|
2522
|
-
`);await this.prefetchBareDeps(h,c,u,p,s);let m=l.format(),g=e===m?[e]:[e,m],b=g.some(C=>this.ambientlyDeclares(i,C));return b?this.markFileAmbient(u,f):p.push(...g.map(C=>({module:C,path:f}))),{pkg:e,mainPath:f,files:u,shims:p,ambient:b}}};
|
|
2523
|
-
`,"utf8"),await
|
|
2524
|
-
`,"utf8"),{dir:e}}function
|
|
2525
|
-
`))console.log(`${e} ${r}`);return t.length>0}function
|
|
2521
|
+
`),r=new Set;for(let s of n.matchAll(/(import|export)\s+[^'"\n]*from\s*['"]([^'"\n]+)['"]/g))r.add(s[2]);for(let s of n.matchAll(/export\s*\*\s*from\s*['"]([^'"\n]+)['"]/g))r.add(s[1]);return Array.from(r)}isBare(e){return!(e.startsWith("./")||e.startsWith("../")||e.startsWith("file:")||e.startsWith("http://")||e.startsWith("https://"))}};St();var zS="file:///node_modules",Il=class{constructor(){this.epoch=0}bumpEpoch(){this.epoch+=1}epochDir(){return`__tsepoch_${this.epoch}`}pathForMain(e){return`${zS}/${this.epochDir()}/${e}/index.d.ts`}pathFor(e,n){let r=Pn(n);return`${zS}/${this.epochDir()}/${e}/${r}`}};import{LRUCache as G1}from"lru-cache";function YS(t){let e=new G1({ttl:Ct.negativeTtlMs,max:500}),n=new Map;return async function(s){try{if(await t.isNegative(s)||e.has(s))return;let i=await t.getCachedFile(s);if(i)return{dts:i,url:s};let o=n.get(s);if(o)return o;let a=(async()=>{let l=await Jr(s,{init:{cache:"no-store"}});if(!l?.ok){l?.status===404&&(e.set(s,!0),await t.recordNegative(s));return}let c=await l.text(),f=l.url||s;return await t.clearNegative(s),await t.setCachedFile(f,c),{dts:c,url:f}})();return n.set(s,a),await a.finally(()=>n.delete(s))}catch{return}}}var Ai=class{constructor(e){this.inFlight=new Map,this.scanner=new Rl,this.cache=e.cache,this.cdnClient=e.cdnClient,this.versionResolver=e.versionResolver,this.packageService=e.packageService,this.fetchDts=YS(e.cache),this.typescriptProvider=new Ol(this.fetchDts,e.cdnClient),this.definitelyTypedProvider=new _l(e.cdnClient,e.cache),this.virtualFs=new Il}withInFlight(e,n){let r=this.inFlight.get(e);if(r)return r;let s=n().finally(()=>this.inFlight.delete(e));return this.inFlight.set(e,s),s}invalidate(){this.virtualFs.bumpEpoch(),this.inFlight.clear()}pushFileIfNew(e,n,r){e.some(s=>s.path===n)||e.push({path:n,content:r})}createStubDef(e){let n=this.virtualFs.pathForMain(e);return{pkg:e,mainPath:n,files:[{path:n,content:"export const _shim: any; export default _shim;"}],shims:[{module:e,path:n}]}}async fetchViaProviders(e){for(let n of[this.typescriptProvider,this.definitelyTypedProvider])try{let r=await n.resolve(e);if(r?.dts)return r}catch{}}async fetchRootDts(e,n){let{effectivePackage:r,root:s,pinned:i}=await this.versionResolver.effectivePackage(e,n),o=await this.cache.getCachedDts(r);if(o?.content){let l=o.url??this.cdnClient.file(i?`${s}@${i}`:s,"index.d.ts");return{dts:o.content,url:l,resolvedPkg:r}}let a;try{a=await this.fetchViaProviders(r)}catch{return}if(!(!a?.dts||!a.url)&&new F(r).subpath===new F(a.resolvedPkg||r).subpath){try{await this.cache.setCachedDts(r,a.dts,a.url)}catch{}return a}}extractPackageRootUrl(e){let n=e.pathname.match(/^(.+@[^/]+\/)/);return n?new URL(n[1],e.origin):new URL("./",e)}toVirtualPath(e,n,r){let s=n.pathname.startsWith(e.pathname)?n.pathname.slice(e.pathname.length):`__deps__/${encodeURIComponent(n.toString()).replace(/%/g,"_")}.d.ts`;return this.virtualFs.pathFor(r,s)}computeEntryPath(e,n){if(!e)return{mainPath:this.virtualFs.pathForMain(n),packageRootUrl:void 0};let r=new URL(e),s=this.extractPackageRootUrl(r);return{mainPath:this.toVirtualPath(s,r,n),packageRootUrl:s}}async expandRelativeRefs(e,n,r,s,i=new Set,o){if(!i.has(n)&&(i.add(n),!(i.size>Ct.maxRelativeTypeRefs)))try{let a=new URL(n),l=new URL("./",a);o??(o=this.extractPackageRootUrl(a));let c=this.scanner.collectRelativeTypeRefs(e).slice(0,Ct.maxRelativeTypeRefs);for(let f of c)await this.tryRelativeRef(f,l,o,r,s,i)}catch{}}async tryRelativeRef(e,n,r,s,i,o){try{let a=new URL(e,n),l=a.pathname+a.search,c=Cl(l)?[l]:rn(l);for(let f of c){let u=new URL(f,a).toString();if(o.has(u))return;let p=await this.fetchDts(u);if(p?.dts){let h=this.toVirtualPath(r,new URL(p.url),s);this.pushFileIfNew(i,h,p.dts),await this.expandRelativeRefs(p.dts,p.url,s,i,o,r);return}}}catch{}}isDifferentPackage(e,n){return e===n?!1:new F(e).name!==new F(n).name}ambientlyDeclares(e,n){if(/^(?:import|export)\b/m.test(e))return!1;for(let r of e.matchAll(/declare\s+module\s+['"]([^'"]+)['"]/g)){let s=r[1];if(s===n||s.endsWith("/*")&&n.startsWith(s.slice(0,-1)))return!0}return!1}markFileAmbient(e,n){let r=e.find(s=>s.path===n);r&&(r.ambient=!0)}async prefetchBareDeps(e,n,r,s,i){try{let o=this.scanner.collectBareModuleRefs(e).slice(0,Ct.maxBareDeps).filter(c=>this.isDifferentPackage(c,n));if(!o.length)return;let a=new Set([n]),l=X1(Ct.prefetchConcurrency);await Promise.all(o.map(c=>l(()=>this.prefetchBareDepsRecursive(c,r,s,Ct.maxBareDepth,a,i).catch(()=>{}))))}catch{}}async prefetchBareDepsRecursive(e,n,r,s,i,o){if(s<=0||i.has(e))return;i.add(e);let a=await this.fetchRootDts(e,o);if(!a?.dts)return;let l=a.resolvedPkg||e,c=this.virtualFs.pathForMain(l);this.pushFileIfNew(n,c,a.dts),this.ambientlyDeclares(a.dts,e)?this.markFileAmbient(n,c):r.push({module:e,path:c}),a.url&&await this.expandRelativeRefs(a.dts,a.url,l,n);let f=this.scanner.collectBareModuleRefs(a.dts).slice(0,Ct.maxBareDeps).filter(d=>!i.has(d));for(let d of f)await this.prefetchBareDepsRecursive(d,n,r,s-1,i,o)}async resolve(e,n,r){let s=await this.packageService.extractImports(e),i=r?[...s,...r]:s;return(await Promise.all(i.map(a=>this.resolveOne(a,n)))).filter(a=>!!a)}async resolveOne(e,n){let{effectivePackage:r}=await this.versionResolver.effectivePackage(e,n);return this.withInFlight(r,async()=>{let s=new F(e),i=await this.fetchRootDts(e,n)??(s.subpath?await this.fetchRootDts(s.name,n):void 0);return i?this.buildDefFromContent(e,i,i.resolvedPkg||e,n):this.createStubDef(e)})}async buildDefFromContent(e,n,r,s){let{dts:i,url:o,resolvedPkg:a}=n,l=new F(a||r),c=l.version?`${l.name}@${l.version}`:l.name,{mainPath:f,packageRootUrl:d}=this.computeEntryPath(o,c),u=[{path:f,content:i}],p=[];o&&await this.expandRelativeRefs(i,o,c,u,void 0,d);let h=u.map(C=>C.content).join(`
|
|
2522
|
+
`);await this.prefetchBareDeps(h,c,u,p,s);let m=l.format(),g=e===m?[e]:[e,m],b=g.some(C=>this.ambientlyDeclares(i,C));return b?this.markFileAmbient(u,f):p.push(...g.map(C=>({module:C,path:f}))),{pkg:e,mainPath:f,files:u,shims:p,ambient:b}}};df();St();Tr();ii();cf();Ar();import*as Wr from"path";var Q1=Wr.join(Ra,"pkg"),Z1=Wr.join(Ra,"files"),eN=Wr.join(Ra,"negative.json"),Nl=class{pkgMem=new Map;fileMem=new Map;negativeCache=new Rn(new Cr(eN));async getCachedDts(e){if(this.pkgMem.has(e))return this.pkgMem.get(e);await ne();let n=await kt(VS(e));return this.pkgMem.set(e,n),n}async setCachedDts(e,n,r){let s={content:n,url:r};this.pkgMem.set(e,s),await $l(async()=>{await ne(),await Fe(VS(e),JSON.stringify(s))})}async getCachedFile(e){if(this.fileMem.has(e))return this.fileMem.get(e);await ne();let n=await _a(GS(e));return this.fileMem.set(e,n),n}async setCachedFile(e,n){this.fileMem.set(e,n),await $l(async()=>{await ne(),await Fe(GS(e),n)})}isNegative(e){return this.negativeCache.isNegative(e)}async recordNegative(e){await $l(async()=>{await ne(),await this.negativeCache.recordNegative(e)})}clearNegative(e){return $l(()=>this.negativeCache.clearNegative(e))}};async function $l(t){try{await t()}catch{}}function VS(t){return Wr.join(Q1,tt(t)+".json")}function GS(t){return Wr.join(Z1,tt(t)+".txt")}Tr();var kp;function tN(){return kp||(kp=new Ai({cache:new Nl,cdnClient:Rw,packageService:La,versionResolver:_w})),kp}var XS="file:///node_modules/";async function QS(t){let e=Ia(t.emitKey,"typecheck");await ne(),await xe.rm(e,{recursive:!0,force:!0}),await xe.mkdir(e,{recursive:!0});let n=iN(t.jsxImportSource,t.dependencies),r=await tN().resolve(t.code,t.dependencies,n),s=t.local?.name,i=s?r.filter(f=>f.pkg!==s):r,o=new Set;for(let f of i)for(let d of f.files){let u=Ll(d.path);if(!u||o.has(u))continue;o.add(u);let p=ve.join(e,"node_modules",u);await xe.mkdir(ve.dirname(p),{recursive:!0}),await xe.writeFile(p,d.content,"utf8")}let a={};for(let f of i)for(let d of f.shims){let u=Ll(d.path);u&&(a[d.module]=[`./node_modules/${u}`])}for(let f of i){if(f.ambient)continue;let d=Ll(f.mainPath);d&&(a[f.pkg]=[`./node_modules/${d}`])}let l=new Set;for(let f of i)for(let d of f.files){if(!d.ambient)continue;let u=Ll(d.path);u&&l.add(`node_modules/${u}`)}if(t.local){delete a[t.local.name];let f=await oN(t.local,e);f?a[t.local.name]=[`./node_modules/${t.local.name}/${f}`]:console.warn(` local: '${t.local.name}' ships no type defs; check cannot type against it.`)}let c=nN(t.jsxImportSource,a,[...l]);return await xe.writeFile(ve.join(e,"tsconfig.json"),JSON.stringify(c,null,2)+`
|
|
2523
|
+
`,"utf8"),await xe.writeFile(ve.join(e,"code.tsx"),t.code,"utf8"),await xe.writeFile(ve.join(e,"tb.d.ts"),wp,"utf8"),{dir:e}}var xp={target:"es2023",module:"esnext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0};function nN(t,e,n=[]){return{compilerOptions:{...xp,lib:rN([...gp,...yp]),jsx:"react-jsx",jsxImportSource:t??"react",paths:e},include:["code.tsx","tb.d.ts",...n]}}function rN(t){return bp(t).map(e=>sN(e.name))}function sN(t){return t.split(".").map(e=>/^es\d+$/i.test(e)?e.toUpperCase():e==="dom"?"DOM":e==="esnext"?"ESNext":e.charAt(0).toUpperCase()+e.slice(1)).join(".")}function iN(t,e){let n=t??("react"in e?"react":void 0);return n?[`${n}/jsx-runtime`,`${n}/jsx-dev-runtime`]:[]}function Ll(t){if(!t.startsWith(XS))return;let e=t.slice(XS.length),n=e.indexOf("/");if(!(n<0))return e.slice(n+1)}async function oN(t,e){if(!t.typesAbs)return;let n=ve.dirname(t.typesAbs),r=ve.join(e,"node_modules",t.name);for(let s of await aN(n)){let i=ve.join(r,ve.relative(n,s));await xe.mkdir(ve.dirname(i),{recursive:!0}),await xe.copyFile(s,i)}return ve.basename(t.typesAbs)}async function aN(t){let e=[];async function n(r){let s=await xe.readdir(r,{withFileTypes:!0});for(let i of s){let o=ve.join(r,i.name);i.isDirectory()?await n(o):/\.d\.ts(\.map)?$/.test(i.name)&&e.push(o)}}return await n(t),e}import*as Je from"fs/promises";import*as Ot from"path";import{existsSync as lN}from"fs";Tr();pf();var cN="^22";async function ZS(t){let e=Ia(t.emitKey,"typecheck-server");await ne(),await Je.rm(e,{recursive:!0,force:!0}),await Je.mkdir(e,{recursive:!0});let n=Ot.join(t.bulbDir,".typebulb"),r=qa(t.server).filter(o=>o!==t.local?.name);await Ua([`@types/node@${cN}`,...r],n,t.dependencies,{ignoreScripts:!0});let s=Ot.join(n,"node_modules"),i=Ot.join(e,"node_modules");return await dN(s,i),await Je.writeFile(Ot.join(e,"server.ts"),t.server,"utf8"),await Je.writeFile(Ot.join(e,"tb.d.ts"),vp,"utf8"),await Je.writeFile(Ot.join(e,"tsconfig.json"),JSON.stringify(uN(t.local),null,2)+`
|
|
2524
|
+
`,"utf8"),{dir:e}}function uN(t){let e={...xp,lib:["ES2023"],types:["node"]};if(t?.typesAbs){let n=i=>i.replace(/\\/g,"/"),r=n(Ot.dirname(t.typesAbs)),s=n(t.typesAbs).replace(/\.d\.ts$/,"");e.paths={[t.name]:[s],[`${t.name}/*`]:[`${r}/*`]}}return{compilerOptions:e,include:["server.ts","tb.d.ts"]}}async function dN(t,e){if(!lN(t)){await Je.mkdir(e,{recursive:!0});return}await Je.rm(e,{recursive:!0,force:!0});let n=process.platform==="win32"?"junction":"dir";await Je.symlink(t,e,n)}ga();te();async function tk(t,e){let{bulb:n,config:r,warnings:s,starts:i}=await rt(t),o=We.basename(t),a=m=>i.get(m)??1;!n.code&&!n.server&&(console.error("Bulb has neither **code.tsx** nor **server.ts**; nothing to check."),process.exit(1));let l=!1,c=!1;for(let m of s)console.log(`structure ${m}`);s.length&&(l=!0);let f=Rr(We.resolve(t)),d=f?nr(n.name):"";f&&d&&d!==f.slug&&(console.log(`naming filename '${f.slug}.bulb.md' doesn't match the title '${n.name}' \u2014 its slug derives to '${d}'. Rename the file to '${d}.bulb.md', or change name: to suit the filename.`),c=!0),n.code&&(l=ek(Js(n.code,{target:"client",dependencies:r.dependencies??{},lineOffset:a("code.tsx")}),"client")||l),n.server&&(l=ek(Js(n.server,{target:"server",lineOffset:a("server.ts")}),"server")||l);let u=wN([process.cwd(),We.dirname(t)]);if(!u){let m=We.relative(process.cwd(),t)||t;console.error("check: TypeScript not found \u2014 install it once, then re-run:"),console.error(" npm i -g typescript"),console.error(` typebulb check ${m}`),process.exit(2)}let p=[];if(n.code){let{dir:m}=await QS({code:n.code,dependencies:r.dependencies??{},jsxImportSource:r.ts?.jsxImportSource,emitKey:t,local:e});p.push({role:"client",dir:m})}if(n.server){let{dir:m}=await ZS({server:n.server,bulbDir:We.dirname(t),emitKey:t,local:e?{name:e.name,typesAbs:e.typesAbs}:void 0,dependencies:r.dependencies});p.push({role:"server",dir:m})}for(let{role:m,dir:g}of p){let{stdout:b,exitCode:C}=await yN(u,g);for(let T of b.split(/\r?\n/))T.trim()&&console.log(`${m} ${gN(T,o,a)}`);C!==0&&(l=!0)}l&&process.exit(1);let h=[n.code&&"code.tsx",n.server&&"server.ts"].filter(Boolean).join(", ");console.error(c?`\u2713 type-checks (${h}) \u2014 see the naming warning above`:`\u2713 no issues (${h})`)}function ek(t,e){for(let n of t)for(let r of n.message.split(`
|
|
2525
|
+
`))console.log(`${e} ${r}`);return t.length>0}function gN(t,e,n){return t.replace(/\b(code\.tsx|server\.ts)\((\d+),(\d+)\)/g,(r,s,i,o)=>`${e}(${Number(i)+n(s)-1},${o})`)}function yN(t,e){return new Promise(n=>{let r=fN(process.execPath,[t,"--noEmit"],{cwd:e}),s="";r.stdout?.on("data",i=>{s+=i.toString()}),r.stderr?.on("data",i=>{s+=i.toString()}),r.on("close",i=>n({stdout:s,exitCode:i??1}))})}var bN=hN(import.meta.url);function wN(t){let e=r=>{try{let s=bN.resolve("typescript/package.json",{paths:r}),i=We.join(We.dirname(s),"lib","tsc.js");return mN(i)?i:void 0}catch{return}},n=e(t);if(n)return n;try{let r=pN("npm root -g",{encoding:"utf8"}).trim();return e([r])}catch{return}}At();ma();Ks();async function nk(t,e){let{bulb:n}=await rt(t),r=hr(n);if(En(t)){console.log("remembered-trusted \u2014 runs with filesystem / AI / server.ts automatically (`typebulb untrust` to revoke)."),r&&console.log(` (it uses ${r})`);return}r?(console.log(`This bulb appears to use ${r}; it runs Restricted unless you grant trust:`),console.log(` ${e}`)):console.log("No privileged capability detected \u2014 runs Restricted by default. (A clean scan is a hint, not a guarantee.)")}Ks();import*as Ti from"path";async function rk(t,e){if(!t){e||(console.error("Usage: typebulb untrust <file.bulb.md>"),process.exit(1));let r=$d();if(!r.length){console.log("No bulbs are remembered as trusted.");return}console.log("Trusted bulbs (run with fs/AI/server.ts without --trust):");for(let s of r)console.log(` ${s}`);return}let n=Ti.resolve(t);n.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1));try{mr(n,e)}catch(r){console.error(r.message),process.exit(1)}console.log(e?`Trusted ${Ti.basename(n)} \u2014 runs with fs / AI / server.ts (no --trust needed).`:`Untrusted ${Ti.basename(n)} \u2014 runs Restricted.`),console.log(` ${n}`)}Ie();import*as ok from"readline";Xd();function Ep(t){let e=n=>r=>t?`\x1B[${n}m${r}\x1B[0m`:r;return{lit:e("38;5;70"),litLink:e("4;38;5;70"),brand:e("38;5;135")}}var vN=5e3,Ml=()=>Math.round(performance.now()),sk=t=>t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`;async function ak(t){let e=NS(process.cwd()),n=Ml();if("ambiguous"in e){let r=await SN(t,e.ambiguous);return r?ik(t,r,{boot:n,from:Ml()}):kN(t,e.ambiguous)}return ik(t,e.name,{boot:n,from:Ml()})}async function ik(t,e,n){let r,s;try{r=await Us(e)}catch(p){s=p instanceof Error?p.message:String(p)}let i=Ml()-n.from,{lit:o,litLink:a,brand:l}=Ep(process.stdout.isTTY===!0),c=[" Read the authoring skill before writing a bulb:",` \u2022 ${o(Vs())}`],f=r?[` Agent mirror (${e}) is live\u{1F4A1}`,` ${o("\u25CF")} ${a(r.url)}`," Inline bulbs render live here."," Agents:",` Reusable app/tool \u2192 write a ${o(".bulb.md")}`," Show something inline \u2192 emit an inline bulb"," emit it with no .bulb.md draft first",...e==="codex"?[" verify it this turn \u2014 foreground-wait, bounded:",` \u2022 ${o('typebulb wait agent --match "[inline <name>" --timeout 120')}`," via exec_command; while it still runs,"," poll it with write_stdin until it exits"]:[e==="pi"?" arm a wait for its render verdict \u2014 run it plainly:":" background a wait for its render verdict:",` \u2022 ${o('typebulb wait agent --match "[inline <name>"')}`],...c," End this reply with the mirror link above"," \u2022 easy to miss the link mid-message"]:[` The mirror did not start (${s})`,` \u25CF Start it manually: ${o(`npx typebulb agent:${e}`)}`," Agents:",...c],d=n.boot+i>vN?[` slow launch: boot ${sk(n.boot)} \xB7 mirror ${sk(i)}`]:[],u=[` ${l(`typebulb v${t}`)}`,...d,...f,""];process.stdout.write(u.join(`
|
|
2526
2526
|
`)+`
|
|
2527
|
-
`)}async function
|
|
2527
|
+
`)}async function SN(t,e){if(!process.stdin.isTTY||!process.stdout.isTTY)return;let{lit:n,brand:r}=Ep(!0),s=[` ${r(`typebulb v${t}`)}`," More than one agent harness is available here.",...e.map((o,a)=>` ${n(String(a+1))}) ${o}`),""];process.stdout.write(s.join(`
|
|
2528
2528
|
`)+`
|
|
2529
|
-
`);let i=
|
|
2529
|
+
`);let i=ok.createInterface({input:process.stdin,output:process.stdout});try{let o=(await new Promise(l=>i.question(" Open which? [1]: ",l))).trim();if(o==="")return e[0];let a=Number(o);return Number.isInteger(a)&&a>=1&&a<=e.length?e[a-1]:e.find(l=>l===o.toLowerCase())}finally{i.close()}}function kN(t,e){let{lit:n,brand:r}=Ep(process.stdout.isTTY===!0),s=[` ${r(`typebulb v${t}`)}`," More than one agent harness is available here."," Open the mirror for the one you want:",...e.map(i=>` \u2022 ${n(`npx typebulb agent:${i}`)}`),""];process.stdout.write(s.join(`
|
|
2530
2530
|
`)+`
|
|
2531
|
-
`)}
|
|
2532
|
-
`+e)}function
|
|
2531
|
+
`)}et();An();async function lk(t){be(t);let e=await wt();if(e.length>0){console.log(Gb(e,process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL));return}if(!Ld()){console.log("No AI provider keys found in this directory's .env, and no local Ollama server detected."),console.log("Set one of these to use a cloud model with tb.ai:");for(let[n,r]of Object.entries(gr))console.log(` ${r.padEnd(20)} (${n})`);console.log("\u2026or start Ollama (http://localhost:11434, or set OLLAMA_HOST) for local models. Then re-run `typebulb models`.");return}console.log("Couldn't fetch the model catalog (offline?). tb.ai still works with any valid provider/model id for your keys.")}te();function ck(t){t?.trim()||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1));let e=nr(t);e||(console.error(`'${t}' has no slug \u2014 a bulb name needs at least one letter or digit.`),process.exit(1)),console.log(e)}je();import*as fk from"path";import{valid as dk,lt as EN}from"semver";Ie();var it={connected:"[page] connected",disconnected:"[page] disconnected",closed:t=>`[page] closed: ${t}`},Ap=3e3,uk=1e4,xN=2500,Dl=class{attached=new Set;leaving=new Set;arrivalWaiters=new Set;goneWaiters=new Set;arrivalSubs=[];settledEmpty;dropAt=0;get count(){return this.attached.size}get lastDropAt(){return this.dropAt}[Symbol.iterator](){return this.attached[Symbol.iterator]()}add(e,n){this.attached.add(e);for(let s of[...this.arrivalWaiters])s(!0);let r={page:e,firstAttach:n,count:this.attached.size};for(let s of this.arrivalSubs)s(r)}closing(e){this.attached.delete(e)&&this.leaving.add(e)}dropped(e){if(this.leaving.delete(e)){this.drainIfGone();return}if(!this.attached.delete(e))return;let n=this.dropAt=Date.now();setTimeout(()=>{this.attached.size===0&&this.dropAt===n&&this.settledEmpty?.()},Ap).unref()}async closeAll(e){let n=[...this.attached];if(!n.length)return{told:0,gone:0};await Promise.all(n.map(s=>s.close(e).catch(()=>{}))),await this.whenGone(n,xN);let r=n.filter(s=>!this.leaving.has(s)).length;for(let s of n)this.leaving.delete(s);return{told:n.length,gone:r}}whenArrives(e){return this.attached.size>0?Promise.resolve(!0):e>0?new Promise(n=>{let r=i=>{clearTimeout(s),this.arrivalWaiters.delete(r),n(i)},s=setTimeout(()=>r(!1),e);s.unref(),this.arrivalWaiters.add(r)}):Promise.resolve(!1)}onArrival(e){this.arrivalSubs.push(e)}onSettledEmpty(e){this.settledEmpty=e}whenGone(e,n){return e.some(r=>this.leaving.has(r))?new Promise(r=>{let s=()=>{e.some(o=>this.leaving.has(o))||(clearTimeout(i),this.goneWaiters.delete(s),r())},i=setTimeout(()=>{this.goneWaiters.delete(s),r()},n);i.unref(),this.goneWaiters.add(s)}):Promise.resolve()}drainIfGone(){for(let e of[...this.goneWaiters])e()}};aa();function AN(t,e,n,r){if(/^\d+$/.test(e))return t.find(i=>i.pid===parseInt(e,10));let s=e==="agent"?t.filter(ye):t.filter(i=>i.agent===e);if(s.length){if(!n)return s[0];let i=s.filter(o=>dr(o,n));return r&&i.find(o=>o.agent===r)||i[0]}return t.find(i=>se(i.file)===se(e))}var sn=t=>t.agent??fk.basename(t.file);function pk(t){return t===Ce?!1:t&&dk(t)&&dk(Ce)?EN(t,Ce):!0}function TN(t){return t===Ce?"":t?pk(t)?` STALE runtime v${t} (this CLI is v${Ce} \u2014 relaunch to update)`:` runtime v${t} (newer than this CLI's v${Ce})`:" STALE runtime (predates the version stamp \u2014 relaunch to update)"}function CN(t,e){return e===void 0?" pages ?":e>0?` ${e} page${e===1?"":"s"}`:ye(t)?" NO PAGE (no tab open on it)":" NO PAGE (nothing of it is running)"}function hk(t,e,n){t.forEach((r,s)=>e(` ${r.url} pid ${r.pid} ${r.trust?"trusted":"restricted"}${n?CN(r,n[s]):""}${TN(r.version)} ${r.file}`))}async function Cp(t,e){if(!t.length){console.log("No running bulb servers.");return}let n=await Promise.all(t.map(Ed));console.log("Running bulb servers:"),hk(t,r=>console.log(r),n),console.log(`
|
|
2532
|
+
`+e)}function Bl(t,e,n,r,s){let i=AN(t,e,r,s);if(i)return i;console.error(`No running server for '${e}'.`),t.length?(console.error(`Running servers (try \`typebulb ${n} <file|pid>\`):`),hk(t,o=>console.error(o))):console.error("No bulb servers are running."),process.exit(1)}async function mk(t,e){if(!t){e.clear&&(console.error("Specify which server to clear: typebulb logs --clear <file|pid>"),process.exit(1)),await Cp(await G(process.cwd()),"Run `typebulb logs <file|pid>` to print one server's console.");return}let n=Bl(await G(),t,"logs",process.cwd(),st());if(e.clear){yd(n.pid),console.log(`Cleared log for ${sn(n)} (pid ${n.pid}).`);return}let r=Qe(n.pid),s=r.text;if(e.run!==void 0?(s=wd(s,e.run),s||console.error(e.run==="latest"?"No output in the latest run yet (the server has logged nothing since its last reload).":`No output for run ${e.run} (it hasn't started, or was trimmed from the log).`)):!s&&!e.follow&&console.error("Log is empty \u2014 this server has logged nothing yet."),e.lines&&e.lines>0){let i=s.split(`
|
|
2533
2533
|
`);i.length&&i[i.length-1]===""&&i.pop(),s=i.slice(-e.lines).join(`
|
|
2534
2534
|
`)}if(process.stdout.write(s),s&&!s.endsWith(`
|
|
2535
2535
|
`)&&process.stdout.write(`
|
|
2536
|
-
`),e.follow&&e.run===void 0){let i=r.offset,o=setInterval(()=>{let l=
|
|
2537
|
-
`);b=k.pop()??"";let
|
|
2538
|
-
`):T)}catch(
|
|
2539
|
-
`).trimEnd()}function
|
|
2536
|
+
`),e.follow&&e.run===void 0){let i=r.offset,o=setInterval(()=>{let l=Qe(n.pid,i);i=l.offset,l.text&&process.stdout.write(l.text)},500),a=()=>{clearInterval(o),process.exit(0)};process.on("SIGINT",a),process.on("SIGTERM",a),await new Promise(()=>{})}}var ON=t=>new Promise(e=>setTimeout(e,t));async function gk(t,e){if(!t){Cp(await G(process.cwd()),"Run `typebulb wait <file|pid>` to block until one logs a new line.");return}let n=Bl(await G(),t,"wait",process.cwd(),st()),r=e.wake?await PN():void 0,s=process.env.TYPEBULB_WAIT_SHIM==="1",i=process.env.TYPEBULB_WAIT_FOLLOW==="1",o=s||i,a=e.timeoutSec??1800,l=e.match??"",c=Qe(n.pid).offset,f=i?void 0:ca(n.pid,l)??(l?ca(n.pid):void 0),d=i?c:f!==void 0&&f<=c?f:l?0:c,u=Date.now()+a*1e3,p=ye(n)?1e4:1e3,h=2e3,m=!ye(n)&&!i,g,b="",C=[],T="",E=0,$=!1;for(;;){let O=d>=c,P=Qe(n.pid,d);if(d=P.offset,P.text){b+=P.text;let k=b.split(`
|
|
2537
|
+
`);b=k.pop()??"";let L=!1;for(let j of k)j.trim()&&(m&&O&&j.startsWith(it.disconnected)&&(L=!0),!(e.match&&!j.includes(e.match))&&(console.log(j),C.push(j),!i&&(g??=Date.now()+p,ye(n)&&(j.includes("] compile error")||j.includes("] runtime error"))&&(g=Math.min(g,Date.now()+h)))));if(L&&!g){T=`the last page of ${sn(n)} closed while waiting \u2014 a bulb runs in its page, so nothing can log ${e.match?`'${e.match}'`:"anything"} now`,console.error(T),E=3;break}}if(g&&Date.now()>=g)break;if(!o&&!g&&Date.now()>=u){T=`timeout: no ${e.match?`line matching '${e.match}'`:"new output"} from ${sn(n)} within ${a}s`,console.error(T),E=2;break}if(!Wt(n.pid)){g||(T=`server ${sn(n)} (pid ${n.pid}) exited while waiting`,console.error(T),E=3,$=!0);break}await ON(400)}if(r){console.error(`detected ${new Date().toISOString()}`);try{await r.adapter.wake(r.sessionId,"typebulb_wait",C.length?C.join(`
|
|
2538
|
+
`):T)}catch(O){console.error(`Not delivered: ${O instanceof Error?O.message:O}`),process.exit(4)}console.error(`accepted ${new Date().toISOString()}`)}$&&process.exit(3),i||js(n.pid,d,l),process.exit(E)}async function PN(){let t=st(),e=t?qr()[t]?.():void 0,n=e?.wake?e.callerSessionId?.(process.cwd()):void 0;(!e||!n)&&(console.error(e?.wake?"Can't --wake: your own session couldn't be identified in this project, and a wake goes to no other.":`--wake needs a harness that wakes through its host (here: ${t??"none detected"}); on Claude Code, a background wait already wakes you.`),process.exit(1));let r=await e.wakeRoute(n);return r.error&&(console.error(`Can't --wake: ${r.error}.`),process.exit(1)),{adapter:e,sessionId:n}}function yk(t,e){if(e==="killed")return` \u2014 forced (${pk(t.version)?`its runtime ${t.version?`v${t.version} `:""}predates the stop route`:"it did not answer"}); a page it opened may still be open`;let n=[];return e.closed&&n.push(`closed ${e.closed} page${e.closed===1?"":"s"}`),e.stuck&&n.push(`${e.stuck} did not close`),n.length?` \u2014 ${n.join(", ")}`:""}async function bk(t){if(!t){await Cp(await G(process.cwd()),"Run `typebulb stop <file|pid>` to stop one.");return}let e=Bl(await G(),t,"stop",process.cwd(),st()),n=await bt(e);console.log(`Stopped ${sn(e)} (pid ${e.pid}, ${e.url}).${yk(e,n)}`)}async function wk(t){let e=await Tp(t),n=t==="global"?"server":t==="agent"?"mirror":"bulb";if(!e.length){console.log(t==="global"?"No running bulb servers.":`No running ${n}s for this project.`);return}let r=await Promise.all(e.map(s=>bt(s)));console.log(`Stopped ${e.length} ${n}${e.length===1?"":"s"}:`),e.forEach((s,i)=>console.log(` ${s.url} pid ${s.pid} ${sn(s)}${yk(s,r[i])}`))}async function Tp(t){let e=process.cwd(),n=t==="agent"?st():void 0;return t==="global"?await G():t==="bulbs"?await G(e):(await G()).filter(r=>dr(r,e)&&(!n||r.agent===n))}async function vk(t,e){let n=process.cwd(),r=t?[Bl(await G(),t,"restart",n,st())]:e?await Tp(e):[...await G(n),...await Tp("agent")];if(!r.length){console.log(e==="global"?"No running bulb servers.":"No running bulbs or mirrors for this project.");return}console.log(`Restarting on v${Ce}:`);for(let s of r){let i=s.version?`v${s.version}`:"unknown version";try{let o=ye(s)?(await bt(s,"keep"),await Us(s.agent,s.cwd??n)):await Sn(s.file,{cwd:s.cwd??n,open:!1,trust:s.trust,noTrust:!s.trust,mode:s.mode,watch:s.watch,replace:s.replace});console.log(` ${o.url} ${sn(s)} ${i} \u2192 v${Ce}`)}catch(o){console.log(` ${s.url} ${sn(s)} failed: ${o instanceof Error?o.message:o}`),process.exitCode=1}}}Ie();je();bn();import*as jl from"path";import*as Sk from"http";import{mkdir as _N,writeFile as RN}from"fs/promises";async function Kr(){let t=[];for await(let e of process.stdin)t.push(e);return Buffer.concat(t).toString("utf-8")}function Ci(t){return(t.charCodeAt(0)===65279?t.slice(1):t).replace(/\r\n/g,`
|
|
2539
|
+
`).trimEnd()}function IN(t,e){return new Promise((n,r)=>{let s=new URL(t),i=Sk.request({hostname:s.hostname,port:s.port,path:s.pathname+s.search,method:"POST",headers:{"Content-Type":"text/plain","Content-Length":Buffer.byteLength(e)}},o=>{let a="";o.setEncoding("utf8"),o.on("data",l=>{a+=l}),o.on("end",()=>n({status:o.statusCode??0,text:a}))});i.setTimeout(0),i.on("error",r),i.end(e)})}var $N=t=>{let e=Math.round((Date.now()-t)/6e4);return e<1?"moments ago":e<60?`${e}m ago`:`${Math.round(e/60)}h ago`};async function kk(t,e,n=0){e==="-"&&(e=Ci(await Kr()));let r=e!==void 0&&e.startsWith("tb:");r&&n<=0&&(n=mp);let s=e!==void 0&&/^tb:(click|set)( |$)/.test(e),i=jl.resolve(t),o=vn(await G(),i)[0];if(!o){let h=(await yn(process.cwd()))(i);console.error(h?`No running server for '${t}' \u2014 it last ran ${$N(h)}. Relaunching reuses the same URL (a stale tab is one reload from live): npx typebulb ${t}`:`No running server for '${t}'. Start it first: npx typebulb ${t}`),process.exit(1)}let a=async h=>{let m=[h>0?`reply=${h}`:"",s?"solo=1":"","open=1"].filter(Boolean).join("&"),g=await IN(`${o.url}/__send${m?`?${m}`:""}`,e??"");(g.status<200||g.status>=300)&&(console.error(`send failed: HTTP ${g.status} from ${o.url}/__send`),process.exit(1));try{return JSON.parse(g.text)}catch{return{}}},l={},c=Date.now();try{l=await a(n)}catch(h){console.error(`send failed: ${h instanceof Error?h.message:String(h)}`),process.exit(1)}let f=l.clients??0,d=`${f} page${f===1?"":"s"}`;if(l.refused&&(console.error(`Actuation needs exactly one connected page; ${d} are open on ${o.url} \u2014 the reset is \`typebulb stop ${t}\` then relaunch.`),process.exit(1)),f===0){let h=l.droppedMsAgo,m=l.opening==="none"?" and no agent mirror page is open to open one through":"",g=l.opening==="unreached"?` \u2014 the page was opened ${l.via?`in VS Code via ${l.via}`:"in your browser"} and never attached; is the browser it opened in still there?`:h!==void 0?` \u2014 a page disconnected ${Math.round(h/1e3)}s ago and hasn't reconnected${m}; reload it, or open ${o.url}`:` \u2014 no page has ever connected${m}; share ${o.url} and arm: typebulb wait ${t} --match "${it.connected}"`;console.error(`No page connected after ${((Date.now()-c)/1e3).toFixed(1)}s, so nothing was delivered${g}`),process.exit(1)}l.opening==="editor"?console.error(`Opened in VS Code via ${l.via}.`):l.opening==="external"&&console.error("Opened in your browser, where the agent mirror is."),console.error(`Sent to ${d}.`);let u=l.results??[],p=l.errors??[];for(let h of p)console.error(`handler error: ${h}`);if(p.length&&process.exit(1),u.length>1&&(console.error(`${u.length} replies from ${d} \u2014 one reply owns stdout: at most one tb.onMessage handler, in one page, may return a value.`),process.exit(1)),u.length===1){if(e!==void 0&&/^tb:png( |$)/.test(e)){let m={};try{m=JSON.parse(u[0])}catch{}typeof m.png!="string"&&(console.error("tb:png replied with an unexpected shape \u2014 an older runtime? (`typebulb logs` lists server versions)"),process.exit(1));let g=hb(i);await _N(jl.dirname(g),{recursive:!0}),await RN(g,Buffer.from(m.png,"base64"));let b=[m.via?`inside "${m.via}"`:"",m.backdrop?`backdrop ${m.backdrop}`:""].filter(Boolean);console.error(`canvas ${m.width}\xD7${m.height} \u2192 PNG${b.length?` (${b.join("; ")})`:""}`),console.log(g);return}let h;try{h=JSON.parse(u[0])}catch{h=void 0}console.log(typeof h=="string"?h:u[0])}else l.timedOut&&(r&&(console.error(`No reply to '${e}' within ${n/1e3}s \u2014 reload the page and retry.`),process.exit(1)),console.error(`(no reply within ${n/1e3}s \u2014 slow work needs a larger --wait=ms; a reply that NEVER comes is a done-promise that missed an exit, or a blocked main thread: tb:snapshot runs no page code, so its silence too means blocked)`))}Ga();kf();te();import*as xk from"fs/promises";async function Ek(t,e){let n=await xk.readFile(t,"utf-8"),r=Wn(n),s=de[e].path,i=r.files.get(s);i||(console.error(i===void 0?`No **${s}** block in ${t}`:`The **${s}** block in ${t} is empty`),process.exit(2)),process.stdout.write(i.endsWith(`
|
|
2540
2540
|
`)?i:i+`
|
|
2541
|
-
`)}te();import*as
|
|
2542
|
-
`);if(i.wake){console.error(`detected ${new Date().toISOString()}`);try{await i.wake(o,
|
|
2541
|
+
`)}te();import*as Oi from"fs/promises";async function Ck(t,e){let n=await Oi.readFile(t,"utf-8"),r=[];for(let{kind:i,source:o}of e){let a;try{a=o==="-"?await Kr():await Oi.readFile(o,"utf-8")}catch(l){Tk(`Cannot read ${i}'s source: ${l instanceof Error?l.message:String(l)}`)}r.push({kind:i,content:Ci(a),label:o==="-"?"stdin":o})}let s;try{s=NN(n,r)}catch(i){Tk(`${t}: ${i instanceof Error?i.message:String(i)}`)}for(let i of s.upToDate)console.log(`${de[i].path}: already up to date`);if(s.written.length){await Oi.writeFile(t,s.text);for(let i of s.written)console.log(i.action==="removed"?`${de[i.kind].path}: removed (${i.label} is empty)`:`${de[i.kind].path}: ${i.action} from ${i.label} (${i.chars.toLocaleString()} chars)`)}}function NN(t,e){let n=Wn(t),r=t,s=[],i=[];for(let{kind:o,content:a,label:l}of e){let c=de[o].path,f=n.files.get(c);if(!a){if(f===void 0){i.push(o);continue}r=Ak(rh(r,o),r,c),s.push({kind:o,action:"removed",chars:0,label:l});continue}if(f!==void 0&&Ci(f)===a){i.push(o);continue}r=Ak(zr(r,o,a),r,c),s.push({kind:o,action:f===void 0?"created":"replaced",chars:a.length,label:l})}return{text:r,written:s,upToDate:i}}function Ak(t,e,n){if(t===e)throw new Error(`the **${n}** block's fence is unterminated; refusing to rewrite inside it`);return t}function Tk(t){console.error(t),process.exit(1)}et();gl();dl();Mr();function Op(){let t=qr(),e=st();return{caller:e,adapters:(e?[e]:Object.keys(t)).map(n=>t[n]()).filter(n=>n.listChildren)}}async function Pk(t,e,n){be(e);let{caller:r,adapters:s}=Op();if(!s.length){console.error(`Sub-agent status isn't supported for ${r} sessions.`),process.exitCode=1;return}let i;for(let o of s){let{sessionId:a,cwd:l}=gi(o,process.cwd());if(!t){let c=a?ml(o,l,a):hl(o,l).next().value;if(!c?.children.length){if(a){en(a,n),console.log("No sub-agents in this session yet.");return}continue}en(a??c.sessionId,n);let{reports:f,files:d}=await Dn(o,l,c);console.log(Uv(c.sessionId,f,d,Date.now()));return}for(let c of hl(o,l)){i??=c;let f=Hv(c,t);if(f.length){if(f.length>1){console.error(`Several agents match "${t}"; name one by its id:`);for(let d of f)console.error(` ${Ok(d)}`);process.exitCode=1;return}en(a??c.sessionId,n),console.log(Dv((await Dn(o,l,c,f[0].id)).reports[0],Date.now()));return}}}if(!i){console.log("No sub-agents in this project's sessions.");return}console.error(`No agent matches "${t}". The agents of session ${i.sessionId}:`);for(let o of i.children)console.error(` ${Ok(o)}`);process.exitCode=1}var Ok=t=>`${t.id} ${ol(t).padEnd(7)} ${Tt(t)}`;et();je();Ie();gl();dl();import{mkdirSync as LN,readFileSync as _p,writeFileSync as Ik,rmSync as _k}from"fs";import{join as Ul}from"path";var MN=1e4,DN=720*6e4,Rk="typebulb_babysit";async function $k(t,e){be(t);let{caller:n,adapters:r}=Op(),s=r.map(p=>({adapter:p,...(p.wake?gi:Kv)(p,process.cwd())})).find(p=>p.sessionId);if(!s?.sessionId)return Pp(r.length?r.some(p=>p.wake)?"Can't babysit: your own session couldn't be identified in this project, and a wake goes to no other.":"No session to babysit in this project.":`Babysitting sub-agents isn't supported for ${n} sessions.`);let{adapter:i,sessionId:o,cwd:a}=s;if(en(o,e),i.wake){let p=await i.wakeRoute(o);if(p.error)return Pp(`Can't babysit: ${p.error}.`)}let l=Ul(Re(),"babysit"),c=Ul(l,`${o}.json`);if(!BN(Ul(l,`${o}.lock`)))return Pp("A babysit is already watching this session.");let f=[];try{f=JSON.parse(_p(c,"utf8"))}catch{}let d=p=>{try{Ik(c,JSON.stringify(p))}catch{}};console.error(`Babysitting the sub-agents of session ${o}: this exits with a line when one needs attention.`);let u=Date.now()+DN;for(;Date.now()<u;){i.sessionEnded?.(o,a)&&Fl(3,"The session this babysits has ended.");let{reports:p}=await Dn(i,a,ml(i,a,o)),h=qv(p,Date.now(),!!i.sessionsWorking?.(a)?.has(o),en(o)),m=[...h].filter(([g])=>!f.includes(g));if(!m.length)f=[...h.keys()],d(f);else{let g=m.map(([,b])=>b).join(`
|
|
2542
|
+
`);if(i.wake){console.error(`detected ${new Date().toISOString()}`);try{await i.wake(o,Rk,g)}catch(b){d([...h.keys()].filter(C=>!m.some(([T])=>T===C))),console.log(g),Fl(4,`Not delivered: ${b instanceof Error?b.message:b}`)}console.error(`accepted ${new Date().toISOString()}`)}d([...h.keys()]),console.log(g),Fl(0)}await new Promise(g=>setTimeout(g,MN))}i.wake&&await i.wake(o,Rk,"typebulb babysit stopped after 12 hours with nothing to report; run it again to keep watching.").catch(()=>{}),Fl(2,"Nothing needed attention; gave up.")}function Pp(t){console.error(t),process.exitCode=1}function Fl(t,e){e&&console.error(e),process.exit(t)}function BN(t){try{LN(Ul(t,".."),{recursive:!0})}catch{}for(let e=0;e<2;e++)try{return Ik(t,String(process.pid),{flag:"wx"}),process.on("exit",()=>{try{Number(_p(t,"utf8"))===process.pid&&_k(t)}catch{}}),!0}catch(n){if(n.code!=="EEXIST")return!0;let r=0;try{r=Number(_p(t,"utf8"))}catch{}if(r&&r!==process.pid&&Wt(r))return!1;try{_k(t)}catch{}}return!1}et();At();te();ma();import*as an from"fs/promises";import*as qn from"path";import{EventEmitter as oL}from"events";Kt();te();import{Hono as WN}from"hono";import{serve as KN}from"@hono/node-server";import{streamSSE as HN}from"hono/streaming";import*as $p from"fs/promises";import zN from"open";Tr();ii();Ar();import*as Rp from"fs/promises";import*as Pi from"path";var ql=class{async get(e){let n=tt(e),r=Pi.join(si,n+".bin"),s=Pi.join(si,n+".json");try{let[i,o]=await Promise.all([Rp.readFile(r),Rp.readFile(s,"utf8")]),a=JSON.parse(o);return{body:i,contentType:a.contentType,cacheControl:a.cacheControl}}catch{return}}async set(e,n){await ne();let r=tt(e),s=Pi.join(si,r+".bin"),i=Pi.join(si,r+".json"),o={url:e,contentType:n.contentType,cacheControl:n.cacheControl};await Promise.all([Fe(s,n.body),Fe(i,JSON.stringify(o))])}};var Nk=`
|
|
2543
2543
|
const CSS = '\\n' +
|
|
2544
2544
|
/* The agent mirror's token set, verbatim (agents/core/client/styles.css) \u2014 one system across CLI
|
|
2545
2545
|
chrome: app chrome sits on --panel, content wells paint --veil, grays ride one neutral tint.
|
|
@@ -2922,22 +2922,22 @@ export function runInference(ctx) {
|
|
|
2922
2922
|
showConfirm();
|
|
2923
2923
|
document.body.appendChild(host);
|
|
2924
2924
|
}
|
|
2925
|
-
`;Or()
|
|
2926
|
-
${u}`:"";return w.text(`Forbidden: this capability requires --trust.${D}`,403)}await A()},
|
|
2927
|
-
`+Y.slice(-4e3)),new
|
|
2928
|
-
Shutting down...`),(m?.pages??(
|
|
2925
|
+
`;Or();Ie();An();Ta();Kt();import{stream as jN}from"hono/streaming";var FN="X-TB-Stream";function _i(t){return t instanceof Ne?{message:t.message,code:t.code,retryable:t.retryable}:{message:t instanceof Error?t.message:"Unknown error",code:"unknown",retryable:!1}}function Jl(t,e){return t.header("Content-Type","application/x-ndjson; charset=utf-8"),t.header("Cache-Control","no-cache"),t.header(FN,"1"),jN(t,async n=>{let r=e[Symbol.asyncIterator]();n.onAbort(()=>{r.return?.()});try{for(;;){let{done:s,value:i}=await r.next();if(s)break;await n.writeln(JSON.stringify({type:"chunk",value:i}))}}catch(s){await n.writeln(JSON.stringify({type:"error",error:_i(s)}))}finally{try{await r.return?.()}catch{}}})}var Wl={log:(...t)=>console.log(...t)};function Kl(t,e){let n=t?.[e]??(Object.hasOwn(Wl,e)?Wl[e]:void 0);return typeof n=="function"?n:void 0}function Hl(t){return t.constructor?.name==="AsyncGeneratorFunction"}hf();var UN=/^\/(v\d+\/|stable\/|node\/|gh\/|@[^/]+\/[^@/]+@|[^@/]+@)/,qN=/[?&]target=/,JN=/^\/(?:@[^/]+\/)?[^/@]+\/[^/]+/;function Lk(t,e=""){return UN.test(t)?!0:JN.test(t)&&qN.test(e)}var YN="127.0.0.1",VN=new Set(["localhost","127.0.0.1","::1"]),Fk=(t,e)=>!!t&&typeof t=="object"&&e in t,Mk=t=>{let e={};return Array.isArray(t.data)&&(e.data=t.data),Fk(t,"insight")&&(e.insight=t.insight),e},Dk=8*1024*1024,GN=0;function XN(t){if(t)try{return new URL(t.includes("://")?t:`http://${t}`).hostname}catch{return}}function Uk(t){let e=XN(t);return!!e&&VN.has(e)}function QN(t){try{let e=new URL(t);return(e.protocol==="http:"||e.protocol==="https:")&&Uk(e.host)}catch{return!1}}function ZN(t){return!!t&&/\bCode\/\d/.test(t)&&/\bElectron\//.test(t)}function eL(t,e){if(!e)return!1;try{return new URL(t).host===e}catch{return!1}}function Ri(t){return t instanceof Error?t.message:"Unknown error"}var Bk=t=>t.how==="editor"||t.how==="unreached"?t.via:void 0,tL=2e3;async function qk(t){let{getHtml:e,basePath:n,fsBase:r,port:s,reloadEmitter:i,sendChannel:o,getServerExports:a,getBulbBlocks:l,saveInferenceResult:c,localOverride:f,trusted:d=!1,trustHint:u,staticAssets:p,bulbAssets:h,sourceFile:m,bulbKey:g,onStop:b}=t,C=`${process.pid}-${++GN}-${Date.now()}`,T=r??n,E=new WN;E.use("*",async(w,A)=>{if(!Uk(w.req.header("host")))return w.text("Forbidden: untrusted Host",403);await A()}),E.use("*",async(w,A)=>{await A(),w.res.headers.set("Cross-Origin-Opener-Policy","same-origin"),w.res.headers.set("Cross-Origin-Embedder-Policy","credentialless")});let $=[["/__fs/*","the filesystem"],["/__api/*","server-side code (server.ts)"],["/__ai","AI (your API keys)"],["/__infer","AI (your API keys)"],["/__infer-save","the filesystem"]],O=async(w,A)=>{if(!d){let R=new URL(w.req.url).pathname,M=$.find(([K])=>K.endsWith("/*")?R.startsWith(K.slice(0,-2)):R===K)?.[1]??"server-side code (server.ts)";Sd(process.pid,M);let D=u?`
|
|
2926
|
+
${u}`:"";return w.text(`Forbidden: this capability requires --trust.${D}`,403)}await A()},P=async(w,A)=>{let R=w.req.header("sec-fetch-site");if(R){if(R!=="same-origin")return w.text(`Forbidden: ${R} request`,403)}else{let M=w.req.header("origin");if(M&&!eL(M,w.req.header("host")))return w.text("Forbidden: cross-origin request",403)}await A()};for(let[w]of $)E.use(w,O),E.use(w,P);E.use("/__log",P),E.post("/__log",async w=>{try{let{args:A}=await w.req.json();console.log(...A||[])}catch{}return w.json({ok:!0})});let k=new Dl,L=new Set,j=new Set,Q=Date.now();k.onArrival(({page:w,firstAttach:A,count:R})=>{o&&R===1&&console.log(it.connected),A&&R>1&&w.close("yielded").catch(()=>{})}),o&&k.onSettledEmpty(()=>console.log(it.disconnected));let U,ie=0,oe=async w=>{let A=Math.max(w.fresh?0:Q,k.lastDropAt);if(await k.whenArrives(Ap-(Date.now()-A)))return{how:"attached"};if(Date.now()-ie<tL)return{how:"none"};let R=`http://localhost:${s}#tb-relay`,M=await xd(R,n),D;return M?.where==="editor"?D={how:"editor",via:M.via}:(w.external==="force"||w.external==="follow"&&M?.where==="external")&&(await zN(R),D={how:"external"}),D?await k.whenArrives(uk)?D:{how:"unreached",via:Bk(D)}:(ie=Date.now(),{how:"none"})},ge=w=>k.count>0?Promise.resolve({how:"attached"}):U??=oe(w).finally(()=>{U=void 0});if(o){let w=0,A=new Map;E.use("/__send",P),E.post("/__send",async R=>{let M="";try{M=await R.req.text()}catch{}let D=Number(R.req.query("reply"))||0,K=k.count===0&&R.req.query("open")!==void 0?await ge({external:"follow",fresh:!1}):void 0,J=k.count,Ke=J===0&&k.lastDropAt?Date.now()-k.lastDropAt:void 0,Y={clients:J,droppedMsAgo:Ke,...K?{opening:K.how,via:Bk(K)}:{}};if(R.req.query("solo")!==void 0&&J!==1)return R.json({...Y,refused:J>1});if(J===0)return R.json(Y);let ue=ln=>{for(let Rt of k)Rt.send(ln).catch(()=>{})};if(D<=0)return ue({payload:M}),R.json(Y);let Pe=++w,Hr=await new Promise(ln=>{let Rt={expected:J,received:0,results:[],errors:[],finish:Vl=>{clearTimeout(Yl),A.delete(Pe),ln({results:Rt.results,errors:Rt.errors,timedOut:Vl})}},Yl=setTimeout(()=>Rt.finish(!0),D);A.set(Pe,Rt),ue({id:Pe,payload:M})});return R.json({...Y,...Hr})}),E.use("/__send-reply",P),E.post("/__send-reply",async R=>{try{let{id:M,results:D,errors:K}=await R.req.json(),J=A.get(M);J&&(J.results.push(...D??[]),J.errors.push(...K??[]),++J.received>=J.expected&&J.finish(!1))}catch{}return R.json({ok:!0})})}E.get("/",w=>w.html(e())),E.post("/__fs/read",async w=>{try{let{path:A}=await w.req.json(),R=await oi(A,T);return new Response(new Uint8Array(R),{headers:{"Content-Type":"application/octet-stream"}})}catch(A){let R=Ri(A);return w.json({error:R},400)}}),E.post("/__fs/write",async w=>{try{let A=w.req.query("path");return A?(await Ja(A,new Uint8Array(await w.req.arrayBuffer()),T),w.json({success:!0})):w.json({error:"Missing path"},400)}catch(A){let R=Ri(A);return w.json({error:R},400)}}),E.post("/__fs/list",async w=>{try{let{path:A}=await w.req.json();return w.json(await Wa(A??".",T))}catch(A){return w.json({error:Ri(A)},400)}}),E.post("/__fs/remove",async w=>{try{let{path:A}=await w.req.json();return await Ka(A,T),w.json({success:!0})}catch(A){return w.json({error:Ri(A)},400)}}),E.post("/__api/:name",async w=>{try{let A=w.req.param("name"),R=Kl(a?.(),A);if(!R)return w.json({error:`API function '${A}' not found`},404);let{args:M}=await w.req.json();if(Hl(R))return Jl(w,R(...M||[]));let D=await R(...M||[]);return w.json({result:D})}catch(A){let R=Ri(A);return w.json({error:R},500)}}),E.post("/__ai",async w=>{try{let{messages:A,system:R,effort:M,provider:D,model:K,webSearch:J,stream:Ke}=await w.req.json();if(!A||!Array.isArray(A)||A.length===0)return w.json({message:"messages array is required",code:"unknown",retryable:!1},400);let Y=vt(D,K);if(typeof Y=="string")return w.json({message:Y,code:"unknown",retryable:!1},400);let ue=await zt(Y,{messages:A,system:R,effort:M,webSearch:J,signal:w.req.raw.signal});if(!ue.ok){let ln=await vr(ue,Y.protocol);return w.json(ln,ue.status)}if(Ke)return Jl(w,On(ue,Y.protocol));let{text:Pe,usage:Hr}=await Sr(ue,Y.protocol);return Pe||console.warn("[tb.ai] Empty response from provider"),w.json({text:Pe,usage:Hr})}catch(A){return w.json(_i(A),500)}}),E.post("/__infer",async w=>{try{let{data:A}=await w.req.json().catch(()=>({})),R=l?.();if(!R?.infer.trim())return w.json({message:"This bulb has no infer.md block.",code:"unknown",retryable:!1},400);let M=vt();if(typeof M=="string")return w.json({message:M,code:"unknown",retryable:!1},400);let D=Array.isArray(A)?A.map(String):[],K=zd(R,D),J=await zt(M,{messages:[{role:"user",content:K}],signal:w.req.raw.signal});if(!J.ok){let Y=await vr(J,M.protocol);return w.json(Y,J.status)}let Ke=(async function*(){let Y="";for await(let Pe of On(J,M.protocol))Pe.kind!=="text"||!Pe.text||(Y+=Pe.text,yield{kind:"delta",text:Pe.text});let ue=Yd(Y);if(ue.parsed===void 0)throw console.warn(`[tb.infer] output not valid JSON after sanitize; raw output (last 4000 chars):
|
|
2927
|
+
`+Y.slice(-4e3)),new Ne("LLM output is not valid JSON","parse_error",!0);ue.fixesApplied.length&&console.warn("[tb.infer] sanitized output, fixes applied:",ue.fixesApplied.join(", ")),yield{kind:"complete",insight:ue.parsed,data:D,fixesApplied:ue.fixesApplied}})();return Jl(w,Ke)}catch(A){return w.json(_i(A),500)}}),E.post("/__infer-save",async w=>{try{if(!c)return w.json({message:"Save is not available for this server.",code:"unknown",retryable:!1},400);let A=Mk(await w.req.json().catch(()=>({})));return Object.keys(A).length?(await c(A.data,Fk(A,"insight")?JSON.stringify(A.insight,null,2):void 0),w.json({ok:!0})):w.json({message:"Nothing to save \u2014 this page holds no runtime state.",code:"unknown",retryable:!1},400)}catch(A){return w.json(_i(A),500)}}),E.get("/__infer-info",w=>{let A=l?.(),R=Yr(A?.config??"").inference,M=jo(A?.data??""),D=!!A?.infer.trim(),K=vt();return typeof K=="string"?w.json({error:K,inference:R,data:M,hasInfer:D}):w.json({provider:K.protocol,model:K.model,inference:R,data:M,hasInfer:D})}),E.use("/__tb-decode",P),E.post("/__tb-decode",async w=>{let{hash:A}=await w.req.json().catch(()=>({})),R=typeof A=="string"?Gd(A):void 0;return w.json(R??{error:"invalid fragment"})}),E.use("/__tb-encode",P),E.post("/__tb-encode",async w=>{let A=Number(w.req.header("content-length"));if(Number.isFinite(A)&&A>Dk)return w.json({hash:""});let R=await w.req.text().catch(()=>"");if(R.length>Dk)return w.json({hash:""});let M;try{M=JSON.parse(R)}catch{return w.json({hash:""})}return w.json({hash:Vd(Mk(M))})}),E.get("/__infer-ui.js",w=>w.body(Nk,200,{"Content-Type":"text/javascript; charset=utf-8"})),E.get("/__models",async w=>{try{let A=await wt();return w.json(A)}catch{return w.json([],200)}}),E.get("/__ai-access",async w=>{try{return w.json(await ba())}catch{return w.json("none",200)}}),m&&E.get("/__source/*",async w=>{let A=await $p.readFile(m,"utf-8").catch(()=>{});return A===void 0?w.text("Not Found",404):new Response(A,{headers:{"Content-Type":"text/plain; charset=utf-8"}})});let Se=["esm.sh","unpkg.com","cdn.jsdelivr.net","cdnjs.cloudflare.com"],ae=new ql;E.get("/proxy/*",async w=>{let A=new URL(w.req.url),M=(A.pathname+A.search).slice(7),D=M.lastIndexOf("https://");return D===-1?w.text("Invalid proxy URL",400):ke(w,M.slice(D))}),f&&jk(E,`/local/${f.name}/`,f.serveDir),p&&jk(E,p.mount,p.dir),h&&E.get("/assets/*",async w=>{let{pathname:A}=new URL(w.req.url),R=A.slice(8),M;try{M=decodeURIComponent(R)}catch{return w.text("Not Found",404)}let D=ah(M);if(D)return w.text(`${D} is not an asset type: a bulb's code and markup live in the bulb; assets are media and data`,403);try{let J=await Jk(M,h.dir,{"Cache-Control":"no-cache"});if(J)return J}catch{return w.text("Not Found",404)}let K=h.remoteBase;return K?w.redirect(K+R,302):w.text("Not Found",404)});async function ke(w,A){let R;try{R=new URL(A)}catch{return w.text("Invalid URL",400)}if(R.protocol!=="https:")return w.text("HTTPS only",400);if(!Se.includes(R.hostname))return w.text("Host not allowed",403);let M=await ae.get(A);if(M)return new Response(M.body,{status:200,headers:Ip(M.contentType,M.cacheControl)});try{let D=await fetch(A,{headers:{Accept:w.req.header("Accept")||"*/*"},redirect:"follow"});if(!D.ok)return w.text(`Upstream ${D.status}`,D.status);let K=D.headers.get("Content-Type")||void 0,J=D.headers.get("Cache-Control")||void 0;if(D.body){let[Ke,Y]=D.body.tee();return(async()=>{try{let ue=await new Response(Y).arrayBuffer();await ae.set(A,{body:Buffer.from(ue),contentType:K,cacheControl:J})}catch{}})(),new Response(Ke,{status:D.status,headers:Ip(K,J)})}return new Response(null,{status:D.status,headers:Ip(K,J)})}catch(D){return w.text(`Proxy fetch failed: ${D instanceof Error?D.message:D}`,502)}}(i||o)&&(E.get("/__reload",w=>HN(w,async A=>{let R=w.req.query("bulb")||void 0;if(g&&R&&R!==g){L.has(R)||(L.add(R),console.log(it.closed("foreign"))),await A.writeSSE({event:"close",data:"foreign"});return}let M=()=>{A.writeSSE({event:"reload",data:""})};i?.on("reload",M);let D=()=>i?.removeListener("reload",M),K=w.req.query("relay")||void 0,J={inEditor:ZN(w.req.header("user-agent")),doc:K,open:Y=>A.writeSSE({event:"open-url",data:Y}),send:Y=>A.writeSSE({event:"message",data:JSON.stringify(Y)}),close:Y=>(D(),k.closing(J),console.log(it.closed(Y)),A.writeSSE({event:"close",data:Y}))},Ke=!!K&&!j.has(K);for(K&&j.add(K),k.add(J,Ke),A.onAbort(()=>{D(),k.dropped(J)}),await A.writeSSE({event:"hello",data:C,retry:ff});!A.aborted;)await A.sleep(3e4)})),E.use("/__open",P),E.post("/__open",async w=>{let A="";try{A=String((await w.req.json()).url??"")}catch{}if(!QN(A))return w.json({error:"a local http URL is required"},400);let R=[...k].find(M=>M.inEditor);return await R?.open(A),w.json({opened:!!R,pages:k.count})})),E.use("/__stop",P),E.post("/__stop",async w=>{if(w.req.header("sec-fetch-site")||w.req.header("origin"))return w.text("Forbidden: browser request",403);let A="close";try{let M=await w.req.json();(M?.pages==="keep"||M?.pages==="close")&&(A=M.pages)}catch{}let R=A==="close"?await k.closeAll("stopped"):{told:0,gone:0};return b&&setTimeout(()=>{b({pages:A})},50),w.json({closed:R.gone,stuck:R.told-R.gone,exiting:!!b})}),E.get("/__pages",w=>w.json({pages:k.count})),E.notFound(async w=>{if(w.req.method!=="GET")return w.text("Not Found",404);let A=new URL(w.req.url);return Lk(A.pathname,A.search)?ke(w,"https://esm.sh"+A.pathname+A.search):w.text("Not Found",404)});let _t=KN({fetch:E.fetch,port:s,hostname:YN});return _t.listening||await new Promise((w,A)=>{let R=M=>A(M);_t.once("error",R),_t.once("listening",()=>{_t.removeListener("error",R),w()})}),{port:s,close:()=>_t.close(),requestPage:ge,closePages:w=>k.closeAll(w),pageCount:()=>k.count}}function Ip(t,e){let n=new Headers;return t&&n.set("Content-Type",t),e&&n.set("Cache-Control",e),n.set("Access-Control-Allow-Origin","*"),n.set("Cross-Origin-Resource-Policy","cross-origin"),n}function jk(t,e,n){t.get(`${e}*`,async r=>{let{pathname:s}=new URL(r.req.url);if(!s.startsWith(e))return r.text("Not Found",404);try{return await Jk(decodeURIComponent(s.slice(e.length)),n)??r.text("Not Found",404)}catch{return r.text("Not Found",404)}})}async function Jk(t,e,n={}){let r=Pr(t,e),s=await $p.readFile(r).catch(()=>{});if(s)return new Response(s,{headers:{"Content-Type":oh(r),...n}})}Ie();bn();async function zl(t){let{port:e,portNote:n,makeServerOptions:r,makeEntry:s,displayName:i,waitTarget:o,stopLog:a}=t,l=`http://localhost:${e}`,c=s(e,l),f=[],d,u=!1,p=async m=>{if(!u){u=!0,console.log(`
|
|
2928
|
+
Shutting down...`),(m?.pages??(ye(c)?"keep":"close"))==="close"&&await d?.closePages("stopped"),d?.close();for(let g of f)try{await g()}catch{}a(),await wn(process.pid),process.exit(0)}},h=await qk({...r(e),onStop:p}).catch(async m=>{if(m?.code!=="EADDRINUSE")throw m;return fd(e)});return d=h,await vd(c),console.log(`
|
|
2929
2929
|
${i}`),console.log(` ${l}`),n&&console.log(` ${n}`),process.on("SIGINT",()=>{p()}),process.on("SIGTERM",()=>{p()}),{port:e,url:l,pageCount:()=>h.pageCount(),async handOver({mode:m,fresh:g,replacedLive:b}){if(m==="none")return;let C={fresh:g,external:b?"never":m==="window"?"force":"follow"},T=await h.requestPage(C);T.how==="attached"?console.log(` Reusing the open browser tab.
|
|
2930
2930
|
`):T.how==="editor"?console.log(` Opened in VS Code via ${T.via}.
|
|
2931
2931
|
`):T.how==="external"?console.log(` Opened in your browser.
|
|
2932
|
-
`):console.log(` ${T.how==="unreached"?`Opened ${T.via?`in VS Code via ${T.via}`:"in your browser"}, but no page attached \u2014 is the browser it opened in still there?`:
|
|
2932
|
+
`):console.log(` ${T.how==="unreached"?`Opened ${T.via?`in VS Code via ${T.via}`:"in your browser"}, but no page attached \u2014 is the browser it opened in still there?`:ye(c)?"No page opened \u2014 nothing is reading this mirror until someone opens it.":"No page opened \u2014 no agent mirror page to open one through, and a bulb runs in its page."}
|
|
2933
2933
|
Share ${l}, and wake on the arrival:
|
|
2934
|
-
typebulb wait ${o} --match "${
|
|
2935
|
-
`)},onCleanup(m){f.push(m)}}}
|
|
2936
|
-
Port ${c} is this bulb's, and a page of it may be waiting there, but something else took it.`),console.error("Free that port and relaunch; starting elsewhere would leave that page running with no way to reach it."),process.exit(1));let h=0,m=()=>console.log(
|
|
2934
|
+
typebulb wait ${o} --match "${it.connected}"
|
|
2935
|
+
`)},onCleanup(m){f.push(m)}}}bn();import nL from"chokidar";import Wk from"node:fs";import rL from"node:path";var sL={persistent:!0,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}};function on(t){let{target:e,onChange:n,events:r="change",debounceMs:s=150}=t,i,o=nL.watch(e,sL);o.on("error",l=>console.warn(`watch: ${l instanceof Error?l.message:l} \u2014 continuing`));let a=()=>{i&&clearTimeout(i),i=setTimeout(n,s)};return r==="all"?o.on("all",a):o.on("change",a),()=>{i&&clearTimeout(i),o.close()}}var iL=t=>process.platform==="win32"||process.platform==="darwin"?t.toLowerCase()==="assets":t==="assets";function Kk(t,e,n=150){let r,s=()=>{r&&clearTimeout(r),r=setTimeout(e,n)};try{let i=Wk.watch(t,{recursive:!0},(o,a)=>{a&&iL(a.split(/[\\/]/)[0])&&s()});return i.on("error",o=>console.warn(`watch: ${o instanceof Error?o.message:o} \u2014 continuing`)),()=>{r&&clearTimeout(r),i.close()}}catch{let i=rL.join(t,"assets");return Wk.existsSync(i)?on({target:i,onChange:e,events:"all",debounceMs:n}):()=>{}}}Ie();je();Or();async function Hk(t,e,n,r){e.port!==void 0&&(console.error("--port isn't supported when running a bulb: a bulb keeps its assigned project port across runs, and moving it strands the open tab."),console.error("It applies to `typebulb agent`. Run the bulb with no --port; `typebulb logs` prints the URL it kept."),process.exit(1));let s=process.cwd(),i=Fs(process.pid),o=e.watch?new oL:void 0,a=be(e.mode),l=(await yn(process.cwd()))(t),c=await lr({kind:"bulb",file:t},process.cwd()),f=await da(t,c);f.length&&console.log(`Replacing the running server for this bulb (pid ${f.map(oe=>oe.pid).join(", ")})`);let d=f.length>0||Date.now()-l<$w,{port:u,note:p}=await oa({target:{kind:"bulb",file:t},cwd:process.cwd()});c!==void 0&&u!==c&&d&&(console.error(`
|
|
2936
|
+
Port ${c} is this bulb's, and a page of it may be waiting there, but something else took it.`),console.error("Free that port and relaunch; starting elsewhere would leave that page running with no way to reach it."),process.exit(1));let h=0,m=()=>console.log(bd(++h));m(),console.log(`Loading ${qn.basename(t)}...`);let{html:g,bulb:b,serverExports:C}=await gf(t,e.watch,e.trust,r);Ht(a,t,b.server);let T=In(t),E=Rr(qn.resolve(t)),$=e.trust?void 0:hr(b),{port:O,onCleanup:P,handOver:k,pageCount:L}=await zl({port:u,portNote:p,displayName:b.name,stopLog:i,makeServerOptions:oe=>({getHtml:()=>g,basePath:s,fsBase:_r(t),port:oe,reloadEmitter:o,sendChannel:!0,getServerExports:()=>C,getBulbBlocks:()=>({infer:b.infer,insight:b.insight,code:b.code,config:b.config,data:b.data}),saveInferenceResult:async(ge,Se)=>{let ae=await an.readFile(t,"utf-8");ge!==void 0&&(ae=zr(ae,"data",ge.join(oy))),Se!==void 0&&(ae=zr(ae,"insight",Se)),await an.writeFile(t,ae)},localOverride:r?{name:r.name,serveDir:r.serveDir}:void 0,bulbAssets:{dir:T,remoteBase:E&&Fi(E.userSlug,E.slug)},sourceFile:t,bulbKey:Bs(t),trusted:e.trust,trustHint:n}),makeEntry:(oe,ge)=>({pid:process.pid,port:oe,url:ge,file:t,cwd:process.cwd(),startedAt:Date.now(),trust:e.trust,mode:e.mode,predicted:$,watch:e.watch?void 0:!1,replace:e.local?`${e.local.name}=${e.local.dir}`:void 0}),waitTarget:qn.relative(process.cwd(),t)||qn.basename(t)});e.trust?console.log(" trust: granted (filesystem, AI, server.ts enabled)"):console.log($?` trust: restricted \u2014 this bulb appears to use ${$}; re-run with --trust to enable it:
|
|
2937
2937
|
${n}
|
|
2938
2938
|
`:` trust: restricted \u2014 re-run with --trust to enable filesystem / AI / server.ts
|
|
2939
2939
|
`),e.watch&&console.log(` Watching for changes...
|
|
2940
|
-
`);let
|
|
2940
|
+
`);let j,Q,U=()=>{L()===0&&console.log(" No page attached \u2014 nothing reloaded; this change is not live."),o?.emit("reload")},ie=oe=>{console.log(oe),m(),U()};if(e.watch&&o){let oe=0,ge=Promise.resolve();if(j=on({target:t,onChange:()=>{let ae=++oe;ge=ge.then(async()=>{if(ae===oe)try{console.log("Recompiling...");let ke=await gf(t,!0,e.trust,r);g=ke.html,C=ke.serverExports,b=ke.bulb,ke.buildError||m(),U()}catch(ke){console.error("Recompile failed:",ke)}})}}),r){let{name:ae,serveDir:ke}=r;Q=on({target:ke,events:"all",onChange:()=>ie(`Local package '${ae}' changed.`)})}let Se=_r(t);await an.stat(Se).then(ae=>ae.isDirectory()).catch(()=>!1)&&P(Kk(Se,()=>ie("Assets changed.")))}j&&P(j),Q&&P(Q),P(()=>an.rm(mf(t),{force:!0})),await k({mode:e.open,fresh:!d,replacedLive:f.some(oe=>oe.port===O)})}et();import{readFileSync as Lp,copyFileSync as lL,existsSync as cL,writeFileSync as uL,renameSync as dL,rmSync as fL}from"fs";import*as he from"path";import{fileURLToPath as pL}from"url";import{EventEmitter as hL}from"events";import mL from"open";bn();Ie();Or();var Np=t=>`/agents/${t}/client.js`,aL=`
|
|
2941
2941
|
(() => {
|
|
2942
2942
|
const api = async (name, ...args) => {
|
|
2943
2943
|
const resp = await fetch('/__api/' + name, {
|
|
@@ -2966,18 +2966,18 @@ Port ${c} is this bulb's, and a page of it may be waiting there, but something e
|
|
|
2966
2966
|
})
|
|
2967
2967
|
});
|
|
2968
2968
|
if (window.__TYPEBULB_WATCH__) {
|
|
2969
|
-
${
|
|
2969
|
+
${Ba()}
|
|
2970
2970
|
}
|
|
2971
2971
|
})();
|
|
2972
|
-
`;function
|
|
2972
|
+
`;function zk(t){let{name:e,agent:n,styles:r,katex:s,mountHtml:i,watch:o,theme:a}=t,l=Np(n);return`<!DOCTYPE html>
|
|
2973
2973
|
<html>
|
|
2974
2974
|
<head>
|
|
2975
2975
|
<meta charset="utf-8">
|
|
2976
2976
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
2977
|
-
<title>${
|
|
2978
|
-
${
|
|
2977
|
+
<title>${Ma(e)} - typebulb</title>
|
|
2978
|
+
${Da(e,a)}
|
|
2979
2979
|
<style>
|
|
2980
|
-
${
|
|
2980
|
+
${Os}
|
|
2981
2981
|
</style>
|
|
2982
2982
|
<style>
|
|
2983
2983
|
${r}
|
|
@@ -2992,18 +2992,18 @@ ${i}
|
|
|
2992
2992
|
${o?"<script>window.__TYPEBULB_WATCH__ = true;</script>":""}
|
|
2993
2993
|
|
|
2994
2994
|
<script>
|
|
2995
|
-
${
|
|
2995
|
+
${aL}
|
|
2996
2996
|
</script>
|
|
2997
2997
|
|
|
2998
2998
|
<script type="module" src="${l}"></script>
|
|
2999
2999
|
</body>
|
|
3000
|
-
</html>`}async function
|
|
3001
|
-
${r.url}`),t.open==="window"&&await
|
|
3002
|
-
`);async function
|
|
3000
|
+
</html>`}async function Yk(t){let e=process.cwd(),n=t.agentTarget;RS(n)||(console.error(`Unknown agent '${n}'. Known: ${Ur().join(", ")}.`),process.exit(1));let r=await ua(e,n);if(r){console.log(`Mirror '${n}' is already running for this project:
|
|
3001
|
+
${r.url}`),t.open==="window"&&await mL(r.url);return}let s=Fs(process.pid),i=t.watch?new hL:void 0,o=be(t.mode),a=await IS(n),l=a.displayName||`${n} mirror`;Ht(o,he.join(e,"mirror"));let c=he.dirname(pL(import.meta.url)),f=he.join(c,"agents",n),d=he.join(c,"..","cli","agents"),u=he.join(f,"styles.css"),p=he.join(f,"katex.min.css"),h=he.join(f,"index.html"),m=()=>zk({name:l,agent:n,styles:Lp(u,"utf8"),katex:Lp(p,"utf8"),mountHtml:Lp(h,"utf8"),watch:t.watch}),{port:g,note:b}=await oa({explicit:t.port,target:{kind:"mirror",agent:n},cwd:e}),{port:C,url:T,onCleanup:E,handOver:$,pageCount:O}=await zl({port:g,portNote:b,displayName:l,stopLog:s,waitTarget:"agent",makeServerOptions:U=>({getHtml:m,basePath:e,port:U,reloadEmitter:i,getServerExports:()=>a,trusted:!0,staticAssets:{mount:`${he.posix.dirname(Np(n))}/`,dir:f}}),makeEntry:(U,ie)=>({pid:process.pid,port:U,url:ie,file:`agent:${n}`,cwd:e,startedAt:Date.now(),trust:!0,agent:n})}),P=he.join(d,n,"client"),k=he.join(d,"core","client"),L=cL(P);t.watch&&L&&console.log(` Watching for changes...
|
|
3002
|
+
`);async function j(){let U=await import("esbuild"),{outputFiles:ie}=await U.build({entryPoints:[he.join(P,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:he.join(f,"client.js"),write:!1}),oe=he.join(f,"client.js"),ge=`${oe}.${process.pid}.tmp`;uL(ge,ie[0].contents);for(let Se=1;;Se++)try{dL(ge,oe);break}catch(ae){if(Se===10)throw fL(ge,{force:!0}),ae;await new Promise(ke=>setTimeout(ke,50))}for(let Se of["styles.css","index.html","typebulb.png","typebulb-inv.png"])lL(he.join(k,Se),he.join(f,Se))}let Q;if(t.watch&&L&&i){let U=!1;Q=on({target:d,events:"all",onChange:async()=>{if(!U){U=!0;try{await j(),console.log(O()?`Mirror rebuilt. Reloading.
|
|
3003
3003
|
`:`Mirror rebuilt. No tab open on it \u2014 nobody is reading this.
|
|
3004
|
-
`),i.emit("reload")}catch(ie){console.error("Mirror rebuild failed:",ie instanceof Error?ie.message:ie)}finally{
|
|
3005
|
-
`);let a=0,l=Promise.resolve();
|
|
3006
|
-
`)}catch(u){
|
|
3007
|
-
`),
|
|
3008
|
-
`),process.exit(1)}function
|
|
3009
|
-
${e}`),process.exit(1))}async function
|
|
3004
|
+
`),i.emit("reload")}catch(ie){console.error("Mirror rebuild failed:",ie instanceof Error?ie.message:ie)}finally{U=!1}}}})}await $({mode:t.open,fresh:!1,replacedLive:!1}),E(()=>a.shutdownSwitcher?.()),E(()=>a.shutdownComposer?.()),Q&&E(Q)}et();At();import*as Vk from"path";async function Gk(t,e,n,r){let s=be(n),i=!1,o=async()=>{let{bulb:a,config:l}=await rt(t);i||(Ht(s,t,a.server),i=!0),await ai(a.server,t,r,l.dependencies)};if(console.log(`Running ${Vk.basename(t)}...`),await o(),e){console.log(`Watching for changes...
|
|
3005
|
+
`);let a=0,l=Promise.resolve();on({target:t,onChange:()=>{let c=++a;l=l.then(async()=>{if(c===a)try{console.log("Re-running..."),await o()}catch(f){console.error("Error:",f)}})}})}}et();At();import{Console as gL}from"node:console";Ie();async function Zk(t,e,n,r){SL();try{let u=vn(await G(),t)[0];u&&(js(u.pid,Qe(u.pid).offset),console.error(`note: 'call' boots a fresh server.ts instance; the running server (${u.url}) is not contacted \u2014 state shared with it must live on disk.`))}catch{}let s=be(n),{bulb:i,config:o}=await rt(t);i.server||Ii("This bulb has no **server.ts** block; nothing to call."),Ht(s,t,i.server);let a;try{a=await ai(i.server,t,r,o.dependencies)}catch(u){Ii(u instanceof Error?u.message:String(u))}let l=Kl(a,e.fn);if(!l){let u=[...Object.keys(a).filter(p=>typeof a[p]=="function"),...Object.keys(Wl)];Ii(`Function '${e.fn}' not found. Available: ${u.length?u.join(", "):"(none)"}.`)}let c=await yL(e);if(Hl(l)){try{for await(let u of l(...c))await Qk(JSON.stringify(u,ex)+`
|
|
3006
|
+
`)}catch(u){Ii(u instanceof Error?u.stack??u.message:String(u))}return Xk(0)}let f;try{f=await l(...c)}catch(u){Ii(u instanceof Error?u.stack??u.message:String(u))}let d=vL(f);d!==void 0&&await Qk(d+`
|
|
3007
|
+
`),Xk(0)}function Xk(t){process.exitCode=t,setTimeout(()=>process.exit(t),2e3).unref?.()}async function yL(t){if(t.hasArgsFlag){let e=t.argsJson??"";return e==="-"&&(e=await Kr()),wL(e)}return bL(t.positional)}function bL(t){return t.map(e=>{try{return JSON.parse(e)}catch{return e}})}function wL(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`--args must be a JSON array: ${n instanceof Error?n.message:String(n)}`)}if(!Array.isArray(e))throw new Error(`--args must be a JSON array, got ${e===null?"null":typeof e}`);return e}function vL(t){if(t!==void 0)return JSON.stringify(t,ex,2)}function ex(t,e){return typeof e=="bigint"?e.toString():e}function Ii(t){process.stderr.write(t+`
|
|
3008
|
+
`),process.exit(1)}function SL(){let t=new gL(process.stderr,process.stderr);console.log=t.log.bind(t),console.info=t.info.bind(t),console.debug=t.debug.bind(t),console.dir=t.dir.bind(t)}function Qk(t){return new Promise((e,n)=>{process.stdout.write(t,r=>r?n(r):e())})}aa();for(let t of[process.stdout,process.stderr])t.on("error",e=>{if(e?.code!=="EPIPE")throw e});function tx(t,e){t||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
|
|
3009
|
+
${e}`),process.exit(1))}async function kL(){let t=LS(process.argv.slice(2));if(t.version&&(console.log(`typebulb ${Ce}`),process.exit(0)),t.help&&(MS(),process.exit(0)),$S(),t.subcommand==="logs"){await mk(t.file||void 0,{follow:t.follow,clear:t.clear,run:t.run,lines:t.lines});return}if(t.subcommand==="wait"){await gk(t.file||void 0,{match:t.match,timeoutSec:t.timeoutSec,wake:t.wake});return}if(t.subcommand==="stop"){t.stopScope?await wk(t.stopScope):await bk(t.file||void 0);return}if(t.subcommand==="restart"){await vk(t.file||void 0,t.stopScope);return}if(t.subcommand==="babysit"){await $k(t.mode,t.slowMs);return}if(t.subcommand==="send"){await kk(t.file,t.sendMessage,t.sendWaitMs??0);return}if(t.subcommand==="models"){await lk(t.mode);return}if(t.subcommand==="slug"){ck(t.slugName);return}if(t.subcommand==="status"){await Pk(t.statusQuery,t.mode,t.slowMs);return}if(t.subcommand==="pull"){await Ww(t.file||void 0,{force:t.force,mode:t.mode});return}if(t.subcommand==="push"){await Hw(t.file||void 0,{force:t.force,mode:t.mode});return}if(t.subcommand==="agent"){await(t.agentTarget?Yk(t):ak(Ce));return}if(t.subcommand==="trust"||t.subcommand==="untrust"){await rk(t.file||void 0,t.subcommand==="trust");return}let e;if(!t.file||t.file==="."){let l=await qw(process.cwd());l||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=l}else e=Pt.resolve(t.file);if(await nx.access(e).then(()=>!0,()=>!1)||(Ur().includes(t.file)&&(console.error(`To open the ${t.file} agent mirror, run: npx typebulb agent:${t.file}`),process.exit(1)),console.error(`File not found: ${e}`+(Pt.isAbsolute(t.file)?"":` (resolved from cwd ${process.cwd()})`)),process.exit(1)),e.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),t.subcommand==="get"){await Ek(e,t.blockKind);return}if(t.subcommand==="put"){await Ck(e,t.blockPairs);return}let r=t.file&&t.file!=="."?t.file:Pt.relative(process.cwd(),e)||Pt.basename(e),s=`npx typebulb --trust ${r.includes(" ")?`"${r}"`:r}`;if(t.subcommand==="predict"){await nk(e,s);return}let i=!t.noTrust&&En(e);i&&!t.trust&&console.error("trust: granted from memory (run `typebulb untrust` to revoke)"),t.trust=t.noTrust?!1:t.trust||i;let o;try{o=await rt(e)}catch{}let a;if(t.local){o&&!(t.local.name in(o.config.dependencies??{}))&&(console.error(`--replace: '${t.local.name}' is not a dependency in this bulb's config.json; nothing to replace.`),process.exit(1)),o&&t.subcommand!=="call"&&(!o.bulb.code||t.server)&&console.warn("warning: --replace has no effect in server mode (the override is client-only).");try{a=await Wp(t.local)}catch(l){console.error(l instanceof Error?l.message:String(l)),process.exit(1)}console.error(`replace: ${a.name} \u2192 ${Pt.relative(process.cwd(),a.dir)||"."}`)}if(t.subcommand==="check"){await tk(e,a);return}if(t.subcommand==="call"){tx(t.trust,s),await Zk(e,{fn:t.fn,positional:t.callArgs,argsJson:t.argsJson,hasArgsFlag:t.hasArgsFlag},t.mode,a);return}if(o&&o.bulb.server&&(fa(o.bulb)||t.server)){tx(t.trust,s),await Gk(e,t.watch,t.mode,a);return}await Hk(e,t,s,a)}kL().catch(t=>{console.error("Error:",t.message),process.exit(1)});
|