typebulb 0.60.9 → 0.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- 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 +180 -180
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`),t=0;if(e[t]?.trim()!=="---")return{reason:
|
|
5
|
-
`)),a.set(d,p),c=t}else t++}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
|
|
3
|
+
var CS=Object.create;var dl=Object.defineProperty;var RS=Object.getOwnPropertyDescriptor;var IS=Object.getOwnPropertyNames;var NS=Object.getPrototypeOf,$S=Object.prototype.hasOwnProperty;var ci=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var S=(n,e)=>()=>(n&&(e=n(n=0)),e);var R=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ui=(n,e)=>{for(var t in e)dl(n,t,{get:e[t],enumerable:!0})},LS=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of IS(e))!$S.call(n,s)&&s!==t&&dl(n,s,{get:()=>e[s],enumerable:!(r=RS(e,s))||r.enumerable});return n};var MS=(n,e,t)=>(t=n!=null?CS(NS(n)):{},LS(e||!n||!n.__esModule?dl(t,"default",{value:n,enumerable:!0}):t,n));import*as qf from"fs/promises";import{existsSync as In,readFileSync as BS}from"fs";import*as ie from"path";import{pathToFileURL as DS}from"url";import{resolve as pl}from"resolve.exports";import{init as Jf,parse as Wf}from"es-module-lexer";function Kf(n,e){let t=ie.join(n,"package.json");try{return JSON.parse(BS(t,"utf8"))}catch{throw new Error(`--replace package '${e}' has no readable package.json at ${t}`)}}function Hf(n){let e=n.indexOf("=");if(e===-1)throw new Error(`--replace must be <name>=<path> (got '${n}')`);let t=n.slice(0,e).trim(),r=n.slice(e+1).trim();if(!t)throw new Error(`--replace missing package name (got '${n}')`);if(!r)throw new Error(`--replace missing path for '${t}'`);if(t.startsWith("@"))throw new Error(`--replace does not support scoped names yet; '${t}' is scoped`);return{name:t,dir:ie.resolve(r)}}async function Yf(n){let{name:e,dir:t}=n;if(!In(t))throw new Error(`--replace path for '${e}' does not exist: ${t}`);let r=Kf(t,e),s=jS(r,e),i=ie.resolve(t,s);if(!In(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=ie.dirname(i),a=`/local/${e}/${ie.basename(i)}`,l=FS(r,t);return await US(e,i,o),{name:e,dir:t,entryAbs:i,serveDir:o,entryUrl:a,typesAbs:l}}function jS(n,e){if(n.exports!==void 0){let r;try{r=pl(n,".",{browser:!0,conditions:fl})}catch(i){throw new Error(`--replace package '${e}' "exports" does not resolve a browser entry (conditions: ${fl.join(", ")}): ${i instanceof Error?i.message:i}`)}let s=hl(r);if(!s)throw new Error(`--replace package '${e}' "exports" did not resolve "." to a single file (conditions: ${fl.join(", ")}); too complex to override.`);return s}let t=n.module??n.main;if(!t)throw new Error(`--replace package '${e}' has no "exports", "module", or "main" entry to resolve.`);return t}function FS(n,e){if(n.exports!==void 0)try{let r=pl(n,".",{conditions:["types"]}),s=hl(r);if(s){let i=ie.resolve(e,s);if(In(i))return i}}catch{}let t=n.types??n.typings;if(t){let r=ie.resolve(e,t);if(In(r))return r}}function hl(n){if(typeof n=="string")return n;if(Array.isArray(n))return n.find(e=>typeof e=="string")}async function US(n,e,t){await Jf;let r=ie.normalize(t),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 qf.readFile(o,"utf8")}catch{continue}let l,c;try{[l,,,c]=Wf(a,o)}catch{continue}if(o===e&&!c)throw new Error(`override package '${n}' 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 u=f.n;if(u&&!u.startsWith("node:")){if(u.startsWith("./")||u.startsWith("../")||u.startsWith("/")){let d=qS(o,u,r);d&&!s.has(d)&&i.push(d);continue}throw new Error(`override package must ship self-contained (bundle its dependencies); ${n} externalizes '${u}'`)}}}}function qS(n,e,t){let r=e.replace(/[?#].*$/,""),s=ie.resolve(ie.dirname(n),r),i=[s,s+".js",s+".mjs",ie.join(s,"index.js"),ie.join(s,"index.mjs")];for(let o of i)if(ie.normalize(o).startsWith(t)&&In(o))return o}function JS(n,e,t){let r=Kf(n,e),s;if(r.exports!==void 0)try{s=hl(pl(r,t,{conditions:Uf}))}catch(o){throw new Error(`--replace package '${e}' "exports" does not resolve a node entry for '${t}' (conditions: ${Uf.join(", ")}): ${o instanceof Error?o.message:o}`)}else t==="."&&(s=r.main??r.module);if(!s)throw new Error(`--replace package '${e}' has no node export for '${t}'.`);let i=ie.resolve(n,s);if(!In(i))throw new Error(`--replace package '${e}' built file not found: ${i} \u2014 did you build it (e.g. \`pnpm run build\`)?`);return DS(i).href}async function Vf(n,e){await Jf;let t;try{[t]=Wf(n)}catch{return n}let r="",s=0;for(let i of t){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=JS(e.dir,e.name,a);r+=n.slice(s,i.s)+l,s=i.e}return r+n.slice(s)}var fl,Uf,di=S(()=>{"use strict";fl=["browser","import","default"],Uf=["node","import","default"]});function zf(n){return qe.find(e=>ue[e].path===n)}function Xf(n){return!!n?.startsWith("typebulb")}var ue,qe,Gf,fi=S(()=>{ue={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"}},qe=["code","css","html","data","infer","insight","config","notes"];Gf="typebulb/v1"});function ml(n){return/[:\n"']/.test(n)||n.startsWith(" ")||n.endsWith(" ")?`"${n.replace(/"/g,'\\"')}"`:n}function gl(n){return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\"/g,'"'):n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}var pi=S(()=>{});function Nn(n){let e=Zf(n);if("reason"in e)throw new Error(`Invalid .bulb.md file format: ${e.reason}`);return e.bulb}function Je(n){let e=Zf(n);return"bulb"in e?e.bulb:void 0}function Zf(n){try{let e=n.split(`
|
|
4
|
+
`),t=0;if(e[t]?.trim()!=="---")return{reason:KS(n,e)};t++;let r=[];for(;t<e.length&&e[t]?.trim()!=="---";)r.push(e[t]),t++;if(e[t]?.trim()!=="---")return{reason:"the frontmatter opened on line 1 but never closed (no second '---')"};t++;let s=VS(r);if(!Xf(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=t;for(;t<e.length;){let u=e[t]?.trim()?.match(Qf);if(u){let d=u[1].trim();for(t++;t<e.length&&e[t]?.trim()==="";)t++;let h=e[t]?.match(hi);if(!h){l.push(`**${d}** has no code fence \u2014 block skipped`);continue}let g=h[1];t++;let p=t+1,y=[],E=yl(g);for(;t<e.length&&!e[t]?.match(E);)y.push(e[t]),t++;let P=t<e.length;t++,l.push(...HS(d,y,P)),o.set(d,y.join(`
|
|
5
|
+
`)),a.set(d,p),c=t}else t++}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 KS(n,e){let t=zS(n)[0];if(t&&t.start>0)return`expected '---' on line 1; the frontmatter starts on line ${t.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 HS(n,e,t){let r=[];for(let s=0;s<e.length;s++){let i=e[s]?.trim().match(Qf);i&&WS.has(i[1].trim())&&YS(e,s)&&r.push(i[1].trim())}return r.length?r.map(s=>`**${n}** block has an unterminated code fence \u2014 it swallowed the **${s}** block.`):t?[]:[`**${n}** block has an unterminated code fence (it runs to the end of the file).`]}function YS(n,e){let t=e+1;for(;t<n.length&&n[t]?.trim()==="";)t++;return!!n[t]?.match(hi)}function VS(n){let e={};for(let t of n){let r=t.indexOf(":");if(r===-1)continue;let s=t.slice(0,r).trim(),i=t.slice(r+1).trim();switch(s){case"format":e.format=i;break;case"name":e.name=gl(i);break}}return e}function ep(n){return Je(n)?.warnings??[]}function zS(n){let e=n.split(`
|
|
6
6
|
`),t=[],r=0;for(;r<e.length;){if(e[r]?.trim()!=="---"){r++;continue}let s=Je(e.slice(r).join(`
|
|
7
7
|
`));if(s&&s.files.size>0){let i=r+s.bodyEndLine;t.push({start:r,end:i,source:e.slice(r,i).join(`
|
|
8
|
-
`)}),r=i}else r++}return t}function tp(n){let e=Object.fromEntries(qe.map(t=>[t,n.files.get(ue[t].path)||""]));return{name:n.frontmatter.name,...e}}var Qf,hi,
|
|
8
|
+
`)}),r=i}else r++}return t}function tp(n){let e=Object.fromEntries(qe.map(t=>[t,n.files.get(ue[t].path)||""]));return{name:n.frontmatter.name,...e}}var Qf,hi,WS,yl,bl=S(()=>{fi();pi();Qf=/^\*\*(.+)\*\*$/,hi=/^(`{3,})(\w*)\s*$/,WS=new Set(qe.map(n=>ue[n].path)),yl=n=>new RegExp(`^${n}\\s*$`)});function np(n){let e=n.match(/^`{3,}/gm),t=e?Math.max(...e.map(r=>r.length)):0;return"`".repeat(Math.max(3,t+1))}function rp(n,e){let{path:t}=ue[n],r=t.split(".").pop(),s=np(e);return`**${t}**
|
|
9
9
|
|
|
10
10
|
${s}${r}
|
|
11
11
|
${e}
|
|
@@ -19,42 +19,42 @@ ${rp(e,t)}
|
|
|
19
19
|
`)}function op(n,e){let t=n.split(`
|
|
20
20
|
`),r=ip(t,ue[e].path);if(!r||r==="unterminated")return n;let s=r.close+1;for(;s<t.length&&t[s]?.trim()==="";)s++;return[...t.slice(0,r.header),...t.slice(s)].join(`
|
|
21
21
|
`).replace(/\s*$/,"")+`
|
|
22
|
-
`}var ap=S(()=>{fi();bl();pi()});function $r(n){if(!n.trim())return{};try{return JSON.parse(n)}catch{return{}}}function cp(n){switch(lp(n)){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 up(n){let e=lp(n);return e!==void 0&&
|
|
23
|
-
>/]`,i);if(r&&console.log("[xml-utils] start:",o),o===-1)return;let a=n.slice(o+e.length),l=Lr(a,"^[^<]*[ /]>",0),c=l!==-1&&a[l-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",c),c===!1)if(s){let h=0,
|
|
24
|
-
>]`),p+=gi(y,"</"+e+">"),p>=
|
|
25
|
-
`)}};Dr.defaultYaml={explicit:!1,version:"1.2"};Dr.defaultTags={"!!":"tag:yaml.org,2002:"};Op.Directives=Dr});var Si=R(jr=>{"use strict";var _p=
|
|
22
|
+
`}var ap=S(()=>{fi();bl();pi()});function $r(n){if(!n.trim())return{};try{return JSON.parse(n)}catch{return{}}}function cp(n){switch(lp(n)){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 up(n){let e=lp(n);return e!==void 0&&XS.has(e)?e:void 0}function ZS(n){return n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"")}function wl(n){let e=$r(n??"").description?.trim();if(!e)return QS;let t=ZS(e);return(t.length>200?t.slice(0,197)+"...":t).replace(/\n/g," ")}var GS,mi,lp,XS,QS,dp=S(()=>{GS="https://assets.typebulb.com",mi=(n,e)=>`${GS}/u/${encodeURIComponent(n)}/${encodeURIComponent(e)}/`,lp=n=>/\.[^./\\]+$/.exec(n)?.[0]?.toLowerCase();XS=new Set([".html",".htm",".xhtml",".js",".mjs",".cjs",".ts",".tsx",".css"]);QS="A Typebulb bulb."});var fp=S(()=>{});function vl(n,e,t){let s=new RegExp(e).exec(n.slice(t));return s?t+s.index:-1}var pp=S(()=>{});function Lr(n,e,t){let s=new RegExp(e).exec(n.slice(t));return s?t+s.index+s[0].length-1:-1}var hp=S(()=>{});function gi(n,e){let t=new RegExp(e,"g"),r=n.match(t);return r?r.length:0}var mp=S(()=>{});function Mr(n,e,t){let r=t&&t.debug||!1,s=!(t&&typeof t.nested===!1),i=t&&t.startIndex||0;r&&console.log("[xml-utils] starting findTagByName with",e," and ",t);let o=vl(n,`<${e}[
|
|
23
|
+
>/]`,i);if(r&&console.log("[xml-utils] start:",o),o===-1)return;let a=n.slice(o+e.length),l=Lr(a,"^[^<]*[ /]>",0),c=l!==-1&&a[l-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",c),c===!1)if(s){let h=0,g=1,p=0;for(;(l=Lr(a,"[ /]"+e+">",h))!==-1;){let y=a.substring(h,l+1);if(g+=gi(y,"<"+e+`[
|
|
24
|
+
>]`),p+=gi(y,"</"+e+">"),p>=g)break;h=l}}else l=Lr(a,"[ /]"+e+">",0);let f=o+e.length+l+1;if(r&&console.log("[xml-utils] end:",f),f===-1)return;let u=n.slice(o,f),d;return c?d=null:d=u.slice(u.indexOf(">")+1,u.lastIndexOf("<")),{inner:d,outer:u,start:o,end:f}}var Sl=S(()=>{pp();hp();mp()});var kl=S(()=>{Sl()});var xl=S(()=>{kl()});var gp=S(()=>{xl()});var yp=S(()=>{});var bp=S(()=>{fp();Sl();kl();gp();xl();yp()});var q=R(pe=>{"use strict";var El=Symbol.for("yaml.alias"),wp=Symbol.for("yaml.document"),yi=Symbol.for("yaml.map"),vp=Symbol.for("yaml.pair"),Al=Symbol.for("yaml.scalar"),bi=Symbol.for("yaml.seq"),at=Symbol.for("yaml.node.type"),nk=n=>!!n&&typeof n=="object"&&n[at]===El,rk=n=>!!n&&typeof n=="object"&&n[at]===wp,sk=n=>!!n&&typeof n=="object"&&n[at]===yi,ik=n=>!!n&&typeof n=="object"&&n[at]===vp,Sp=n=>!!n&&typeof n=="object"&&n[at]===Al,ok=n=>!!n&&typeof n=="object"&&n[at]===bi;function kp(n){if(n&&typeof n=="object")switch(n[at]){case yi:case bi:return!0}return!1}function ak(n){if(n&&typeof n=="object")switch(n[at]){case El:case yi:case Al:case bi:return!0}return!1}var lk=n=>(Sp(n)||kp(n))&&!!n.anchor;pe.ALIAS=El;pe.DOC=wp;pe.MAP=yi;pe.NODE_TYPE=at;pe.PAIR=vp;pe.SCALAR=Al;pe.SEQ=bi;pe.hasAnchor=lk;pe.isAlias=nk;pe.isCollection=kp;pe.isDocument=rk;pe.isMap=sk;pe.isNode=ak;pe.isPair=ik;pe.isScalar=Sp;pe.isSeq=ok});var Br=R(Tl=>{"use strict";var oe=q(),we=Symbol("break visit"),xp=Symbol("skip children"),Ze=Symbol("remove node");function wi(n,e){let t=Ep(e);oe.isDocument(n)?$n(null,n.contents,t,Object.freeze([n]))===Ze&&(n.contents=null):$n(null,n,t,Object.freeze([]))}wi.BREAK=we;wi.SKIP=xp;wi.REMOVE=Ze;function $n(n,e,t,r){let s=Ap(n,e,t,r);if(oe.isNode(s)||oe.isPair(s))return Tp(n,r,s),$n(n,s,t,r);if(typeof s!="symbol"){if(oe.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=$n(i,e.items[i],t,r);if(typeof o=="number")i=o-1;else{if(o===we)return we;o===Ze&&(e.items.splice(i,1),i-=1)}}}else if(oe.isPair(e)){r=Object.freeze(r.concat(e));let i=$n("key",e.key,t,r);if(i===we)return we;i===Ze&&(e.key=null);let o=$n("value",e.value,t,r);if(o===we)return we;o===Ze&&(e.value=null)}}return s}async function vi(n,e){let t=Ep(e);oe.isDocument(n)?await Ln(null,n.contents,t,Object.freeze([n]))===Ze&&(n.contents=null):await Ln(null,n,t,Object.freeze([]))}vi.BREAK=we;vi.SKIP=xp;vi.REMOVE=Ze;async function Ln(n,e,t,r){let s=await Ap(n,e,t,r);if(oe.isNode(s)||oe.isPair(s))return Tp(n,r,s),Ln(n,s,t,r);if(typeof s!="symbol"){if(oe.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=await Ln(i,e.items[i],t,r);if(typeof o=="number")i=o-1;else{if(o===we)return we;o===Ze&&(e.items.splice(i,1),i-=1)}}}else if(oe.isPair(e)){r=Object.freeze(r.concat(e));let i=await Ln("key",e.key,t,r);if(i===we)return we;i===Ze&&(e.key=null);let o=await Ln("value",e.value,t,r);if(o===we)return we;o===Ze&&(e.value=null)}}return s}function Ep(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function Ap(n,e,t,r){if(typeof t=="function")return t(n,e,r);if(oe.isMap(e))return t.Map?.(n,e,r);if(oe.isSeq(e))return t.Seq?.(n,e,r);if(oe.isPair(e))return t.Pair?.(n,e,r);if(oe.isScalar(e))return t.Scalar?.(n,e,r);if(oe.isAlias(e))return t.Alias?.(n,e,r)}function Tp(n,e,t){let r=e[e.length-1];if(oe.isCollection(r))r.items[n]=t;else if(oe.isPair(r))n==="key"?r.key=t:r.value=t;else if(oe.isDocument(r))r.contents=t;else{let s=oe.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}Tl.visit=wi;Tl.visitAsync=vi});var Pl=R(Op=>{"use strict";var Pp=q(),ck=Br(),uk={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dk=n=>n.replace(/[!,[\]{}]/g,e=>uk[e]),Dr=class n{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},n.defaultYaml,e),this.tags=Object.assign({},n.defaultTags,t)}clone(){let e=new n(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},n.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},n.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(t(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 t(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 t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${s}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,r,s]=e.match(/^(.*!)([^!]*)$/s);s||t(`The ${e} tag has no suffix`);let i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(o){return t(String(o)),null}return r==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+dk(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),s;if(e&&r.length>0&&Pp.isNode(e.contents)){let i={};ck.visit(e.contents,(o,a)=>{Pp.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)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
|
|
25
|
+
`)}};Dr.defaultYaml={explicit:!1,version:"1.2"};Dr.defaultTags={"!!":"tag:yaml.org,2002:"};Op.Directives=Dr});var Si=R(jr=>{"use strict";var _p=q(),fk=Br();function pk(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Cp(n){let e=new Set;return fk.visit(n,{Value(t,r){r.anchor&&e.add(r.anchor)}}),e}function Rp(n,e){for(let t=1;;++t){let r=`${n}${t}`;if(!e.has(r))return r}}function hk(n,e){let t=[],r=new Map,s=null;return{onAnchor:i=>{t.push(i),s??(s=Cp(n));let o=Rp(e,s);return s.add(o),o},setAnchors:()=>{for(let i of t){let o=r.get(i);if(typeof o=="object"&&o.anchor&&(_p.isScalar(o.node)||_p.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}}jr.anchorIsValid=pk;jr.anchorNames=Cp;jr.createNodeAnchors=hk;jr.findNewAnchor=Rp});var Ol=R(Ip=>{"use strict";function Fr(n,e,t,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=Fr(n,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=Fr(n,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=Fr(n,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=Fr(n,r,s,i);o===void 0?delete r[s]:o!==i&&(r[s]=o)}return n.call(e,t,r)}Ip.applyReviver=Fr});var Et=R($p=>{"use strict";var mk=q();function Np(n,e,t){if(Array.isArray(n))return n.map((r,s)=>Np(r,String(s),t));if(n&&typeof n.toJSON=="function"){if(!t||!mk.hasAnchor(n))return n.toJSON(e,t);let r={aliasCount:0,count:1,res:void 0};t.anchors.set(n,r),t.onCreate=i=>{r.res=i,delete t.onCreate};let s=n.toJSON(e,t);return t.onCreate&&t.onCreate(s),s}return typeof n=="bigint"&&!t?.keep?Number(n):n}$p.toJS=Np});var ki=R(Mp=>{"use strict";var gk=Ol(),Lp=q(),yk=Et(),_l=class{constructor(e){Object.defineProperty(this,Lp.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:t,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!Lp.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=yk.toJS(this,"",o);if(typeof s=="function")for(let{count:l,res:c}of o.anchors.values())s(c,l);return typeof i=="function"?gk.applyReviver(i,{"":a},"",a):a}};Mp.NodeBase=_l});var Ur=R(Bp=>{"use strict";var bk=Si(),wk=Br(),Mn=q(),vk=ki(),Sk=Et(),Cl=class extends vk.NodeBase{constructor(e){super(Mn.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let r;t?.aliasResolveCache?r=t.aliasResolveCache:(r=[],wk.visit(e,{Node:(i,o)=>{(Mn.isAlias(o)||Mn.hasAnchor(o))&&r.push(o)}}),t&&(t.aliasResolveCache=r));let s;for(let i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(e,t){if(!t)return{source:this.source};let{anchors:r,doc:s,maxAliasCount:i}=t,o=this.resolve(s,t);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||(Sk.toJS(o,null,t),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=xi(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,t,r){let s=`*${this.source}`;if(e){if(bk.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 xi(n,e,t){if(Mn.isAlias(e)){let r=e.resolve(n),s=t&&r&&t.get(r);return s?s.count*s.aliasCount:0}else if(Mn.isCollection(e)){let r=0;for(let s of e.items){let i=xi(n,s,t);i>r&&(r=i)}return r}else if(Mn.isPair(e)){let r=xi(n,e.key,t),s=xi(n,e.value,t);return Math.max(r,s)}return 1}Bp.Alias=Cl});var ne=R(Rl=>{"use strict";var kk=q(),xk=ki(),Ek=Et(),Ak=n=>!n||typeof n!="function"&&typeof n!="object",At=class extends xk.NodeBase{constructor(e){super(kk.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Ek.toJS(this.value,e,t)}toString(){return String(this.value)}};At.BLOCK_FOLDED="BLOCK_FOLDED";At.BLOCK_LITERAL="BLOCK_LITERAL";At.PLAIN="PLAIN";At.QUOTE_DOUBLE="QUOTE_DOUBLE";At.QUOTE_SINGLE="QUOTE_SINGLE";Rl.Scalar=At;Rl.isScalarValue=Ak});var qr=R(jp=>{"use strict";var Tk=Ur(),en=q(),Dp=ne(),Pk="tag:yaml.org,2002:";function Ok(n,e,t){if(e){let r=t.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 t.find(r=>r.identify?.(n)&&!r.format)}function _k(n,e,t){if(en.isDocument(n)&&(n=n.contents),en.isNode(n))return n;if(en.isPair(n)){let u=t.schema[en.MAP].createNode?.(t.schema,null,t);return u.items.push(n),u}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:o,sourceObjects:a}=t,l;if(r&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=s(n)),new Tk.Alias(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=Pk+e.slice(2));let c=Ok(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let u=new Dp.Scalar(n);return l&&(l.node=u),u}c=n instanceof Map?o[en.MAP]:Symbol.iterator in Object(n)?o[en.SEQ]:o[en.MAP]}i&&(i(c),delete t.onTagObj);let f=c?.createNode?c.createNode(t.schema,n,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,n,t):new Dp.Scalar(n);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}jp.createNode=_k});var Ai=R(Ei=>{"use strict";var Ck=qr(),et=q(),Rk=ki();function Il(n,e,t){let r=t;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 Ck.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var Fp=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Nl=class extends Rk.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(r=>et.isNode(r)||et.isPair(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Fp(e))this.add(t);else{let[r,...s]=e,i=this.get(r,!0);if(et.isCollection(i))i.addIn(s,t);else if(i===void 0&&this.schema)this.set(r,Il(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let s=this.get(t,!0);if(et.isCollection(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...s]=e,i=this.get(r,!0);return s.length===0?!t&&et.isScalar(i)?i.value:i:et.isCollection(i)?i.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!et.isPair(t))return!1;let r=t.value;return r==null||e&&et.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let s=this.get(t,!0);return et.isCollection(s)?s.hasIn(r):!1}setIn(e,t){let[r,...s]=e;if(s.length===0)this.set(r,t);else{let i=this.get(r,!0);if(et.isCollection(i))i.setIn(s,t);else if(i===void 0&&this.schema)this.set(r,Il(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}};Ei.Collection=Nl;Ei.collectionFromPath=Il;Ei.isEmptyPath=Fp});var Jr=R(Ti=>{"use strict";var Ik=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function $l(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var Nk=(n,e,t)=>n.endsWith(`
|
|
26
26
|
`)?$l(t,e):t.includes(`
|
|
27
27
|
`)?`
|
|
28
|
-
`+$l(t,e):(n.endsWith(" ")?"":" ")+t;Ti.indentComment=$l;Ti.lineComment=
|
|
28
|
+
`+$l(t,e):(n.endsWith(" ")?"":" ")+t;Ti.indentComment=$l;Ti.lineComment=Nk;Ti.stringifyComment=Ik});var qp=R(Wr=>{"use strict";var $k="flow",Ll="block",Pi="quoted";function Lk(n,e,t="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return n;s<i&&(i=0);let l=Math.max(1+i,1+s-e.length);if(n.length<=l)return n;let c=[],f={},u=s-e.length;typeof r=="number"&&(r>s-Math.max(2,i)?c.push(0):u=s-r);let d,h,g=!1,p=-1,y=-1,E=-1;t===Ll&&(p=Up(n,p,e.length),p!==-1&&(u=p+l));for(let C;C=n[p+=1];){if(t===Pi&&C==="\\"){switch(y=p,n[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}E=p}if(C===`
|
|
29
29
|
`)t===Ll&&(p=Up(n,p,e.length)),u=p+e.length+l,d=void 0;else{if(C===" "&&h&&h!==" "&&h!==`
|
|
30
30
|
`&&h!==" "){let x=n[p+1];x&&x!==" "&&x!==`
|
|
31
|
-
`&&x!==" "&&(d=p)}if(p>=u)if(d)c.push(d),u=d+l,d=void 0;else if(t===Pi){for(;h===" "||h===" ";)h=C,C=n[p+=1],
|
|
31
|
+
`&&x!==" "&&(d=p)}if(p>=u)if(d)c.push(d),u=d+l,d=void 0;else if(t===Pi){for(;h===" "||h===" ";)h=C,C=n[p+=1],g=!0;let x=p>E+1?p-2:y-1;if(f[x])return n;c.push(x),f[x]=!0,u=x+l,d=void 0}else g=!0}h=C}if(g&&a&&a(),c.length===0)return n;o&&o();let P=n.slice(0,c[0]);for(let C=0;C<c.length;++C){let x=c[C],I=c[C+1]||n.length;x===0?P=`
|
|
32
32
|
${e}${n.slice(0,I)}`:(t===Pi&&f[x]&&(P+=`${n[x]}\\`),P+=`
|
|
33
33
|
${e}${n.slice(x+1,I)}`)}return P}function Up(n,e,t){let r=e,s=e+1,i=n[s];for(;i===" "||i===" ";)if(e<s+t)i=n[++e];else{do i=n[++e];while(i&&i!==`
|
|
34
|
-
`);r=e,s=e+1,i=n[s]}return r}Wr.FOLD_BLOCK=Ll;Wr.FOLD_FLOW
|
|
34
|
+
`);r=e,s=e+1,i=n[s]}return r}Wr.FOLD_BLOCK=Ll;Wr.FOLD_FLOW=$k;Wr.FOLD_QUOTED=Pi;Wr.foldFlowLines=Lk});var Hr=R(Jp=>{"use strict";var We=ne(),Tt=qp(),_i=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),Ci=n=>/^(%|---|\.\.\.)/m.test(n);function Mk(n,e,t){if(!e||e<0)return!1;let r=e-t,s=n.length;if(s<=r)return!1;for(let i=0,o=0;i<s;++i)if(n[i]===`
|
|
35
35
|
`){if(i-o>r)return!0;if(o=i+1,s-o<=r)return!1}return!0}function Kr(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:r}=e,s=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Ci(n)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let f=t.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+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||t[l+2]==='"'||t.length<s)l+=1;else{for(o+=t.slice(a,l)+`
|
|
36
36
|
|
|
37
37
|
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
38
38
|
`,l+=2;o+=i,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,r?o:Tt.foldFlowLines(o,i,Tt.FOLD_QUOTED,_i(e,!1))}function Ml(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
39
39
|
`)||/[ \t]\n|\n[ \t]/.test(n))return Kr(n,e);let t=e.indent||(Ci(n)?" ":""),r="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
40
|
-
${t}`)+"'";return e.implicitKey?r:Tt.foldFlowLines(r,t,Tt.FOLD_FLOW,_i(e,!1))}function
|
|
40
|
+
${t}`)+"'";return e.implicitKey?r:Tt.foldFlowLines(r,t,Tt.FOLD_FLOW,_i(e,!1))}function Bn(n,e){let{singleQuote:t}=e.options,r;if(t===!1)r=Kr;else{let s=n.includes('"'),i=n.includes("'");s&&!i?r=Ml:i&&!s?r=Kr:r=t?Ml:Kr}return r(n,e)}var Bl;try{Bl=new RegExp(`(^|(?<!
|
|
41
41
|
))
|
|
42
42
|
+(?!
|
|
43
|
-
|$)`,"g")}catch{Bl=/\n+(?!\n|$)/g}function Oi({comment:n,type:e,value:t},r,s,i){let{blockQuote:o,commentString:a,lineWidth:l}=r.options;if(!o||/\n[\t ]+$/.test(t))return
|
|
43
|
+
|$)`,"g")}catch{Bl=/\n+(?!\n|$)/g}function Oi({comment:n,type:e,value:t},r,s,i){let{blockQuote:o,commentString:a,lineWidth:l}=r.options;if(!o||/\n[\t ]+$/.test(t))return Bn(t,r);let c=r.indent||(r.forceBlockIndent||Ci(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===We.Scalar.BLOCK_FOLDED?!1:e===We.Scalar.BLOCK_LITERAL?!0:!Mk(t,l,c.length);if(!t)return f?`|
|
|
44
44
|
`:`>
|
|
45
45
|
`;let u,d;for(d=t.length;d>0;--d){let I=t[d-1];if(I!==`
|
|
46
|
-
`&&I!==" "&&I!==" ")break}let h=t.substring(d),
|
|
47
|
-
`);
|
|
46
|
+
`&&I!==" "&&I!==" ")break}let h=t.substring(d),g=h.indexOf(`
|
|
47
|
+
`);g===-1?u="-":t===h||g!==h.length-1?(u="+",i&&i()):u="",h&&(t=t.slice(0,-h.length),h[h.length-1]===`
|
|
48
48
|
`&&(h=h.slice(0,-1)),h=h.replace(Bl,`$&${c}`));let p=!1,y,E=-1;for(y=0;y<t.length;++y){let I=t[y];if(I===" ")p=!0;else if(I===`
|
|
49
49
|
`)E=y;else break}let P=t.substring(0,E<y?E+1:y);P&&(t=t.substring(P.length),P=P.replace(/\n+/g,`$&${c}`));let x=(p?c?"2":"1":"")+u;if(n&&(x+=" "+a(n.replace(/ ?[\r\n]+/g," ")),s&&s()),!f){let I=t.replace(/\n+/g,`
|
|
50
50
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,M=_i(r,!0);o!=="folded"&&e!==We.Scalar.BLOCK_FOLDED&&(M.onOverflow=()=>{N=!0});let T=Tt.foldFlowLines(`${P}${I}${h}`,c,Tt.FOLD_BLOCK,M);if(!N)return`>${x}
|
|
51
51
|
${c}${T}`}return t=t.replace(/\n+/g,`$&${c}`),`|${x}
|
|
52
|
-
${c}${P}${t}${h}`}function
|
|
53
|
-
`)||f&&/[[\]{},]/.test(i))return
|
|
54
|
-
`)?
|
|
55
|
-
`))return Oi(n,e,t,r);if(Ci(i)){if(l==="")return e.forceBlockIndent=!0,Oi(n,e,t,r);if(a&&l===c)return
|
|
56
|
-
${l}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:
|
|
57
|
-
${e.indent}${a}`:a}Dl.createStringifyContext=
|
|
52
|
+
${c}${P}${t}${h}`}function Bk(n,e,t,r){let{type:s,value:i}=n,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&i.includes(`
|
|
53
|
+
`)||f&&/[[\]{},]/.test(i))return Bn(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||f||!i.includes(`
|
|
54
|
+
`)?Bn(i,e):Oi(n,e,t,r);if(!a&&!f&&s!==We.Scalar.PLAIN&&i.includes(`
|
|
55
|
+
`))return Oi(n,e,t,r);if(Ci(i)){if(l==="")return e.forceBlockIndent=!0,Oi(n,e,t,r);if(a&&l===c)return Bn(i,e)}let u=i.replace(/\n+/g,`$&
|
|
56
|
+
${l}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return Bn(i,e)}return a?u:Tt.foldFlowLines(u,l,Tt.FOLD_FLOW,_i(e,!1))}function Dk(n,e,t,r){let{implicitKey:s,inFlow:i}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)}),{type:a}=n;a!==We.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=We.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case We.Scalar.BLOCK_FOLDED:case We.Scalar.BLOCK_LITERAL:return s||i?Bn(o.value,e):Oi(o,e,t,r);case We.Scalar.QUOTE_DOUBLE:return Kr(o.value,e);case We.Scalar.QUOTE_SINGLE:return Ml(o.value,e);case We.Scalar.PLAIN:return Bk(o,e,t,r);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=s&&f||u;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}Jp.stringifyString=Dk});var Yr=R(Dl=>{"use strict";var jk=Si(),Pt=q(),Fk=Jr(),Uk=Hr();function qk(n,e){let t=Object.assign({blockQuote:!0,commentString:Fk.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},n.schema.toStringOptions,e),r;switch(t.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:r,options:t}}function Jk(n,e){if(e.tag){let s=n.filter(i=>i.tag===e.tag);if(s.length>0)return s.find(i=>i.format===e.format)??s[0]}let t,r;if(Pt.isScalar(e)){r=e.value;let s=n.filter(i=>i.identify?.(r));if(s.length>1){let i=s.filter(o=>o.test);i.length>0&&(s=i)}t=s.find(i=>i.format===e.format)??s.find(i=>!i.format)}else r=e,t=n.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!t){let s=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${s} value`)}return t}function Wk(n,e,{anchors:t,doc:r}){if(!r.directives)return"";let s=[],i=(Pt.isScalar(n)||Pt.isCollection(n))&&n.anchor;i&&jk.anchorIsValid(i)&&(t.add(i),s.push(`&${i}`));let o=n.tag??(e.default?null:e.tag);return o&&s.push(r.directives.tagString(o)),s.join(" ")}function Kk(n,e,t,r){if(Pt.isPair(n))return n.toString(e,t,r);if(Pt.isAlias(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let s,i=Pt.isNode(n)?n:e.doc.createNode(n,{onTagObj:l=>s=l});s??(s=Jk(e.doc.schema.tags,i));let o=Wk(i,s,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof s.stringify=="function"?s.stringify(i,e,t,r):Pt.isScalar(i)?Uk.stringifyString(i,e,t,r):i.toString(e,t,r);return o?Pt.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
57
|
+
${e.indent}${a}`:a}Dl.createStringifyContext=qk;Dl.stringify=Kk});var Yp=R(Hp=>{"use strict";var lt=q(),Wp=ne(),Kp=Yr(),Vr=Jr();function Hk({key:n,value:e},t,r,s){let{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t,d=lt.isNode(n)&&n.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(lt.isCollection(n)||!lt.isNode(n)&&typeof n=="object"){let M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let h=!u&&(!n||d&&e==null&&!t.inFlow||lt.isCollection(n)||(lt.isScalar(n)?n.type===Wp.Scalar.BLOCK_FOLDED||n.type===Wp.Scalar.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!h&&(u||!i),indent:a+l});let g=!1,p=!1,y=Kp.stringify(n,t,()=>g=!0,()=>p=!0);if(!h&&!t.inFlow&&y.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(t.inFlow){if(i||e==null)return g&&r&&r(),y===""?"?":h?`? ${y}`:y}else if(i&&!u||e==null&&h)return y=`? ${y}`,d&&!g?y+=Vr.lineComment(y,t.indent,c(d)):p&&s&&s(),y;g&&(d=null),h?(d&&(y+=Vr.lineComment(y,t.indent,c(d))),y=`? ${y}
|
|
58
58
|
${a}:`):(y=`${y}:`,d&&(y+=Vr.lineComment(y,t.indent,c(d))));let E,P,C;lt.isNode(e)?(E=!!e.spaceBefore,P=e.commentBefore,C=e.comment):(E=!1,P=null,C=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!h&&!d&<.isScalar(e)&&(t.indentAtStart=y.length+1),p=!1,!f&&l.length>=2&&!t.inFlow&&!h&<.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let x=!1,I=Kp.stringify(e,t,()=>x=!0,()=>p=!0),N=" ";if(d||E||P){if(N=E?`
|
|
59
59
|
`:"",P){let M=c(P);N+=`
|
|
60
60
|
${Vr.indentComment(M,t.indent)}`}I===""&&!t.inFlow?N===`
|
|
@@ -64,32 +64,32 @@ ${Vr.indentComment(M,t.indent)}`}I===""&&!t.inFlow?N===`
|
|
|
64
64
|
${t.indent}`}else if(!h&<.isCollection(e)){let M=I[0],T=I.indexOf(`
|
|
65
65
|
`),K=T!==-1,ee=t.inFlow??e.flow??e.items.length===0;if(K||!ee){let Q=!1;if(K&&(M==="&"||M==="!")){let U=I.indexOf(" ");M==="&"&&U!==-1&&U<T&&I[U+1]==="!"&&(U=I.indexOf(" ",U+1)),(U===-1||T<U)&&(Q=!0)}Q||(N=`
|
|
66
66
|
${t.indent}`)}}else(I===""||I[0]===`
|
|
67
|
-
`)&&(N="");return y+=N+I,t.inFlow?x&&r&&r():C&&!x?y+=Vr.lineComment(y,t.indent,c(C)):p&&s&&s(),y}Hp.stringifyPair=
|
|
67
|
+
`)&&(N="");return y+=N+I,t.inFlow?x&&r&&r():C&&!x?y+=Vr.lineComment(y,t.indent,c(C)):p&&s&&s(),y}Hp.stringifyPair=Hk});var Fl=R(jl=>{"use strict";var Vp=ci("process");function Yk(n,...e){n==="debug"&&console.log(...e)}function Vk(n,e){(n==="debug"||n==="warn")&&(typeof Vp.emitWarning=="function"?Vp.emitWarning(e):console.warn(e))}jl.debug=Yk;jl.warn=Vk});var $i=R(Ni=>{"use strict";var zr=q(),zp=ne(),Ri="<<",Ii={identify:n=>n===Ri||typeof n=="symbol"&&n.description===Ri,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new zp.Scalar(Symbol(Ri)),{addToJSMap:Gp}),stringify:()=>Ri},zk=(n,e)=>(Ii.identify(e)||zr.isScalar(e)&&(!e.type||e.type===zp.Scalar.PLAIN)&&Ii.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===Ii.tag&&t.default);function Gp(n,e,t){if(t=n&&zr.isAlias(t)?t.resolve(n.doc):t,zr.isSeq(t))for(let r of t.items)Ul(n,e,r);else if(Array.isArray(t))for(let r of t)Ul(n,e,r);else Ul(n,e,t)}function Ul(n,e,t){let r=n&&zr.isAlias(t)?t.resolve(n.doc):t;if(!zr.isMap(r))throw new Error("Merge sources must be maps or map aliases");let s=r.toJSON(null,n,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}Ni.addMergeToJSMap=Gp;Ni.isMergeKey=zk;Ni.merge=Ii});var Jl=R(Zp=>{"use strict";var Gk=Fl(),Xp=$i(),Xk=Yr(),Qp=q(),ql=Et();function Qk(n,e,{key:t,value:r}){if(Qp.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,r);else if(Xp.isMergeKey(n,t))Xp.addMergeToJSMap(n,e,r);else{let s=ql.toJS(t,"",n);if(e instanceof Map)e.set(s,ql.toJS(r,s,n));else if(e instanceof Set)e.add(s);else{let i=Zk(t,s,n),o=ql.toJS(r,i,n);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function Zk(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Qp.isNode(n)&&t?.doc){let r=Xk.createStringifyContext(t.doc,{});r.anchors=new Set;for(let i of t.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;let s=n.toString(r);if(!t.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),Gk.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return s}return JSON.stringify(e)}Zp.addPairToJSMap=Qk});var Ot=R(Wl=>{"use strict";var eh=qr(),ex=Yp(),tx=Jl(),Li=q();function nx(n,e,t){let r=eh.createNode(n,void 0,t),s=eh.createNode(e,void 0,t);return new Mi(r,s)}var Mi=class n{constructor(e,t=null){Object.defineProperty(this,Li.NODE_TYPE,{value:Li.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;return Li.isNode(t)&&(t=t.clone(e)),Li.isNode(r)&&(r=r.clone(e)),new n(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return tx.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?ex.stringifyPair(this,e,t,r):JSON.stringify(this)}};Wl.Pair=Mi;Wl.createPair=nx});var Kl=R(nh=>{"use strict";var tn=q(),th=Yr(),Bi=Jr();function rx(n,e,t){return(e.inFlow??n.flow?ix:sx)(n,e,t)}function sx({comment:n,items:e},t,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:i,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],y=null;if(tn.isNode(p))!u&&p.spaceBefore&&d.push(""),Di(t,d,p.commentBefore,u),p.comment&&(y=p.comment);else if(tn.isPair(p)){let P=tn.isNode(p.key)?p.key:null;P&&(!u&&P.spaceBefore&&d.push(""),Di(t,d,P.commentBefore,u))}u=!1;let E=th.stringify(p,f,()=>y=null,()=>u=!0);y&&(E+=Bi.lineComment(E,i,c(y))),u&&y&&(u=!1),d.push(r+E)}let h;if(d.length===0)h=s.start+s.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
|
|
68
68
|
${l}${p}`:`
|
|
69
69
|
`}}return n?(h+=`
|
|
70
|
-
`+Bi.indentComment(c(n),l),a&&a()):u&&o&&o(),h}function
|
|
71
|
-
`))&&(c=!0),u.push(E),f=u.length}let{start:d,end:h}=t;if(u.length===0)return d+h;if(!c){let
|
|
70
|
+
`+Bi.indentComment(c(n),l),a&&a()):u&&o&&o(),h}function ix({items:n},e,{flowChars:t,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,u=[];for(let g=0;g<n.length;++g){let p=n[g],y=null;if(tn.isNode(p))p.spaceBefore&&u.push(""),Di(e,u,p.commentBefore,!1),p.comment&&(y=p.comment);else if(tn.isPair(p)){let P=tn.isNode(p.key)?p.key:null;P&&(P.spaceBefore&&u.push(""),Di(e,u,P.commentBefore,!1),P.comment&&(c=!0));let C=tn.isNode(p.value)?p.value:null;C?(C.comment&&(y=C.comment),C.commentBefore&&(c=!0)):p.value==null&&P?.comment&&(y=P.comment)}y&&(c=!0);let E=th.stringify(p,l,()=>y=null);g<n.length-1&&(E+=","),y&&(E+=Bi.lineComment(E,r,a(y))),!c&&(u.length>f||E.includes(`
|
|
71
|
+
`))&&(c=!0),u.push(E),f=u.length}let{start:d,end:h}=t;if(u.length===0)return d+h;if(!c){let g=u.reduce((p,y)=>p+y.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=d;for(let p of u)g+=p?`
|
|
72
72
|
${i}${s}${p}`:`
|
|
73
|
-
`;return`${
|
|
74
|
-
${s}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Di({indent:n,options:{commentString:e}},t,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){let i=Bi.indentComment(e(r),n);t.push(i.trimStart())}}nh.stringifyCollection=
|
|
75
|
-
`:" ")}return
|
|
73
|
+
`;return`${g}
|
|
74
|
+
${s}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Di({indent:n,options:{commentString:e}},t,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){let i=Bi.indentComment(e(r),n);t.push(i.trimStart())}}nh.stringifyCollection=rx});var Ct=R(Yl=>{"use strict";var ox=Kl(),ax=Jl(),lx=Ai(),_t=q(),ji=Ot(),cx=ne();function Gr(n,e){let t=_t.isScalar(e)?e.value:e;for(let r of n)if(_t.isPair(r)&&(r.key===e||r.key===t||_t.isScalar(r.key)&&r.key.value===t))return r}var Hl=class extends lx.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(_t.MAP,e),this.items=[]}static from(e,t,r){let{keepUndefined:s,replacer:i}=r,o=new this(e),a=(l,c)=>{if(typeof i=="function")c=i.call(t,l,c);else if(Array.isArray(i)&&!i.includes(l))return;(c!==void 0||s)&&o.items.push(ji.createPair(l,c,r))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let r;_t.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new ji.Pair(e,e?.value):r=new ji.Pair(e.key,e.value);let s=Gr(this.items,r.key),i=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${r.key} already set`);_t.isScalar(s.value)&&cx.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 t=Gr(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let s=Gr(this.items,e)?.value;return(!t&&_t.isScalar(s)?s.value:s)??void 0}has(e){return!!Gr(this.items,e)}set(e,t){this.add(new ji.Pair(e,t),!0)}toJSON(e,t,r){let s=r?new r:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(let i of this.items)ax.addPairToJSMap(t,s,i);return s}toString(e,t,r){if(!e)return JSON.stringify(this);for(let s of this.items)if(!_t.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})),ox.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}};Yl.YAMLMap=Hl;Yl.findPair=Gr});var Dn=R(sh=>{"use strict";var ux=q(),rh=Ct(),dx={collection:"map",default:!0,nodeClass:rh.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return ux.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>rh.YAMLMap.from(n,e,t)};sh.map=dx});var Rt=R(ih=>{"use strict";var fx=qr(),px=Kl(),hx=Ai(),Ui=q(),mx=ne(),gx=Et(),Vl=class extends hx.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ui.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Fi(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let r=Fi(e);if(typeof r!="number")return;let s=this.items[r];return!t&&Ui.isScalar(s)?s.value:s}has(e){let t=Fi(e);return typeof t=="number"&&t<this.items.length}set(e,t){let r=Fi(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[r];Ui.isScalar(s)&&mx.isScalarValue(t)?s.value=t:this.items[r]=t}toJSON(e,t){let r=[];t?.onCreate&&t.onCreate(r);let s=0;for(let i of this.items)r.push(gx.toJS(i,String(s++),t));return r}toString(e,t,r){return e?px.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t}):JSON.stringify(this)}static from(e,t,r){let{replacer:s}=r,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof s=="function"){let l=t instanceof Set?a:String(o++);a=s.call(t,l,a)}i.items.push(fx.createNode(a,void 0,r))}}return i}};function Fi(n){let e=Ui.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ih.YAMLSeq=Vl});var jn=R(ah=>{"use strict";var yx=q(),oh=Rt(),bx={collection:"seq",default:!0,nodeClass:oh.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return yx.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>oh.YAMLSeq.from(n,e,t)};ah.seq=bx});var Xr=R(lh=>{"use strict";var wx=Hr(),vx={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,r){return e=Object.assign({actualString:!0},e),wx.stringifyString(n,e,t,r)}};lh.string=vx});var qi=R(dh=>{"use strict";var ch=ne(),uh={identify:n=>n==null,createNode:()=>new ch.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ch.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&uh.test.test(n)?n:e.options.nullStr};dh.nullTag=uh});var zl=R(ph=>{"use strict";var Sx=ne(),fh={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new Sx.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&fh.test.test(n)){let r=n[0]==="t"||n[0]==="T";if(e===r)return n}return e?t.options.trueStr:t.options.falseStr}};ph.boolTag=fh});var Fn=R(hh=>{"use strict";function kx({format:n,minFractionDigits:e,tag:t,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(!n&&e&&(!t||t==="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}hh.stringifyNumber=kx});var Xl=R(Ji=>{"use strict";var xx=ne(),Gl=Fn(),Ex={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Gl.stringifyNumber},Ax={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():Gl.stringifyNumber(n)}},Tx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){let e=new xx.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:Gl.stringifyNumber};Ji.float=Tx;Ji.floatExp=Ax;Ji.floatNaN=Ex});var Zl=R(Ki=>{"use strict";var mh=Fn(),Wi=n=>typeof n=="bigint"||Number.isInteger(n),Ql=(n,e,t,{intAsBigInt:r})=>r?BigInt(n):parseInt(n.substring(e),t);function gh(n,e,t){let{value:r}=n;return Wi(r)&&r>=0?t+r.toString(e):mh.stringifyNumber(n)}var Px={identify:n=>Wi(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>Ql(n,2,8,t),stringify:n=>gh(n,8,"0o")},Ox={identify:Wi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>Ql(n,0,10,t),stringify:mh.stringifyNumber},_x={identify:n=>Wi(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>Ql(n,2,16,t),stringify:n=>gh(n,16,"0x")};Ki.int=Ox;Ki.intHex=_x;Ki.intOct=Px});var bh=R(yh=>{"use strict";var Cx=Dn(),Rx=qi(),Ix=jn(),Nx=Xr(),$x=zl(),ec=Xl(),tc=Zl(),Lx=[Cx.map,Ix.seq,Nx.string,Rx.nullTag,$x.boolTag,tc.intOct,tc.int,tc.intHex,ec.floatNaN,ec.floatExp,ec.float];yh.schema=Lx});var Sh=R(vh=>{"use strict";var Mx=ne(),Bx=Dn(),Dx=jn();function wh(n){return typeof n=="bigint"||Number.isInteger(n)}var Hi=({value:n})=>JSON.stringify(n),jx=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:Hi},{identify:n=>n==null,createNode:()=>new Mx.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Hi},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:Hi},{identify:wh,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>wh(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:Hi}],Fx={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},Ux=[Bx.map,Dx.seq].concat(jx,Fx);vh.schema=Ux});var rc=R(kh=>{"use strict";var Qr=ci("buffer"),nc=ne(),qx=Hr(),Jx={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof Qr.Buffer=="function")return Qr.Buffer.from(n,"base64");if(typeof atob=="function"){let t=atob(n.replace(/[\n\r]/g,"")),r=new Uint8Array(t.length);for(let s=0;s<t.length;++s)r[s]=t.charCodeAt(s);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},r,s,i){if(!t)return"";let o=t,a;if(typeof Qr.Buffer=="function")a=o instanceof Qr.Buffer?o.toString("base64"):Qr.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=nc.Scalar.BLOCK_LITERAL),e!==nc.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 u=0,d=0;u<c;++u,d+=l)f[u]=a.substr(d,l);a=f.join(e===nc.Scalar.BLOCK_LITERAL?`
|
|
75
|
+
`:" ")}return qx.stringifyString({comment:n,type:e,value:a},r,s,i)}};kh.binary=Jx});var zi=R(Vi=>{"use strict";var Yi=q(),sc=Ot(),Wx=ne(),Kx=Rt();function xh(n,e){if(Yi.isSeq(n))for(let t=0;t<n.items.length;++t){let r=n.items[t];if(!Yi.isPair(r)){if(Yi.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let s=r.items[0]||new sc.Pair(new Wx.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}n.items[t]=Yi.isPair(r)?r:new sc.Pair(r)}}else e("Expected a sequence for this tag");return n}function Eh(n,e,t){let{replacer:r}=t,s=new Wx.YAMLSeq(n);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(sc.createPair(a,l,t))}return s}var Kx={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:xh,createNode:Eh};Vi.createPairs=Eh;Vi.pairs=Kx;Vi.resolvePairs=xh});var ac=R(oc=>{"use strict";var Ah=J(),ic=Et(),Zr=Ct(),Hx=Rt(),Th=zi(),nn=class n extends Hx.YAMLSeq{constructor(){super(),this.add=Zr.YAMLMap.prototype.add.bind(this),this.delete=Zr.YAMLMap.prototype.delete.bind(this),this.get=Zr.YAMLMap.prototype.get.bind(this),this.has=Zr.YAMLMap.prototype.has.bind(this),this.set=Zr.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;t?.onCreate&&t.onCreate(r);for(let s of this.items){let i,o;if(Ah.isPair(s)?(i=ic.toJS(s.key,"",t),o=ic.toJS(s.value,i,t)):i=ic.toJS(s,"",t),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,t,r){let s=Th.createPairs(e,t,r),i=new this;return i.items=s.items,i}};nn.tag="tag:yaml.org,2002:omap";var Yx={collection:"seq",identify:n=>n instanceof Map,nodeClass:nn,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=Th.resolvePairs(n,e),r=[];for(let{key:s}of t.items)Ah.isScalar(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new nn,t)},createNode:(n,e,t)=>nn.from(n,e,t)};oc.YAMLOMap=nn;oc.omap=Yx});var Rh=R(lc=>{"use strict";var Ph=ne();function Oh({value:n,source:e},t){return e&&(n?_h:Ch).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var _h={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ph.Scalar(!0),stringify:Oh},Ch={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ph.Scalar(!1),stringify:Oh};lc.falseTag=Ch;lc.trueTag=_h});var Ih=R(Gi=>{"use strict";var Vx=ne(),cc=jn(),zx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:cc.stringifyNumber},Gx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():cc.stringifyNumber(n)}},Xx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new Vx.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let r=n.substring(t+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:cc.stringifyNumber};Gi.float=Xx;Gi.floatExp=Gx;Gi.floatNaN=zx});var $h=R(ts=>{"use strict";var Nh=jn(),es=n=>typeof n=="bigint"||Number.isInteger(n);function Xi(n,e,t,{intAsBigInt:r}){let s=n[0];if((s==="-"||s==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),r){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return s==="-"?BigInt(-1)*o:o}let i=parseInt(n,t);return s==="-"?-1*i:i}function uc(n,e,t){let{value:r}=n;if(es(r)){let s=r.toString(e);return r<0?"-"+t+s.substr(1):t+s}return Nh.stringifyNumber(n)}var Qx={identify:es,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Xi(n,2,2,t),stringify:n=>uc(n,2,"0b")},Zx={identify:es,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Xi(n,1,8,t),stringify:n=>uc(n,8,"0")},e0={identify:es,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Xi(n,0,10,t),stringify:Nh.stringifyNumber},t0={identify:es,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Xi(n,2,16,t),stringify:n=>uc(n,16,"0x")};ts.int=e0;ts.intBin=Qx;ts.intHex=t0;ts.intOct=Zx});var fc=R(dc=>{"use strict";var eo=J(),Qi=Ot(),Zi=Ct(),rn=class n extends Zi.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;eo.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Qi.Pair(e.key,null):t=new Qi.Pair(e,null),Zi.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=Zi.findPair(this.items,e);return!t&&eo.isPair(r)?eo.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=Zi.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new Qi.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);throw new Error("Set items must all have null values")}static from(e,t,r){let{replacer:s}=r,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof s=="function"&&(o=s.call(t,o,o)),i.items.push(Qi.createPair(o,null,r));return i}};rn.tag="tag:yaml.org,2002:set";var n0={collection:"map",identify:n=>n instanceof Set,nodeClass:rn,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>rn.from(n,e,t),resolve(n,e){if(eo.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new rn,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};dc.YAMLSet=rn;dc.set=n0});var hc=R(to=>{"use strict";var r0=jn();function pc(n,e){let t=n[0],r=t==="-"||t==="+"?n.substring(1):n,s=o=>e?BigInt(o):Number(o),i=r.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*i:i}function Lh(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return r0.stringifyNumber(n);let r="";e<0&&(r="-",e*=t(-1));let s=t(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 s0={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>pc(n,t),stringify:Lh},i0={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>pc(n,!1),stringify:Lh},Mh={identify:n=>n 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(n){let e=n.match(Mh.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,r,s,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,r-1,s,i||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let u=pc(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};to.floatTime=i0;to.intTime=s0;to.timestamp=Mh});var jh=R(Dh=>{"use strict";var o0=Bn(),a0=qi(),l0=Dn(),c0=Xr(),u0=rc(),Bh=Rh(),mc=Ih(),no=$h(),d0=$i(),f0=ac(),p0=zi(),h0=fc(),gc=hc(),m0=[o0.map,l0.seq,c0.string,a0.nullTag,Bh.trueTag,Bh.falseTag,no.intBin,no.intOct,no.int,no.intHex,mc.floatNaN,mc.floatExp,mc.float,u0.binary,d0.merge,f0.omap,p0.pairs,h0.set,gc.intTime,gc.floatTime,gc.timestamp];Dh.schema=m0});var zh=R(wc=>{"use strict";var Jh=Bn(),g0=qi(),Wh=Dn(),y0=Xr(),b0=zl(),yc=Xl(),bc=Zl(),w0=bh(),v0=Sh(),Kh=rc(),ns=$i(),Hh=ac(),Yh=zi(),Fh=jh(),Vh=fc(),ro=hc(),Uh=new Map([["core",w0.schema],["failsafe",[Jh.map,Wh.seq,y0.string]],["json",v0.schema],["yaml11",Fh.schema],["yaml-1.1",Fh.schema]]),qh={binary:Kh.binary,bool:b0.boolTag,float:yc.float,floatExp:yc.floatExp,floatNaN:yc.floatNaN,floatTime:ro.floatTime,int:bc.int,intHex:bc.intHex,intOct:bc.intOct,intTime:ro.intTime,map:Jh.map,merge:ns.merge,null:g0.nullTag,omap:Hh.omap,pairs:Yh.pairs,seq:Wh.seq,set:Vh.set,timestamp:ro.timestamp},S0={"tag:yaml.org,2002:binary":Kh.binary,"tag:yaml.org,2002:merge":ns.merge,"tag:yaml.org,2002:omap":Hh.omap,"tag:yaml.org,2002:pairs":Yh.pairs,"tag:yaml.org,2002:set":Vh.set,"tag:yaml.org,2002:timestamp":ro.timestamp};function k0(n,e,t){let r=Uh.get(e);if(r&&!n)return t&&!r.includes(ns.merge)?r.concat(ns.merge):r.slice();let s=r;if(!s)if(Array.isArray(n))s=[];else{let i=Array.from(Uh.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(n))for(let i of n)s=s.concat(i);else typeof n=="function"&&(s=n(s.slice()));return t&&(s=s.concat(ns.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?qh[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(qh).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},[])}wc.coreKnownTags=S0;wc.getTags=k0});var kc=R(Gh=>{"use strict";var vc=J(),x0=Bn(),E0=Dn(),A0=Xr(),so=zh(),T0=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Sc=class n{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?so.getTags(e,"compat"):e?so.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?so.coreKnownTags:{},this.tags=so.getTags(t,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,vc.MAP,{value:x0.map}),Object.defineProperty(this,vc.SCALAR,{value:A0.string}),Object.defineProperty(this,vc.SEQ,{value:E0.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?T0:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Gh.Schema=Sc});var Qh=R(Xh=>{"use strict";var P0=J(),xc=Yr(),rs=Jr();function O0(n,e){let t=[],r=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),r=!0):n.directives.docStart&&(r=!0)}r&&t.push("---");let s=xc.createStringifyContext(n,e),{commentString:i}=s.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=i(n.commentBefore);t.unshift(rs.indentComment(l,""))}let o=!1,a=null;if(n.contents){if(P0.isNode(n.contents)){if(n.contents.spaceBefore&&r&&t.push(""),n.contents.commentBefore){let f=i(n.contents.commentBefore);t.push(rs.indentComment(f,""))}s.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>o=!0,c=xc.stringify(n.contents,s,()=>a=null,l);a&&(c+=rs.lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(xc.stringify(n.contents,s));if(n.directives?.docEnd)if(n.comment){let l=i(n.comment);l.includes(`
|
|
77
|
+
${i.comment}`:r.comment}r=s}n.items[t]=Yi.isPair(r)?r:new sc.Pair(r)}}else e("Expected a sequence for this tag");return n}function Eh(n,e,t){let{replacer:r}=t,s=new Kx.YAMLSeq(n);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(sc.createPair(a,l,t))}return s}var Hx={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:xh,createNode:Eh};Vi.createPairs=Eh;Vi.pairs=Hx;Vi.resolvePairs=xh});var ac=R(oc=>{"use strict";var Ah=q(),ic=Et(),Zr=Ct(),Yx=Rt(),Th=zi(),nn=class n extends Yx.YAMLSeq{constructor(){super(),this.add=Zr.YAMLMap.prototype.add.bind(this),this.delete=Zr.YAMLMap.prototype.delete.bind(this),this.get=Zr.YAMLMap.prototype.get.bind(this),this.has=Zr.YAMLMap.prototype.has.bind(this),this.set=Zr.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;t?.onCreate&&t.onCreate(r);for(let s of this.items){let i,o;if(Ah.isPair(s)?(i=ic.toJS(s.key,"",t),o=ic.toJS(s.value,i,t)):i=ic.toJS(s,"",t),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,t,r){let s=Th.createPairs(e,t,r),i=new this;return i.items=s.items,i}};nn.tag="tag:yaml.org,2002:omap";var Vx={collection:"seq",identify:n=>n instanceof Map,nodeClass:nn,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=Th.resolvePairs(n,e),r=[];for(let{key:s}of t.items)Ah.isScalar(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new nn,t)},createNode:(n,e,t)=>nn.from(n,e,t)};oc.YAMLOMap=nn;oc.omap=Vx});var Rh=R(lc=>{"use strict";var Ph=ne();function Oh({value:n,source:e},t){return e&&(n?_h:Ch).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var _h={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ph.Scalar(!0),stringify:Oh},Ch={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ph.Scalar(!1),stringify:Oh};lc.falseTag=Ch;lc.trueTag=_h});var Ih=R(Gi=>{"use strict";var zx=ne(),cc=Fn(),Gx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:cc.stringifyNumber},Xx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():cc.stringifyNumber(n)}},Qx={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new zx.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let r=n.substring(t+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:cc.stringifyNumber};Gi.float=Qx;Gi.floatExp=Xx;Gi.floatNaN=Gx});var $h=R(ts=>{"use strict";var Nh=Fn(),es=n=>typeof n=="bigint"||Number.isInteger(n);function Xi(n,e,t,{intAsBigInt:r}){let s=n[0];if((s==="-"||s==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),r){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return s==="-"?BigInt(-1)*o:o}let i=parseInt(n,t);return s==="-"?-1*i:i}function uc(n,e,t){let{value:r}=n;if(es(r)){let s=r.toString(e);return r<0?"-"+t+s.substr(1):t+s}return Nh.stringifyNumber(n)}var Zx={identify:es,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Xi(n,2,2,t),stringify:n=>uc(n,2,"0b")},e0={identify:es,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Xi(n,1,8,t),stringify:n=>uc(n,8,"0")},t0={identify:es,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Xi(n,0,10,t),stringify:Nh.stringifyNumber},n0={identify:es,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Xi(n,2,16,t),stringify:n=>uc(n,16,"0x")};ts.int=t0;ts.intBin=Zx;ts.intHex=n0;ts.intOct=e0});var fc=R(dc=>{"use strict";var eo=q(),Qi=Ot(),Zi=Ct(),rn=class n extends Zi.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;eo.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Qi.Pair(e.key,null):t=new Qi.Pair(e,null),Zi.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=Zi.findPair(this.items,e);return!t&&eo.isPair(r)?eo.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=Zi.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new Qi.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);throw new Error("Set items must all have null values")}static from(e,t,r){let{replacer:s}=r,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof s=="function"&&(o=s.call(t,o,o)),i.items.push(Qi.createPair(o,null,r));return i}};rn.tag="tag:yaml.org,2002:set";var r0={collection:"map",identify:n=>n instanceof Set,nodeClass:rn,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>rn.from(n,e,t),resolve(n,e){if(eo.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new rn,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};dc.YAMLSet=rn;dc.set=r0});var hc=R(to=>{"use strict";var s0=Fn();function pc(n,e){let t=n[0],r=t==="-"||t==="+"?n.substring(1):n,s=o=>e?BigInt(o):Number(o),i=r.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*i:i}function Lh(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return s0.stringifyNumber(n);let r="";e<0&&(r="-",e*=t(-1));let s=t(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 i0={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>pc(n,t),stringify:Lh},o0={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>pc(n,!1),stringify:Lh},Mh={identify:n=>n 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(n){let e=n.match(Mh.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,r,s,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,r-1,s,i||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let u=pc(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};to.floatTime=o0;to.intTime=i0;to.timestamp=Mh});var jh=R(Dh=>{"use strict";var a0=Dn(),l0=qi(),c0=jn(),u0=Xr(),d0=rc(),Bh=Rh(),mc=Ih(),no=$h(),f0=$i(),p0=ac(),h0=zi(),m0=fc(),gc=hc(),g0=[a0.map,c0.seq,u0.string,l0.nullTag,Bh.trueTag,Bh.falseTag,no.intBin,no.intOct,no.int,no.intHex,mc.floatNaN,mc.floatExp,mc.float,d0.binary,f0.merge,p0.omap,h0.pairs,m0.set,gc.intTime,gc.floatTime,gc.timestamp];Dh.schema=g0});var zh=R(wc=>{"use strict";var Jh=Dn(),y0=qi(),Wh=jn(),b0=Xr(),w0=zl(),yc=Xl(),bc=Zl(),v0=bh(),S0=Sh(),Kh=rc(),ns=$i(),Hh=ac(),Yh=zi(),Fh=jh(),Vh=fc(),ro=hc(),Uh=new Map([["core",v0.schema],["failsafe",[Jh.map,Wh.seq,b0.string]],["json",S0.schema],["yaml11",Fh.schema],["yaml-1.1",Fh.schema]]),qh={binary:Kh.binary,bool:w0.boolTag,float:yc.float,floatExp:yc.floatExp,floatNaN:yc.floatNaN,floatTime:ro.floatTime,int:bc.int,intHex:bc.intHex,intOct:bc.intOct,intTime:ro.intTime,map:Jh.map,merge:ns.merge,null:y0.nullTag,omap:Hh.omap,pairs:Yh.pairs,seq:Wh.seq,set:Vh.set,timestamp:ro.timestamp},k0={"tag:yaml.org,2002:binary":Kh.binary,"tag:yaml.org,2002:merge":ns.merge,"tag:yaml.org,2002:omap":Hh.omap,"tag:yaml.org,2002:pairs":Yh.pairs,"tag:yaml.org,2002:set":Vh.set,"tag:yaml.org,2002:timestamp":ro.timestamp};function x0(n,e,t){let r=Uh.get(e);if(r&&!n)return t&&!r.includes(ns.merge)?r.concat(ns.merge):r.slice();let s=r;if(!s)if(Array.isArray(n))s=[];else{let i=Array.from(Uh.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(n))for(let i of n)s=s.concat(i);else typeof n=="function"&&(s=n(s.slice()));return t&&(s=s.concat(ns.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?qh[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(qh).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},[])}wc.coreKnownTags=k0;wc.getTags=x0});var kc=R(Gh=>{"use strict";var vc=q(),E0=Dn(),A0=jn(),T0=Xr(),so=zh(),P0=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Sc=class n{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?so.getTags(e,"compat"):e?so.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?so.coreKnownTags:{},this.tags=so.getTags(t,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,vc.MAP,{value:E0.map}),Object.defineProperty(this,vc.SCALAR,{value:T0.string}),Object.defineProperty(this,vc.SEQ,{value:A0.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?P0:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Gh.Schema=Sc});var Qh=R(Xh=>{"use strict";var O0=q(),xc=Yr(),rs=Jr();function _0(n,e){let t=[],r=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),r=!0):n.directives.docStart&&(r=!0)}r&&t.push("---");let s=xc.createStringifyContext(n,e),{commentString:i}=s.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=i(n.commentBefore);t.unshift(rs.indentComment(l,""))}let o=!1,a=null;if(n.contents){if(O0.isNode(n.contents)){if(n.contents.spaceBefore&&r&&t.push(""),n.contents.commentBefore){let f=i(n.contents.commentBefore);t.push(rs.indentComment(f,""))}s.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>o=!0,c=xc.stringify(n.contents,s,()=>a=null,l);a&&(c+=rs.lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(xc.stringify(n.contents,s));if(n.directives?.docEnd)if(n.comment){let l=i(n.comment);l.includes(`
|
|
78
78
|
`)?(t.push("..."),t.push(rs.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=n.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(rs.indentComment(i(l),"")))}return t.join(`
|
|
79
79
|
`)+`
|
|
80
|
-
`}Xh.stringifyDocument=
|
|
80
|
+
`}Xh.stringifyDocument=_0});var ss=R(Zh=>{"use strict";var C0=Ur(),Un=Ai(),Ie=q(),R0=Ot(),I0=Et(),N0=kc(),$0=Qh(),Ec=Si(),L0=Ol(),M0=qr(),Ac=Pl(),Tc=class n{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ie.NODE_TYPE,{value:Ie.DOC});let s=null;typeof t=="function"||Array.isArray(t)?s=t:r===void 0&&t&&(r=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},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 Ac.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,s,r)}clone(){let e=Object.create(n.prototype,{[Ie.NODE_TYPE]:{value:Ie.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=Ie.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){qn(this.contents)&&this.contents.add(e)}addIn(e,t){qn(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=Ec.anchorNames(this);e.anchor=!t||r.has(t)?Ec.findNewAnchor(t||"a",r):t}return new C0.Alias(e.anchor)}createNode(e,t,r){let s;if(typeof t=="function")e=t.call({"":e},"",e),s=t;else if(Array.isArray(t)){let y=P=>typeof P=="number"||P instanceof String||P instanceof Number,E=t.filter(y).map(String);E.length>0&&(t=t.concat(E)),s=t}else r===void 0&&t&&(r=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=r??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=Ec.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:s,schema:this.schema,sourceObjects:h},p=M0.createNode(e,f,g);return a&&Ie.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,t,r={}){let s=this.createNode(e,null,r),i=this.createNode(t,null,r);return new R0.Pair(s,i)}delete(e){return qn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Un.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):qn(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Ie.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Un.isEmptyPath(e)?!t&&Ie.isScalar(this.contents)?this.contents.value:this.contents:Ie.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Ie.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Un.isEmptyPath(e)?this.contents!==void 0:Ie.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Un.collectionFromPath(this.schema,[e],t):qn(this.contents)&&this.contents.set(e,t)}setIn(e,t){Un.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Un.collectionFromPath(this.schema,Array.from(e),t):qn(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ac.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 Ac.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(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new N0.Schema(Object.assign(r,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,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=I0.toJS(this.contents,t??"",a);if(typeof i=="function")for(let{count:c,res:f}of a.anchors.values())i(f,c);return typeof o=="function"?L0.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return $0.stringifyDocument(this,e)}};function qn(n){if(Ie.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}Zh.Document=Tc});var as=R(os=>{"use strict";var is=class extends Error{constructor(e,t,r,s){super(),this.name=e,this.code=r,this.message=s,this.pos=t}},Pc=class extends is{constructor(e,t,r){super("YAMLParseError",e,t,r)}},Oc=class extends is{constructor(e,t,r){super("YAMLWarning",e,t,r)}},B0=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:r,col:s}=t.linePos[0];t.message+=` at line ${r}, column ${s}`;let i=s-1,o=n.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=n.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=t.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);t.message+=`:
|
|
82
82
|
|
|
83
83
|
${o}
|
|
84
84
|
${c}
|
|
85
|
-
`}};os.YAMLError=is;os.YAMLParseError=Pc;os.YAMLWarning=Oc;os.prettifyError=
|
|
86
|
-
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(_c(e.key)||_c(e.value))return!0}return!1;default:return!0}}tm.containsNewline=_c});var Cc=R(nm=>{"use strict";var
|
|
87
|
-
`+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||
|
|
88
|
-
`+C.comment:P.comment=C.comment);let x=new im.Pair(P);t.options.keepSourceTokens&&(x.srcToken=f),a.items.push(x)}}return c&&c<l&&s(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,l,c??l],a}cm.resolveBlockMap=
|
|
89
|
-
`+N.comment:c.comment=N.comment),u=N.end;continue}!o&&t.options.strict&&
|
|
85
|
+
`}};os.YAMLError=is;os.YAMLParseError=Pc;os.YAMLWarning=Oc;os.prettifyError=B0});var ls=R(em=>{"use strict";function D0(n,{flow:e,indicator:t,next:r,offset:s,onError:i,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",d="",h=!1,g=!1,p=null,y=null,E=null,P=null,C=null,x=null,I=null;for(let T of n)switch(g&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&i(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(c&&T.type!=="comment"&&T.type!=="newline"&&i(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),T.type){case"space":!e&&(t!=="doc-start"||r?.type!=="flow-collection")&&T.source.includes(" ")&&(p=T),f=!0;break;case"comment":{f||i(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let K=T.source.substring(1)||" ";u?u+=d+K:u=K,d="",c=!1;break}case"newline":c?u?u+=T.source:(!x||t!=="seq-item-ind")&&(l=!0):d+=T.source,c=!0,h=!0,(y||E)&&(P=T),f=!0;break;case"anchor":y&&i(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&i(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=T,I??(I=T.offset),c=!1,f=!1,g=!0;break;case"tag":{E&&i(T,"MULTIPLE_TAGS","A node can have at most one tag"),E=T,I??(I=T.offset),c=!1,f=!1,g=!0;break}case t:(y||E)&&i(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),x&&i(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),x=T,c=t==="seq-item-ind"||t==="explicit-key-ind",f=!1;break;case"comma":if(e){C&&i(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),C=T,c=!1,f=!1;break}default:i(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),c=!1,f=!1}let N=n[n.length-1],M=N?N.offset+N.source.length:s;return g&&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"),p&&(c&&p.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&i(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:C,found:x,spaceBefore:l,comment:u,hasNewline:h,anchor:y,tag:E,newlineAfterProp:P,end:M,start:I??M}}em.resolveProps=D0});var io=R(tm=>{"use strict";function _c(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
86
|
+
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(_c(e.key)||_c(e.value))return!0}return!1;default:return!0}}tm.containsNewline=_c});var Cc=R(nm=>{"use strict";var j0=io();function F0(n,e,t){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===n&&(r.source==="]"||r.source==="}")&&j0.containsNewline(e)&&t(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}nm.flowIndentCheck=F0});var Rc=R(sm=>{"use strict";var rm=q();function U0(n,e,t){let{uniqueKeys:r}=n.options;if(r===!1)return!1;let s=typeof r=="function"?r:(i,o)=>i===o||rm.isScalar(i)&&rm.isScalar(o)&&i.value===o.value;return e.some(i=>s(i.key,t))}sm.mapIncludes=U0});var um=R(cm=>{"use strict";var im=Ot(),q0=Ct(),om=ls(),J0=io(),am=Cc(),W0=Rc(),lm="All mapping items must start at the same column";function K0({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=i?.nodeClass??q0.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=r.offset,c=null;for(let f of r.items){let{start:u,key:d,sep:h,value:g}=f,p=om.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:l,onError:s,parentIndent:r.indent,startOnNewline:!0}),y=!p.found;if(y){if(d&&(d.type==="block-seq"?s(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&s(l,"BAD_INDENT",lm)),!p.anchor&&!p.tag&&!h){c=p.end,p.comment&&(a.comment?a.comment+=`
|
|
87
|
+
`+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||J0.containsNewline(d))&&s(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&s(l,"BAD_INDENT",lm);t.atKey=!0;let E=p.end,P=d?n(t,d,p,s):e(t,E,u,null,p,s);t.schema.compat&&am.flowIndentCheck(r.indent,d,s),t.atKey=!1,W0.mapIncludes(t,a.items,P)&&s(E,"DUPLICATE_KEY","Map keys must be unique");let C=om.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:P.range[2],onError:s,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=C.end,C.found){y&&(g?.type==="block-map"&&!C.hasNewline&&s(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<C.found.offset-1024&&s(P.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=g?n(t,g,C,s):e(t,l,h,null,C,s);t.schema.compat&&am.flowIndentCheck(r.indent,g,s),l=x.range[2];let I=new im.Pair(P,x);t.options.keepSourceTokens&&(I.srcToken=f),a.items.push(I)}else{y&&s(P.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),C.comment&&(P.comment?P.comment+=`
|
|
88
|
+
`+C.comment:P.comment=C.comment);let x=new im.Pair(P);t.options.keepSourceTokens&&(x.srcToken=f),a.items.push(x)}}return c&&c<l&&s(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,l,c??l],a}cm.resolveBlockMap=K0});var fm=R(dm=>{"use strict";var H0=Rt(),Y0=ls(),V0=Cc();function z0({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=i?.nodeClass??H0.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=r.offset,c=null;for(let{start:f,value:u}of r.items){let d=Y0.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:l,onError:s,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?s(d.end,"BAD_INDENT","All sequence items must start at the same column"):s(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?n(t,u,d,s):e(t,d.end,f,null,d,s);t.schema.compat&&V0.flowIndentCheck(r.indent,u,s),l=h.range[2],a.items.push(h)}return a.range=[r.offset,l,c??l],a}dm.resolveBlockSeq=z0});var Jn=R(pm=>{"use strict";function G0(n,e,t,r){let s="";if(n){let i=!1,o="";for(let a of n){let{source:l,type:c}=a;switch(c){case"space":i=!0;break;case"comment":{t&&!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}}pm.resolveEnd=G0});var ym=R(gm=>{"use strict";var X0=q(),Q0=Ot(),hm=Ct(),Z0=Rt(),eE=Jn(),mm=ls(),tE=io(),nE=Rc(),Ic="Block collections are not allowed within flow collections",Nc=n=>n&&(n.type==="block-map"||n.type==="block-seq");function rE({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=r.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?hm.YAMLMap:Z0.YAMLSeq),c=new l(t.schema);c.flow=!0;let f=t.atRoot;f&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let E=r.items[y],{start:P,key:C,sep:x,value:I}=E,N=mm.resolveProps(P,{flow:a,indicator:"explicit-key-ind",next:C??x?.[0],offset:u,onError:s,parentIndent:r.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!x&&!I){y===0&&N.comma?s(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&s(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),N.comment&&(c.comment?c.comment+=`
|
|
89
|
+
`+N.comment:c.comment=N.comment),u=N.end;continue}!o&&t.options.strict&&tE.containsNewline(C)&&s(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)N.comma&&s(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(N.comma||s(N.start,"MISSING_CHAR",`Missing , between ${a} items`),N.comment){let M="";e:for(let T of P)switch(T.type){case"comma":case"space":break;case"comment":M=T.source.substring(1);break e;default:break e}if(M){let T=c.items[c.items.length-1];X0.isPair(T)&&(T=T.value??T.key),T.comment?T.comment+=`
|
|
90
90
|
`+M:T.comment=M,N.comment=N.comment.substring(M.length+1)}}if(!o&&!x&&!N.found){let M=I?n(t,I,N,s):e(t,N.end,x,null,N,s);c.items.push(M),u=M.range[2],Nc(I)&&s(M.range,"BLOCK_IN_FLOW",Ic)}else{t.atKey=!0;let M=N.end,T=C?n(t,C,N,s):e(t,M,P,null,N,s);Nc(C)&&s(T.range,"BLOCK_IN_FLOW",Ic),t.atKey=!1;let K=mm.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:I,offset:T.range[2],onError:s,parentIndent:r.indent,startOnNewline:!1});if(K.found){if(!o&&!N.found&&t.options.strict){if(x)for(let U of x){if(U===K.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}}N.start<K.found.offset-1024&&s(K.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else I&&("source"in I&&I.source?.[0]===":"?s(I,"MISSING_CHAR",`Missing space after : in ${a}`):s(K.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ee=I?n(t,I,K,s):K.found?e(t,K.end,x,null,K,s):null;ee?Nc(I)&&s(ee.range,"BLOCK_IN_FLOW",Ic):K.comment&&(T.comment?T.comment+=`
|
|
91
|
-
`+K.comment:T.comment=K.comment);let Q=new
|
|
92
|
-
`+y.comment:c.comment=y.comment),c.range=[r.offset,p,y.offset]}else c.range=[r.offset,p,p];return c}gm.resolveFlowCollection=
|
|
91
|
+
`+K.comment:T.comment=K.comment);let Q=new Q0.Pair(T,ee);if(t.options.keepSourceTokens&&(Q.srcToken=E),o){let U=c;nE.mapIncludes(t,U.items,T)&&s(M,"DUPLICATE_KEY","Map keys must be unique"),U.items.push(Q)}else{let U=new hm.YAMLMap(t.schema);U.flow=!0,U.items.push(Q);let se=(ee??T).range;U.range=[T.range[0],se[1],se[2]],c.items.push(U)}u=ee?ee.range[2]:K.end}}let d=o?"}":"]",[h,...g]=r.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let y=a[0].toUpperCase()+a.substring(1),E=f?`${y} must end with a ${d}`:`${y} in block collection must be sufficiently indented and end with a ${d}`;s(u,f?"MISSING_CHAR":"BAD_INDENT",E),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let y=eE.resolveEnd(g,p,t.options.strict,s);y.comment&&(c.comment?c.comment+=`
|
|
92
|
+
`+y.comment:c.comment=y.comment),c.range=[r.offset,p,y.offset]}else c.range=[r.offset,p,p];return c}gm.resolveFlowCollection=rE});var wm=R(bm=>{"use strict";var sE=q(),iE=ne(),oE=Ct(),aE=Rt(),lE=um(),cE=fm(),uE=ym();function $c(n,e,t,r,s,i){let o=t.type==="block-map"?lE.resolveBlockMap(n,e,t,r,i):t.type==="block-seq"?cE.resolveBlockSeq(n,e,t,r,i):uE.resolveFlowCollection(n,e,t,r,i),a=o.constructor;return s==="!"||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function dE(n,e,t,r,s){let i=r.tag,o=i?e.directives.tagName(i.source,d=>s(i,"TAG_RESOLVE_FAILED",d)):null;if(t.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=r,g=d&&i?d.offset>i.offset?d:i:d??i;g&&(!h||h.offset<g.offset)&&s(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===oE.YAMLMap.tagName&&a==="map"||o===aE.YAMLSeq.tagName&&a==="seq")return $c(n,e,t,s,o);let l=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?s(i,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),$c(n,e,t,s,o)}let c=$c(n,e,t,s,o,l),f=l.resolve?.(c,d=>s(i,"TAG_RESOLVE_FAILED",d),e.options)??c,u=sE.isNode(f)?f:new iE.Scalar(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}bm.composeCollection=dE});var Mc=R(vm=>{"use strict";var Lc=ne();function fE(n,e,t){let r=e.offset,s=pE(e,n.options.strict,t);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};let i=s.mode===">"?Lc.Scalar.BLOCK_FOLDED:Lc.Scalar.BLOCK_LITERAL,o=e.source?hE(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let y=o[p][1];if(y===""||y==="\r")a=p;else break}if(a===0){let p=s.chomp==="+"&&o.length>0?`
|
|
93
93
|
`.repeat(Math.max(1,o.length-1)):"",y=r+s.length;return e.source&&(y+=e.source.length),{value:p,type:i,comment:s.comment,range:[r,y,y]}}let l=e.indent+s.indent,c=e.offset+s.length,f=0;for(let p=0;p<a;++p){let[y,E]=o[p];if(E===""||E==="\r")s.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&t(c+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(l=y.length),f=p,l===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=y.length+E.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>l&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(l)+`
|
|
94
94
|
`;for(let p=f;p<a;++p){let[y,E]=o[p];c+=y.length+E.length+1;let P=E[E.length-1]==="\r";if(P&&(E=E.slice(0,-1)),E&&y.length<l){let x=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;t(c-E.length-(P?2:1),"BAD_INDENT",x),y=""}i===Lc.Scalar.BLOCK_LITERAL?(u+=d+y.slice(l)+E,d=`
|
|
95
95
|
`):y.length>l||E[0]===" "?(d===" "?d=`
|
|
@@ -104,41 +104,41 @@ ${c}
|
|
|
104
104
|
`+o[p][0].slice(l);u[u.length-1]!==`
|
|
105
105
|
`&&(u+=`
|
|
106
106
|
`);break;default:u+=`
|
|
107
|
-
`}let
|
|
107
|
+
`}let g=r+s.length+e.source.length;return{value:u,type:i,comment:s.comment,range:[r,g,g]}}function pE({offset:n,props:e},t,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 d=1;d<s.length;++d){let h=s[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!o&&g?o=g:l===-1&&(l=n+d)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let c=!1,f="",u=s.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":c=!0;case"newline":u+=h.source.length;break;case"comment":t&&!c&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:i,indent:o,chomp:a,comment:f,length:u}}function hE(n){let e=n.split(/\n( *)/),t=e[0],r=t.match(/^( *)/),i=[r?.[1]?[r[1],t.slice(r[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}vm.resolveBlockScalar=fE});var Dc=R(km=>{"use strict";var Bc=ne(),mE=Jn();function gE(n,e,t){let{offset:r,type:s,source:i,end:o}=n,a,l,c=(d,h,g)=>t(r+d,h,g);switch(s){case"scalar":a=Bc.Scalar.PLAIN,l=yE(i,c);break;case"single-quoted-scalar":a=Bc.Scalar.QUOTE_SINGLE,l=bE(i,c);break;case"double-quoted-scalar":a=Bc.Scalar.QUOTE_DOUBLE,l=wE(i,c);break;default:return t(n,"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,u=mE.resolveEnd(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[r,f,u.offset]}}function yE(n,e){let t="";switch(n[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Sm(n)}function bE(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),Sm(n.slice(1,-1)).replace(/''/g,"'")}function Sm(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
108
108
|
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
109
109
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(n);if(!r)return n;let s=r[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;r=t.exec(n);)r[1]===""?i===`
|
|
110
110
|
`?s+=i:i=`
|
|
111
|
-
`:(s+=i+r[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(n),s+i+(r?.[1]??"")}function
|
|
111
|
+
`:(s+=i+r[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(n),s+i+(r?.[1]??"")}function wE(n,e){let t="";for(let r=1;r<n.length-1;++r){let s=n[r];if(!(s==="\r"&&n[r+1]===`
|
|
112
112
|
`))if(s===`
|
|
113
|
-
`){let{fold:i,offset:o}=
|
|
113
|
+
`){let{fold:i,offset:o}=vE(n,r);t+=i,r=o}else if(s==="\\"){let i=n[++r],o=SE[i];if(o)t+=o;else if(i===`
|
|
114
114
|
`)for(i=n[r+1];i===" "||i===" ";)i=n[++r+1];else if(i==="\r"&&n[r+1]===`
|
|
115
|
-
`)for(i=n[++r+1];i===" "||i===" ";)i=n[++r+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=
|
|
115
|
+
`)for(i=n[++r+1];i===" "||i===" ";)i=n[++r+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=kE(n,r+1,a,e),r+=a}else{let a=n.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(s===" "||s===" "){let i=r,o=n[r+1];for(;o===" "||o===" ";)o=n[++r+1];o!==`
|
|
116
116
|
`&&!(o==="\r"&&n[r+2]===`
|
|
117
|
-
`)&&(t+=r>i?n.slice(i,r+1):s)}else t+=s}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function
|
|
117
|
+
`)&&(t+=r>i?n.slice(i,r+1):s)}else t+=s}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function vE(n,e){let t="",r=n[e+1];for(;(r===" "||r===" "||r===`
|
|
118
118
|
`||r==="\r")&&!(r==="\r"&&n[e+2]!==`
|
|
119
119
|
`);)r===`
|
|
120
120
|
`&&(t+=`
|
|
121
|
-
`),e+=1,r=n[e+1];return t||(t=" "),{fold:t,offset:e}}var
|
|
122
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
121
|
+
`),e+=1,r=n[e+1];return t||(t=" "),{fold:t,offset:e}}var SE={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 kE(n,e,t,r){let s=n.substr(e,t),o=s.length===t&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(o)){let a=n.substr(e-2,t+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}km.resolveFlowScalar=gE});var Am=R(Em=>{"use strict";var sn=q(),xm=ne(),xE=Mc(),EE=Dc();function AE(n,e,t,r){let{value:s,type:i,comment:o,range:a}=e.type==="block-scalar"?xE.resolveBlockScalar(n,e,r):EE.resolveFlowScalar(e,n.options.strict,r),l=t?n.directives.tagName(t.source,u=>r(t,"TAG_RESOLVE_FAILED",u)):null,c;n.options.stringKeys&&n.atKey?c=n.schema[sn.SCALAR]:l?c=TE(n.schema,s,l,t,r):e.type==="scalar"?c=PE(n,s,e,r):c=n.schema[sn.SCALAR];let f;try{let u=c.resolve(s,d=>r(t??e,"TAG_RESOLVE_FAILED",d),n.options);f=sn.isScalar(u)?u:new xm.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);r(t??e,"TAG_RESOLVE_FAILED",d),f=new xm.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 TE(n,e,t,r,s){if(t==="!")return n[sn.SCALAR];let i=[];for(let a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[sn.SCALAR])}function PE({atKey:n,directives:e,schema:t},r,s,i){let o=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(r))||t[sn.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(r))??t[sn.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}Em.composeScalar=AE});var Pm=R(Tm=>{"use strict";function OE(n,e,t){if(e){t??(t=e.length);for(let r=t-1;r>=0;--r){let s=e[r];switch(s.type){case"space":case"comment":case"newline":n-=s.source.length;continue}for(s=e[++r];s?.type==="space";)n+=s.source.length,s=e[++r];break}}return n}Tm.emptyScalarPosition=OE});var Cm=R(Fc=>{"use strict";var _E=Ur(),CE=q(),RE=wm(),Om=Am(),IE=Jn(),NE=Pm(),$E={composeNode:_m,composeEmptyNode:jc};function _m(n,e,t,r){let s=n.atKey,{spaceBefore:i,comment:o,anchor:a,tag:l}=t,c,f=!0;switch(e.type){case"alias":c=LE(n,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=Om.composeScalar(n,e,l,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=RE.composeCollection($E,n,e,t,r),a&&(c.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),c=jc(n,e.offset,void 0,null,t,r),f=!1}}return a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&n.options.stringKeys&&(!CE.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),n.options.keepSourceTokens&&f&&(c.srcToken=e),c}function jc(n,e,t,r,{spaceBefore:s,comment:i,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:NE.emptyScalarPosition(e,t,r),indent:-1,source:""},u=Om.composeScalar(n,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=l),u}function LE({options:n},{offset:e,source:t,end:r},s){let i=new _E.Alias(t.substring(1));i.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=IE.resolveEnd(r,o,n.strict,s);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}Fc.composeEmptyNode=jc;Fc.composeNode=_m});var Nm=R(Im=>{"use strict";var ME=ss(),Rm=Cm(),BE=Jn(),DE=ls();function jE(n,e,{offset:t,start:r,value:s,end:i},o){let a=Object.assign({_directives:e},n),l=new ME.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=DE.resolveProps(r,{indicator:"doc-start",next:s??i?.[0],offset:t,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?Rm.composeNode(c,s,f,o):Rm.composeEmptyNode(c,f.end,r,null,f,o);let u=l.contents.range[2],d=BE.resolveEnd(i,u,!1,o);return d.comment&&(l.comment=d.comment),l.range=[t,u,d.offset],l}Im.composeDoc=jE});var qc=R(Mm=>{"use strict";var FE=ci("process"),UE=Pl(),qE=ss(),cs=as(),$m=q(),JE=Nm(),WE=Jn();function us(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];let{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function Lm(n){let e="",t=!1,r=!1;for(let s=0;s<n.length;++s){let i=n[s];switch(i[0]){case"#":e+=(e===""?"":r?`
|
|
123
123
|
|
|
124
124
|
`:`
|
|
125
|
-
`)+(i.substring(1)||" "),t=!0,r=!1;break;case"%":n[s+1]?.[0]!=="#"&&(s+=1),t=!1;break;default:t||(r=!0),t=!1}}return{comment:e,afterEmptyLine:r}}var Uc=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,s,i)=>{let o=us(t);i?this.warnings.push(new cs.YAMLWarning(o,r,s)):this.errors.push(new cs.YAMLParseError(o,r,s))},this.directives=new
|
|
125
|
+
`)+(i.substring(1)||" "),t=!0,r=!1;break;case"%":n[s+1]?.[0]!=="#"&&(s+=1),t=!1;break;default:t||(r=!0),t=!1}}return{comment:e,afterEmptyLine:r}}var Uc=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,s,i)=>{let o=us(t);i?this.warnings.push(new cs.YAMLWarning(o,r,s)):this.errors.push(new cs.YAMLParseError(o,r,s))},this.directives=new UE.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:s}=Lm(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
126
126
|
${r}`:r;else if(s||e.directives.docStart||!i)e.commentBefore=r;else if($m.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];$m.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}}t?(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:Lm(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let s of e)yield*this.next(s);yield*this.end(t,r)}*next(e){switch(
|
|
129
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new cs.YAMLParseError(us(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),s=new
|
|
128
|
+
${o}`:r}}t?(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:Lm(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let s of e)yield*this.next(s);yield*this.end(t,r)}*next(e){switch(FE.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,s)=>{let i=us(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=JE.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new cs.YAMLParseError(us(e),"UNEXPECTED_TOKEN",t);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 cs.YAMLParseError(us(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let t=WE.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
129
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new cs.YAMLParseError(us(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),s=new qE.Document(void 0,r);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}};Mm.Composer=Uc});var jm=R(oo=>{"use strict";var KE=Mc(),HE=Dc(),YE=as(),Bm=Hr();function VE(n,e=!0,t){if(n){let r=(s,i,o)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(t)t(a,i,o);else throw new YE.YAMLParseError([a,a+1],i,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return HE.resolveFlowScalar(n,e,r);case"block-scalar":return KE.resolveBlockScalar({options:{strict:e}},n,r)}}return null}function zE(n,e){let{implicitKey:t=!1,indent:r,inFlow:s=!1,offset:i=-1,type:o="PLAIN"}=e,a=Bm.stringifyString({type:o,value:n},{implicitKey:t,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),u=a.substring(c+1)+`
|
|
132
132
|
`,d=[{type:"block-scalar-header",offset:i,indent:r,source:f}];return Dm(d,l)||d.push({type:"newline",offset:-1,indent:r,source:`
|
|
133
|
-
`}),{type:"block-scalar",offset:i,indent:r,props:d,source:u}}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
|
|
133
|
+
`}),{type:"block-scalar",offset:i,indent:r,props:d,source:u}}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 GE(n,e,t={}){let{afterKey:r=!1,implicitKey:s=!1,inFlow:i=!1,type:o}=t,a="indent"in n?n.indent:null;if(r&&typeof a=="number"&&(a+=2),!o)switch(n.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=n.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=Bm.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">":XE(n,l);break;case'"':Jc(n,l,"double-quoted-scalar");break;case"'":Jc(n,l,"single-quoted-scalar");break;default:Jc(n,l,"scalar")}}function XE(n,e){let t=e.indexOf(`
|
|
134
134
|
`),r=e.substring(0,t),s=e.substring(t+1)+`
|
|
135
135
|
`;if(n.type==="block-scalar"){let i=n.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=r,n.source=s}else{let{offset:i}=n,o="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:r}];Dm(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
136
136
|
`});for(let l of Object.keys(n))l!=="type"&&l!=="offset"&&delete n[l];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:s})}}function Dm(n,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function Jc(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{let r=n.props.slice(1),s=e.length;n.props[0].type==="block-scalar-header"&&(s-=n.props[0].source.length);for(let i of r)i.offset+=s;delete n.props,Object.assign(n,{type:t,source:e,end:r});break}case"block-map":case"block-seq":{let s={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
|
|
137
|
-
`};delete n.items,Object.assign(n,{type:t,source:e,end:[s]});break}default:{let r="indent"in n?n.indent:-1,s="end"in n&&Array.isArray(n.end)?n.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(n))i!=="type"&&i!=="offset"&&delete n[i];Object.assign(n,{type:t,indent:r,source:e,end:s})}}}oo.createScalarToken=
|
|
137
|
+
`};delete n.items,Object.assign(n,{type:t,source:e,end:[s]});break}default:{let r="indent"in n?n.indent:-1,s="end"in n&&Array.isArray(n.end)?n.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(n))i!=="type"&&i!=="offset"&&delete n[i];Object.assign(n,{type:t,indent:r,source:e,end:s})}}}oo.createScalarToken=zE;oo.resolveAsScalar=VE;oo.setScalarValue=GE});var Um=R(Fm=>{"use strict";var QE=n=>"type"in n?lo(n):ao(n);function lo(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=lo(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=ao(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=ao(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=ao(n);if(n.end)for(let t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(let t of n.end)e+=t.source;return e}}}function ao({start:n,key:e,sep:t,value:r}){let s="";for(let i of n)s+=i.source;if(e&&(s+=lo(e)),t)for(let i of t)s+=i.source;return r&&(s+=lo(r)),s}Fm.stringify=QE});var Km=R(Wm=>{"use strict";var Wc=Symbol("break visit"),ZE=Symbol("skip children"),qm=Symbol("remove item");function on(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),Jm(Object.freeze([]),n,e)}on.BREAK=Wc;on.SKIP=ZE;on.REMOVE=qm;on.itemAtPath=(n,e)=>{let t=n;for(let[r,s]of e){let i=t?.[r];if(i&&"items"in i)t=i.items[s];else return}return t};on.parentCollection=(n,e)=>{let t=on.itemAtPath(n,e.slice(0,-1)),r=e[e.length-1][0],s=t?.[r];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function Jm(n,e,t){let r=t(e,n);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=Jm(Object.freeze(n.concat([[s,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Wc)return Wc;a===qm&&(i.items.splice(o,1),o-=1)}}typeof r=="function"&&s==="key"&&(r=r(e,n))}}return typeof r=="function"?r(e,n):r}Wm.visit=on});var co=R(ve=>{"use strict";var Kc=jm(),eA=Um(),tA=Km(),Hc="\uFEFF",Yc="",Vc="",zc="",nA=n=>!!n&&"items"in n,rA=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function sA(n){switch(n){case Hc:return"<BOM>";case Yc:return"<DOC>";case Vc:return"<FLOW_END>";case zc:return"<SCALAR>";default:return JSON.stringify(n)}}function iA(n){switch(n){case Hc:return"byte-order-mark";case Yc:return"doc-mode";case Vc:return"flow-error-end";case zc: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(n[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 Hm=new Set("0123456789ABCDEFabcdef"),
|
|
141
|
-
\r `),Gc=n=>!n||
|
|
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(n[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}ve.createScalarToken=Kc.createScalarToken;ve.resolveAsScalar=Kc.resolveAsScalar;ve.setScalarValue=Kc.setScalarValue;ve.stringify=eA.stringify;ve.visit=tA.visit;ve.BOM=Hc;ve.DOCUMENT=Yc;ve.FLOW_END=Vc;ve.SCALAR=zc;ve.isCollection=nA;ve.isScalar=rA;ve.prettyToken=sA;ve.tokenType=iA});var Qc=R(Ym=>{"use strict";var ds=co();function Ke(n){switch(n){case void 0:case" ":case`
|
|
140
|
+
`:case"\r":case" ":return!0;default:return!1}}var Hm=new Set("0123456789ABCDEFabcdef"),oA=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),uo=new Set(",[]{}"),aA=new Set(` ,[]{}
|
|
141
|
+
\r `),Gc=n=>!n||aA.has(n),Xc=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";for(;r&&(t||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
142
142
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
143
143
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;for(;t===" ";)t=this.buffer[++r+e];if(t==="\r"){let s=this.buffer[r+e+1];if(s===`
|
|
144
144
|
`||!s&&!this.atEnd)return e+r+1}return t===`
|
|
@@ -153,20 +153,20 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
153
153
|
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield ds.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){let i=this.buffer[r+1];if(Ke(i)||e&&uo.has(i))break;t=r}else if(Ke(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===`
|
|
154
154
|
`?(r+=1,s=`
|
|
155
155
|
`,i=this.buffer[r+1]):t=r),i==="#"||e&&uo.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&&uo.has(s))break;t=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield ds.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Gc))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Ke(t)||e&&uo.has(t))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,t=this.buffer[e];for(;!Ke(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(
|
|
156
|
+
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&uo.has(s))break;t=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield ds.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Gc))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Ke(t)||e&&uo.has(t))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,t=this.buffer[e];for(;!Ke(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(oA.has(t))t=this.buffer[++e];else if(t==="%"&&Hm.has(this.buffer[e+1])&&Hm.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
157
157
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
158
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,r=this.buffer[t];for(;!e(r);)r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Ym.Lexer=Xc});var eu=R(Vm=>{"use strict";var Zc=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,r=this.lineStarts.length;for(;t<r;){let i=t+r>>1;this.lineStarts[i]<e?t=i+1:r=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};Vm.LineCounter=Zc});var nu=R(Zm=>{"use strict";var
|
|
158
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,r=this.buffer[t];for(;!e(r);)r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Ym.Lexer=Xc});var eu=R(Vm=>{"use strict";var Zc=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,r=this.lineStarts.length;for(;t<r;){let i=t+r>>1;this.lineStarts[i]<e?t=i+1:r=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};Vm.LineCounter=Zc});var nu=R(Zm=>{"use strict";var lA=ci("process"),zm=co(),cA=Qc();function It(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function Gm(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Qm(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function fo(n){switch(n.type){case"document":return n.start;case"block-map":{let e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function Wn(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function Xm(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!It(e.start,"explicit-key-ind")&&!It(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Qm(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 tu=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 cA.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);t||(yield*this.end())}*next(e){if(this.source=e,lA.env.LOG_TOKENS&&console.log("|",zm.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=zm.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let 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 t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let r=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in r?r.indent:0:t.type==="flow-collection"&&r.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Xm(t),r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,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:t}):s.value=t;break}case"flow-collection":{let s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&Gm(s.start)===-1&&(t.indent===0||s.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(r.type==="document"?r.end=s.start:r.items.push({start:s.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Gm(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=fo(this.peek(2)),r=Wn(t),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 t=this.source.indexOf(`
|
|
159
159
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
160
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.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 t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,s=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.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=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(It(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Qm(t.key)&&!It(t.sep,"newline")){let o=
|
|
160
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.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 t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,s=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.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=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(It(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Qm(t.key)&&!It(t.sep,"newline")){let o=Wn(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(It(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Wn(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):It(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);s||t.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!It(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let r="end"in t.value?t.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 t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||It(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.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 t=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":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{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=fo(r),i=Wn(s);Xm(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 t=this.source.indexOf(`
|
|
161
161
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
162
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=fo(e),r=
|
|
162
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=fo(e),r=Wn(t);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 t=fo(e),r=Wn(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!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())}}};Zm.Parser=tu});var sg=R(ps=>{"use strict";var eg=qc(),uA=ss(),fs=as(),dA=Fl(),fA=q(),pA=eu(),tg=nu();function ng(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new pA.LineCounter||null,prettyErrors:e}}function hA(n,e={}){let{lineCounter:t,prettyErrors:r}=ng(e),s=new tg.Parser(t?.addNewLine),i=new eg.Composer(e),o=Array.from(i.compose(s.parse(n)));if(r&&t)for(let a of o)a.errors.forEach(fs.prettifyError(n,t)),a.warnings.forEach(fs.prettifyError(n,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function rg(n,e={}){let{lineCounter:t,prettyErrors:r}=ng(e),s=new tg.Parser(t?.addNewLine),i=new eg.Composer(e),o=null;for(let a of i.compose(s.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new fs.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&t&&(o.errors.forEach(fs.prettifyError(n,t)),o.warnings.forEach(fs.prettifyError(n,t))),o}function mA(n,e,t){let r;typeof e=="function"?r=e:t===void 0&&e&&typeof e=="object"&&(t=e);let s=rg(n,t);if(!s)return null;if(s.warnings.forEach(i=>dA.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},t))}function gA(n,e,t){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let s=Math.round(t);t=s<1?void 0:s>8?{indent:8}:{indent:s}}if(n===void 0){let{keepUndefined:s}=t??e??{};if(!s)return}return fA.isDocument(n)&&!r?n.toString(t):new uA.Document(n,r,t).toString(t)}ps.parse=mA;ps.parseAllDocuments=hA;ps.parseDocument=rg;ps.stringify=gA});var og=R(V=>{"use strict";var yA=qc(),bA=ss(),wA=kc(),ru=as(),vA=Ur(),Nt=q(),SA=Ot(),kA=ne(),xA=Ct(),EA=Rt(),AA=co(),TA=Qc(),PA=eu(),OA=nu(),po=sg(),ig=Br();V.Composer=yA.Composer;V.Document=bA.Document;V.Schema=wA.Schema;V.YAMLError=ru.YAMLError;V.YAMLParseError=ru.YAMLParseError;V.YAMLWarning=ru.YAMLWarning;V.Alias=vA.Alias;V.isAlias=Nt.isAlias;V.isCollection=Nt.isCollection;V.isDocument=Nt.isDocument;V.isMap=Nt.isMap;V.isNode=Nt.isNode;V.isPair=Nt.isPair;V.isScalar=Nt.isScalar;V.isSeq=Nt.isSeq;V.Pair=SA.Pair;V.Scalar=kA.Scalar;V.YAMLMap=xA.YAMLMap;V.YAMLSeq=EA.YAMLSeq;V.CST=AA;V.Lexer=TA.Lexer;V.LineCounter=PA.LineCounter;V.Parser=OA.Parser;V.parse=po.parse;V.parseAllDocuments=po.parseAllDocuments;V.parseDocument=po.parseDocument;V.stringify=po.stringify;V.visit=ig.visit;V.visitAsync=ig.visitAsync});function CA(n){try{return JSON.parse(n.trim()),!0}catch{return!1}}function RA(n){let e=n.trim();if(!e.startsWith("<"))return!1;let t=e.match(_A);return t?Mr(e,t[1])!==null:!1}function IA(n){let e=n.trim();if(!e.match(/^(---|#|\w+:|-)/)||"[{<".includes(e[0]))return!1;try{let t=ag.parse(e);return t!==null&&typeof t=="object"}catch{return!1}}function lg(n){return CA(n)||RA(n)||IA(n)}var ag,_A,su=S(()=>{bp();ag=MS(og(),1),_A=/<([a-zA-Z_][\w.-]*)/});function NA(n){if(!n?.trim())return[];let e=n.replace(/\r\n/g,`
|
|
163
163
|
`),t=e.trim();if(lg(t))return[{text:t,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 ho(n){return
|
|
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 ho(n){return NA(n).map(e=>e.text)}var cg,ug=S(()=>{su();cg=`
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
`});function mo(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var dg=S(()=>{});var NA,$A,iu,fg=S(()=>{NA=[["\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","-"]],$A=new Map(NA),iu=$A});var pg,go,ou,hg=S(()=>{pg=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],go={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:pg,nb:pg,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 n of Object.keys(go))go[n]=new Map(go[n]);ou=go});function au(n,e){if(typeof n!="string")throw new TypeError(`Expected a string, got \`${typeof n}\``);e={customReplacements:[],...e};let t=MA(e.locale),r=iu,s=e.customReplacements.length>0||e.customReplacements.size>0;if(t||s){if(r=new Map(iu),t)for(let[i,o]of t)r.set(i,o);for(let[i,o]of e.customReplacements)r.set(i,o)}return n=n.normalize(),n=LA(n,r),n=n.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),n=n.replaceAll(/\p{Dash_Punctuation}/gu,"-"),n}var LA,MA,mg=S(()=>{fg();hg();LA=(n,e)=>{for(let[t,r]of e)n=n.replaceAll(t,r);return n},MA=n=>{if(!n)return;let e=n.toLowerCase().replace(/^no(-|$)/,"nb$1");return ou[e]||ou[e.split("-")[0]]||void 0}});var BA,gg,yg=S(()=>{BA=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],gg=BA});function lu(n,e){if(typeof n!="string")throw new TypeError(`Expected a string, got \`${typeof n}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let t=e.preserveLeadingUnderscore&&n.startsWith("_"),r=e.preserveTrailingDash&&n.endsWith("-");if(e.transliterate){let i=new Map([...gg,...e.customReplacements]);n=au(n,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)n=n.replaceAll(i,o);e.decamelize&&(n=DA(n));let s=FA(e);return e.lowercase&&(n=e.locale?n.toLocaleLowerCase(e.locale):n.toLowerCase()),n=n.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),n=n.replace(s,e.separator),n=n.replaceAll("\\",""),e.separator&&(n=jA(n,e.separator)),t&&(n=`_${n}`),r&&(n=`${n}-`),n}var DA,jA,FA,bg=S(()=>{dg();mg();yg();DA=n=>n.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"),jA=(n,e)=>{let t=mo(e);return n.replaceAll(new RegExp(`(?:${t}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${t})|(?:${t})$`,"g"),"")},FA=n=>{let e=String.raw`a-z\d`;if(e+=n.lowercase?"":"A-Z",n.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),n.preserveCharacters.length>0)for(let r of n.preserveCharacters){if(r===n.separator)throw new Error(`The separator character \`${n.separator}\` cannot be included in preserved characters: ${n.preserveCharacters}`);e+=mo(r)}let t=n.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,t)}});function Wn(n){return lu(n)}var wg=S(()=>{bg()});var Kn,vg,Sg=S(()=>{Kn={local:"local",ide:"ide",published:"published",inline:"inline"},vg=Object.values(Kn).map(n=>`'${n}'`).join(" | ")});var hs,cu,kg=S(()=>{hs=` *, *::before, *::after { box-sizing: border-box; }
|
|
169
|
+
`});function mo(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var dg=S(()=>{});var $A,LA,iu,fg=S(()=>{$A=[["\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","-"]],LA=new Map($A),iu=LA});var pg,go,ou,hg=S(()=>{pg=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],go={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:pg,nb:pg,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 n of Object.keys(go))go[n]=new Map(go[n]);ou=go});function au(n,e){if(typeof n!="string")throw new TypeError(`Expected a string, got \`${typeof n}\``);e={customReplacements:[],...e};let t=BA(e.locale),r=iu,s=e.customReplacements.length>0||e.customReplacements.size>0;if(t||s){if(r=new Map(iu),t)for(let[i,o]of t)r.set(i,o);for(let[i,o]of e.customReplacements)r.set(i,o)}return n=n.normalize(),n=MA(n,r),n=n.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),n=n.replaceAll(/\p{Dash_Punctuation}/gu,"-"),n}var MA,BA,mg=S(()=>{fg();hg();MA=(n,e)=>{for(let[t,r]of e)n=n.replaceAll(t,r);return n},BA=n=>{if(!n)return;let e=n.toLowerCase().replace(/^no(-|$)/,"nb$1");return ou[e]||ou[e.split("-")[0]]||void 0}});var DA,gg,yg=S(()=>{DA=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],gg=DA});function lu(n,e){if(typeof n!="string")throw new TypeError(`Expected a string, got \`${typeof n}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let t=e.preserveLeadingUnderscore&&n.startsWith("_"),r=e.preserveTrailingDash&&n.endsWith("-");if(e.transliterate){let i=new Map([...gg,...e.customReplacements]);n=au(n,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)n=n.replaceAll(i,o);e.decamelize&&(n=jA(n));let s=UA(e);return e.lowercase&&(n=e.locale?n.toLocaleLowerCase(e.locale):n.toLowerCase()),n=n.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),n=n.replace(s,e.separator),n=n.replaceAll("\\",""),e.separator&&(n=FA(n,e.separator)),t&&(n=`_${n}`),r&&(n=`${n}-`),n}var jA,FA,UA,bg=S(()=>{dg();mg();yg();jA=n=>n.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"),FA=(n,e)=>{let t=mo(e);return n.replaceAll(new RegExp(`(?:${t}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${t})|(?:${t})$`,"g"),"")},UA=n=>{let e=String.raw`a-z\d`;if(e+=n.lowercase?"":"A-Z",n.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),n.preserveCharacters.length>0)for(let r of n.preserveCharacters){if(r===n.separator)throw new Error(`The separator character \`${n.separator}\` cannot be included in preserved characters: ${n.preserveCharacters}`);e+=mo(r)}let t=n.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,t)}});function Kn(n){return lu(n)}var wg=S(()=>{bg()});var Hn,vg,Sg=S(()=>{Hn={local:"local",ide:"ide",published:"published",inline:"inline"},vg=Object.values(Hn).map(n=>`'${n}'`).join(" | ")});var hs,cu,kg=S(()=>{hs=` *, *::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; }
|
|
@@ -292,38 +292,38 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
292
292
|
return publish();
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
|
-
})();`});var Z=S(()=>{fi();bl();ap();dp();su();ug();wg();Sg();kg();Eg();Tg();pi()});function
|
|
296
|
-
\u2026[${n.length-5e4} more characters truncated]`:n}function Ne(n){let e=n.replace(
|
|
297
|
-
`).map(i=>i.trim()).filter(Boolean),t=e[0];if(!t)return"";let r=t.length>300?t.slice(0,300).trimEnd()+"\u2026":t,s=e.length-1;return s>0?`${r} (+${s} line${s===1?"":"s"})`:r}var
|
|
298
|
-
`);for(let f=c.length-1;f>=0&&s===void 0;f--){if(!c[f].includes('"usage"'))continue;let u;try{u=JSON.parse(c[f])}catch{continue}let d=u?.type==="assistant"?u.message?.usage:void 0;d&&(s=(d.input_tokens??0)+(d.output_tokens??0)+(d.cache_read_input_tokens??0)+(d.cache_creation_input_tokens??0))}}catch{}finally{i!==void 0&&Ig(i)}return Og.set(n,{size:e,mtime:t,tokens:s}),s}function
|
|
299
|
-
`):n==null?"":
|
|
295
|
+
})();`});var Z=S(()=>{fi();bl();ap();dp();su();ug();wg();Sg();kg();Eg();Tg();pi()});function Ae(n){return n.length>5e4?n.slice(0,5e4)+`
|
|
296
|
+
\u2026[${n.length-5e4} more characters truncated]`:n}function Ne(n){let e=n.replace(qA,"").split(`
|
|
297
|
+
`).map(i=>i.trim()).filter(Boolean),t=e[0];if(!t)return"";let r=t.length>300?t.slice(0,300).trimEnd()+"\u2026":t,s=e.length-1;return s>0?`${r} (+${s} line${s===1?"":"s"})`:r}var Se,qA,yo,ms=S(()=>{"use strict";Se=(n,e,t=e+"s")=>`${n} ${n===1?e:t}`;qA=/\u001b\[[0-9;]*m/g;yo=(n,e)=>``});import{existsSync as JA,readdirSync as WA,statSync as KA}from"fs";import{join as HA}from"path";function bo(n){if(!JA(n))return[];let e;try{e=WA(n)}catch{return[]}let t=[];for(let r of e){if(!r.endsWith(".jsonl"))continue;let s=HA(n,r);try{let i=KA(s);i.isFile()&&t.push({sessionId:r.slice(0,-6),file:s,mtime:i.mtimeMs})}catch{}}return t}var du=S(()=>{"use strict"});var $t,wo=S(()=>{"use strict";$t=class{ensureHarnessSupport(){}}});import{openSync as Cg,readSync as Rg,closeSync as Ig,statSync as Ng,readdirSync as mu,readFileSync as gu,existsSync as YA}from"fs";import{join as ct}from"path";import{homedir as yu}from"os";function VA(n){return n.replace(/[^a-zA-Z0-9]/g,"-")}function XA(n,e){let t=ct(pu(n),e,GA),r;try{r=mu(t)}catch{return[]}let s=[];for(let i of r){if(!i.endsWith(".jsonl"))continue;let o=ct(t,i),a;try{a=Ng(o)}catch{continue}let l=i.slice(0,-6),c={};try{c=JSON.parse(gu(ct(t,`${l}.meta.json`),"utf8"))}catch{}s.push({id:l.startsWith("agent-")?l.slice(6):l,file:o,mtime:a.mtimeMs,started:a.birthtimeMs||void 0,tokens:eT(o,a.size,a.mtimeMs),label:c.description??"",kind:c.agentType===QA?void 0:c.agentType,model:c.model,spawnId:c.toolUseId,parentId:c.parentAgentId,depth:c.spawnDepth??1,stopped:!!c.stoppedByUser})}return s}function eT(n,e,t){let r=Og.get(n);if(r&&r.size===e&&r.mtime===t)return r.tokens;let s,i;try{i=Cg(n,"r");let o=Math.min(ZA,e),a=Buffer.alloc(o),l=Rg(i,a,0,o,e-o),c=a.subarray(0,l).toString("utf8").split(`
|
|
298
|
+
`);for(let f=c.length-1;f>=0&&s===void 0;f--){if(!c[f].includes('"usage"'))continue;let u;try{u=JSON.parse(c[f])}catch{continue}let d=u?.type==="assistant"?u.message?.usage:void 0;d&&(s=(d.input_tokens??0)+(d.output_tokens??0)+(d.cache_read_input_tokens??0)+(d.cache_creation_input_tokens??0))}}catch{}finally{i!==void 0&&Ig(i)}return Og.set(n,{size:e,mtime:t,tokens:s}),s}function tT(n,e){let t=n&&typeof n=="object"?n:{};return t.status==="async_launched"||t.isAsync===!0||gs(e.content).startsWith(nT)}function rT(n){let e=n&&typeof n=="object"?n.resumedAgentId:void 0;return typeof e=="string"&&e?e:void 0}function sT(n){return n.type==="attachment"&&n.attachment?.type==="queued_command"?gs(n.attachment.prompt):n.type==="user"&&typeof n.message?.content=="string"?n.message.content:n.type==="queue-operation"&&n.operation==="enqueue"&&typeof n.content=="string"?n.content:""}function iT(n){if(!n.includes("<task-notification>"))return[];let e=[];for(let t of[/<tool-use-id>\s*([^<\s]+)/g,/<task-id>\s*([^<\s]+)/g])for(let r of n.matchAll(t))e.push(r[1]);return e}function So(n){let e=n?.type==="image"?n.source:void 0;return e?.type==="base64"&&e.data?yo(e.data,e.media_type):""}function gs(n){return typeof n=="string"?Ae(n):Array.isArray(n)?n.map(e=>{if(typeof e=="string")return Ae(e);let t=e;return typeof t?.text=="string"?Ae(t.text):t?.content!=null?gs(t.content):So(t)}).join(`
|
|
299
|
+
`):n==null?"":Ae(JSON.stringify(n))}function oT(n){let e=n.trim();return!!e&&$g.some(t=>t.test(e))}function aT(n){let e=n.trim();return e?$g.some(t=>{let r=t.exec(e);return!!r&&r.index===0}):!0}function cT(n){return n.replace(lT,"")}function uT(n){let e=/^<command-name>([\s\S]*?)<\/command-name>/.exec(n)?.[1]?.trim();if(!e)return;let t=/<command-args>([\s\S]*?)<\/command-args>/.exec(n)?.[1]?.trim();return t?`${e} ${t}`:e}function Lt(n){let e=cT(n).trim();return e?uT(e)??(oT(e)?"":e):""}function ko(n){let e=dT.exec(n.trim());if(e)return{from:e[1],body:pT(e[2].replace(fT,""))}}function pT(n){let e=n.split(`
|
|
300
300
|
`).filter(r=>r.trim()).map(r=>r.length-r.trimStart().length),t=e.length?Math.min(...e):0;return t?n.split(`
|
|
301
301
|
`).map(r=>r.slice(t)).join(`
|
|
302
|
-
`):n}function fu(n){let e=ko(n);return e?{type:"user",text:e.body,agent:{from:e.from}}:{type:"user",text:n}}function
|
|
303
|
-
`).length,"line")}`;if(t.mode==="content")return
|
|
304
|
-
`)){if(!h.includes(`"${f}"`))continue;let
|
|
305
|
-
`)){if(!c.trim())continue;let f;try{f=JSON.parse(c)}catch{continue}if(!f||ys(f)||f.type!=="user")continue;let u=f.message?.content,d="";typeof u=="string"?d=Lt(u):Array.isArray(u)&&(d=u.map(hu).filter(Boolean).join(" "));let h=d.replace(/\s+/g," ").trim();if(h)return(h.replace(/^Continuing from a prior session\. Here is the summary of our work so far:\s*/i,"").trim()||h).slice(0,200)}return""}finally{Ig(e)}}function
|
|
306
|
-
`),l=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||l.length){let u=Date.parse(e.timestamp??""),d=!isNaN(u)&&u>=t;r.push({type:"assistant",text:o,thinking:a,tools:l,live:d})}let c=e.message?.usage??e.usage,f=c&&{in:c.input_tokens??0,out:c.output_tokens??0,cached:c.cache_read_input_tokens??0,cacheCreate:c.cache_creation_input_tokens??0};return{events:r,usage:f,model:e.message?.model}}return{events:r}}chainWorking(e){let t;for(let o of e)(o.type==="user"||o.type==="assistant")&&(t=o);if(!t)return!1;if(t.type==="user"){try{let o=t.message?.content,a=typeof o=="string"?o:Array.isArray(o)?o.filter(c=>c&&c.type==="text").map(c=>c.text??"").join(""):"";if(!(Array.isArray(o)&&o.some(c=>c&&c.type==="tool_result"))&&a.trim()&&Lt(a)==="")return!1}catch{}return!0}let s=(Array.isArray(t.message?.content)?t.message.content:[]).filter(o=>o.type==="tool_use").map(o=>o.id);if(s.length===0)return!
|
|
307
|
-
`):""}function
|
|
308
|
-
`))r.startsWith("+")&&!r.startsWith("+++")?e++:r.startsWith("-")&&!r.startsWith("---")&&t++;return`+${e} \u2212${t}`}function
|
|
309
|
-
`||i==="&&"||i==="||")&&(e.push(n.slice(t,r)),(i==="&&"||i==="||")&&r++,t=r+1)}return e.push(n.slice(t)),e.map(r=>r.trim()).filter(Boolean)}function
|
|
310
|
-
`)}}function
|
|
302
|
+
`):n}function fu(n){let e=ko(n);return e?{type:"user",text:e.body,agent:{from:e.from}}:{type:"user",text:n}}function hT(n){let e=n.message?.content;return typeof e=="string"&&!!ko(e)}function hu(n){return n?.type==="text"&&typeof n.text=="string"?Lt(n.text):""}function bu(n,e){if(typeof n=="string")return Ne(n);if(!n||typeof n!="object")return Ne(e);let t=n;if(t.type==="text"&&typeof t.file?.numLines=="number")return Se(t.file.numLines,"line");if(t.type==="image"){let r=_g(t.file?.originalSize);return r?`image (${r})`:"image"}if(t.type==="pdf"){let r=_g(t.file?.originalSize);return r?`PDF (${r})`:"PDF"}if(t.type==="parts"&&typeof t.file?.count=="number")return Se(t.file.count,"page");if(t.type==="file_unchanged")return"unchanged since last read";if(t.type==="create"&&typeof t.content=="string")return`created, ${Se(t.content.split(`
|
|
303
|
+
`).length,"line")}`;if(t.mode==="content")return Se(t.numLines??0,"line");if(t.mode==="count")return`${Se(t.numMatches??0,"match","matches")} (${Se(t.numFiles??0,"file")})`;if(t.mode==="files_with_matches")return Se(t.numFiles??0,"file");if(Array.isArray(t.structuredPatch)){let r=0,s=0;for(let i of t.structuredPatch)for(let o of i?.lines??[])typeof o=="string"&&(o.startsWith("+")?r++:o.startsWith("-")&&s++);return`+${r} \u2212${s}`}return typeof t.stdout=="string"||typeof t.stderr=="string"?t.backgroundTaskId?"running in background":t.interrupted?"interrupted":Ne(t.stdout||t.stderr||"")||"no output":typeof t.code=="number"&&typeof t.codeText=="string"?`${t.code} ${t.codeText}`:typeof t.searchCount=="number"?Se(t.searchCount,"search","searches"):Array.isArray(t.matches)&&typeof t.total_deferred_tools=="number"?Se(t.matches.length,"tool"):Array.isArray(t.newTodos)?Se(t.newTodos.length,"todo"):typeof t.numFiles=="number"?Se(t.numFiles,"file"):Ne(e)}function ys(n){return!!n.isMeta}function mT(n){let e;try{e=Cg(n,"r")}catch{return""}try{let r=65536;try{r=Ng(n).size}catch{}let s=(c,f)=>{if(f<=0)return"";let u=Buffer.alloc(f),d=Rg(e,u,0,f,c);return u.subarray(0,d).toString("utf8")},i=(c,f,u)=>{let d="";for(let h of c.split(`
|
|
304
|
+
`)){if(!h.includes(`"${f}"`))continue;let g;try{g=JSON.parse(h)}catch{continue}let p=g?.[u];g?.type===f&&typeof p=="string"&&p&&(d=p)}return d},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(`
|
|
305
|
+
`)){if(!c.trim())continue;let f;try{f=JSON.parse(c)}catch{continue}if(!f||ys(f)||f.type!=="user")continue;let u=f.message?.content,d="";typeof u=="string"?d=Lt(u):Array.isArray(u)&&(d=u.map(hu).filter(Boolean).join(" "));let h=d.replace(/\s+/g," ").trim();if(h)return(h.replace(/^Continuing from a prior session\. Here is the summary of our work so far:\s*/i,"").trim()||h).slice(0,200)}return""}finally{Ig(e)}}function gT(n){let e;try{e=mu(vo)}catch{return!1}for(let t of e)if(t.endsWith(".json"))try{let r=JSON.parse(gu(ct(vo,t),"utf8"));if(r?.sessionId!==n)continue;return process.kill(r.pid,0),!0}catch{}return!1}function yT(){let n=new Set,e;try{e=mu(vo)}catch{return n}for(let t of e)if(t.endsWith(".json"))try{let r=JSON.parse(gu(ct(vo,t),"utf8"));if(!r?.sessionId||r.status!=="busy")continue;process.kill(r.pid,0),n.add(r.sessionId)}catch{}return n}var zA,pu,GA,QA,ZA,Og,nT,$g,lT,dT,fT,_g,vo,Yn,xo=S(()=>{"use strict";ms();du();wo();zA=ct(yu(),".claude","projects"),pu=n=>ct(zA,VA(n)),GA="subagents";QA="general-purpose",ZA=256*1024,Og=new Map;nT="Async agent launched successfully";$g=[/\[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];lT=/<ide_[a-z_]+>[\s\S]*?<\/ide_[a-z_]+>/gi;dT=/^(?:[^\n<][^\n]*\n)?<agent-message from="([^"]+)">\n([\s\S]*?)(?:\n?<\/agent-message>[\s\S]*)?$/,fT=/^\[[^\]\n]+\][\s\S]*?The report follows:\n/;_g=n=>typeof n!="number"?"":n<1024?`${n}B`:n<1048576?`${Math.round(n/1024)}KB`:`${(n/1048576).toFixed(1)}MB`;vo=ct(yu(),".claude","sessions");Yn=class extends $t{displayName="Claude Mirror";detectsSelf(){return process.env.CLAUDECODE==="1"}detectsInstalled(){return YA(ct(yu(),".claude"))}sessionsDir(e){return pu(e)}listSessionFiles(e){return bo(pu(e))}listChildren(e,t){return XA(e,t)}parseEntry(e){try{return JSON.parse(e)}catch{return null}}idOf(e){return e.uuid}parentOf(e){return e.parentUuid}timestampOf(e){return e.timestamp}isSidechain(e,t){return!!e.isSidechain!=(t==="child")}isLeafType(e){return e.type==="user"||e.type==="assistant"}isRecoveryNoise(e){return!!e.isApiErrorMessage}apply(e,t){if(ys(e)&&!hT(e))return{events:[]};let r=[];if(e.type==="user"){let s=e.message?.content;if(typeof s=="string"){let i=Lt(s);i&&r.push(fu(i))}else if(Array.isArray(s))for(let i of s)if(i?.type==="tool_result"){let o=gs(i.content);r.push({type:"tool_result",id:i.tool_use_id??"",content:o,isError:!!i.is_error,digest:bu(e.toolUseResult,o)})}else{let o=hu(i)||So(i);o&&r.push(fu(o))}return{events:r}}if(e.type==="attachment"&&e.attachment?.type==="queued_command"){let s=Lt(gs(e.attachment.prompt));return s&&r.push(fu(s)),{events:r}}if(e.type==="assistant"){let s=e.message?.content,i=Array.isArray(s)?s:[],o=i.filter(u=>u.type==="text").map(u=>u.text??"").filter(u=>!aT(u)).join(""),a=i.filter(u=>u.type==="thinking").map(u=>u.thinking??"").join(`
|
|
306
|
+
`),l=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||l.length){let u=Date.parse(e.timestamp??""),d=!isNaN(u)&&u>=t;r.push({type:"assistant",text:o,thinking:a,tools:l,live:d})}let c=e.message?.usage??e.usage,f=c&&{in:c.input_tokens??0,out:c.output_tokens??0,cached:c.cache_read_input_tokens??0,cacheCreate:c.cache_creation_input_tokens??0};return{events:r,usage:f,model:e.message?.model}}return{events:r}}chainWorking(e){let t;for(let o of e)(o.type==="user"||o.type==="assistant")&&(t=o);if(!t)return!1;if(t.type==="user"){try{let o=t.message?.content,a=typeof o=="string"?o:Array.isArray(o)?o.filter(c=>c&&c.type==="text").map(c=>c.text??"").join(""):"";if(!(Array.isArray(o)&&o.some(c=>c&&c.type==="tool_result"))&&a.trim()&&Lt(a)==="")return!1}catch{}return!0}let s=(Array.isArray(t.message?.content)?t.message.content:[]).filter(o=>o.type==="tool_use").map(o=>o.id);if(s.length===0)return!t.message?.stop_reason||t.message.stop_reason==="tool_use";let i=new Set;for(let o of e){let a=o.message?.content;if(Array.isArray(a))for(let l of a)l.type==="tool_result"&&l.tool_use_id&&i.add(l.tool_use_id)}return s.some(o=>o&&!i.has(o))}sessionAlive(e){return gT(e)}sessionsWorking(e){return yT()}spawnSignals(e){let t=Date.parse(e.timestamp??"")||0,r=iT(sT(e)).map(o=>({id:o,stopped:!0,at:t}));if(e.agentId&&e.origin?.kind==="task-notification")return[...r,{id:e.agentId,stopped:!1,at:t}];if(r.length)return r;if(e.type!=="user")return[];let s=rT(e.toolUseResult);if(s)return[{id:s,stopped:!1,at:t}];let i=e.message?.content;return Array.isArray(i)?i.filter(o=>o?.type==="tool_result"&&!tT(e.toolUseResult,o)).map(o=>o.tool_use_id??"").filter(Boolean).map(o=>({id:o,stopped:!0,at:t})):[]}readPreview(e){return mT(e)}searchText(e){if(!e||ys(e)||e.type!=="user"&&e.type!=="assistant")return"";let t=e.message?.content,r="";if(typeof t=="string")r=Lt(t);else if(Array.isArray(t)){let s=t;r=e.type==="user"?s.map(hu).filter(Boolean).join(" "):s.filter(i=>i.type==="text"&&typeof i.text=="string").map(i=>i.text).join(" ")}return r.replace(/\s+/g," ").trim()}}});import{statSync as Eo,fstatSync as bT,readdirSync as wT,openSync as Ug,readSync as qg,closeSync as Jg,existsSync as vT}from"fs";import{basename as Lg,join as wu,resolve as ST}from"path";import{homedir as Mg}from"os";function xT(n){let e=n.trimStart();return kT.some(t=>e.startsWith(t))}function Vn(n,e){return Array.isArray(n)?n.map(t=>typeof t?.text=="string"?e&&xT(t.text)?"":Ae(t.text):t?.type==="input_image"&&typeof t.image_url=="string"&&t.image_url.startsWith("data:")?``:"").filter(Boolean).join(`
|
|
307
|
+
`):""}function ET(n){return typeof n=="string"?Ae(n):Vn(n,!1)}function AT(n,e){let t=e??"",r=BT(t);if(!r.length)return{name:n,input:{script:t}};let s=r.map(i=>vu(i.fn)&&bs(i.arg)?NT(String(i.arg.cmd??i.arg.command??"")):void 0);if(s.every(i=>i!==void 0))return{name:"read",input:Bg(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}=Dg(o);return{name:i,input:new Set(a).size===1?{path:a[0],patch:l}:{patch:l},pending:{kind:"patch",digest:OT(l)}}}return bs(o)?vu(i)?{name:n,input:PT(o)}:{name:i,input:o}:typeof o=="string"?{name:i,input:{arg:o}}:{name:n,input:{script:t}}}return{name:n,input:Bg(r.map(({fn:i,arg:o})=>i==="apply_patch"&&typeof o=="string"?["patch",Dg(o).diff]:vu(i)&&bs(o)?["command",o.cmd??o.command]:[i,o]))}}function PT(n){let e=Object.fromEntries(Object.entries(n).filter(([r])=>r!=="cmd"&&r!=="command"&&!TT.has(r))),t=n.command??n.cmd;return t===void 0?e:{command:t,...e}}function Bg(n){let e={};for(let[t,r]of n){let s=t;for(let i=2;s in e;i++)s=`${t} (${i})`;e[s]=r}return e}function OT(n){let e=0,t=0;for(let r of n.split(`
|
|
308
|
+
`))r.startsWith("+")&&!r.startsWith("+++")?e++:r.startsWith("-")&&!r.startsWith("---")&&t++;return`+${e} \u2212${t}`}function NT(n){let e=LT(n),t=e.map($T);return e.length&&t.every(r=>r!==void 0)?t:void 0}function $T(n){let[e,...t]=n.split("|");if(!t.every(i=>IT.test(i.trim())))return;let r=MT(e);if(!_T.test(r[0]??""))return;let s=[];for(let i=1;i<r.length;i++){let o=r[i];if(CT.test(o)){i+1<r.length&&s.push(r[++i]);continue}if(RT.test(o)){i++;continue}o.startsWith("-")||/^\d+(,\d+)?p?$/.test(o)||s.push(o)}return s.length===1?s[0]:void 0}function LT(n){let e=[],t=0;for(let r=0;r<n.length;r++){let s=n[r];if(s==='"'||s==="'"){let o=n.indexOf(s,r+1);if(o<0)break;r=o;continue}let i=n.slice(r,r+2);(s===";"||s===`
|
|
309
|
+
`||i==="&&"||i==="||")&&(e.push(n.slice(t,r)),(i==="&&"||i==="||")&&r++,t=r+1)}return e.push(n.slice(t)),e.map(r=>r.trim()).filter(Boolean)}function MT(n){return(n.match(/'[^']*'|"[^"]*"|\S+/g)??[]).map(e=>/^(['"])(.*)\1$/.exec(e)?.[2]??e)}function BT(n){let e=[],t=/tools\.([A-Za-z_$][\w$]*)\s*\(/g;for(let r=t.exec(n);r;r=t.exec(n)){let s=r.index+r[0].length-1,i=Kg(n,s);if(i<0)break;e.push({fn:r[1],arg:Wg(n.slice(s+1,i).trim(),n)}),t.lastIndex=i+1}return e}function Wg(n,e){let t=n[0];if(t==='"'||t==="'"||t==="`")return To(n,0)===n.length-1?Hg(n.slice(1,-1)):n;if(t==="{"){for(let r of[n,jT(n)])try{let s=JSON.parse(r);if(bs(s))return s}catch{}return n}if(/^[A-Za-z_$][\w$]*$/.test(n)){let r=new RegExp(`\\b(?:const|let|var)\\s+${n.replace(/\$/g,"\\$")}\\s*=\\s*`).exec(e);if(r){let s=r.index+r[0].length,i=e[s],o=i==='"'||i==="'"||i==="`"?To(e,s):i==="{"?Kg(e,s):-1;if(o>s)return Wg(e.slice(s,o+1),"")}}return n}function Kg(n,e){let t=0;for(let r=e;r<n.length;r++){let s=n[r];if(s==='"'||s==="'"||s==="`"){if(r=To(n,r),r<0)return-1}else if(s==="("||s==="["||s==="{")t++;else if((s===")"||s==="]"||s==="}")&&--t===0)return r}return-1}function To(n,e){let t=n[e];for(let r=e+1;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===t)return r;return-1}function Hg(n){return n.replace(/\\(?:u\{([0-9a-fA-F]+)\}|u([0-9a-fA-F]{4})|x([0-9a-fA-F]{2})|([\s\S]))/g,(e,t,r,s,i)=>t||r||s?String.fromCodePoint(parseInt(t||r||s,16)):DT[i]??i)}function jT(n){let e=/[A-Za-z_$][\w$]*(?=\s*:)/y,t=/,(?=\s*[}\]])/y,r="",s="";for(let i=0;i<n.length;i++){let o=n[i];if(o==='"'||o==="'"||o==="`"){let l=To(n,i);if(l<0)return n;r+=JSON.stringify(Hg(n.slice(i+1,l))),i=l,s=o;continue}e.lastIndex=i;let a=s==="{"||s===","?e.exec(n):null;if(a){r+=`"${a[0]}"`,i+=a[0].length-1,s='"';continue}t.lastIndex=i,!t.test(n)&&(r+=o,/\s/.test(o)||(s=o))}return r}function Dg(n){let e=[],t=[],r=!1;for(let s of n.split(/\r?\n/)){let i=/^\*\*\* (Update|Add|Delete) File: (.+)$/.exec(s);if(i){let o=i[2].trim();e.push(o),t.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:")){t.push(s);continue}r&&!s.startsWith("@@")&&t.push("@@"),r=!1,t.push(s)}}return r&&t.push("@@"),{files:e,diff:t.join(`
|
|
310
|
+
`)}}function FT(n,e){let t=/^Script (completed|failed|running with cell ID (\d+))\nWall time [^\n]*\nOutput:\n([\s\S]*)$/.exec(n);if(!t)return{content:n,isError:!1,digest:Ne(n)};let r=t[3].replace(/^\n+/,"").replace(/^Script error:\n/,""),s=t[1]==="failed",i=UT(r);return i&&(r=i.output,i.exit_code&&(s=!0)),t[2]?{content:r,isError:s,digest:`running (cell ${t[2]})`}:e?.kind==="read"&&!s?{content:r,isError:s,digest:Se(qT(r),"line")}:e?.kind==="patch"&&!s?{content:e.digest,isError:s,digest:e.digest}:{content:r,isError:s,digest:Ne(r)}}function UT(n){if(n.startsWith("{"))try{let e=JSON.parse(n);if(bs(e)&&typeof e.output=="string")return{output:e.output,exit_code:typeof e.exit_code=="number"?e.exit_code:void 0}}catch{}}function JT(n){if(typeof n=="string"&&n)try{let e=JSON.parse(n);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{arguments:n??""}}function Yg(n,e){let t;try{t=Ug(n,"r")}catch{return}try{let r=Buffer.alloc(e),s=qg(t,r,0,e,0);return{text:r.subarray(0,s).toString("utf8"),bytes:s}}finally{Jg(t)}}function WT(n,e){let t;try{t=Ug(n,"r")}catch{return}try{let r=Math.max(0,bT(t).size-e),s=Buffer.alloc(e),i=qg(t,s,0,e,r);return{text:s.subarray(0,i).toString("utf8"),partial:r>0}}finally{Jg(t)}}function HT(n){let e,t;for(let r of KT){let s=WT(n,r);if(s===void 0)return{};let i=s.text.split(`
|
|
311
311
|
`);s.partial&&i.shift();let o;for(let a=i.length-1;a>=0;a--){if(!i[a].trim())continue;let l;try{l=JSON.parse(i[a])}catch{continue}if(o===void 0){let c=Date.parse(l.timestamp??"");Number.isNaN(c)||(o=c)}if(e===void 0&&l.type==="event_msg"){let c=l.payload?.type;c==="task_started"?e=!0:(c==="task_complete"||c==="turn_aborted")&&(e=!1)}if(t===void 0&&l.type==="event_msg"&&l.payload?.type==="token_count"&&l.payload.info?.last_token_usage){let c=Vg(l.payload.info.last_token_usage);t=c.in+c.out+c.cached+c.cacheCreate}if(o!==void 0&&e!==void 0&&t!==void 0)break}if(o!==void 0)return{ms:o,running:e??!0,tokens:t};if(!s.partial)break}return{running:e??!0,tokens:t}}function Vg(n){return{in:Math.max(0,(n.input_tokens??0)-(n.cached_input_tokens??0)),out:n.output_tokens??0,cached:n.cached_input_tokens??0,cacheCreate:n.cache_write_input_tokens??0}}function Fg(n){let t=Yg(n,65536);if(t===void 0)return;let r=t.text.indexOf(`
|
|
312
|
-
`);if(r<0)return t.bytes>=65536?{cwd:"",subagent:!1}:void 0;try{let s=JSON.parse(t.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;return{cwd:i.cwd,subagent:!!o,id:i.id,spawn:
|
|
313
|
-
`))if(t.trim())try{let r=JSON.parse(t);if(r.type==="turn_context"&&typeof r.payload?.model=="string")return r.payload.model}catch{}}var
|
|
314
|
-
`,t:" ",r:"\r",b:"\b",f:"\f",v:"\v",0:"\0"};
|
|
315
|
-
`).length:0;Ao=n=>{let e=
|
|
316
|
-
`))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"?
|
|
317
|
-
`),r=[];if(t.forEach((o,a)=>{let l=
|
|
318
|
-
`)}function
|
|
312
|
+
`);if(r<0)return t.bytes>=65536?{cwd:"",subagent:!1}:void 0;try{let s=JSON.parse(t.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;return{cwd:i.cwd,subagent:!!o,id:i.id,spawn:YT(i,o),model:VT(t.text,r)}}catch{return{cwd:"",subagent:!1}}}function YT(n,e){let t=e?.thread_spawn;if(!t)return;let r=t.parent_thread_id??n.parent_thread_id;if(!(!n.id||!r))return{id:n.id,parent:r,path:t.agent_path??"",role:t.agent_role??void 0,depth:t.depth??1}}function VT(n,e){for(let t of n.slice(e+1).split(`
|
|
313
|
+
`))if(t.trim())try{let r=JSON.parse(t);if(r.type==="turn_context"&&typeof r.payload?.model=="string")return r.payload.model}catch{}}var kT,bs,vu,TT,_T,CT,RT,IT,DT,qT,Ao,jg,zn,KT,Su=S(()=>{"use strict";ms();wo();kT=["<permissions instructions>","<apps_instructions>","<plugins_instructions>","<skills_instructions>","<recommended_plugins>","<environment_context>","<node_repl_review_evidence>","# AGENTS.md instructions for "];bs=n=>!!n&&typeof n=="object"&&!Array.isArray(n),vu=n=>n==="shell_command"||n==="exec_command",TT=new Set(["max_output_tokens","yield_time_ms","timeout_ms"]);_T=/^(Get-Content|gc|cat|type|nl|bat|sed|head|tail)$/i,CT=/^-(Path|LiteralPath)$/i,RT=/^-(Encoding|TotalCount|Head|Tail|ReadCount|Delimiter)$/i,IT=/^(sed -n|head|tail|Select-Object|select)(\s|$)/i;DT={n:`
|
|
314
|
+
`,t:" ",r:"\r",b:"\b",f:"\f",v:"\v",0:"\0"};qT=n=>n?n.replace(/\r?\n$/,"").split(`
|
|
315
|
+
`).length:0;Ao=n=>{let e=ST(n);return process.platform==="win32"?e.toLowerCase():e},jg=12e4,zn=class extends $t{constructor(t=wu(Mg(),".codex","sessions")){super();this.root=t}displayName="Codex Mirror";#e=0;#c;#t=!1;#i;#m=0;#s=new Map;#d=new Map;#a=new Map;#u=new Map;detectsSelf(){return!!process.env.CODEX_THREAD_ID}detectsInstalled(){return vT(wu(Mg(),".codex"))}sessionsDir(t){return this.root}listSessionFiles(t){let r=Ao(t),s=[];for(let i of this.#o()){let o=0,a=0;try{let f=Eo(i);if(!f.isFile())continue;o=f.size,a=f.mtimeMs}catch{continue}let l=this.#s.get(i);if(l===void 0){if(l=Fg(i),l===void 0)continue;this.#s.set(i,l)}if(l.subagent||Ao(l.cwd)!==r)continue;let c=Lg(i,".jsonl");this.#a.set(c,i),s.push({sessionId:c,file:i,mtime:this.#r(i,o,a)})}return s}listChildren(t,r){let s=Ao(t),i=new Map,o,a;for(let f of this.#o()){let u=0,d=0,h;try{let p=Eo(f);if(!p.isFile())continue;u=p.size,d=p.mtimeMs,h=p.birthtimeMs||void 0}catch{continue}let g=this.#s.get(f);if(g===void 0){if(g=Fg(f),g===void 0)continue;this.#s.set(f,g)}Lg(f,".jsonl")===r&&(o=g.id,a=g.model),!(!g.spawn||Ao(g.cwd)!==s)&&i.set(g.spawn.id,{file:f,mtime:this.#r(f,u,d),started:h,running:this.#n(f,u,d),tokens:this.#l(f,u,d).tokens,spawn:g.spawn,model:g.model})}if(!o)return[];let l=(f,u=new Set)=>{if(f.parent===o)return!0;if(u.has(f.id))return!1;u.add(f.id);let d=i.get(f.parent);return d?l(d.spawn,u):!1},c=[];for(let{file:f,mtime:u,started:d,running:h,tokens:g,spawn:p,model:y}of i.values())l(p)&&c.push({id:p.id,file:f,mtime:u,started:d,tokens:g,label:p.path.split("/").filter(Boolean).pop()??p.path,kind:p.role||void 0,model:y&&y!==a?y:void 0,parentId:i.has(p.parent)?p.parent:void 0,depth:p.depth,stopped:!1,running:h});return c}#n(t,r,s){return this.#l(t,r,s).running}sessionsWorking(t){let r=new Set,s=Date.now();for(let{sessionId:i,file:o,mtime:a}of this.listSessionFiles(t)){if(s-a>=jg)continue;let l;try{let c=Eo(o);l=this.#l(o,c.size,c.mtimeMs)}catch{continue}l.running&&r.add(i)}return r}#r(t,r,s){return Math.max(s,this.#l(t,r,s).ms??0)}#l(t,r,s){let i=this.#d.get(t);if(i&&i.size===r&&i.mtime===s)return i;let o={size:r,mtime:s,...HT(t)};return this.#d.set(t,o),o}#o(){let t=[],r=s=>{try{return wT(s).map(i=>wu(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")&&t.push(a);return t}parseEntry(t){let r;try{r=JSON.parse(t)}catch{return null}return!r||typeof r.type!="string"?null:r}idOf(t){return t.ord===void 0&&(this.#h(t),t.ord=String(this.#e++),t.parent=this.#c,this.#c=t.ord),t.ord}#h(t){let r=t.payload;if(t.type==="session_meta"){if(++this.#m===1){let s=typeof r?.source=="object"?r.source?.subagent?.thread_spawn:void 0;this.#i=s?.agent_path,this.#t=!!s}}else this.#m=0,this.#t&&r?.type==="agent_message"&&r.recipient===this.#i&&(this.#t=!1);t.inherited=this.#t}parentOf(t){return t.parent}timestampOf(t){return t.timestamp}isSidechain(t,r){return r==="child"&&!!t.inherited}isLeafType(t){return!0}isRecoveryNoise(t){return!1}apply(t,r){let s=[],i=t.payload;if(!i)return{events:s};let o=()=>{let a=Date.parse(t.timestamp??"");return!isNaN(a)&&a>=r};if(t.type==="response_item"){if(i.type==="message"){if(i.role==="user"){let a=Vn(i.content,!0).trim();a&&s.push({type:"user",text:a})}else if(i.role==="assistant"){let a=Vn(i.content,!1);a&&s.push({type:"assistant",text:a,thinking:"",tools:[],live:o()})}return{events:s}}if(i.type==="reasoning"){let a=Vn(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"?AT(i.name??"",i.input):{name:i.name??"",input:JT(i.arguments)};return l&&this.#u.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.#u.get(a);return this.#u.delete(a),s.push({type:"tool_result",id:a,...FT(ET(i.output),l)}),{events:s}}return{events:s}}if(t.type==="event_msg"){if(i.type==="token_count"){let a=i.info?.last_token_usage;return a?{events:s,usage:Vg(a)}:{events:s}}return{events:s}}return t.type==="turn_context"?{events:s,model:i.model}:{events:s}}chainWorking(t){let r=!1;for(let s of t){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(t){let r=this.#a.get(t);if(!r)return;let s;try{let i=Eo(r);s=this.#r(r,i.size,i.mtimeMs)}catch{return}return Date.now()-s<jg}readPreview(t){for(let r of(Yg(t,256*1024)?.text??"").split(`
|
|
316
|
+
`))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"?Vn(i.item.content,!0):void 0)??"").replace(/\s+/g," ").trim();if(a)return a.slice(0,200)}catch{}return""}searchText(t){if(t?.type!=="response_item"||t.payload?.type!=="message")return"";let r=t.payload.role;return r!=="user"&&r!=="assistant"?"":Vn(t.payload.content,r==="user").replace(/\s+/g," ").trim()}};KT=[64*1024,1024*1024]});import{realpathSync as zT}from"fs";import{createHash as GT}from"crypto";import{join as Po,resolve as XT}from"path";import{homedir as QT}from"os";function Mt(){let n=process.env.TYPEBULB_SERVERS_DIR;return n?Po(n,".."):Po(QT(),".typebulb")}function ut(){zg||(zg=!0,console.error(`${Mt()} not writable \u2014 continuing stateless: ports won't stick, caches stay cold, and typebulb logs/wait/send/stop may not see this run`))}function dt(){return process.env.TYPEBULB_SERVERS_DIR||Po(Mt(),"servers")}function Gg(n){let e=re(n),t=e.slice(e.lastIndexOf("/")+1).replace(/\.bulb\.md$/,"");return Po(Mt(),"canvas",`${t}-${ws(n)}.png`)}function ws(n){return GT("sha1").update(re(n)).digest("hex").slice(0,8)}function re(n){let e=XT(n),t=e;try{t=zT.native(e)}catch{}return(process.platform==="win32"?t.toLowerCase():t).replace(/\\/g,"/")}function Xg(n,e){let t=re(n),r=re(e);return t.startsWith(r.endsWith("/")?r:r+"/")?!t.includes("/node_modules/"):!1}var zg,tt=S(()=>{"use strict";zg=!1});import*as ey from"net";import{mkdir as ZT,readFile as eP,writeFile as ty}from"fs/promises";import{existsSync as tP}from"fs";import{join as ny}from"path";function iy(){return ny(Mt(),"blocks")}function ku(n){return ny(iy(),`${n}.json`)}function _o(n){return new Promise(e=>{let t=ey.createServer();t.once("error",()=>e(!1)),t.listen(n,"127.0.0.1",()=>t.close(()=>e(!0)))})}async function iP(n){for(let e=n;e<65535;e++)if(await _o(e))return e;throw new Error(`No free port found above ${n}`)}async function xu(n){let{listBulbServers:e}=await Promise.resolve().then(()=>($e(),oy)),t=(await e()).find(s=>s.port===n),r=t?` (pid ${t.pid}, ${t.agent?`agent:${t.agent}`:t.file})`:"";console.error(`port ${n} in use${r}`),process.exit(1)}async function Co(n){try{let e=JSON.parse(await eP(ku(n),"utf8"));return e&&typeof e.cwd=="string"?{cwd:e.cwd,slots:e.slots??{},mirrors:e.mirrors??{}}:void 0}catch{return}}async function Ro(n,e){try{return await ty(ku(n),JSON.stringify(e,null,2)),!0}catch{return ut(),!1}}async function oP(n){let e=re(n);try{await ZT(iy(),{recursive:!0})}catch{return}let t=[];for(let o=0;o<sy;o++)t.push(ry+o*an);let r=await Promise.all(t.map(async o=>({base:o,block:await Co(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 ty(ku(o),JSON.stringify(s,null,2),{flag:"wx"}),o}catch(l){if((await Co(o))?.cwd===e)return o;l.code!=="EEXIST"&&ut();continue}if(!tP(a.cwd))return await Ro(o,s)?o:void 0}let i=r.filter(o=>!!o.block).sort((o,a)=>Qg(o.block)-Qg(a.block))[0];if(i)return await Ro(i.base,s)?i.base:void 0}function Qg(n){return Object.values(n.slots).reduce((e,t)=>Math.max(e,t.usedAt??0),0)}async function aP(n,e){let t=await Co(n)??{cwd:"",slots:{},mirrors:{}};if(e.kind==="mirror"){let i=t.mirrors[e.agent];if(i!==void 0)return i;let o=Zg(t),a=o.has(0)?rP:0;for(;a>Oo&&o.has(a);)a--;return t.mirrors[e.agent]=a,await Ro(n,t),a}let r=re(e.file),s=t.slots[r]?.offset;if(s===void 0){let i=Zg(t);for(s=Oo;s<an&&i.has(s);)s++;if(s>=an){let o=Object.entries(t.slots).sort((a,l)=>(a[1].usedAt??0)-(l[1].usedAt??0))[0];s=o?o[1].offset:Oo,o&&delete t.slots[o[0]]}}return t.slots[r]={offset:s,usedAt:Date.now()},await Ro(n,t),s}function Zg(n){return new Set([...Object.values(n.mirrors),...Object.values(n.slots).map(e=>e.offset)])}async function Gn(n,e){let t=await oP(e);return t===void 0?void 0:t+await aP(t,n)}async function ln(n){let e=re(n);for(let t=0;t<sy;t++){let r=await Co(ry+t*an);if(r?.cwd===e)return s=>r.slots[re(s)]?.usedAt??0}return()=>0}async function Io(n){if(n.explicit!==void 0)return await _o(n.explicit)||await xu(n.explicit),n.target.kind==="bulb"&&await Gn(n.target,n.cwd),{port:n.explicit};let e=await Gn(n.target,n.cwd);if(e!==void 0){let r=e-e%an,s=Date.now()+sP;do{if(await _o(e))return{port:e};await new Promise(i=>setTimeout(i,150))}while(Date.now()<s);for(let i=Oo;i<an;i++){let o=r+i;if(o!==e&&await _o(o))return{port:o,note:`(slot ${e} was busy)`}}}return{port:await iP(nP),note:e===void 0?"(no port block available)":"(this project's block was full)"}}var ry,an,sy,nP,Oo,rP,sP,cn=S(()=>{"use strict";tt();ry=20100,an=100,sy=19,nP=23e3,Oo=1,rP=an-1,sP=3e3});var Le,No=S(()=>{"use strict";Le="0.61.1"});var oy={};ui(oy,{agentViewerCommand:()=>gy,bulbServerCommand:()=>my,clearServerLog:()=>Ou,findProjectViewer:()=>Mo,isAlive:()=>Xn,isMirror:()=>ge,isProjectBulb:()=>Nu,isProjectMirror:()=>er,launchAgentViewer:()=>Mu,launchBulbServer:()=>ks,listBulbServers:()=>X,probePageCount:()=>Lu,readServerLog:()=>He,readWaitCursor:()=>Lo,recordDenial:()=>Iu,registerServer:()=>Ru,relayOpen:()=>$u,runMarker:()=>_u,serverLogPath:()=>Zn,serversForBulb:()=>dn,sliceRunLog:()=>Cu,startServerLog:()=>Ss,stopBulbServer:()=>Qn,stopServer:()=>Bt,stopServersForBulb:()=>Bo,typebulbBinPath:()=>tr,unregisterServer:()=>un,writeWaitCursor:()=>vs});import{spawn as ay}from"child_process";import{readdir as lP,readFile as uy,writeFile as dy,unlink as Eu,mkdir as cP}from"fs/promises";import{mkdirSync as fy,writeFileSync as $o,appendFileSync as uP,readFileSync as Au}from"fs";import*as Te from"path";import{fileURLToPath as dP}from"url";function Tu(n){return Te.join(dt(),`${n}.json`)}function Zn(n){return Te.join(dt(),`${n}.log`)}function Pu(n){return Te.join(dt(),`${n}.wait.json`)}function py(n){try{let e=JSON.parse(Au(Pu(n),"utf8"));return e.cursors&&typeof e.cursors=="object"?e.cursors:{}}catch{return{}}}function Lo(n,e=""){let t=py(n)[e];return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0}function vs(n,e,t=""){try{fy(dt(),{recursive:!0});let r=py(n);r[t]=e,$o(Pu(n),JSON.stringify({cursors:r}))}catch{}}function Ss(n){let e=Zn(n);try{fy(dt(),{recursive:!0}),$o(e,"")}catch{return()=>{}}let t=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(uP(e,l),s+=l.length,s>2*ly){let c=Au(e),f=c.subarray(Math.max(0,c.length-ly));$o(e,f),s=f.length}}catch{i=!0}};return process.stdout.write=((a,...l)=>(o(a),t(a,...l))),process.stderr.write=((a,...l)=>(o(a),r(a,...l))),()=>{process.stdout.write=t,process.stderr.write=r}}function Ou(n){try{$o(Zn(n),"")}catch{}}function He(n,e=0){try{let t=Au(Zn(n)),r=e>=0&&e<=t.length?e:0;return{text:t.subarray(r).toString("utf8"),offset:t.length}}catch{return{text:"",offset:0}}}function _u(n){return`\u2500\u2500 run ${n} \u2500\u2500 ${new Date().toTimeString().slice(0,8)}`}function pP(n){let e=fP.exec(n);return e?Number(e[1]):void 0}function Cu(n,e){let t=n.split(`
|
|
317
|
+
`),r=[];if(t.forEach((o,a)=>{let l=pP(o);l!==void 0&&r.push({id:l,idx:a})}),!r.length)return e==="latest"?n:"";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 t.slice(s.idx,i?i.idx:t.length).join(`
|
|
318
|
+
`)}function Xn(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function Ru(n){try{await cP(dt(),{recursive:!0}),await dy(Tu(n.pid),JSON.stringify({version:Le,...n}))}catch{ut()}}async function Iu(n,e){let t=Tu(n);try{let r=JSON.parse(await uy(t,"utf8"));if(r.denied===e)return;r.denied=e,await dy(t,JSON.stringify(r))}catch{}}async function un(n){await Eu(Tu(n)).catch(()=>{}),await Eu(Zn(n)).catch(()=>{}),await Eu(Pu(n)).catch(()=>{})}function ge(n){return n.agent!=null}function er(n,e){return ge(n)&&n.cwd!=null&&re(n.cwd)===re(e)}function Nu(n,e){return!ge(n)&&Xg(n.file,e)}async function X(n){let e;try{e=await lP(dt())}catch{return[]}let t=[];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 uy(Te.join(dt(),s),"utf8"))}catch{await un(i);return}o&&typeof o.pid=="number"&&Xn(o.pid)?t.push(o):await un(i)})),(n?t.filter(s=>Nu(s,n)):t).sort((s,i)=>s.startedAt-i.startedAt)}async function Mo(n,e){return(await X()).find(t=>er(t,n)&&(e?t.agent===e:!0))}async function $u(n,e){let t=new URL(n).port,r=(await X()).filter(a=>String(a.port)!==t),s=r.filter(a=>er(a,e)),i=r.filter(a=>Nu(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:n}),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":`${Te.basename(a.file)}'s page`};ge(a)&&(o+=f??0)}catch{}return o>0?{where:"external"}:void 0}async function Qn(n){try{process.kill(n,"SIGTERM")}catch{}await un(n)}async function Lu(n){try{let e=await fetch(`${n.url}/__pages`,{signal:AbortSignal.timeout(hP)});if(!e.ok)return;let{pages:t}=await e.json();return typeof t=="number"?t:void 0}catch{return}}async function Bt(n,e=ge(n)?"keep":"close"){try{let t=await fetch(`${n.url}/__stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pages:e}),signal:AbortSignal.timeout(cy)});if(!t.ok)throw new Error(`/__stop ${t.status}`);let{closed:r=0,stuck:s=0}=await t.json(),i=Date.now()+cy;for(;Xn(n.pid)&&Date.now()<i;)await hy(100);return Xn(n.pid)?(await Qn(n.pid),"killed"):(await un(n.pid),{closed:r,stuck:s})}catch{return await Qn(n.pid),"killed"}}function dn(n,e){let t=re(e);return n.filter(r=>!ge(r)&&r.pid!==process.pid&&re(r.file)===t)}async function Bo(n,e){let t=dn(await X(),n);for(let r of t)await Bt(r,e!==void 0&&r.port===e?"keep":"close");return t}function mP(n,e,t){(process.platform==="win32"?ay("cmd",["/c","start","","/b",n,...e],{cwd:t,stdio:"ignore",windowsHide:!0}):ay(n,e,{cwd:t,detached:!0,stdio:"ignore"})).unref()}function tr(){return Te.join(Te.dirname(dP(import.meta.url)),"index.js")}function my(n,e={}){return{command:process.execPath,args:[tr(),...e.trust?["--trust"]:[],...e.mode?["--mode",e.mode]:[],n,...e.open===!1?["--no-open"]:[]]}}function gy(n){return{command:process.execPath,args:[tr(),`agent:${n}`,"--no-open"]}}async function yy(n,e,t,r){let s=await n();if(s)return s;mP(e.command,e.args,t);let i=Date.now()+2e4;for(;Date.now()<i;){await hy(150);let o=await n();if(o)return o}throw new Error(`Launched ${r} but it did not register within 20s.`)}async function ks(n,e={}){let t=e.cwd??process.cwd(),r=Te.resolve(t,n),s=await Gn({kind:"bulb",file:r},t),[i]=await Bo(r,s),o={...e,mode:e.mode??i?.mode};return yy(async()=>dn(await X(),r)[0],my(n,o),t,Te.basename(n))}async function Mu(n,e=process.cwd()){return yy(()=>Mo(e,n),gy(n),e,`the ${n} mirror`)}var ly,fP,cy,hP,hy,$e=S(()=>{"use strict";tt();cn();No();ly=1e6;fP=/^── run (\d+) ── /;cy=6e3,hP=500;hy=n=>new Promise(e=>setTimeout(e,n))});function nr(n){return{...tp(n),server:n.files.get("server.ts")??""}}function Do(n){return!!n.server&&!n.code}var xs=S(()=>{"use strict";Z();Z()});function jo(n){let e=/^---[^\n]*\n([\s\S]*?)\n---/.exec(n),t=e?/^\s*name:\s*(.+?)\s*$/m.exec(e[1]):null;return t?t[1].replace(/^["']|["']$/g,""):void 0}function Bu(n){return Kn(jo(n)??"bulb")||"bulb"}var Du=S(()=>{"use strict";Z()});import{readdirSync as gP,readFileSync as yP,statSync as bP}from"fs";import{join as by,basename as wP}from"path";function vy(n,e,t){if(e>8)return t;let r;try{r=gP(n,{withFileTypes:!0})}catch{return t}for(let s of r)if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;vy(by(n,s.name),e+1,t)}else s.isFile()&&s.name.endsWith(".bulb.md")&&t.push(by(n,s.name));return t}function vP(n,e){let t,r=!1;try{let s=yP(n,"utf8");t=jo(s.slice(0,1024));let i=Je(s);r=!!i&&Do(nr(i))}catch{}return{mtime:e,name:t??wP(n).replace(/\.bulb\.md$/,""),serverOnly:r}}function Fo(n){let e=new Map,t=vy(n,0,[]).map(r=>{let s=0;try{s=bP(r).mtimeMs}catch{}let i=s?wy.get(r):void 0,o=i?.mtime===s?i:vP(r,s);return s&&e.set(r,o),{path:r,...o}});return wy=e,t}var wy,Sy=S(()=>{"use strict";Z();xs();Du();wy=new Map});function rr(n){if(n.server.trim())return"server-side code (server.ts)";let e=n.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")||n.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 Uo=S(()=>{"use strict"});import{readFile as SP}from"fs/promises";async function ju(n){try{let e=Je(await SP(n,"utf-8"));return e?rr(nr(e)):void 0}catch{return}}var ky=S(()=>{"use strict";xs();Uo()});function Fu(n){let e=n.split(""),t=(i,o)=>{for(let a=i;a<o&&a<e.length;a++)e[a]!==`
|
|
319
319
|
`&&(e[a]=" ")},r=0,s="";for(;r<n.length;){let i=n[r],o=n[r+1];if(i==="/"&&o==="/"){let a=r;for(;a<n.length&&n[a]!==`
|
|
320
|
-
`;)a++;t(r,a),r=a}else if(i==="/"&&o==="*"){let a=r+2;for(;a<n.length&&!(n[a]==="*"&&n[a+1]==="/");)a++;t(r,Math.min(a+2,n.length)),r=a+2}else if(i==="/"&&
|
|
320
|
+
`;)a++;t(r,a),r=a}else if(i==="/"&&o==="*"){let a=r+2;for(;a<n.length&&!(n[a]==="*"&&n[a+1]==="/");)a++;t(r,Math.min(a+2,n.length)),r=a+2}else if(i==="/"&&kP.has(s)){let a=r+1,l=!1;for(;a<n.length&&n[a]!==`
|
|
321
321
|
`;){let c=n[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<n.length&&n[a]!==i&&n[a]!==`
|
|
322
|
-
`;)n[a]==="\\"&&a++,a++;r=a+1,s=i}else if(i==="`"){let a=xy(n,r);t(r,a),r=a,s="`"}else/\s/.test(i)||(s=i),r++}return e.join("")}function xy(n,e){let t=e+1,r=0;for(;t<n.length;){let s=n[t];if(s==="\\"){t+=2;continue}if(s==="`"){if(r===0)return t+1;t=xy(n,t);continue}if(s==="$"&&n[t+1]==="{"){r++,t+=2;continue}if(s==="}"&&r>0){r--,t++;continue}t++}return n.length}var
|
|
322
|
+
`;)n[a]==="\\"&&a++,a++;r=a+1,s=i}else if(i==="`"){let a=xy(n,r);t(r,a),r=a,s="`"}else/\s/.test(i)||(s=i),r++}return e.join("")}function xy(n,e){let t=e+1,r=0;for(;t<n.length;){let s=n[t];if(s==="\\"){t+=2;continue}if(s==="`"){if(r===0)return t+1;t=xy(n,t);continue}if(s==="$"&&n[t+1]==="{"){r++,t+=2;continue}if(s==="}"&&r>0){r--,t++;continue}t++}return n.length}var kP,Ey=S(()=>{kP=new Set(["","(",",","=",":","[","!","&","|","?",";","{"])});function AP(n){if(/^[./]/.test(n)||/^[a-z][a-z0-9+.-]*:/i.test(n))return;let e=n.split("/");return n.startsWith("@")?e.slice(0,2).join("/"):e[0]}function Ay(n){let e=[];for(let s of EP)for(let i of n.matchAll(s)){let o=AP(i[1]);o&&e.push({root:o,index:i.index??0})}e.sort((s,i)=>s.index-i.index);let t=new Set,r=[];for(let{root:s,index:i}of e)t.has(s)||(t.add(s),r.push({root:s,lineIndex:n.slice(0,i).split(`
|
|
323
323
|
`).length-1}));return r}function Ty(n){return Ay(Fu(n)).map(e=>e.root)}function Es(n,e){if(!n)return[];let{target:t,dependencies:r}=e,s=(e.lineOffset??1)-1,i=[],o=n.split(`
|
|
324
324
|
`),a=Fu(n).split(`
|
|
325
|
-
`);for(let l=0;l<o.length;l++){let c=a[l],f=l+1+s;for(let u of
|
|
326
|
-
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+r;return{type:"UNDECLARED_IMPORT",severity:"error",message:
|
|
325
|
+
`);for(let l=0;l<o.length;l++){let c=a[l],f=l+1+s;for(let u of xP)u.targets.includes(t)&&u.pattern.test(c)&&i.push({type:u.type,severity:"error",message:OP(u.type,f),lineNumber:f,lineContent:o[l]})}return t==="client"&&r&&i.push(...TP(a,o,r,s)),i}function TP(n,e,t,r){let s=new Set(Object.keys(t));return Ay(n.join(`
|
|
326
|
+
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+r;return{type:"UNDECLARED_IMPORT",severity:"error",message:PP(i,a),lineNumber:a,lineContent:e[o]}})}function PP(n,e){return`Import "${n}" is not declared in config.json dependencies! Found on line ${e}.
|
|
327
327
|
|
|
328
328
|
**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.
|
|
329
329
|
|
|
@@ -337,7 +337,7 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
337
337
|
}
|
|
338
338
|
\`\`\`
|
|
339
339
|
|
|
340
|
-
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${n}" \u2014 and for every other bare import in code.tsx. Pin a real version where you can (e.g. "react": "^19.2.7").`}function
|
|
340
|
+
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${n}" \u2014 and for every other bare import in code.tsx. Pin a real version where you can (e.g. "react": "^19.2.7").`}function OP(n,e){return n==="URL_IMPORT"?`Direct URL imports are not supported! Found on line ${e}.
|
|
341
341
|
|
|
342
342
|
**CRITICAL**: Import packages by name only. Do NOT use CDN URLs:
|
|
343
343
|
|
|
@@ -491,22 +491,22 @@ import { something } from 'module-name'
|
|
|
491
491
|
const something = require('module-name') // NOT SUPPORTED!
|
|
492
492
|
\`\`\`
|
|
493
493
|
|
|
494
|
-
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var fn,pn,
|
|
495
|
-
`)}var
|
|
494
|
+
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var fn,pn,xP,EP,qo=S(()=>{Ey();fn=["client"],pn=["client","server"],xP=[{type:"DYNAMIC_IMPORT",pattern:/\bimport\s*\(\s*['"`]/,targets:fn},{type:"COMMONJS_REQUIRE",pattern:/\brequire\s*\(\s*['"`]/,targets:pn},{type:"JS_EXTENSION_IMPORT",pattern:/from\s+['"][^'"]*\/[^'"]*\.js['"]/,targets:fn},{type:"URL_IMPORT",pattern:/from\s+['"]https?:\/\//,targets:fn},{type:"VERSION_SPECIFIER_IMPORT",pattern:/from\s+['"][^'"]*@[\d^~]/,targets:fn},{type:"REDUNDANT_TB_DECLARATION",pattern:/declare\s+(const|var|let)\s+tb\b/,targets:pn},{type:"CONST_ENUM",pattern:/\bconst\s+enum\b/,targets:pn},{type:"NAMESPACE_DECLARATION",pattern:/\bnamespace\s+\w+/,targets:pn},{type:"COMMONJS_EXPORT_EQUALS",pattern:/\bexport\s*=/,targets:pn},{type:"COMMONJS_IMPORT_EQUALS",pattern:/\bimport\s+\w+\s*=/,targets:pn},{type:"MODULE_DECLARATION",pattern:/\bmodule\s+\w+\s*\{/,targets:pn},{type:"CSS_FILE_IMPORT",pattern:/(?:from|import)\s+['"][^'"]*\.css['"]/,targets:fn},{type:"NAVIGATION",pattern:/window\.(location\.(reload|assign|replace)\s*\(|open\s*\()/,targets:fn},{type:"NAVIGATION",pattern:/window\.location(\.href)?\s*=[^=]/,targets:fn}],EP=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});function Uu(n){let e=Je(n);if(!e)return n;let t=e.files.get("code.tsx");if(!t)return n;let r=Ty(t);if(!r.length)return n;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 n;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 u=zf(c);u&&(l[u]=f)}return l.config=JSON.stringify(i,null,2),sp(l)}var Py=S(()=>{"use strict";Z();qo()});import{spawn as Oy}from"child_process";import{basename as _P}from"path";function CP(){return process.env.TYPEBULB_EDITOR||"code"}function IP(n,e,t){return t==null?[e]:RP.test(_P(n))?["-g",`${e}:${t}`]:[`+${t}`,e]}function NP(n,e){let t=CP();return{command:t,args:IP(t,n,e)}}function qu(n,e){let{command:t,args:r}=NP(n,e),s=process.platform==="win32"?Oy("cmd.exe",["/d","/s","/c",t,...r],{detached:!0,stdio:"ignore",windowsHide:!0}):Oy(t,r,{detached:!0,stdio:"ignore"});s.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),s.unref()}var RP,_y=S(()=>{"use strict";RP=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i});import{readFileSync as $P,writeFileSync as LP,mkdirSync as MP,statSync as BP}from"fs";import{join as DP}from"path";function Ju(){return DP(Mt(),"trust.json")}function Wu(){try{let n=Ju(),e=BP(n).mtimeMs;if(As?.mtime!==e){let t=JSON.parse($P(n,"utf8"));As={mtime:e,set:new Set(Array.isArray(t)?t:[])}}return As.set}catch{return As=void 0,new Set}}function jP(n){try{MP(Mt(),{recursive:!0}),LP(Ju(),JSON.stringify([...n])),As=void 0}catch(e){throw new Error(`can't write ${Ju()} \u2014 trust not remembered (unwritable home; sandboxed shell?): ${e.message}`)}}function hn(n){return Wu().has(re(n))}function sr(n,e){let t=new Set(Wu()),r=re(n);(e?t.has(r):!t.has(r))||(e?t.add(r):t.delete(r),jP(t))}function Ku(){return[...Wu()]}var As,Ts=S(()=>{"use strict";tt()});function or(n){return(n.includes("://")?n:`http://${n}`).replace(/\/+$/,"")}function Hu(){return Os}async function ft(){let[n,e]=await Promise.all([Ry(),HP()]);return KP([...YP(e),...n],process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL)}function KP(n,e,t){return!e||!t?n:n.map(r=>r.provider===e&&r.name===t?{...r,default:!0}:r)}async function Cy(){let n;try{n=await fetch(FP,{signal:AbortSignal.timeout(qP)})}catch(e){Os=`catalog fetch failed: ${e?.message??e}`;return}if(!n.ok){Os=`catalog fetch failed: HTTP ${n.status}`;return}try{return await n.json()}catch(e){Os=`catalog returned an unreadable body: ${e?.message??e}`;return}}async function HP(){if(Ps&&Date.now()-Ps.fetchedAt<=UP)return Ps.models;let n=await Cy()??await Cy();return n?(Ps={models:n,fetchedAt:Date.now()},Os=void 0,n):Ps?.models??[]}async function Ry(){if(Jo&&Date.now()-Jo.fetchedAt<=JP)return Jo.models;let n=or(process.env.OLLAMA_HOST??"http://localhost:11434"),e=[];try{let t=await fetch(new URL("/api/tags",n).toString(),{signal:AbortSignal.timeout(WP)});t.ok&&(e=((await t.json()).models??[]).map(s=>s.name).filter(s=>!!s).map(s=>({provider:"ollama",name:s,friendlyName:s,providerName:"Ollama"})))}catch{}return Jo={models:e,fetchedAt:Date.now()},e}function YP(n){let e=new Set(Object.entries(ir).filter(([,t])=>!!process.env[t]).map(([t])=>t));return n.filter(t=>e.has(t.provider))}function Yu(){return Object.values(ir).some(n=>!!process.env[n])}async function Wo(){return Yu()||process.env.TB_AI_BASE_URL||(await Ry()).length>0?"own":"none"}function Iy(n,e,t){let r=Math.max(...n.map(o=>o.name.length)),s=Math.max(...n.map(o=>o.friendlyName.length)),i=["Models available to tb.ai (filtered by your .env keys):",""];for(let o of n)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&&t&&i.push(`Default (from .env): ${e} / ${t}`),i.join(`
|
|
495
|
+
`)}var ir,FP,UP,qP,JP,WP,Ps,Jo,Os,mn=S(()=>{"use strict";ir={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};FP="https://api.typebulb.com/api/models",UP=1440*60*1e3,qP=5e3,JP=60*1e3,WP=1500});var Ny,$y,nt,gn=S(()=>{Ny=n=>n!=null&&n>=0&&n<=4?n:void 0,$y=(n,e)=>{let t={...n};for(let r of["input","output","reasoning","cacheRead"])e[r]!==void 0&&(t[r]=e[r]);return t},nt=n=>n===void 0||n.input===void 0&&n.output===void 0?void 0:{input:n.input??0,output:n.output??0,reasoning:n.reasoning,cacheRead:n.cacheRead}});var Pe,Ye,ar=S(()=>{Pe=class extends Error{constructor(e,t="unknown",r=!1){super(e),this.code=t,this.retryable=r}},Ye=class{getPath(e,t){return this.path}parseError(e,t){return this.parseJsonError(e,t)}parseStreamChunk(e){return this.checkAndThrowError(e),this.parseProviderStreamChunk(e)}extractSystemMessages(e,t=`
|
|
496
496
|
|
|
497
|
-
`){let r=e.filter(s=>s.role==="system").map(s=>s.content);return{system:r.length?r.join(t):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let r=JSON.parse(e);return r.error&&typeof r.error=="object"?{message:r.error.message||`HTTP ${t}`,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 t=e;if(t.type==="error"&&"message"in t){let r=t.code||"unknown";throw new
|
|
498
|
-
`)),!t&&s.type==="message"&&s.content&&(t=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,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
|
|
497
|
+
`){let r=e.filter(s=>s.role==="system").map(s=>s.content);return{system:r.length?r.join(t):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let r=JSON.parse(e);return r.error&&typeof r.error=="object"?{message:r.error.message||`HTTP ${t}`,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 t=e;if(t.type==="error"&&"message"in t){let r=t.code||"unknown";throw new Pe(t.message,r,!!t.retryable)}if(t.error){let r=t.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 Pe(this.extractErrorMessage(t.error),i?"rate_limit":a?"context_exceeded":"unknown",i||o)}}extractErrorMessage(e){if(typeof e=="string")try{let t=JSON.parse(e);return t.error?.message||t.message||e}catch{return e}return typeof e=="object"&&e!==null?e.message||JSON.stringify(e):`${this.providerName} returned an error`}}});var Ko,Vu=S(()=>{gn();ar();Ko=class extends Ye{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,t,r,s){let i=this.convertMessagesToInput(e),o={model:t,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 t=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(`
|
|
498
|
+
`)),!t&&s.type==="message"&&s.content&&(t=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,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 Pe(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 t=this.mapUsage(e.response?.usage);return t?{usage:t}:void 0}default:return}}mapUsage(e){if(e)return nt({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(t=>t.role==="system"?`System: ${t.content}`:t.role==="user"?`User: ${t.content}`:t.role==="assistant"?`Assistant: ${t.content}`:t.content).join(`
|
|
499
499
|
|
|
500
|
-
`)}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
|
|
500
|
+
`)}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 lr,Ho=S(()=>{gn();ar();lr=class extends Ye{parseNonStreamingResponse(e){if(!this.hasChoices(e))return{text:""};let t=e,r=t.choices[0],s=r?.message,i=s?.content??r?.text??"",o=s?.reasoning??s?.reasoning_content??t.reasoning;return{text:i,reasoning:o,usage:this.mapUsage(t.usage)}}parseProviderStreamChunk(e){if(!this.hasChoices(e))return;let t=e,r=this.mapUsage(t.usage),s=t.choices[0]?.delta||t.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 nt({input:e.prompt_tokens,output:e.completion_tokens,reasoning:e.completion_tokens_details?.reasoning_tokens,cacheRead:e.prompt_tokens_details?.cached_tokens})}}});var zu,Yo,Gu=S(()=>{Ho();zu={"HTTP-Referer":"https://typebulb.com","X-OpenRouter-Title":"Typebulb"},Yo=class extends lr{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",...zu}}buildPayload(e,t,r,s){let i={model:t,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 Vo,Xu=S(()=>{gn();ar();Vo=class extends Ye{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,t,r,s){let{system:i,conversationMessages:o}=this.extractSystemMessages(e),a={model:t,max_tokens:Math.min(this.getMaxTokens(t),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(t))if(l===0)this.alwaysThinks(t)||(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 t=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(`
|
|
501
501
|
|
|
502
|
-
`);return{text:t,reasoning:r||void 0,usage:nt(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 t=this.mapUsage(e.message?.usage);return t?{usage:t}:void 0}case"message_delta":{let t=this.mapUsage(e.usage);return t?{usage:t}:void 0}default:return}}mapUsage(e){if(typeof e!="object"||e===null)return;let t=e,r=c=>typeof c=="number"?c:void 0,s=r(t.input_tokens),i=r(t.cache_read_input_tokens),o=r(t.cache_creation_input_tokens),a=r(t.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 t=Math.max(0,e.length-2);return e.map((r,s)=>s>=t?{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 t=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!t)return!1;let r=+t[1],s=t[2]?+t[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 zo,Qu=S(()=>{gn();
|
|
502
|
+
`);return{text:t,reasoning:r||void 0,usage:nt(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 t=this.mapUsage(e.message?.usage);return t?{usage:t}:void 0}case"message_delta":{let t=this.mapUsage(e.usage);return t?{usage:t}:void 0}default:return}}mapUsage(e){if(typeof e!="object"||e===null)return;let t=e,r=c=>typeof c=="number"?c:void 0,s=r(t.input_tokens),i=r(t.cache_read_input_tokens),o=r(t.cache_creation_input_tokens),a=r(t.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 t=Math.max(0,e.length-2);return e.map((r,s)=>s>=t?{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 t=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!t)return!1;let r=+t[1],s=t[2]?+t[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 zo,Qu=S(()=>{gn();ar();zo=class extends Ye{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,t){return`/v1beta/models/${e}:${t?"streamGenerateContent":"generateContent"}${t?"?alt=sse":""}`}buildHeaders(e){return{"Content-Type":"application/json","x-goog-api-key":e}}buildPayload(e,t,r,s){let{system:i,conversationMessages:o}=this.extractSystemMessages(e,`
|
|
503
503
|
`),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(t),u=f!==void 0&&f>=3?{thinkingLevel:this.thinkingLevelFor(f,c)}:{thinkingBudget:this.budgetMap[c]};l.generationConfig={thinkingConfig:c===0?u:{includeThoughts:!0,...u}}}return r?.maxOutputTokens!==void 0&&(l.generationConfig={...l.generationConfig,maxOutputTokens:r.maxOutputTokens}),l}parseError(e,t){if(!e)return{message:`HTTP ${t}`};try{let r=JSON.parse(e),s=Array.isArray(r)?r[0]?.error:r?.error;return s&&typeof s=="object"?{message:(s.message||`HTTP ${t}`).split(`
|
|
504
|
-
`)[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 t=this.extractParts(e).text||"",r=e.candidates?.[0]?.finishReason,s="complete";return r==="MAX_TOKENS"?s="interrupted":(r==="SAFETY"||r==="RECITATION")&&(s="failed"),{text:t,status:s,usage:this.mapUsage(e.usageMetadata)}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return;let t=this.extractParts(e),r=this.mapUsage(e.usageMetadata);return r&&(t.usage=r),t.text||t.reasoning||t.usage?t:void 0}mapUsage(e){if(!e)return;let t=e.candidatesTokenCount!==void 0||e.thoughtsTokenCount!==void 0;return nt({input:e.promptTokenCount,output:t?(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0):void 0,reasoning:e.thoughtsTokenCount,cacheRead:e.cachedContentTokenCount})}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):void 0}thinkingLevelFor(e,t){let r=["minimal","low","medium","high","high"][t];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 t=e.candidates?.[0]?.content?.parts;if(!t)return{};let r="",s="";for(let i of t)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 t=e.promptFeedback.blockReason;throw new
|
|
504
|
+
`)[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 t=this.extractParts(e).text||"",r=e.candidates?.[0]?.finishReason,s="complete";return r==="MAX_TOKENS"?s="interrupted":(r==="SAFETY"||r==="RECITATION")&&(s="failed"),{text:t,status:s,usage:this.mapUsage(e.usageMetadata)}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return;let t=this.extractParts(e),r=this.mapUsage(e.usageMetadata);return r&&(t.usage=r),t.text||t.reasoning||t.usage?t:void 0}mapUsage(e){if(!e)return;let t=e.candidatesTokenCount!==void 0||e.thoughtsTokenCount!==void 0;return nt({input:e.promptTokenCount,output:t?(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0):void 0,reasoning:e.thoughtsTokenCount,cacheRead:e.cachedContentTokenCount})}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):void 0}thinkingLevelFor(e,t){let r=["minimal","low","medium","high","high"][t];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 t=e.candidates?.[0]?.content?.parts;if(!t)return{};let r="",s="";for(let i of t)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 t=e.promptFeedback.blockReason;throw new Pe(`Prompt blocked: ${t}`)}}}});var Go,Zu=S(()=>{Ho();Go=class extends lr{constructor(){super(...arguments),this.providerName="Ollama",this.defaultBaseUrl="http://localhost:11434",this.path="/chat/completions"}buildHeaders(e){let t={"Content-Type":"application/json",Accept:"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}buildPayload(e,t,r,s){return s?{model:t,messages:e,stream:s,stream_options:{include_usage:!0}}:{model:t,messages:e,stream:s}}}});function yn(n){let e=VP.get(n);if(!e)throw new Error(`Unsupported protocol: ${n}`);return e}function zP(n,e){return n.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)}async function ed(n,e){let t=yn(n.protocol),r=t.getPath(n.model,e.stream),s=zP(n.baseUrl,r),i=t.buildHeaders(n.apiKey),o=t.buildPayload(e.messages,n.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 GP(n){return/prompt is too long|context[_ ](length|window)|maximum context|token count exceeds|too many tokens/i.test(n)}async function cr(n,e){let t=yn(e),r=await n.text().catch(()=>""),{message:s}=t.parseError(r,n.status),i=n.status,o="unknown";return i===429?o="rate_limit":(i===413||GP(s))&&(o="context_exceeded"),{code:o,message:s,retryable:i===429||i>=500}}var Ly,VP,td=S(()=>{Vu();Gu();Xu();Qu();Zu();Ly=new Go,VP=new Map([["openai",new Ko],["openrouter",new Yo],["anthropic",new Vo],["gemini",new zo],["ollama",Ly],["openai-compat",Ly]])});function My(n){let e=n.indexOf(`\r
|
|
505
505
|
\r
|
|
506
506
|
`),t=n.indexOf(`
|
|
507
507
|
|
|
508
508
|
`);return e!==-1&&(t===-1||e<t)?{pos:e,len:4}:t!==-1?{pos:t,len:2}:{pos:-1,len:0}}function nd(n){let t=n.split(/\r?\n/).filter(s=>s.startsWith("data:"));if(!t.length)return;let r=t.map(s=>s.replace(/^data:\s?/,"")).join(`
|
|
509
|
-
`).trim();if(r){if(r==="[DONE]")return"done";try{return JSON.parse(r)}catch{return}}}async function*By(n,e,t){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([n.read(),o]):await n.read();if(a){if(s.trim()){let u=nd(s);u!==void 0&&u!=="done"&&(yield u)}return}t?.(),s+=r.decode(l,{stream:!0});let{pos:c,len:f}=My(s);for(;c!==-1;){let u=s.slice(0,c);s=s.slice(c+f);let d=nd(u);if(d==="done")return;d!==void 0&&(yield d),{pos:c,len:f}=My(s)}}}finally{i&&e?.removeEventListener("abort",i);try{await n.cancel()}catch{}}}async function rd(n,e){return(await
|
|
509
|
+
`).trim();if(r){if(r==="[DONE]")return"done";try{return JSON.parse(r)}catch{return}}}async function*By(n,e,t){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([n.read(),o]):await n.read();if(a){if(s.trim()){let u=nd(s);u!==void 0&&u!=="done"&&(yield u)}return}t?.(),s+=r.decode(l,{stream:!0});let{pos:c,len:f}=My(s);for(;c!==-1;){let u=s.slice(0,c);s=s.slice(c+f);let d=nd(u);if(d==="done")return;d!==void 0&&(yield d),{pos:c,len:f}=My(s)}}}finally{i&&e?.removeEventListener("abort",i);try{await n.cancel()}catch{}}}async function rd(n,e){return(await ur(n,e)).text}async function ur(n,e){if(!n.body)throw new Error("Response body is missing");let t="",r;for await(let s of bn(n,e))s.kind==="text"?t+=s.text:s.kind==="usage"&&(r=s.usage);return{text:t,usage:r}}async function*bn(n,e){let t=e??(n.headers.get("X-Provider-Protocol")||"openai"),r=yn(t);if(!n.body)return;let s=n.body.getReader(),i;for await(let a of By(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=$y(i,l.usage))}let o=nt(i);o&&(yield{kind:"usage",usage:o})}var Dy=S(()=>{gn();td()});import{strToU8 as XP,strFromU8 as QP,deflateSync as ZP,inflateSync as eO}from"fflate";function id(n,e){let t=[];if(t.push(`You are a data processor. Follow the instructions to analyze the provided data. Output valid JSON that the code can consume.
|
|
510
510
|
|
|
511
511
|
---
|
|
512
512
|
Instructions:
|
|
@@ -524,12 +524,12 @@ ${r}
|
|
|
524
524
|
</data>`)}return t.push(`
|
|
525
525
|
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.`),t.join(`
|
|
526
526
|
|
|
527
|
-
`)}function _s(n){try{return JSON.parse(n)}catch{return}}function jy(n,e){let t="",r=0,s=!1,i=!1;for(let o=0;o<n.length;o++){let a=n[o];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}a==='"'&&(s?(t+=n.slice(r,o+1),r=o+1):(t+=e(n.slice(r,o))+'"',r=o+1),s=!s)}return t+=s?n.slice(r):e(n.slice(r)),t}function
|
|
528
|
-
`)){let t=e.trim();if(!t||t.startsWith("#"))continue;let r=t.indexOf("=");if(r===-1)continue;let s=t.slice(0,r).trim(),i=t.slice(r+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function Xo(n,e=process.cwd()){for(let t of Jy()){let r;try{r=qy(rt.resolve(e,t),"utf-8")}catch{continue}for(let[s,i]of Wy(r))if(s===n)return i}return process.env[n]}function
|
|
527
|
+
`)}function _s(n){try{return JSON.parse(n)}catch{return}}function jy(n,e){let t="",r=0,s=!1,i=!1;for(let o=0;o<n.length;o++){let a=n[o];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}a==='"'&&(s?(t+=n.slice(r,o+1),r=o+1):(t+=e(n.slice(r,o))+'"',r=o+1),s=!s)}return t+=s?n.slice(r):e(n.slice(r)),t}function nO(n){let e=jy(n,t=>t.replace(/,(\s*[}\]])/g,"$1"));return e!==n?e:void 0}function rO(n){let e=jy(n,t=>t.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!==n?e:void 0}function sO(n,e){let t=0,r=!1,s=!1;for(let i=e;i<n.length;i++){let o=n[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(o==='"'){r=!r;continue}if(!r){if(o==="{"||o==="[")t++;else if((o==="}"||o==="]")&&(t--,t===0))return i}}return-1}function iO(n){let e,t=0;for(;t<n.length;){let r=n[t];if(r==="{"||r==="["){let s=sO(n,t);if(s!==-1){let i=n.slice(t,s+1),o=_s(i);o!==void 0&&(e={parsed:o,json:i}),t=s+1;continue}}t++}return e}function od(n){let e=[],t=n.trim();t.startsWith("```")&&(t=t.replace(/^```(?:json)?\s*\n?/,"").replace(/\n?```\s*$/,""),e.push("markdown fences"));let r=_s(t);if(r!==void 0)return{parsed:r,json:t,fixesApplied:e};let s=t.match(/```(?:json)?\s*\n([\s\S]*?)\n?```\s*$/);if(s&&(t=s[1].trim(),e.push("preamble before fenced JSON"),r=_s(t),r!==void 0))return{parsed:r,json:t,fixesApplied:e};if(!t.startsWith("{")&&!t.startsWith("[")){let o=t.indexOf("{"),a=t.indexOf("["),l=o>=0&&a>=0?Math.min(o,a):o>=0?o:a;if(l>0&&(t=t.slice(l),e.push("preamble text"),r=_s(t),r!==void 0))return{parsed:r,json:t,fixesApplied:e}}for(let[o,a]of tO){let l=a(t);if(l!==void 0){let c=_s(l);if(c!==void 0)return{parsed:c,json:l,fixesApplied:[...e,o]}}}let i=iO(n);return i!==void 0?{...i,fixesApplied:[...e,"extracted last JSON value"]}:{parsed:void 0,json:t,fixesApplied:e}}function ad(n){try{let e={};if(n.insight!==void 0&&(e.i=n.insight),n.data!==void 0&&(e.d=n.data),e.i===void 0&&e.d===void 0)return"";let t=JSON.stringify(e),r=ZP(XP(t),{level:9}),s=aO(r),i=`${Fy}:${s}`;return i.length>oO?"":"#"+sd+i}catch{return""}}function ld(n){try{let e=n.startsWith("#")?n.slice(1):n;if(!e.startsWith(sd))return;let t=e.slice(sd.length),r=t.indexOf(":");if(r===-1||t.slice(0,r)!==Fy)return;let s=lO(t.slice(r+1)),i=JSON.parse(QP(eO(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 aO(n){let e="";for(let t=0;t<n.length;t+=32768)e+=String.fromCharCode(...n.subarray(t,t+32768));return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function lO(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";let t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}var tO,sd,Fy,oO,Uy=S(()=>{tO=[["orphan quote",n=>{let e=n.replace(/^[ \t]*"[ \t]*\r?\n/gm,"");return e!==n?e:void 0}],["trailing }",n=>n.endsWith("}}")?n.slice(0,-1):void 0],["trailing ]",n=>n.endsWith("]]")?n.slice(0,-1):void 0],["trailing },",n=>n.endsWith("},")?n.slice(0,-1):void 0],["trailing ],",n=>n.endsWith("],")?n.slice(0,-1):void 0],["trailing commas",nO],["arithmetic constants",rO]];sd="tb=",Fy="1",oO=6e4});var Dt=S(()=>{gn();ar();td();Dy();Uy();Ho();Xu();Qu();Vu();Gu();Zu()});import{readFileSync as qy,existsSync as cO}from"fs";import*as rt from"path";function Jy(n){return[...n?[`.env.${n}.local`,`.env.${n}`]:[],".env.local",".env"]}function Me(n,e=process.cwd()){let t={},r=[];for(let s of Jy(n)){let i;try{i=qy(rt.resolve(e,s),"utf-8")}catch{continue}r.push(s);for(let[o,a]of Wy(i))process.env[o]===void 0&&(process.env[o]=a,t[o]=s)}return{mode:n,sources:t,loaded:r}}function*Wy(n){for(let e of n.split(`
|
|
528
|
+
`)){let t=e.trim();if(!t||t.startsWith("#"))continue;let r=t.indexOf("=");if(r===-1)continue;let s=t.slice(0,r).trim(),i=t.slice(r+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function Xo(n,e=process.cwd()){for(let t of Jy()){let r;try{r=qy(rt.resolve(e,t),"utf-8")}catch{continue}for(let[s,i]of Wy(r))if(s===n)return i}return process.env[n]}function uO(n){let e=new Set,t=/process\.env\.([A-Za-z_$][\w$]*)|process\.env\[\s*['"]([^'"]+)['"]\s*\]/g;for(let r;r=t.exec(n);)e.add(r[1]??r[2]);return[...e]}function Ky(){return`.env loads from ${process.cwd()} (the directory you ran from, not the bulb's)`}function jt(n,e,t){let{sources:r,mode:s,loaded:i}=n,o=process.cwd(),a=rt.dirname(e),l=`(mode: ${s??"none"})`,c=t?uO(t):[],f=c.filter(h=>r[h]).map(h=>`${h} \u2190 ${r[h]}`);f.length?console.log(`env: ${f.join(", ")} ${l}`):i.length&&console.log(`env: loaded ${i.join(", ")} ${l}`),s&&!i.some(h=>h===`.env.${s}`||h===`.env.${s}.local`)&&console.log(`env: mode=${s} \u2014 no .env.${s} found; using .env`);let u=rt.resolve(a)!==rt.resolve(o);if(u)for(let h of[".env.local",".env"])cO(rt.join(a,h))&&console.log(`env: ${rt.join(a,h)} present but not loaded (cwd is ${o})`);let d=c.filter(h=>process.env[h]===void 0);if(d.length){let h=u?` \u2014 try running from ${a}`:"";console.log(`env: server.ts reads ${d.join(", ")} but ${d.length>1?"they are":"it's"} unset${h}`)}}var pt=S(()=>{"use strict"});function ht(n,e){let t=n??process.env.TB_AI_PROVIDER,r=e??process.env.TB_AI_MODEL;if(!t)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=yn(t)}catch{return`Unknown provider '${t}'.`}if(t==="ollama")return{apiKey:"",baseUrl:`${or(process.env.OLLAMA_HOST??s.defaultBaseUrl)}/v1`,protocol:t,model:r,isFreeModel:!1};if(t==="openai-compat"){let a=process.env.TB_AI_BASE_URL;return a?{apiKey:process.env.TB_AI_API_KEY??"",baseUrl:a,protocol:t,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=ir[t];if(!i)return`Unknown provider '${t}'.`;let o=process.env[i];return o?{apiKey:o,baseUrl:s.defaultBaseUrl,protocol:t,model:r,isFreeModel:!1}:`No API key for '${t}'. Set ${i} \u2014 ${Ky()}.`}function Ft(n,e){let t=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(r=>({role:r.role,content:r.content}))];return ed(n,{messages:t,stream:!0,effort:Ny(e.effort),webSearch:e.webSearch,signal:e.signal})}var Qo=S(()=>{"use strict";Dt();Dt();pt();mn()});import{readFileSync as kB,existsSync as dO}from"fs";import*as dr from"path";import{fileURLToPath as fO}from"url";function pO(){let n=dr.dirname(fO(import.meta.url));for(;!dO(dr.join(n,"package.json"));){let e=dr.dirname(n);if(e===n)break;n=e}return n}function Cs(){return dr.join(pO(),"SKILL.md")}var cd=S(()=>{"use strict"});import{transform as hO}from"sucrase";function ud(n,e={}){let t=e.serverOnly?["typescript"]:["typescript","jsx"];try{let{code:r}=hO(n,{transforms:t,jsxRuntime:"automatic",jsxImportSource:e.jsxImportSource||"react",production:!0});return{code:r}}catch(r){return{code:"",error:String(r)}}}var Hy=S(()=>{});function mO(n){return n.map(e=>`${e.type} (line ${e.lineNumber}): ${e.message.split(`
|
|
529
529
|
`)[0]}`).join(`
|
|
530
530
|
`)}function Yy(n,e){let t=Es(n,{target:"client",dependencies:e}).filter(r=>r.type==="UNDECLARED_IMPORT");if(t.length)throw new Error(`Lint failed:
|
|
531
|
-
${hO(t)}`)}var Vy=S(()=>{"use strict";qo()});var Ut,Rs,dd,Is=S(()=>{Ut="https://esm.sh",Rs="https://cdn.jsdelivr.net/npm/",dd="https://data.jsdelivr.com/v1/package/npm/"});function zy(n){let e=(n||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var F,dr,Gy,Ns=S(()=>{Is();F=class n{constructor(e,t,r){let s=typeof e=="string"?n.parse(e):e;this.name=s.name,this.version=dr(t??s.version),this.subpath=dr(r??s.subpath)}static parse(e){let t=zy(e||"");if(!t.length)return new n({name:""});if(t[0].startsWith("@")){let s=t[0],[i,o]=Gy(t[1]??""),a=dr(t.slice(2).join("/"));return new n({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=Gy(t[0]),o=dr(t.slice(1).join("/"));return new n({name:s,version:i,subpath:o})}}static fromUrl(e){try{let t=new URL(e),r=new URL(Ut).host,s=new URL(Rs).host;if(t.host===r){let i=zy(t.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return n.parse(o)}if(t.host===s){let i=t.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return n.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 n.parse(e).name}withVersion(e){return new n({name:this.name,version:dr(e),subpath:this.subpath})}static isBare(e){return!e||e.startsWith(".")||e.startsWith("/")?!1:!/^[a-z][a-z0-9+.-]*:/i.test(e)}},dr=n=>n&&n.length?n:void 0,Gy=n=>{let e=n.indexOf("@");return e<0?[n,void 0]:[n.slice(0,e),dr(n.slice(e+1))]}});async function xe(n){try{return await n()}catch{return}}var Zo=S(()=>{});function wn(n){let e=n||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function fd(n){return n.startsWith("./")?n:`./${n}`}var $s,pd=S(()=>{Ns();Zo();Is();$s=class{constructor(e,t){this.cache=e,this.http=t,this.pinMs=1e4,this.versionsIndexMs=1440*60*1e3,this.metaTtlMs=10080*60*1e3,this.pinCache=new Map}baseDir(e){let t=typeof e=="string"?new F(e):e;return`${Rs}${t.name}${t.version?`@${t.version}`:""}/`}file(e,t){return new URL(wn(t),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,t={}){let{target:r="es2022",bundle:s=!1,external:i}=t,o=new URLSearchParams({target:r});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${Ut}/${e}?${o.toString()}`}async resolveExactVersion(e){let t=Date.now(),r=this.pinCache.get(e);if(r&&t-r.ts<this.pinMs)return r.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${Ut}/${e}`]);return this.pinCache.set(e,{value:s,ts:t}),s}async tryResolveFromUrls(e){for(let t of e){let r=await xe(()=>this.http.head(t)),s=this.parseVersionFromUrl(r?.url||t);if(s)return s}}async fetchVersionsIndex(e){if(await this.cache.isNegative(e))return;let t=await this.cache.getIndex(e);if(t&&Date.now()-t.updatedAt<this.versionsIndexMs)return{versions:t.versions,distTags:t.distTags};let r=await xe(()=>this.http.getJson(`${dd}${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 t=F.fromUrl(e)?.version;return t&&/\d+\.\d+\.\d+/.test(t)?t:void 0}async fetchPackageMeta(e,t){let r=await this.cache.getMeta(e,t);if(r&&Date.now()-r.updatedAt<this.metaTtlMs){let{dependencies:f,peerDependencies:u,peerDependenciesMeta:d}=r;return{name:e,version:t,dependencies:f,peerDependencies:u,peerDependenciesMeta:d}}let s=this.packageJson(new F(`${e}@${t}`)),i=await xe(()=>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,t,a,l,c),{name:e,version:t,dependencies:a,peerDependencies:l,peerDependenciesMeta:c}}}});var Xy,Ls,hd,mO,Ms,ea=S(()=>{Xy=n=>n.startsWith("@types/"),Ls=n=>Object.keys(n?.peerDependencies||{}).filter(e=>!Xy(e)),hd=n=>Object.keys(n?.dependencies||{}).filter(e=>!Xy(e)),mO=n=>Ls(n).filter(e=>!n?.peerDependenciesMeta?.[e]?.optional),Ms=class{constructor(e){this.cdn=e}async resolve(e,t){let r=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(r,t),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:t,version:r})=>({name:t,version:r,meta:await this.cdn.fetchPackageMeta(t,r)})))}async expandWithPeers(e,t){let r=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of mO(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 t(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 t=new Set(e.flatMap(i=>Ls(i.meta))),r=new Map;for(let i of e)for(let o of hd(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:t.has(i.name),hasPeers:Ls(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var Bs,md=S(()=>{Ns();Zo();Bs=class{constructor(e,t,r){this.cache=e,this.cdn=t,this.semver=r}async learnExactVersion(e){let t=await xe(()=>this.cdn.fetchVersionsIndex(e));if(t?.versions?.length){let r=this.semver.selectBestVersion(t.versions,{distTags:t.distTags});if(r)return r}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,t){if(!t)return this.learnExactVersion(e);let r=a=>!this.semver.isRange(t)||this.semver.satisfies(t,a),s=await this.cache.getPinnedExact(e,t);if(s){if(this.semver.isExactVersion(s)&&r(s))return s;console.debug("[typebulb] cached version for",e,"is not exact or not in",t,"(",s,"); re-resolving from registry")}let i=async a=>{if(a&&this.semver.isExactVersion(a)&&r(a))return await this.cache.setPinnedExact(e,t,a),a},o=await xe(()=>this.cdn.fetchVersionsIndex(e));if(o?.versions?.length){let a=this.semver.selectBestVersion(o.versions,{range:t,distTags:o.distTags});if(a){let l=await i(a);if(l)return l}else{console.debug("[typebulb] refreshing version cache for",e,"(",t,"not in cached set \u2014 likely a new release)"),await this.cache.invalidateVersionsCache(e);let l=await xe(()=>this.cdn.fetchVersionsIndex(e));if(l?.versions?.length){let c=await i(this.semver.selectBestVersion(l.versions,{range:t,distTags:l.distTags}));if(c)return c}}}return i(await this.cdn.resolveExactVersion(`${e}@${t}`))}async effectivePackage(e,t){let r=new F(e),s=r.root(),i=t[s],o=i?await xe(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?r.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as gO,parse as yO}from"es-module-lexer";var fr,gd=S(()=>{Ns();Is();ea();fr=class n{constructor(e,t,r){this.version=e,this.cdn=t,this.peer=r}extractImportsSync(e){let t=new Set;for(let r of n.importPatterns){r.lastIndex=0;for(let s of e.matchAll(r))F.isBare(s[1])&&t.add(s[1])}return Array.from(t)}async extractImports(e){let t=new Set,r=s=>{F.isBare(s)&&t.add(s)};try{await gO;let[s]=yO(e);s.forEach(i=>r(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(t)}async buildImportMap(e,t,r){let s=(await this.extractImports(e)).filter(u=>!r?.has(F.rootOf(u))),i=[...new Set(s.map(F.rootOf))],o=await Promise.all(i.map(async u=>({name:u,version:await this.resolveVersion(u,t)}))),{allRoots:a,flags:l,autoAddedPeers:c}=await this.peer.resolve(o,u=>this.resolveVersion(u,t)),f=this.buildEntries([...s,...c.map(u=>u.name)],a,l);return{importMap:{imports:Object.fromEntries(f)},prefetchUrls:f.map(([,u])=>u)}}async resolveVersion(e,t){let r=t[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,t,r){let s=new Map(t.map(h=>[h.name,h])),i=h=>{let m=s.get(F.rootOf(h));return new F(h).withVersion(m.version).format()},o=new Set([...r.entries()].filter(([,h])=>h.isPeerRoot||h.isSharedDep).map(([h])=>h)),a=new Set(e.filter(h=>h!==F.rootOf(h)).map(F.rootOf)),l=[],c=new Set,f=new Set(e.filter(h=>h===F.rootOf(h))),u=new Set;for(let h of e){let m=F.rootOf(h),p=s.get(m),{isPeerRoot:y,hasPeers:E,isSharedDep:P}=r.get(m),C=a.has(m),x=h!==m,N=!(y||P)&&(C||!E),M=this.singletonDepsOf(p,o),T=x&&f.has(m);T&&u.add(m);let K=T?[...M,m]:M.length?M:void 0;l.push([h,this.cdn.buildEsmUrl(i(h),{bundle:N,external:K})]),c.add(h)}let d=new Set([...o,...u]);for(let h of d)s.has(h)&&(c.has(h)||l.push([h,this.cdn.buildEsmUrl(i(h),{})]),l.push([`${h}/`,`${Ut}/${i(h)}/`]));return l}singletonDepsOf(e,t){return[...new Set([...Ls(e.meta),...hd(e.meta)])].filter(r=>t.has(r))}};fr.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as Qy,satisfies as bO,maxSatisfying as Zy,major as wO,valid as vO,validRange as SO}from"semver";var ta,vn,yd=S(()=>{ta=class{cmp(e,t){return e===t?0:Qy(e,t)?1:Qy(t,e)?-1:0}satisfies(e,t){return!e||!e.trim()?!0:!!bO(t,e,{includePrerelease:!0})}selectBestVersion(e,t){if(!e?.length)return;let r=t?.range?.trim()||"*",s=t?.preferStable??!0,i=t?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(r,i))return i;if(s){let a=Zy(e,r,{includePrerelease:!1});if(a)return a}return Zy(e,r,{includePrerelease:!0})??void 0}majorOf(e){return wO(e)}isExactVersion(e){return vO(e)!==null}isRange(e){return SO(e)!==null}},vn=new ta});function kO(n){return Math.min(9e5*Math.pow(2,Math.max(0,n-1)),864e5)}var Sn,eb=S(()=>{Zo();Sn=class{constructor(e){this.store=e}async isNegative(e){let t=await xe(()=>this.store.get(e));return!!t&&t.until>Date.now()}async recordNegative(e){let r=((await xe(()=>this.store.get(e)))?.attempts||0)+1;await xe(()=>this.store.set(e,{until:Date.now()+kO(r),attempts:r}))}async clearNegative(e){await xe(()=>this.store.delete(e))}}});function tb(n,e){let t=new $s(n,e),r=new Ms(t),s=new Bs(n,t,vn);return{packageService:new fr(s,t,r),versionResolver:s,cdnClient:t,peerResolver:r}}var mt=S(()=>{pd();ea();md();gd();yd();Ns();yd();Is();pd();ea();md();gd();eb()});import*as bd from"fs/promises";import*as nb from"crypto";function Ve(n){return nb.createHash("sha1").update(n).digest("hex")}async function gt(n){try{return JSON.parse(await bd.readFile(n,"utf8"))}catch{return}}async function na(n){try{return await bd.readFile(n,"utf8")}catch{return}}var pr=S(()=>{"use strict"});import*as Jt from"fs/promises";import*as yt from"path";import*as sb from"os";function te(){return wd||(wd=EO().catch(()=>ut())),wd}function sa(n,e){return yt.join(xO,Ve(n),e)}async function EO(){await Jt.mkdir(qt,{recursive:!0});let n=yt.join(qt,"version.json");if((await gt(n))?.version===rb)return;let t=await Jt.readdir(qt).catch(()=>[]);await Promise.all(t.map(r=>Jt.rm(yt.join(qt,r),{recursive:!0,force:!0}))),await Jt.writeFile(n,JSON.stringify({version:rb})+`
|
|
532
|
-
`,"utf8")}var rb,qt,Ds,js,ra,
|
|
531
|
+
${mO(t)}`)}var Vy=S(()=>{"use strict";qo()});var Ut,Rs,dd,Is=S(()=>{Ut="https://esm.sh",Rs="https://cdn.jsdelivr.net/npm/",dd="https://data.jsdelivr.com/v1/package/npm/"});function zy(n){let e=(n||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var F,fr,Gy,Ns=S(()=>{Is();F=class n{constructor(e,t,r){let s=typeof e=="string"?n.parse(e):e;this.name=s.name,this.version=fr(t??s.version),this.subpath=fr(r??s.subpath)}static parse(e){let t=zy(e||"");if(!t.length)return new n({name:""});if(t[0].startsWith("@")){let s=t[0],[i,o]=Gy(t[1]??""),a=fr(t.slice(2).join("/"));return new n({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=Gy(t[0]),o=fr(t.slice(1).join("/"));return new n({name:s,version:i,subpath:o})}}static fromUrl(e){try{let t=new URL(e),r=new URL(Ut).host,s=new URL(Rs).host;if(t.host===r){let i=zy(t.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return n.parse(o)}if(t.host===s){let i=t.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return n.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 n.parse(e).name}withVersion(e){return new n({name:this.name,version:fr(e),subpath:this.subpath})}static isBare(e){return!e||e.startsWith(".")||e.startsWith("/")?!1:!/^[a-z][a-z0-9+.-]*:/i.test(e)}},fr=n=>n&&n.length?n:void 0,Gy=n=>{let e=n.indexOf("@");return e<0?[n,void 0]:[n.slice(0,e),fr(n.slice(e+1))]}});async function ke(n){try{return await n()}catch{return}}var Zo=S(()=>{});function wn(n){let e=n||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function fd(n){return n.startsWith("./")?n:`./${n}`}var $s,pd=S(()=>{Ns();Zo();Is();$s=class{constructor(e,t){this.cache=e,this.http=t,this.pinMs=1e4,this.versionsIndexMs=1440*60*1e3,this.metaTtlMs=10080*60*1e3,this.pinCache=new Map}baseDir(e){let t=typeof e=="string"?new F(e):e;return`${Rs}${t.name}${t.version?`@${t.version}`:""}/`}file(e,t){return new URL(wn(t),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,t={}){let{target:r="es2022",bundle:s=!1,external:i}=t,o=new URLSearchParams({target:r});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${Ut}/${e}?${o.toString()}`}async resolveExactVersion(e){let t=Date.now(),r=this.pinCache.get(e);if(r&&t-r.ts<this.pinMs)return r.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${Ut}/${e}`]);return this.pinCache.set(e,{value:s,ts:t}),s}async tryResolveFromUrls(e){for(let t of e){let r=await ke(()=>this.http.head(t)),s=this.parseVersionFromUrl(r?.url||t);if(s)return s}}async fetchVersionsIndex(e){if(await this.cache.isNegative(e))return;let t=await this.cache.getIndex(e);if(t&&Date.now()-t.updatedAt<this.versionsIndexMs)return{versions:t.versions,distTags:t.distTags};let r=await ke(()=>this.http.getJson(`${dd}${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 t=F.fromUrl(e)?.version;return t&&/\d+\.\d+\.\d+/.test(t)?t:void 0}async fetchPackageMeta(e,t){let r=await this.cache.getMeta(e,t);if(r&&Date.now()-r.updatedAt<this.metaTtlMs){let{dependencies:f,peerDependencies:u,peerDependenciesMeta:d}=r;return{name:e,version:t,dependencies:f,peerDependencies:u,peerDependenciesMeta:d}}let s=this.packageJson(new F(`${e}@${t}`)),i=await ke(()=>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,t,a,l,c),{name:e,version:t,dependencies:a,peerDependencies:l,peerDependenciesMeta:c}}}});var Xy,Ls,hd,gO,Ms,ea=S(()=>{Xy=n=>n.startsWith("@types/"),Ls=n=>Object.keys(n?.peerDependencies||{}).filter(e=>!Xy(e)),hd=n=>Object.keys(n?.dependencies||{}).filter(e=>!Xy(e)),gO=n=>Ls(n).filter(e=>!n?.peerDependenciesMeta?.[e]?.optional),Ms=class{constructor(e){this.cdn=e}async resolve(e,t){let r=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(r,t),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:t,version:r})=>({name:t,version:r,meta:await this.cdn.fetchPackageMeta(t,r)})))}async expandWithPeers(e,t){let r=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of gO(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 t(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 t=new Set(e.flatMap(i=>Ls(i.meta))),r=new Map;for(let i of e)for(let o of hd(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:t.has(i.name),hasPeers:Ls(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var Bs,md=S(()=>{Ns();Zo();Bs=class{constructor(e,t,r){this.cache=e,this.cdn=t,this.semver=r}async learnExactVersion(e){let t=await ke(()=>this.cdn.fetchVersionsIndex(e));if(t?.versions?.length){let r=this.semver.selectBestVersion(t.versions,{distTags:t.distTags});if(r)return r}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,t){if(!t)return this.learnExactVersion(e);let r=a=>!this.semver.isRange(t)||this.semver.satisfies(t,a),s=await this.cache.getPinnedExact(e,t);if(s){if(this.semver.isExactVersion(s)&&r(s))return s;console.debug("[typebulb] cached version for",e,"is not exact or not in",t,"(",s,"); re-resolving from registry")}let i=async a=>{if(a&&this.semver.isExactVersion(a)&&r(a))return await this.cache.setPinnedExact(e,t,a),a},o=await ke(()=>this.cdn.fetchVersionsIndex(e));if(o?.versions?.length){let a=this.semver.selectBestVersion(o.versions,{range:t,distTags:o.distTags});if(a){let l=await i(a);if(l)return l}else{console.debug("[typebulb] refreshing version cache for",e,"(",t,"not in cached set \u2014 likely a new release)"),await this.cache.invalidateVersionsCache(e);let l=await ke(()=>this.cdn.fetchVersionsIndex(e));if(l?.versions?.length){let c=await i(this.semver.selectBestVersion(l.versions,{range:t,distTags:l.distTags}));if(c)return c}}}return i(await this.cdn.resolveExactVersion(`${e}@${t}`))}async effectivePackage(e,t){let r=new F(e),s=r.root(),i=t[s],o=i?await ke(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?r.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as yO,parse as bO}from"es-module-lexer";var pr,gd=S(()=>{Ns();Is();ea();pr=class n{constructor(e,t,r){this.version=e,this.cdn=t,this.peer=r}extractImportsSync(e){let t=new Set;for(let r of n.importPatterns){r.lastIndex=0;for(let s of e.matchAll(r))F.isBare(s[1])&&t.add(s[1])}return Array.from(t)}async extractImports(e){let t=new Set,r=s=>{F.isBare(s)&&t.add(s)};try{await yO;let[s]=bO(e);s.forEach(i=>r(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(t)}async buildImportMap(e,t,r){let s=(await this.extractImports(e)).filter(u=>!r?.has(F.rootOf(u))),i=[...new Set(s.map(F.rootOf))],o=await Promise.all(i.map(async u=>({name:u,version:await this.resolveVersion(u,t)}))),{allRoots:a,flags:l,autoAddedPeers:c}=await this.peer.resolve(o,u=>this.resolveVersion(u,t)),f=this.buildEntries([...s,...c.map(u=>u.name)],a,l);return{importMap:{imports:Object.fromEntries(f)},prefetchUrls:f.map(([,u])=>u)}}async resolveVersion(e,t){let r=t[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,t,r){let s=new Map(t.map(h=>[h.name,h])),i=h=>{let g=s.get(F.rootOf(h));return new F(h).withVersion(g.version).format()},o=new Set([...r.entries()].filter(([,h])=>h.isPeerRoot||h.isSharedDep).map(([h])=>h)),a=new Set(e.filter(h=>h!==F.rootOf(h)).map(F.rootOf)),l=[],c=new Set,f=new Set(e.filter(h=>h===F.rootOf(h))),u=new Set;for(let h of e){let g=F.rootOf(h),p=s.get(g),{isPeerRoot:y,hasPeers:E,isSharedDep:P}=r.get(g),C=a.has(g),x=h!==g,N=!(y||P)&&(C||!E),M=this.singletonDepsOf(p,o),T=x&&f.has(g);T&&u.add(g);let K=T?[...M,g]:M.length?M:void 0;l.push([h,this.cdn.buildEsmUrl(i(h),{bundle:N,external:K})]),c.add(h)}let d=new Set([...o,...u]);for(let h of d)s.has(h)&&(c.has(h)||l.push([h,this.cdn.buildEsmUrl(i(h),{})]),l.push([`${h}/`,`${Ut}/${i(h)}/`]));return l}singletonDepsOf(e,t){return[...new Set([...Ls(e.meta),...hd(e.meta)])].filter(r=>t.has(r))}};pr.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as Qy,satisfies as wO,maxSatisfying as Zy,major as vO,valid as SO,validRange as kO}from"semver";var ta,vn,yd=S(()=>{ta=class{cmp(e,t){return e===t?0:Qy(e,t)?1:Qy(t,e)?-1:0}satisfies(e,t){return!e||!e.trim()?!0:!!wO(t,e,{includePrerelease:!0})}selectBestVersion(e,t){if(!e?.length)return;let r=t?.range?.trim()||"*",s=t?.preferStable??!0,i=t?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(r,i))return i;if(s){let a=Zy(e,r,{includePrerelease:!1});if(a)return a}return Zy(e,r,{includePrerelease:!0})??void 0}majorOf(e){return vO(e)}isExactVersion(e){return SO(e)!==null}isRange(e){return kO(e)!==null}},vn=new ta});function xO(n){return Math.min(9e5*Math.pow(2,Math.max(0,n-1)),864e5)}var Sn,eb=S(()=>{Zo();Sn=class{constructor(e){this.store=e}async isNegative(e){let t=await ke(()=>this.store.get(e));return!!t&&t.until>Date.now()}async recordNegative(e){let r=((await ke(()=>this.store.get(e)))?.attempts||0)+1;await ke(()=>this.store.set(e,{until:Date.now()+xO(r),attempts:r}))}async clearNegative(e){await ke(()=>this.store.delete(e))}}});function tb(n,e){let t=new $s(n,e),r=new Ms(t),s=new Bs(n,t,vn);return{packageService:new pr(s,t,r),versionResolver:s,cdnClient:t,peerResolver:r}}var mt=S(()=>{pd();ea();md();gd();yd();Ns();yd();Is();pd();ea();md();gd();eb()});import*as bd from"fs/promises";import*as nb from"crypto";function Ve(n){return nb.createHash("sha1").update(n).digest("hex")}async function gt(n){try{return JSON.parse(await bd.readFile(n,"utf8"))}catch{return}}async function na(n){try{return await bd.readFile(n,"utf8")}catch{return}}var hr=S(()=>{"use strict"});import*as Jt from"fs/promises";import*as yt from"path";import*as sb from"os";function te(){return wd||(wd=AO().catch(()=>ut())),wd}function sa(n,e){return yt.join(EO,Ve(n),e)}async function AO(){await Jt.mkdir(qt,{recursive:!0});let n=yt.join(qt,"version.json");if((await gt(n))?.version===rb)return;let t=await Jt.readdir(qt).catch(()=>[]);await Promise.all(t.map(r=>Jt.rm(yt.join(qt,r),{recursive:!0,force:!0}))),await Jt.writeFile(n,JSON.stringify({version:rb})+`
|
|
532
|
+
`,"utf8")}var rb,qt,Ds,js,ra,EO,wd,mr=S(()=>{"use strict";hr();tt();rb=1,qt=yt.join(sb.homedir(),".typebulb","cache"),Ds=yt.join(qt,"packages"),js=yt.join(qt,"proxy"),ra=yt.join(qt,"dts"),EO=yt.join(qt,"emit")});import*as Wt from"fs/promises";import*as ib from"path";async function Be(n,e){let t=`${n}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;try{await Wt.mkdir(ib.dirname(n),{recursive:!0}),await Wt.writeFile(t,e,"utf8")}catch{ut();return}await Wt.rename(t,n).catch(async()=>{await Wt.rm(t,{force:!0}).catch(()=>{})})}var Fs=S(()=>{"use strict";tt()});var gr,vd=S(()=>{"use strict";Fs();hr();gr=class{constructor(e){this.filePath=e}mem;loadPromise;load(){return this.mem?Promise.resolve(this.mem):(this.loadPromise||(this.loadPromise=gt(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,t){let r=await this.load();r.set(e,t),await this.persist(r)}async delete(e){let t=await this.load();t.delete(e)&&await this.persist(t)}async persist(e){await Be(this.filePath,JSON.stringify(Object.fromEntries(e)))}}});import*as lb from"fs/promises";import*as ze from"path";function ab(n,e){return ze.join(TO,ia(n),encodeURIComponent(e)+".json")}function ia(n){return n.replace(/\//g,"__")}var Sd,ob,TO,PO,oa,cb=S(()=>{"use strict";mt();mr();Fs();vd();hr();Sd=ze.join(Ds,"indexes"),ob=ze.join(Ds,"pinned"),TO=ze.join(Ds,"meta"),PO=ze.join(Ds,"negative.json"),oa=class{pinnedMem=new Map;indexMem=new Map;metaMem=new Map;negativeCache=new Sn(new gr(PO));async getPinnedExact(e,t){let r=`${e}@${t}`;if(this.pinnedMem.has(r))return this.pinnedMem.get(r);await te();let s=await na(ze.join(ob,Ve(r)+".txt"));return this.pinnedMem.set(r,s),s}async setPinnedExact(e,t,r){let s=`${e}@${t}`;this.pinnedMem.set(s,r),await te(),await Be(ze.join(ob,Ve(s)+".txt"),r)}async getIndex(e){if(this.indexMem.has(e))return this.indexMem.get(e);await te();let t=await gt(ze.join(Sd,ia(e)+".json"));return this.indexMem.set(e,t),t}async setIndex(e,t,r){let s={versions:t,distTags:r,updatedAt:Date.now()};this.indexMem.set(e,s),await te(),await Be(ze.join(Sd,ia(e)+".json"),JSON.stringify(s))}async invalidateVersionsCache(e){this.indexMem.delete(e),await lb.rm(ze.join(Sd,ia(e)+".json"),{force:!0}).catch(()=>{})}async isNegative(e){return await te(),this.negativeCache.isNegative(e)}async recordNegative(e){await te(),await this.negativeCache.recordNegative(e)}async clearNegative(e){await this.negativeCache.clearNegative(e)}async getMeta(e,t){let r=`${e}@${t}`;if(this.metaMem.has(r))return this.metaMem.get(r);await te();let s=await gt(ab(e,t));return this.metaMem.set(r,s),s}async setMeta(e,t,r,s,i){let o={dependencies:r,peerDependencies:s,peerDependenciesMeta:i,updatedAt:Date.now()};this.metaMem.set(`${e}@${t}`,o),await te(),await Be(ab(e,t),JSON.stringify(o))}}});var ub,db=S(()=>{"use strict";ub={async getJson(n){try{let e=await fetch(n,{redirect:"follow"});return e.ok?await e.json():void 0}catch{return}},async head(n){try{let e=await fetch(n,{method:"HEAD",redirect:"follow"});return{ok:e.ok,url:e.url}}catch{return}}}});var OO,aa,fb,pb,_D,kd=S(()=>{"use strict";mt();cb();db();OO=new oa,{packageService:aa,versionResolver:fb,cdnClient:pb,peerResolver:_D}=tb(OO,ub)});function la(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function hb(){return` <script>
|
|
533
533
|
${xg}
|
|
534
534
|
(function () {
|
|
535
535
|
try {
|
|
@@ -588,7 +588,7 @@ ${xg}
|
|
|
588
588
|
});
|
|
589
589
|
} catch (e) {}
|
|
590
590
|
})();
|
|
591
|
-
</script>`}var bt,mb,xd,
|
|
591
|
+
</script>`}var bt,mb,xd,_O,CO,ua,yr=S(()=>{"use strict";Z();Z();bt=n=>n.replace(/<\/script/gi,"<\\/script");mb=30*6e4,xd=1e3,_O=6e4,CO=3e4,ua=(n="'/__reload'")=>`
|
|
592
592
|
let es = null;
|
|
593
593
|
let bootId = null;
|
|
594
594
|
let firstErrorAt = 0;
|
|
@@ -603,9 +603,9 @@ ${xg}
|
|
|
603
603
|
es.onerror = () => {
|
|
604
604
|
if (!firstErrorAt) firstErrorAt = Date.now();
|
|
605
605
|
// Inside the replace window, EventSource's own retry is faster than anything we'd schedule.
|
|
606
|
-
if (Date.now() - firstErrorAt <= ${
|
|
606
|
+
if (Date.now() - firstErrorAt <= ${_O}) return;
|
|
607
607
|
es.close();
|
|
608
|
-
backoff = Math.min(${
|
|
608
|
+
backoff = Math.min(${CO}, backoff ? backoff * 2 : ${xd} * 2);
|
|
609
609
|
setTimeout(tbConnect, backoff);
|
|
610
610
|
};
|
|
611
611
|
};
|
|
@@ -621,7 +621,7 @@ ${xg}
|
|
|
621
621
|
// A relay open (TB-VSCode-Browser.md): the CLI asks a page of ours inside VS Code to open a URL,
|
|
622
622
|
// since its integrated browser honors a gesture-less window.open and keeps the new tab in-editor.
|
|
623
623
|
tbOn('open-url', (e) => { window.open(e.data, '_blank', 'noopener'); });
|
|
624
|
-
tbConnect();`});var gb,yb=S(()=>{"use strict";
|
|
624
|
+
tbConnect();`});var gb,yb=S(()=>{"use strict";yr();Z();gb=`
|
|
625
625
|
(() => {
|
|
626
626
|
// Inline (bulb-in-a-bulb): runs inside a sandboxed iframe with no parent
|
|
627
627
|
// bridge, so privileged tb.* (AI, fs, server RPC) can't reach a host and would
|
|
@@ -1065,7 +1065,7 @@ ${xg}
|
|
|
1065
1065
|
},
|
|
1066
1066
|
|
|
1067
1067
|
// Environment ('inline' when running as a bulb-in-a-bulb)
|
|
1068
|
-
mode: isFramed ? '${
|
|
1068
|
+
mode: isFramed ? '${Hn.inline}' : '${Hn.local}',
|
|
1069
1069
|
|
|
1070
1070
|
// Theme accessor - delegates to the head-script engine (window.__tbTheme).
|
|
1071
1071
|
// Get: override slot ('dark'|'light'|undefined). Set applies + persists
|
|
@@ -1581,8 +1581,8 @@ ${ua("tbStreamUrl")}
|
|
|
1581
1581
|
});
|
|
1582
1582
|
}
|
|
1583
1583
|
})();
|
|
1584
|
-
`});function bb(n){let{name:e,code:t,css:r,html:s,data:i,insight:o,importMap:a,theme:l,inline:c,dir:f,source:u,bulbKey:d,compileError:h}=n,
|
|
1585
|
-
`+cu,y={imports
|
|
1584
|
+
`});function bb(n){let{name:e,code:t,css:r,html:s,data:i,insight:o,importMap:a,theme:l,inline:c,dir:f,source:u,bulbKey:d,compileError:h}=n,g=s.trim()||'<div id="app"></div>',p=c?"":`
|
|
1585
|
+
`+cu,y={imports:LO(a.imports)};return`<!DOCTYPE html>
|
|
1586
1586
|
<html>
|
|
1587
1587
|
<head>
|
|
1588
1588
|
<meta charset="utf-8">
|
|
@@ -1601,7 +1601,7 @@ ${r}
|
|
|
1601
1601
|
</style>
|
|
1602
1602
|
</head>
|
|
1603
1603
|
<body>
|
|
1604
|
-
${
|
|
1604
|
+
${g}
|
|
1605
1605
|
|
|
1606
1606
|
${i.length>0?`<script>window.__TB_DATA__ = ${bt(JSON.stringify(i))};</script>`:""}
|
|
1607
1607
|
${o?`<script>window.__TB_INSIGHT__ = ${bt(JSON.stringify(o))};</script>`:""}
|
|
@@ -1614,16 +1614,16 @@ ${Ag}
|
|
|
1614
1614
|
${gb}
|
|
1615
1615
|
</script>
|
|
1616
1616
|
|
|
1617
|
-
${
|
|
1617
|
+
${$O}
|
|
1618
1618
|
|
|
1619
|
-
${
|
|
1619
|
+
${IO(t,u)}
|
|
1620
1620
|
</body>
|
|
1621
|
-
</html>`}function
|
|
1622
|
-
`);return`<script type="module">${s}${
|
|
1623
|
-
</script>`}function
|
|
1621
|
+
</html>`}function IO(n,e){let t=["",...RO],r=e?Array(Math.max(0,e.codeLine-t.length-1)).fill(""):[],s=[...t,...r,bt(n)].join(`
|
|
1622
|
+
`);return`<script type="module">${s}${NO(e,s)}
|
|
1623
|
+
</script>`}function NO(n,e){if(!n)return"";let t=e.split(`
|
|
1624
1624
|
`).length,r={version:3,file:n.file,sources:[`/__source/${n.file}`],names:[],mappings:["AAAA",...Array(Math.max(0,t-1)).fill("AACA")].join(";")};return`
|
|
1625
1625
|
//# sourceURL=${n.file.replace(/\s/g,"%20")}
|
|
1626
|
-
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(r))}`}function
|
|
1626
|
+
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(r))}`}function LO(n){let e={};for(let[t,r]of Object.entries(n))e[t]=r.startsWith("https://")?"/proxy/"+r:r;return e}var RO,$O,wb=S(()=>{"use strict";Z();yb();yr();RO=["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) */"];$O=`<script>
|
|
1627
1627
|
(function () {
|
|
1628
1628
|
var framed = window.parent !== window;
|
|
1629
1629
|
var post = function (m) { try { parent.postMessage(m, '*'); } catch (e) {} }; /* framed only */
|
|
@@ -1722,20 +1722,20 @@ ${RO(t,u)}
|
|
|
1722
1722
|
}
|
|
1723
1723
|
});
|
|
1724
1724
|
})();
|
|
1725
|
-
</script>`});import*as fa from"fs/promises";import*as da from"path";import{existsSync as vb,readFileSync as
|
|
1726
|
-
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await fa.mkdir(e,{recursive:!0});let a=da.join(e,"package.json");vb(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
|
|
1727
|
-
Expected <origin>/u/<user>/<slug>`);let l=a[1],c=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:l,slug:c,dest:je.join(e,ba(l,c))}}let r=je.resolve(e,n),s=
|
|
1728
|
-
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:t,...s,dest:r}}async function
|
|
1725
|
+
</script>`});import*as fa from"fs/promises";import*as da from"path";import{existsSync as vb,readFileSync as MO}from"fs";import{execFile as BO}from"child_process";import{promisify as DO}from"util";import{builtinModules as jO}from"node:module";import{satisfies as FO}from"semver";async function pa(n,e,t,r){let i=n.map(c=>WO(c,t)).filter(c=>!KO(c,e));if(i.length===0)return;let o=i.filter(c=>!JO.test(c));if(o.length)throw new Error(`Refusing to install npm spec(s) with unsupported characters: ${o.join(", ")}
|
|
1726
|
+
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await fa.mkdir(e,{recursive:!0});let a=da.join(e,"package.json");vb(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 UO("npm",["install",...l,...i],{cwd:e,shell:!0})}function WO(n,e){if(!e||F.parse(n).version)return n;let t=e[n];return t?`${n}@${t}`:n}function KO(n,e){let{name:t,version:r}=F.parse(n),s=da.join(e,"node_modules",t);if(!vb(s))return!1;if(!r)return!0;try{let i=JSON.parse(MO(da.join(s,"package.json"),"utf-8")).version;return FO(i,r)}catch{return!1}}function ha(n){let e=new Set,t=/\bimport\s+(?:[\s\S]*?\s+from\s+)?['"]([^./][^'"]*)['"]/g,r;for(;r=t.exec(n);){let s=r[1];if(s.includes(":"))continue;let i=F.rootOf(s);qO.has(i)||e.add(i)}return[...e]}var UO,qO,JO,Ed=S(()=>{"use strict";mt();UO=DO(BO),qO=new Set(jO),JO=/^(@[a-z0-9._-]+\/)?[a-z0-9._-]+(@[a-zA-Z0-9.^~*x-]+)?$/i});import*as De from"fs/promises";import*as Oe from"path";function br(n,e){let t=Oe.resolve(e,n),r=Oe.normalize(e),s=Oe.normalize(t);if(s!==r&&!s.startsWith(r+Oe.sep))throw new Error("Path traversal detected - access denied");return t}async function Us(n,e){return De.readFile(br(n,e))}async function ma(n,e,t){let r=br(n,t);await De.mkdir(Oe.dirname(r),{recursive:!0}),await De.writeFile(r,typeof e=="string"?e:Buffer.from(e))}async function ga(n,e){let t=br(n,e),r=await De.readdir(t,{withFileTypes:!0});return Promise.all(r.map(async s=>{let i=await De.stat(Oe.join(t,s.name)).then(o=>o.mtimeMs).catch(()=>0);return{name:s.name,dir:s.isDirectory(),mtime:i}}))}async function ya(n,e){let t=br(n,e);if(Oe.normalize(t)===Oe.normalize(e))throw new Error("Cannot remove the bulb's folder itself: remove its contents instead");await De.rm(t,{recursive:!0})}var Ad=S(()=>{"use strict"});async function Sb(n){let e=ht(n.provider,n.model);if(typeof e=="string")throw new Error(e);let t=await Ft(e,n);if(!t.ok){let r=await cr(t,e.protocol);throw new Error(r.message)}return{response:t,protocol:e.protocol}}async function HO(n){let{response:e,protocol:t}=await Sb(n);return ur(e,t)}async function*YO(n){let{response:e,protocol:t}=await Sb(n);yield*bn(e,t)}function kb(n){let e=Object.assign(HO,{stream:YO}),t={read:async r=>{let s=await Us(r,n);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 Us(r,n)),write:async(r,s)=>(await ma(r,s,n),!0),list:async(r=".")=>ga(r,n),remove:async r=>(await ya(r,n),!0)};globalThis.tb=Object.freeze({log:(...r)=>{console.log(...r)},ai:e,fs:t,dir:n,models:()=>ft(),aiAccess:Wo,mode:Hn.local})}var xb=S(()=>{"use strict";Dt();Z();Qo();mn();Ad()});import*as Kt from"fs/promises";import*as de from"path";import{pathToFileURL as VO}from"url";async function Eb(n){let t=(await Kt.readdir(n)).find(r=>r.endsWith(".bulb.md"));return t?de.join(n,t):void 0}function wr(n){let e=de.resolve(n);return de.join(de.dirname(e),de.basename(e).replace(/\.bulb\.md$/,""))}function vr(n){let[e,t,r,s]=n.split(de.sep).slice(-4);if(!(e!=="typebulbs"||t!=="u"||!r||!s?.endsWith(".bulb.md")))return{userSlug:r,slug:s.slice(0,-8)}}async function Ge(n){let e=await Kt.readFile(n,"utf-8"),t=Nn(e),r=nr(t);return{bulb:r,config:$r(r.config),warnings:ep(e),starts:t.starts}}function Td(n){let e=de.basename(n).replace(/\.bulb\.md$/i,"");return de.join(de.dirname(n),".typebulb",`${e}.server.mjs`)}async function qs(n,e,t,r){let s=ud(n,{serverOnly:!0});if(s.error)throw new Error(`Server compilation error: ${s.error}`);let i=s.code;t&&(i=await Vf(i,t));let o=de.join(de.dirname(e),".typebulb");await Kt.mkdir(o,{recursive:!0});let a=ha(i);a.length>0&&await pa(a,o,r);let l=Td(e);return await Kt.writeFile(l,i,"utf-8"),kb(wr(e)),await import(`${VO(l).href}?t=${Date.now()}`)}async function Pd(n,e,t,r){let{bulb:s,config:i,starts:o}=await Ge(n),a=ho(s.data),l,c=g=>{l??=g instanceof Error?g.message:String(g)};try{Yy(s.code,i.dependencies??{})}catch(g){c(g)}let f=ud(s.code,{jsxImportSource:i.ts?.jsxImportSource});f.error&&c(f.error);let u={imports:{}};if(!l)try{({importMap:u}=await aa.buildImportMap(f.code,i.dependencies??{},r?new Set([r.name]):void 0))}catch(g){c(`Dependency resolution failed: ${g instanceof Error?g.message:String(g)}`)}l&&console.error("Build error:",l),r&&(u.imports[r.name]=r.entryUrl);let d=bb({name:s.name,code:l?"":f.code,css:s.css,html:s.html,data:a,insight:s.insight,importMap:u,dir:wr(n),watch:e,source:{file:de.basename(n),codeLine:o.get("code.tsx")??1},bulbKey:ws(n),compileError:l}),h;return s.server&&t&&(h=await qs(s.server,n,r,i.dependencies)),{html:d,bulb:s,serverExports:h,buildError:l}}var kn,wt=S(()=>{"use strict";xs();Hy();Vy();kd();wb();Ed();di();tt();xb();kn=n=>de.join(wr(n),"assets")});import*as _e from"fs/promises";import*as je from"path";import{createHash as zO}from"crypto";async function _d(n,e,t){let r=[...n],s=async()=>{for(let i=r.shift();i!==void 0;i=r.shift())await t(i)};await Promise.all(Array.from({length:Math.min(e,n.length)},s))}function Sr(n){try{return JSON.parse(n).error||n}catch{return n}}async function Rd(n,e){try{let t=await fetch(Js(n),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});return t.ok?t.headers.get("content-type")?.includes("json")?{entries:await t.json()}:{error:"manifest response is not JSON \u2014 wrong origin?"}:{error:`manifest request failed (${t.status}): ${Sr(await t.text())}`}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function Id(n,e){Me(e);let t=process.env.TYPEBULB_ORIGIN||GO;try{return va(n,process.cwd(),t)}catch(r){console.error(r instanceof Error?r.message:String(r)),process.exit(1)}}function va(n,e,t){if(/^https?:\/\//i.test(n)){let i=new URL(n),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: ${n}
|
|
1727
|
+
Expected <origin>/u/<user>/<slug>`);let l=a[1],c=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:l,slug:c,dest:je.join(e,ba(l,c))}}let r=je.resolve(e,n),s=vr(r);if(!s)throw new Error(`Not a conventional bulb path: ${n}
|
|
1728
|
+
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:t,...s,dest:r}}async function XO(n,e){let t=await Rd(n,e);if("error"in t||!t.entries.length)return{kind:"none"};let r=t.entries,s=kn(n.dest),i=[],o=[],a=0;for(let l of r){let c=await _e.readFile(je.join(s,...l.path.split("/"))).catch(()=>{});c===void 0?i.push(l.path):Cd(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 QO(n,e,t){let r=kn(n.dest),s=[],i=0;return await _d(e.toGet,4,async o=>{try{let a=await fetch(`${Js(n)}/${wa(o)}`,{headers:t.token?{Authorization:`Bearer ${t.token}`}:{},signal:AbortSignal.timeout(t.timeoutMs??3e4)});if(!a.ok){s.push(`${o}: HTTP ${a.status}`);return}let l=je.join(r,...o.split("/"));await _e.mkdir(je.dirname(l),{recursive:!0}),await _e.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 Sa(n,e={}){let t=await fetch(Od(n),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});if(!t.ok)return{kind:"http-error",status:t.status};let r=t.headers.get("content-type");if(!r?.includes("text/markdown"))return{kind:"not-markdown",contentType:r??void 0};let s=await t.text(),i;try{i=await _e.readFile(n.dest,"utf-8")}catch{}let o=i!==void 0&&ZO(i,s);if(i!==void 0&&!o&&!e.force){let{mtime:c}=await _e.stat(n.dest);return{kind:"conflict",dest:n.dest,localMtime:c,remoteLastModified:t.headers.get("last-modified")??void 0}}let a=await XO(n,e);if(a.kind==="conflict")return{kind:"asset-conflict",dest:n.dest,paths:a.paths};if(!o){await _e.mkdir(je.dirname(n.dest),{recursive:!0}),await _e.writeFile(n.dest,s);let c=new Date(t.headers.get("last-modified")??"");isNaN(c.getTime())||await _e.utimes(n.dest,new Date,c)}let l=a.kind==="plan"?await QO(n,a,e):void 0;return o?{kind:"up-to-date",dest:n.dest,assets:l}:{kind:"written",dest:n.dest,created:i===void 0,assets:l}}function ZO(n,e){let t=i=>i.replace(/\r\n/g,`
|
|
1729
1729
|
`),r=Je(t(n)),s=Je(t(e));return!r||!s?t(n)===t(e):r.frontmatter.name===s.frontmatter.name&&qe.every(i=>(r.files.get(ue[i].path)||"")===(s.files.get(ue[i].path)||""))}async function Tb(n,e){n||(console.error("Usage: typebulb pull <bulb url | typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1));let t=Id(n,e.mode),r=`${t.origin}/u/${t.userSlug}/${t.slug}`,s;try{s=await Sa(t,{force:e.force,token:process.env.TYPEBULB_TOKEN})}catch(o){console.error(`Could not reach ${t.origin}: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1;return}let i=je.relative(process.cwd(),t.dest)||t.dest;switch(s.kind){case"written":console.log(`pulled ${r} \u2192 ${i}${s.created?"":" (overwritten)"}`),Ab(s.assets);return;case"up-to-date":console.log(`up to date: ${i}`),Ab(s.assets);return;case"conflict":console.error(`Refusing to overwrite ${i} \u2014 it differs from ${r}
|
|
1730
1730
|
local file modified ${s.localMtime.toISOString()}
|
|
1731
1731
|
remote last saved ${s.remoteLastModified??"unknown"}
|
|
1732
1732
|
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:
|
|
1733
1733
|
`+s.paths.map(o=>` assets/${o}`).join(`
|
|
1734
1734
|
`)+`
|
|
1735
|
-
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: ${t.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 ${t.origin} a typebulb host?`),process.exitCode=1}}function Ab(n){if(!(!n||!n.downloaded&&!n.errors.length)){console.log(`assets: ${n.downloaded} downloaded${n.unchanged?`, ${n.unchanged} unchanged`:""}`);for(let e of n.errors)console.error(` asset failed \u2014 ${e} (a re-pull retries just the missing ones)`);n.errors.length&&(process.exitCode=1)}}var
|
|
1735
|
+
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: ${t.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 ${t.origin} a typebulb host?`),process.exitCode=1}}function Ab(n){if(!(!n||!n.downloaded&&!n.errors.length)){console.log(`assets: ${n.downloaded} downloaded${n.unchanged?`, ${n.unchanged} unchanged`:""}`);for(let e of n.errors)console.error(` asset failed \u2014 ${e} (a re-pull retries just the missing ones)`);n.errors.length&&(process.exitCode=1)}}var GO,ba,Od,wa,Js,Cd,ka=S(()=>{"use strict";pt();Z();wt();GO="https://typebulb.com",ba=(n,e)=>je.join("typebulbs","u",n,`${e}.bulb.md`),Od=n=>`${n.origin}/u/${encodeURIComponent(n.userSlug)}/${encodeURIComponent(n.slug)}.md`,wa=n=>n.split("/").map(encodeURIComponent).join("/"),Js=n=>`${n.origin}/u/${encodeURIComponent(n.userSlug)}/${encodeURIComponent(n.slug)}/assets`;Cd=n=>zO("md5").update(n).digest("hex")});import*as st from"fs/promises";import*as Ws from"path";async function Pb(n,e=""){let t=await st.readdir(n,{withFileTypes:!0}).catch(()=>[]),r=[];for(let s of t)s.isDirectory()?r.push(...await Pb(Ws.join(n,s.name),`${e}${s.name}/`)):s.isFile()&&r.push(e+s.name);return r}async function e_(n,e){let t=e.timeoutMs??3e4,r=Js(n),s={Authorization:`Bearer ${e.token}`},i=kn(n.dest);if(!await st.stat(i).then(g=>g.isDirectory()).catch(()=>!1))return{kind:"skipped"};let o=await Pb(i),a=await Rd(n,{token:e.token,timeoutMs:t});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(g=>[g.path,g.md5])),f=new Set(o),u=l.map(g=>g.path).filter(g=>!f.has(g)),d=0,h=0;try{await _d(o,4,async g=>{let p=await st.readFile(Ws.join(i,...g.split("/")));if(c.get(g)===Cd(p)){h++;return}let y=await fetch(`${r}/${wa(g)}`,{method:"PUT",body:new Uint8Array(p),headers:s,signal:AbortSignal.timeout(t)});if(!y.ok)throw new Error(`upload of '${g}' refused (${y.status}): ${Sr(await y.text())}`);d++})}catch(g){return{kind:"sync-error",message:g instanceof Error?g.message:String(g)}}return{kind:"synced",uploaded:d,unchanged:h,toDelete:u,base:mi(n.userSlug,n.slug)}}async function t_(n,e,t){let r=t.timeoutMs??3e4,s=Js(n),i=[];for(let o of e)try{let a=await fetch(`${s}/${wa(o)}`,{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`},signal:AbortSignal.timeout(r)});if(!a.ok)return{deleted:i,error:`delete of '${o}' refused (${a.status}): ${Sr(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(n,e){let t=await st.readFile(n.dest,"utf-8"),{mtime:r}=await st.stat(n.dest),s=await e_(n,{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(Od(n),{method:"PUT",body:t,headers:o,signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0}),l=await a.text();if(a.status===409)return{kind:"conflict",message:Sr(l),assets:i};if(!a.ok)return{kind:"http-error",status:a.status,message:Sr(l),assets:i};let c=JSON.parse(l);if(await st.utimes(n.dest,new Date,new Date(c.updatedAt)),i&&s.kind==="synced"&&s.toDelete.length){let f=await t_(n,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 Ob(n,e){n||(console.error("Usage: typebulb push <typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1)),/^https?:\/\//i.test(n)&&(console.error("push takes a local .bulb.md file, not a URL (the path is its remote identity)"),process.exit(1));let t=Id(n,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=`${t.origin}/u/${t.userSlug}/${t.slug}`,i=Ws.relative(process.cwd(),t.dest)||t.dest,o;try{o=await xa(t,{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 ${t.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}
|
|
1736
1736
|
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}
|
|
1737
1737
|
pull to see the remote: typebulb pull ${i}
|
|
1738
|
-
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: ${t.origin} responded ${o.status}${o.message?` \u2014 ${o.message}`:""}`),process.exitCode=1}}var Nd=S(()=>{"use strict";Z();ka();wt()});var
|
|
1738
|
+
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: ${t.origin} responded ${o.status}${o.message?` \u2014 ${o.message}`:""}`),process.exitCode=1}}var Nd=S(()=>{"use strict";Z();ka();wt()});var kr=S(()=>{"use strict";$e();Sy();cn();ky();Du();Py();_y();Ts();mn();mn();Qo();cd();$e();ka();Nd();pt()});import{existsSync as n_,mkdirSync as r_,readFileSync as s_,rmSync as i_,writeFileSync as o_}from"fs";import{homedir as a_}from"os";import*as xr from"path";function d_(){return u_.replace('"__TB_SKILL_PATH__"',JSON.stringify(Cs())).replace('"__TB_BIN_PATH__"',JSON.stringify(tr()))}function _b(){try{if(!n_($d()))return}catch{return}try{let n=l_(),e=d_(),t;try{t=s_(n,"utf8")}catch{}t!==e&&(r_(xr.dirname(n),{recursive:!0}),o_(n,e))}catch{}for(let n of c_())try{i_(n,{force:!0})}catch{}}var $d,l_,c_,u_,Cb=S(()=>{"use strict";kr();$d=()=>xr.join(a_(),".pi","agent"),l_=()=>xr.join($d(),"extensions","typebulb.ts"),c_=()=>["typebulb-wait.ts","matchu-patchu.ts"].map(n=>xr.join($d(),"extensions",n)),u_=String.raw`// Generated by typebulb — do not edit; overwritten on each run.
|
|
1739
1739
|
import { spawn } from "node:child_process";
|
|
1740
1740
|
import { existsSync } from "node:fs";
|
|
1741
1741
|
|
|
@@ -2003,23 +2003,23 @@ export default function (pi) {
|
|
|
2003
2003
|
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) {}
|
|
2004
2004
|
} catch (e) { logErr("load", e && e.message); }
|
|
2005
2005
|
}
|
|
2006
|
-
`});function z(n){return n?.message??String(n)}var G,Ht=S(()=>{"use strict";G=process.cwd()});import{spawn as Rb}from"child_process";import{StringDecoder as
|
|
2007
|
-
`))>=0;){let o=r.slice(0,i);r=r.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var
|
|
2006
|
+
`});function z(n){return n?.message??String(n)}var G,Ht=S(()=>{"use strict";G=process.cwd()});import{spawn as Rb}from"child_process";import{StringDecoder as f_}from"string_decoder";function b_(n,e){let t=new f_("utf8"),r="";n.on("data",s=>{r+=typeof s=="string"?s:t.write(s);let i;for(;(i=r.indexOf(`
|
|
2007
|
+
`))>=0;){let o=r.slice(0,i);r=r.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var p_,Ib,Nb,Ld,$b,h_,m_,g_,Lb,y_,Ea,Aa,Mb,Bb=S(()=>{"use strict";Ht();p_=3e4,Ib=18e4,Nb="starting pi\u2026",Ld=5e3,$b=2e3,h_=2e3,m_=12e4,g_=8e3,Lb=15e3,y_=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"]),Ea=new Set;process.on("exit",()=>{for(let n of Ea)try{n.kill()}catch{}});Aa=class{#e;#c=!1;#t=0;#i=!1;#m=0;#s=!1;#d=null;#a=[];#u=null;#n=null;#r=null;#l=new Map;#o=[];#h=null;#k=null;#w=null;#g;#y;#v="";#C=1;#f=new Map;#x;#S;constructor(e,t,r=(s,i)=>Rb(s,{cwd:i,shell:!0,stdio:["pipe","pipe","pipe"],env:{...process.env,TYPEBULB_MIRROR:"1"}})){if(this.#x=new Promise(o=>{this.#S=o}),t?.includes('"')){this.#y="session path contains a quote \u2014 cannot drive it",this.#S();return}let s=t?`pi --mode rpc --session "${t}"`:"pi --mode rpc",i;try{i=r(s,e)}catch(o){this.#y=`could not start pi: ${z(o)}`,this.#S();return}this.#e=i,this.#g=t,this.#i=!0,this.#m=Date.now()+Ib,this.#n={text:Nb,kind:"info"},Ea.add(i),i.stdout&&b_(i.stdout,o=>this.#I(o)),i.stderr&&i.stderr.on("data",o=>{this.#v=(this.#v+o.toString()).slice(-h_)}),i.on("error",o=>this.#O(`could not start pi: ${o.message}`)),i.on("exit",o=>{this.#e===i&&this.#O(o?`pi exited (code ${o})${this.#v.trim()?`: ${this.#v.trim()}`:""}`:"pi exited"),Ea.delete(i),this.#S()}),this.#p({type:"get_state"}).then(o=>{let a=o.data?.sessionFile;typeof a=="string"&&a&&(this.#g=a);let l=o.data?.model;l&&typeof l.id=="string"&&l.id&&(this.#w=l.id)}).catch(()=>{}).finally(()=>this.#R())}#R(){this.#i&&(this.#i=!1,this.#n?.text===Nb&&(this.#n=null),this.#r&&(this.#r.until=Date.now()+Lb),!this.#c&&Date.now()<this.#t&&(this.#t=Date.now()+Ld),this.#T())}get streaming(){return this.#c||Date.now()<this.#t}get draft(){return this.#d}get echo(){return this.#u}get queue(){return this.#h}get stats(){return this.#k}get model(){return this.#w}get sessionFile(){return this.#g}get error(){return this.#y}get status(){if(this.#n)return this.#n;if(this.#r){if(Date.now()<this.#r.until)return{text:this.#r.text,kind:this.#r.kind};this.#r=null}return this.#l.size?{text:[...this.#l.values()].join(" \xB7 "),kind:"info"}:null}get dialog(){let e=Date.now();for(;this.#o.length;){let t=this.#o[0];if(e<t.until)return t.req;this.#o.shift(),t.ownTimeout||this.#E({type:"extension_ui_response",id:t.req.id,cancelled:!0})}return null}notice(e,t){this.#b(e,t)}respondUi(e,t){let r=this.#o.findIndex(o=>o.req.id===e);if(r<0)return{ok:!1,error:"dialog expired or already answered"};let[s]=this.#o.splice(r,1),i={type:"extension_ui_response",id:e};return t.cancelled?i.cancelled=!0:s.req.method==="confirm"?i.confirmed=!!t.confirmed:i.value=t.value??"",this.#E(i),{ok:!0}}async rpc(e){if(!y_.has(e.type))return{ok:!1,error:`command not allowed: ${e.type}`};try{let t=await this.#p(e);if(t.success&&e.type==="set_model"){let r=t.data?.id;typeof r=="string"&&r&&(this.#w=r)}if(t.success&&(e.type==="fork"||e.type==="clone")){try{let s=(await this.#p({type:"get_state"})).data?.sessionFile;typeof s=="string"&&s&&(this.#g=s)}catch{}return{ok:!0,data:{...t.data??{},sessionFile:this.#g}}}return t.success?{ok:!0,data:t.data}:{ok:!1,error:t.error??`pi rejected ${e.type}`}}catch(t){return{ok:!1,error:z(t)}}}async send(e,t){let r=this.streaming,s=e.trimStart().startsWith("/"),i=r?s?{type:"prompt",message:e,streamingBehavior:t?.followUp?"followUp":"steer"}:{type:t?.followUp?"follow_up":"steer",message:e}:{type:"prompt",message:e},o=l=>{r||(this.#t=l,s||(this.#u=e))};if(this.#i)return this.#p(i).catch(()=>{}),o(this.#m+Ld),{ok:!0};let a;try{a=await this.#p(i)}catch(l){return{ok:!1,error:z(l)}}return a.success&&o(Date.now()+Ld),a.success?{ok:!0}:{ok:!1,error:a.error??"pi rejected the message"}}async stop(){if(this.#e){if(this.#i){this.#E({type:"abort"}),this.#t=0;return}try{await this.#p({type:"abort"})}catch{}}}clearCompletedDraft(){this.#s||(this.#d=null)}clearEcho(){this.#u=null}async dispose(){let e=this.#e;if(e){if(this.#e=void 0,this.#i=!1,this.#c){try{e.stdin?.write(JSON.stringify({type:"abort"})+`
|
|
2008
2008
|
`)}catch{}await Promise.race([this.#x,Mb($b)])}try{e.stdin?.end()}catch{}if(await Promise.race([this.#x,Mb($b)]),e.exitCode===null&&!e.killed)if(process.platform==="win32"&&e.pid)try{Rb("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"})}catch{}else try{e.kill("SIGKILL")}catch{}Ea.delete(e),this.#o=[],this.#_("pi was shut down")}}#E(e){try{this.#e?.stdin?.write(JSON.stringify(e)+`
|
|
2009
2009
|
`)}catch{}}#P(){let e=this.#a[this.#a.length-1];this.#d={text:this.#a.filter(t=>t?.kind==="text").map(t=>t.text).join(""),thinking:this.#a.filter(t=>t?.kind==="thinking").map(t=>t.text).join(`
|
|
2010
|
-
`),tool:e?.kind==="tool"?e.name:void 0}}#A(e){let t=Array.isArray(e?.content)?e.content:[];this.#a=t.map(r=>({kind:r.type==="thinking"?"thinking":r.type==="toolCall"?"tool":"text",text:(r.type==="thinking"?r.thinking:r.text)??"",name:r.name})),this.#P()}#b(e,t){let r=e.length>200?e.slice(0,200)+"\u2026":e;r&&(this.#r={text:r,kind:t,until:Date.now()+(t==="info"?
|
|
2011
|
-
`)}catch(l){clearTimeout(a),this.#f.delete(s),o(new Error(z(l)))}})}#I(e){let t;try{t=JSON.parse(e)}catch{return}switch(t.type){case"response":{let r=t,s=r.id?this.#f.get(r.id):void 0;s&&(this.#f.delete(r.id),clearTimeout(s.timer),s.resolve(r));return}case"agent_start":this.#c=!0,this.#t=0;return;case"agent_end":this.#c=!1,this.#t=0,this.#s=!1,this.#n=null,this.#h=null,this.#T();return;case"message_start":{let r=t.message;if(r?.role!=="assistant")return;this.#s=!0,this.#A(r);return}case"message_update":{if(!this.#s)return;if(t.message){this.#A(t.message);return}let r=t.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.#P();return}case"message_end":if(!this.#s)return;t.message&&this.#A(t.message),this.#s=!1;return;case"auto_retry_start":this.#n={text:`retrying after a transient error (attempt ${Number(t.attempt)||1}/${Number(t.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#n=null,t.success===!1&&this.#b(`retries exhausted: ${String(t.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#n={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#n=null;let r=t.result;typeof t.errorMessage=="string"&&t.errorMessage?this.#b(`compaction failed: ${t.errorMessage}`,"error"):r?.tokensBefore&&this.#b(`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(t.steering)?t.steering.map(String):[],s=Array.isArray(t.followUp)?t.followUp.map(String):[];this.#h=r.length||s.length?{steering:r,followUp:s}:null;return}case"extension_ui_request":{let r=String(t.method??"");if(r==="select"||r==="confirm"||r==="input"||r==="editor"){let s=typeof t.timeout=="number"&&t.timeout>0?t.timeout:void 0;this.#o.push({req:{id:String(t.id??""),method:r,title:typeof t.title=="string"?t.title:void 0,message:typeof t.message=="string"?t.message:void 0,options:Array.isArray(t.options)?t.options.map(String):void 0,placeholder:typeof t.placeholder=="string"?t.placeholder:void 0,prefill:typeof t.prefill=="string"?t.prefill:void 0},until:Date.now()+(s??
|
|
2012
|
-
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function
|
|
2013
|
-
`),l=i.filter(d=>d.type==="toolCall").map(d=>({id:d.id??"",name:d.name??"",input:d.arguments??{}}));if(o||a||l.length){let d=Date.parse(e.timestamp??""),h=!isNaN(d)&&d>=t;r.push({type:"assistant",text:o,thinking:a,tools:l,live:h})}let c=s.usage,f=c?(c.input??0)+(c.output??0)+(c.cacheRead??0)+(c.cacheWrite??0):0,u=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:u,model:s.model,cost:c?.cost?.total}}return{events:r}}chainWorking(e){let t;for(let a of e)Kb(a)&&(t=a);if(!t||t.type==="custom_message")return!1;let r=t.message.role;if(r==="user"||r==="toolResult"||r==="bashExecution")return!0;if(r!=="assistant")return!1;let i=(Array.isArray(t.message.content)?t.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 t;try{t=
|
|
2014
|
-
`))if(h.includes('"session_info"'))try{let
|
|
2015
|
-
`))if(!(c||!u.includes('"type"')))try{let d=JSON.parse(u);d?.type==="message"&&d.message?.role==="user"&&(c=this.contentText(d.message.content).replace(/\s+/g," ").trim())}catch{}let f=l(a)||l(o)||c;return f?f.slice(0,200):""}finally{
|
|
2016
|
-
`):""}}});var Pa,Yb=S(()=>{"use strict";Pa=class{#e=new Map;accept(e,t){return this.#e.get(e)===t?!1:(this.#e.set(e,t),!0)}}});import{execFile as
|
|
2010
|
+
`),tool:e?.kind==="tool"?e.name:void 0}}#A(e){let t=Array.isArray(e?.content)?e.content:[];this.#a=t.map(r=>({kind:r.type==="thinking"?"thinking":r.type==="toolCall"?"tool":"text",text:(r.type==="thinking"?r.thinking:r.text)??"",name:r.name})),this.#P()}#b(e,t){let r=e.length>200?e.slice(0,200)+"\u2026":e;r&&(this.#r={text:r,kind:t,until:Date.now()+(t==="info"?g_:Lb)})}#T(){this.#p({type:"get_session_stats"}).then(e=>{if(!e.success||!e.data)return;let t=e.data;this.#k={cost:typeof t.cost=="number"?t.cost:0,contextTokens:typeof t.contextUsage?.tokens=="number"?t.contextUsage.tokens:null,contextPercent:typeof t.contextUsage?.percent=="number"?t.contextUsage.percent:null}}).catch(()=>{})}#p(e){let t=this.#e;if(!t?.stdin?.writable)return Promise.reject(new Error(this.#y??"pi is not running"));let r=this.#i?Ib:p_,s=`tb-${this.#C++}`;return new Promise((i,o)=>{let a=setTimeout(()=>{this.#f.delete(s),o(new Error(`pi did not respond (${Math.round(r/1e3)}s)`))},r);a.unref?.(),this.#f.set(s,{resolve:i,timer:a});try{t.stdin.write(JSON.stringify({id:s,...e})+`
|
|
2011
|
+
`)}catch(l){clearTimeout(a),this.#f.delete(s),o(new Error(z(l)))}})}#I(e){let t;try{t=JSON.parse(e)}catch{return}switch(t.type){case"response":{let r=t,s=r.id?this.#f.get(r.id):void 0;s&&(this.#f.delete(r.id),clearTimeout(s.timer),s.resolve(r));return}case"agent_start":this.#c=!0,this.#t=0;return;case"agent_end":this.#c=!1,this.#t=0,this.#s=!1,this.#n=null,this.#h=null,this.#T();return;case"message_start":{let r=t.message;if(r?.role!=="assistant")return;this.#s=!0,this.#A(r);return}case"message_update":{if(!this.#s)return;if(t.message){this.#A(t.message);return}let r=t.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.#P();return}case"message_end":if(!this.#s)return;t.message&&this.#A(t.message),this.#s=!1;return;case"auto_retry_start":this.#n={text:`retrying after a transient error (attempt ${Number(t.attempt)||1}/${Number(t.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#n=null,t.success===!1&&this.#b(`retries exhausted: ${String(t.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#n={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#n=null;let r=t.result;typeof t.errorMessage=="string"&&t.errorMessage?this.#b(`compaction failed: ${t.errorMessage}`,"error"):r?.tokensBefore&&this.#b(`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(t.steering)?t.steering.map(String):[],s=Array.isArray(t.followUp)?t.followUp.map(String):[];this.#h=r.length||s.length?{steering:r,followUp:s}:null;return}case"extension_ui_request":{let r=String(t.method??"");if(r==="select"||r==="confirm"||r==="input"||r==="editor"){let s=typeof t.timeout=="number"&&t.timeout>0?t.timeout:void 0;this.#o.push({req:{id:String(t.id??""),method:r,title:typeof t.title=="string"?t.title:void 0,message:typeof t.message=="string"?t.message:void 0,options:Array.isArray(t.options)?t.options.map(String):void 0,placeholder:typeof t.placeholder=="string"?t.placeholder:void 0,prefill:typeof t.prefill=="string"?t.prefill:void 0},until:Date.now()+(s??m_),ownTimeout:s!==void 0})}else if(r==="notify"){let s=t.notifyType==="warning"?"warning":t.notifyType==="error"?"error":"info";this.#b(String(t.message??""),s),console.log(`[composer] pi extension: ${String(t.message??"")}`)}else if(r==="setStatus"){let s=String(t.statusKey??"");typeof t.statusText=="string"&&t.statusText?this.#l.set(s,t.statusText):this.#l.delete(s)}return}default:return}}#O(e){this.#y=e,this.#i=!1,this.#c=!1,this.#t=0,this.#s=!1,this.#d=null,this.#a=[],this.#u=null,this.#n=null,this.#r=null,this.#l.clear(),this.#o=[],this.#h=null,this.#k=null,this.#w=null,this.#e=void 0,this.#_(e)}#_(e){for(let[,t]of this.#f)clearTimeout(t.timer),t.resolve({type:"response",success:!1,error:e});this.#f.clear()}},Mb=n=>new Promise(e=>{setTimeout(e,n).unref?.()})});import{existsSync as Db,readFileSync as w_,realpathSync as v_}from"fs";import{join as xn,dirname as qb,resolve as S_}from"path";import{homedir as jb}from"os";function x_(n,e){let t=xn(n,".pi");if(k_.some(s=>Db(xn(t,s))))return!0;let r=xn(e,".agents","skills");for(let s=n;;){let i=xn(s,".agents","skills");if(i!==r&&Db(i))return!0;let o=qb(s);if(o===s)return!1;s=o}}function E_(n,e){for(let t=e;;){if(n[t]===!0||n[t]===!1)return!0;let r=qb(t);if(r===t)return!1;t=r}}function Jb(n,e){try{let t=e?.agentDir??xn(jb(),".pi","agent"),r=Fb(e?.home??process.env.HOME??jb()),s=Fb(S_(n));if(!x_(s,r))return null;let i=Ub(xn(t,"settings.json")).defaultProjectTrust;return i==="always"||i==="never"||E_(Ub(xn(t,"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 k_,Fb,Ub,Wb=S(()=>{"use strict";k_=["settings.json","extensions","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"],Fb=n=>{try{return v_(n)}catch{return n}},Ub=n=>{try{return JSON.parse(w_(n,"utf8"))}catch{return{}}}});import{statSync as A_,openSync as T_,readSync as P_,closeSync as O_,existsSync as Hb}from"fs";import{join as Ta}from"path";import{homedir as Md}from"os";import{execFile as __}from"child_process";async function R_(n){let e=Ta(Md(),".pi","agent","bin",process.platform==="win32"?"fd.exe":"fd");for(let t of["fd","fdfind",...Hb(e)?[e]:[]]){let r=await new Promise(s=>{__(t,["--base-directory",n,"--type","f","--follow","--hidden","--exclude",".git"],{maxBuffer:67108864},(i,o)=>s(i?null:o))});if(r!==null)return r.split(`
|
|
2012
|
+
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function I_(n){return`--${n.replace(/^[/\\]/,"").replace(/[/\\:]/g,"-")}--`}function Kb(n){return n.type==="message"?N_(n.message?.role):n.type==="custom_message"?n.display!==!1:!1}var C_,N_,Er,Bd=S(()=>{"use strict";ms();du();wo();Cb();Bb();Wb();C_=Ta(Md(),".pi","agent","sessions");N_=n=>n==="user"||n==="assistant"||n==="toolResult"||n==="bashExecution";Er=class extends $t{displayName="Pi Mirror";detectsSelf(){return process.env.PI_CODING_AGENT==="true"}detectsInstalled(){return Hb(Ta(Md(),".pi","agent"))}ensureHarnessSupport(){_b()}createDriver(e,t){let r=new Aa(e,t),s=Jb(e);return s&&r.notice(s,"warning"),r}walkFiles(e){return R_(e)}sessionsDir(e){return Ta(C_,I_(e))}listSessionFiles(e){return bo(this.sessionsDir(e))}parseEntry(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||t.type==="session"||!t.id?null:t}idOf(e){return e.id}parentOf(e){return e.parentId??void 0}timestampOf(e){return e.timestamp}isSidechain(e){return!1}isLeafType(e){return Kb(e)}isRecoveryNoise(e){return!1}apply(e,t){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:Ne(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(d=>d.type==="text").map(d=>d.text??"").join(""),a=i.filter(d=>d.type==="thinking").map(d=>d.thinking??"").join(`
|
|
2013
|
+
`),l=i.filter(d=>d.type==="toolCall").map(d=>({id:d.id??"",name:d.name??"",input:d.arguments??{}}));if(o||a||l.length){let d=Date.parse(e.timestamp??""),h=!isNaN(d)&&d>=t;r.push({type:"assistant",text:o,thinking:a,tools:l,live:h})}let c=s.usage,f=c?(c.input??0)+(c.output??0)+(c.cacheRead??0)+(c.cacheWrite??0):0,u=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:u,model:s.model,cost:c?.cost?.total}}return{events:r}}chainWorking(e){let t;for(let a of e)Kb(a)&&(t=a);if(!t||t.type==="custom_message")return!1;let r=t.message.role;if(r==="user"||r==="toolResult"||r==="bashExecution")return!0;if(r!=="assistant")return!1;let i=(Array.isArray(t.message.content)?t.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 t;try{t=T_(e,"r")}catch{return""}try{let s=65536;try{s=A_(e).size}catch{}let i=(u,d)=>{let h=Buffer.alloc(d),g=P_(t,h,0,d,u);return h.subarray(0,g).toString("utf8")},o=i(0,Math.min(65536,s)),a=s>65536?i(s-65536,65536):"",l=u=>{let d="";for(let h of u.split(`
|
|
2014
|
+
`))if(h.includes('"session_info"'))try{let g=JSON.parse(h);g?.type==="session_info"&&typeof g.name=="string"&&g.name&&(d=g.name)}catch{}return d},c="";for(let u of o.split(`
|
|
2015
|
+
`))if(!(c||!u.includes('"type"')))try{let d=JSON.parse(u);d?.type==="message"&&d.message?.role==="user"&&(c=this.contentText(d.message.content).replace(/\s+/g," ").trim())}catch{}let f=l(a)||l(o)||c;return f?f.slice(0,200):""}finally{O_(t)}}searchText(e){if(e?.type!=="message")return"";let t=e.message?.role;if(t!=="user"&&t!=="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"?Ae(e):Array.isArray(e)?e.map(t=>typeof t?.text=="string"?Ae(t.text):t?.type==="image"&&t.data?yo(t.data,t.mimeType):"").filter(Boolean).join(`
|
|
2016
|
+
`):""}}});var Pa,Yb=S(()=>{"use strict";Pa=class{#e=new Map;accept(e,t){return this.#e.get(e)===t?!1:(this.#e.set(e,t),!0)}}});import{execFile as $_}from"child_process";import{promisify as L_}from"util";import{readFile as M_}from"fs/promises";import{resolve as Vb,sep as B_}from"path";async function Xe(n,e){let{stdout:t}=await D_("git",n,{cwd:e,maxBuffer:67108864});return t}async function En(){if(Oa)return Oa;try{Oa=(await Xe(["rev-parse","--show-toplevel"],G)).trim()}catch{}return Oa}function j_(n,e){let t=e===" "?n:e;return t==="?"?"U":t}async function jd(){let n=await En();if(!n)return{repo:!1,root:"",files:[]};try{let e=await Xe(["status","--porcelain","-z"],n),t=[],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++,t.push({path:i.slice(3),status:j_(i[0],i[1])}))}try{let s=await Xe(["diff","--numstat","-z","HEAD"],n),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 t){let l=i.get(a.path);l&&(l.binary?a.binary=!0:(a.add=l.add,a.del=l.del))}}catch{}return t.sort((s,i)=>s.path.localeCompare(i.path)),{repo:!0,root:n,files:t}}catch(e){return{repo:!1,root:"",files:[],error:z(e)}}}async function Fd(n){let e=await En();if(!e)return{ok:!1,error:"not a git repository"};try{if((await Xe(["status","--porcelain","-z","--",n],e)).startsWith("??")){let s=Vb(e,n);if(!s.startsWith(Vb(e)+B_))return{ok:!1,error:"outside repository"};let i=await M_(s);return i.includes(0)?Dd("Binary file (not shown)",!1):Dd(i.toString("utf8"),!0)}let r;try{r=await Xe(["diff","--no-color","--unified=999999","HEAD","--",n],e)}catch{r=await Xe(["diff","--no-color","--unified=999999","--",n],e)}return Dd(r,!1)}catch(t){return{ok:!1,error:z(t)}}}var D_,zb,Oa,Dd,Ks=S(()=>{"use strict";Ht();D_=L_($_),zb=2e6;Dd=(n,e)=>({ok:!0,text:n.slice(0,zb),untracked:e,truncated:n.length>zb})});function Hs(n,e){let t=0,r="";for(let s of n){let i=s.lower.indexOf(e);if(!(i<0)&&(t++,!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:t,snippet:r}}var Ud=S(()=>{"use strict"});function Gb(){return F_.map(([n,e])=>ht(n,e)).filter(n=>typeof n!="string")}function Xb(){return Gb().length>0}async function _a(n,e,t=0){let r=AbortSignal.timeout(e);for(let s of Gb()){try{let i=await Ft(s,{messages:[{role:"user",content:n}],effort:t,webSearch:!1,signal:r});if(i.ok){let o=(await rd(i,s.protocol)).trim();if(o)return o}}catch{}if(r.aborted)return}}var F_,qd=S(()=>{"use strict";Dt();kr();F_=[["openrouter","openai/gpt-5.6-luna"],["openai","gpt-5.6-luna"]]});var Ca,Ra,Qb=S(()=>{"use strict";Ca=".typebulb/paste",Ra={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp"}});import{existsSync as U_,mkdirSync as q_,writeFileSync as J_,readFileSync as W_}from"fs";import{join as Ia}from"path";function Zb(){let n=new Date,e=t=>String(t).padStart(2,"0");return`${n.getFullYear()}${e(n.getMonth()+1)}${e(n.getDate())}-${e(n.getHours())}${e(n.getMinutes())}${e(n.getSeconds())}`}function Y_(n){return n.trim().toLowerCase().replace(/\.[a-z0-9]{1,4}$/,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}async function V_(n){let e=await _a(`Reply with ONLY a short kebab-case filename (2-5 words, lowercase, no extension) describing this text:
|
|
2017
2017
|
|
|
2018
|
-
${n.slice(0,
|
|
2019
|
-
`+
|
|
2018
|
+
${n.slice(0,H_)}`,K_);return e&&Y_(e)||void 0}async function ew(n,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 t=Ia(n,Ca);try{q_(t,{recursive:!0})}catch(a){return{ok:!1,error:z(a)}}let r,s,i;if(e.kind==="image"){if(r=`img-${Zb()}`,s=Object.keys(Ra).find(a=>Ra[a]===e.mime)??"png",i=Buffer.from(e.data,"base64"),!i.length)return{ok:!1,error:"empty image data"}}else r=await V_(e.data)??`paste-${Zb()}`,s="md",i=e.data;let o=`${r}.${s}`;for(let a=2;U_(Ia(t,o));a++)o=`${r}-${a}.${s}`;try{J_(Ia(t,o),i)}catch(a){return{ok:!1,error:z(a)}}return{ok:!0,path:`${Ca}/${o}`}}function tw(n,e){if(!/^[\w-]+(\.[\w-]+)*$/.test(e))return{ok:!1,error:"bad name"};let t=e.slice(e.lastIndexOf(".")+1).toLowerCase(),r=Ra[t];if(!r)return{ok:!1,error:"not an image"};try{return{ok:!0,mime:r,base64:W_(Ia(n,Ca,e)).toString("base64")}}catch{return{ok:!1,error:"not found"}}}var K_,H_,nw=S(()=>{"use strict";qd();Ht();Qb();K_=4e3,H_=4e3});async function iw(n,e=""){let t=n.trim();if(!t)return{ok:!1,error:"nothing to summarize"};if(!Xb())return{ok:!1,error:"Summary needs OPENROUTER_API_KEY or OPENAI_API_KEY in this project\u2019s .env.",setup:!0};let r=e.trim()?sw+`CONTEXT \u2014 the user message this reply answers. It is context only: never summarize it, and never report it as the reply's content.
|
|
2019
|
+
`+G_(e.trim())+`
|
|
2020
2020
|
|
|
2021
2021
|
REPLY TO SUMMARIZE:
|
|
2022
|
-
`+t.slice(0,rw):sw+t.slice(0,rw),s=await _a(r,
|
|
2022
|
+
`+t.slice(0,rw):sw+t.slice(0,rw),s=await _a(r,z_,1);return s?{ok:!0,text:s}:{ok:!1,error:"the model call failed or timed out"}}var z_,rw,sw,G_,ow=S(()=>{"use strict";qd();z_=2e4,rw=24e3,sw=`Summarize this assistant reply for someone who wants its substance without the prose.
|
|
2023
2023
|
|
|
2024
2024
|
- 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.
|
|
2025
2025
|
- 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.
|
|
@@ -2034,24 +2034,24 @@ Reply with the summary alone.
|
|
|
2034
2034
|
|
|
2035
2035
|
---
|
|
2036
2036
|
|
|
2037
|
-
`,
|
|
2037
|
+
`,G_=(n,e=4e3)=>{if(n.length<=e)return n;let t=Math.floor(e/2)-20;return n.slice(0,t)+`
|
|
2038
2038
|
|
|
2039
2039
|
[snipped for brevity]
|
|
2040
2040
|
|
|
2041
|
-
`+n.slice(n.length-t)}});function
|
|
2042
|
-
`))>=0;){let L=w.partial.slice(0,
|
|
2043
|
-
`))>=0;){let j=
|
|
2044
|
-
`).filter(Boolean):await n.walkFiles?.(e.cwd)??[];return(await Promise.all(v.map(async A=>{try{return{f:A,m:(await
|
|
2045
|
-
`)){if(!L.trim())continue;let D=n.parseEntry(L);if(!D)continue;let j=n.searchText(D);j&&A.push({text:j,lower:j.toLowerCase()})}return Bf.set(
|
|
2046
|
-
`)){if(!D.trim())continue;let j=n.parseEntry(D);if(j)for(let
|
|
2047
|
-
`)){let c=l.replace(/\s+/g," ").trim();c&&i.push({text:c,lower:c.toLowerCase()})}let{hitCount:o,snippet:a}=Hs(i,e);o&&t.push({path:r.path,hitCount:o,snippet:a})}return t}async function ef(n,e){let t=G;e!=null&&
|
|
2048
|
-
${n}`;return Yt?.key===e&&Date.now()-Yt.fetchedAt<=
|
|
2041
|
+
`+n.slice(n.length-t)}});function X_(n,...e){return n.slice().sort((t,r)=>{for(let{key:s,desc:i}of e){let o=s(t),a=s(r);if(o!==a)return o==null?i?-1:1:a==null||o<a?i?1:-1:i?-1:1}return 0})}var Na,aw=S(()=>{"use strict";Na=(n,e)=>X_(n,{key:e,desc:!0})});import{existsSync as lw,openSync as Q_,readSync as Z_,closeSync as eC,statSync as Ar,readdirSync as cw,watchFile as tC,unwatchFile as uw,mkdirSync as nC,writeFileSync as rC,readFileSync as $a,unlinkSync as sC,rmSync as iC}from"fs";import{stat as oC}from"fs/promises";import{dirname as aC,join as An,resolve as dw}from"path";function dC(n){if(!Number.isInteger(n))return!0;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function Tr(n){let e={cwd:G,sessionId:"",sessionStartMs:Date.now(),buffer:[],partial:"",offset:0,latest:{in:0,out:0,cached:0,cacheCreate:0},latestModel:null,everAttached:!1,entries:new Map,thread:"main"},t=new Map,r,s=new Map;function i(m){t.clear(),r=m,s.clear()}function o(m){if(!(!r||!n.spawnSignals))for(let v of[r,...m.map(w=>w.file)]){let w=s.get(v);w||s.set(v,w={offset:0,partial:""});let A=a(v,w.offset);if(!A.text)continue;w.offset=A.offset,w.partial+=A.text;let _;for(;(_=w.partial.indexOf(`
|
|
2042
|
+
`))>=0;){let L=w.partial.slice(0,_);if(w.partial=w.partial.slice(_+1),!L.trim())continue;let D=n.parseEntry(L);if(D)for(let j of n.spawnSignals(D)){let Y=t.get(j.id);(!Y||j.at>=Y.at)&&t.set(j.id,j)}}}}function a(m,v){let w={offset:v,text:""},A;try{A=Ar(m).size}catch{return w}if(A<=v)return w;let _;try{_=Q_(m,"r")}catch{return w}try{let L=A-v,D=Buffer.alloc(L),j=0;for(;j<L;){let Y=Z_(_,D,j,L-j,v+j);if(!Y)break;j+=Y}return{offset:v+j,text:D.subarray(0,j).toString("utf8")}}finally{eC(_)}}let l=new Set,c,f=0;function u(){if(e.file){for(let m of l)if(m.file===e.file)return m;return}return c}function d(m){let v={d:n.createDriver(e.cwd,m),file:m,id:`new:${++f}`,startedAt:Date.now()};return l.add(v),e.file||(c=v),v}function h(){let m=[...l].filter(w=>w.file);if(!m.length)return[];let v=new Map(n.listSessionFiles(e.cwd).map(w=>[w.file,w.sessionId]));return m.map(w=>{let A=v.get(w.file);return{rec:w,sessionId:A??w.id,pending:A===void 0}})}let g=()=>h().filter(m=>m.pending&&m.rec.prompt!==void 0);async function p(m){l.delete(m),c===m&&(c=void 0);try{await m.d.dispose()}catch(v){console.error("[composer] dispose:",z(v))}}function y(){let m=u(),v=new Set(g().map(w=>w.rec));for(let w of[...l])w!==m&&(v.has(w)||w.d.streaming||w.d.queue||w.d.error||p(w))}function E(){for(let m of l)m.d.sessionFile&&m.file!==m.d.sessionFile&&(m.file=m.d.sessionFile);if(c&&!e.file&&c.file){let m=n.listSessionFiles(e.cwd).find(v=>v.file===c.file);m&&ae(m)}c&&!e.file&&c.prompt!==void 0&&e.sessionId!==c.id&&(se(void 0,c.id),e.everAttached=!0)}let P=m=>An(m,cC),C=(m,v)=>An(P(m),`${v}.lock`);function x(m,v){try{let w=C(m,v);if(Date.now()-Ar(w).mtimeMs>=fw)return!1;try{let A=parseInt($a(w,"utf8").trim(),10);if(A===process.pid||!dC(A))return!1}catch{}return!0}catch{return!1}}function I(m,v){if(v)try{nC(P(m),{recursive:!0}),rC(C(m,v),String(process.pid))}catch(w){console.error("[lock] claim failed:",z(w))}}function N(m){try{iC(An(m,".claude-bulb"),{recursive:!0,force:!0})}catch{}}function M(m){let v=P(m);if(!lw(v))return;let w;try{w=cw(v)}catch{return}let A=Date.now();for(let _ of w){if(!_.endsWith(".lock"))continue;let L=An(v,_);try{let D=Ar(L);A-D.mtimeMs>uC&&sC(L)}catch{}}}function T(m){try{return Ar(m),!1}catch(v){return v.code==="ENOENT"}}function K(){let m=e;if(m.file&&!T(m.file)){I(m.cwd,m.sessionId);return}let v=ee(m);v&&ae(v)}function ee(m){if(!m.everAttached)return Q(m.cwd)??U(m.cwd,()=>!0)}function Q(m){let v=P(m);if(!lw(v))return;let w;try{w=cw(v)}catch{return}let A;for(let L of w)if(L.endsWith(".lock"))try{let D=Ar(An(v,L));if(Date.now()-D.mtimeMs>=fw||parseInt($a(An(v,L),"utf8").trim(),10)!==process.pid)continue;(!A||D.mtimeMs>A.mtime)&&(A={sessionId:L.slice(0,-5),mtime:D.mtimeMs})}catch{}if(!A)return;let _=n.listSessionFiles(m).find(L=>L.sessionId===A.sessionId);if(!(!_||T(_.file)))return _}function U(m,v){return n.listSessionFiles(m).sort((w,A)=>A.mtime-w.mtime).find(w=>!x(m,w.sessionId)&&v(w))}function se(m,v){let w=e;if(w.file)try{uw(w.file)}catch{}w.file=m,w.sessionId=v,w.partial="",w.offset=0,w.latest={in:0,out:0,cached:0,cacheCreate:0},w.latestModel=null,w.entries=new Map,w.chainLastId=void 0,w.buffer.push({type:"cleared"}),w.buffer.push({type:"session",sessionId:v})}function ae(m){let v=e;c=void 0,li(),i(m.file),se(m.file,m.sessionId),v.everAttached=!0,I(v.cwd,m.sessionId),be(m.file)}function be(m){if(fe(),!!m){try{uw(m)}catch{}tC(m,{interval:200},()=>fe())}}function ot(){li(),i(void 0),se(void 0,"")}function fe(){let m=e;if(!m.file)return;let v=a(m.file,m.offset);if(!v.text)return;m.offset=v.offset,m.partial+=v.text;let w,A;for(;(A=m.partial.indexOf(`
|
|
2043
|
+
`))>=0;){let j=m.partial.slice(0,A);if(m.partial=m.partial.slice(A+1),!j.trim())continue;let Y=n.parseEntry(j);if(!Y)continue;let ce=n.idOf(Y);ce&&(m.entries.set(ce,Y),!n.isSidechain(Y,m.thread)&&n.isLeafType(Y)&&(w=ce))}if(!w)return;let _=[],L=m.entries.get(w),D=!1;for(;L;){if(_.push(L),n.idOf(L)===m.chainLastId){D=!0;break}let j=n.parentOf(L);L=j?m.entries.get(j):void 0}if(D)for(let j=_.length-2;j>=0;j--)k(_[j]);else{m.chainLastId!==void 0&&(m.buffer.push({type:"cleared"}),m.buffer.push({type:"session",sessionId:m.sessionId}),m.latest={in:0,out:0,cached:0,cacheCreate:0});let j=new Set(_.map(ce=>n.idOf(ce))),Y=xe(m.entries);for(let ce=_.length-1;ce>=0;ce--)k(_[ce]),Qt(n.idOf(_[ce]),Y,j)}m.chainLastId=w}function xe(m){let v=new Map;for(let w of m.values()){let A=n.parentOf(w);if(!A)continue;let _=v.get(A);_?_.push(w):v.set(A,[w])}return v}function Qt(m,v,w){if(!m)return;let A=v.get(m);if(!A)return;let _=A.filter(Y=>!n.isSidechain(Y,e.thread));if(_.length<2)return;let L=_.filter(Y=>!w.has(n.idOf(Y)));if(!L.length)return;let D=[],j=0;for(let Y of L){let ce=b(Y,v);D.push(...ce.events),j+=ce.count}j>0&&e.buffer.push({type:"fork",atId:m,count:j,events:D})}function b(m,v){let w=[],A=[m];for(;A.length;){let D=A.pop();if(n.isSidechain(D,e.thread))continue;w.push(D);let j=v.get(n.idOf(D)??"");if(j)for(let Y of j)A.push(Y)}w.sort((D,j)=>(Date.parse(n.timestampOf(D)??"")||0)-(Date.parse(n.timestampOf(j)??"")||0));let _=[];for(let D of w)n.isRecoveryNoise(D)||_.push(...O(n.apply(D,e.sessionStartMs).events));return{count:_.reduce((D,j)=>D+(j.type==="user"||j.type==="assistant"?1:0),0),events:_}}function k(m){if(!n.isSidechain(m,e.thread))try{let{events:v,usage:w,model:A,cost:_}=n.apply(m,e.sessionStartMs);for(let L of O(v))e.buffer.push(L);v.some(L=>L.type==="assistant")&&u()?.d.clearCompletedDraft(),v.some(L=>L.type==="user")&&u()?.d.clearEcho(),A&&(e.latestModel=A),w&&(e.latest=w),(w||_)&&e.buffer.push({type:"usage",...e.latest,cost:_})}catch(v){console.error("[mirror] skipped malformed entry:",z(v))}}function O(m){return e.thread!=="child"?m:m.map(v=>v.type==="user"?{...v,authored:!0}:v)}async function $(){return{cwd:e.cwd,pid:process.pid,composer:!!n.createDriver,children:!!n.listChildren,elsewhere:await B()}}async function B(){if(n.listSessionFiles(e.cwd).length)return;let m=await En();if(!m)return;let v=dw(m).toLowerCase();for(let w=dw(e.cwd);w.toLowerCase()!==v;){let A=aC(w);if(A===w)return;w=A;let _=n.listSessionFiles(w).length;if(_)return{dir:w,count:_}}}B().then(m=>{m&&console.log(`No sessions for ${e.cwd} \u2014 ${m.count} exist for ${m.dir}. Launched from a subfolder? Relaunch from the project root.`)}).catch(()=>{});let J=new Pa;async function W(m,v){e.thread!=="child"&&J.accept(m,v)&&console.log(v)}function Ce(){let m=n.sessionAlive(e.sessionId,e.cwd);if(m!==void 0)return m;if(!e.file)return!1;try{return Date.now()-Ar(e.file).mtimeMs<1e4}catch{return!1}}function H(){return n.chainWorking([...e.entries.values()])&&Ce()}function le(){!n.createDriver||u()||e.latestModel||H()||d(e.file)}async function Ee(m){let v=e;K(),E(),le(),y();let w=u();for(let D of l)D!==w&&D.d.dialog;let A=h().filter(D=>D.rec.d.streaming).map(D=>D.sessionId),_=H(),L=n.createDriver?{streaming:!!w?.d.streaming,foreign:!w&&_,draft:w?.d.draft??null,echo:w?.d.echo??null,status:w?.d.status??null,dialog:w?.d.dialog??null,queue:w?.d.queue??null,stats:w?.d.stats??null,model:w?.d.model??null,error:w?.d.error}:void 0;return{events:v.buffer.slice(m),cursor:v.buffer.length,working:!!w?.d.streaming||_,latestModel:v.latestModel,child:v.child?.id??null,composer:L,busy:A}}async function Rn(){K(),E();let m=u();if(m?.d.error&&!m.d.streaming&&(await p(m),m=void 0),!m){if(H())return{ok:!1,error:"the agent is mid-turn in a terminal \u2014 watch only"};m=d(e.file)}let v=m;return{ok:!0,d:v.d,markSent:w=>{v.prompt===void 0&&(v.prompt=w)}}}async function Zt(m,v){if(!n.createDriver)return{ok:!1,error:"not supported"};let w=String(m??"").trim();if(!w)return{ok:!1,error:"empty message"};let A=await Rn();if(!A.ok)return A;let _=await A.d.send(w,v);return _.ok&&A.markSent(w),_}async function xt(m,v){let w=u();return w?w.d.respondUi(String(m??""),v??{}):{ok:!1,error:"no dialog pending"}}async function cl(m,v){if(!n.createDriver)return{ok:!1,error:"not supported"};if(!m||typeof m.type!="string")return{ok:!1,error:"bad command"};if(v?.spawn){let A=await Rn();return A.ok?A.d.rpc(m):A}let w=u();return!w||w.d.error?{ok:!1,error:"not running"}:w.d.rpc(m)}async function ul(){let m=u();if(m)try{await m.d.stop()}catch(v){console.error("[composer] stop:",z(v))}return{ok:!0}}async function fS(){return n.createDriver?(E(),!e.file&&c&&c.prompt===void 0&&!c.d.streaming&&!c.d.error?{ok:!0}:(c?.d.error&&await p(c),c=void 0,ot(),d(void 0),y(),{ok:!0})):{ok:!1,error:"not supported"}}async function pS(){if(!n.createDriver)return[];let m=await Xe(["ls-files","--cached","--others","--exclude-standard"],e.cwd).catch(()=>null),v=m!==null?m.split(`
|
|
2044
|
+
`).filter(Boolean):await n.walkFiles?.(e.cwd)??[];return(await Promise.all(v.map(async A=>{try{return{f:A,m:(await oC(An(e.cwd,A))).mtimeMs}}catch{return{f:A,m:0}}}))).sort((A,_)=>_.m-A.m).map(A=>A.f)}function hS(){for(let m of[...l])p(m)}async function mS(m){return n.createDriver?ew(e.cwd,m):{ok:!1,error:"not supported"}}async function gS(m){return tw(e.cwd,String(m??""))}async function yS(m,v){return iw(String(m??""),String(v??""))}async function bS(){let m=n.sessionsWorking?.(e.cwd),v=n.listSessionFiles(e.cwd).map(({sessionId:A,file:_,mtime:L})=>({sessionId:A,mtime:L,preview:n.readPreview(_),working:m?.has(A)})),w=g().map(A=>({sessionId:A.sessionId,mtime:A.rec.startedAt,preview:A.rec.prompt??"",pending:!0}));return Na([...v,...w],A=>A.mtime)}let Bf=new Map;function Df(m,v){let w=Bf.get(m);if(w&&w.mtime===v)return w.turns;let A=[],_="";try{_=$a(m,"utf8")}catch{return[]}for(let L of _.split(`
|
|
2045
|
+
`)){if(!L.trim())continue;let D=n.parseEntry(L);if(!D)continue;let j=n.searchText(D);j&&A.push({text:j,lower:j.toLowerCase()})}return Bf.set(m,{mtime:v,turns:A}),A}async function wS(m){let v=m.toLowerCase(),w=[],A=0,_=n.sessionsWorking?.(e.cwd);for(let{sessionId:L,file:D,mtime:j}of n.listSessionFiles(e.cwd).sort((Y,ce)=>ce.mtime-Y.mtime)){let Y=Hs(Df(D,j),v),ce=(n.listChildren?.(e.cwd,L)??[]).map(Re=>({c:Re,hit:Hs(Df(Re.file,Re.mtime),v)})).filter(Re=>Re.hit.hitCount);if(!(!Y.hitCount&&!ce.length)){for(let{c:Re,hit:OS}of Na(ce,_S=>_S.c.mtime))w.push({sessionId:L,mtime:Re.mtime,preview:Re.label||Re.kind||"agent",...OS,child:{id:Re.id,kind:Re.kind,depth:Re.depth}});if(w.push({sessionId:L,mtime:j,preview:n.readPreview(D),working:_?.has(L),...Y}),++A>=fC)break}}return w}let jf=800,Ff=new Map;function vS(m,v){let w=Ff.get(m);if(w&&w.mtime===v)return w.text;let A="";try{A=$a(m,"utf8")}catch{return""}let _="";for(let D of A.split(`
|
|
2046
|
+
`)){if(!D.trim())continue;let j=n.parseEntry(D);if(j)for(let Y of n.apply(j,e.sessionStartMs).events)Y.type==="assistant"&&Y.text.trim()&&(_=Y.text.trim())}let L=_.length>jf?_.slice(0,jf).trimEnd()+"\u2026":_;return Ff.set(m,{mtime:v,text:L}),L}async function SS(m){let v=n.listSessionFiles(e.cwd).find(w=>w.sessionId===m);return{text:v?vS(v.file,v.mtime):""}}async function kS(m){let v=e,w=n.listSessionFiles(v.cwd).find(A=>A.sessionId===m);if(!w){let A=g().find(_=>_.sessionId===m)?.rec;return A?((c!==A||v.sessionId!==A.id)&&(c=A,li(),i(void 0),se(void 0,A.id),v.everAttached=!0,y()),{ok:!0}):{ok:!1,error:"session not found"}}return w.file===v.file?{ok:!0}:(ae(w),E(),y(),{ok:!0})}async function xS(){if(!n.listChildren||!e.sessionId)return[];let m=Ce(),v=n.listChildren(e.cwd,e.sessionId);o(v);let w=new Map(v.map(_=>[_.id,_])),A=(_,L=new Set)=>{if(_.stopped||ES(_))return!0;if(!_.parentId||L.has(_.id))return!1;L.add(_.id);let D=w.get(_.parentId);return D?A(D,L):!1};return Na(v,_=>_.mtime).map(_=>({..._,state:AS(_,m,A(_))}))}function ES(m){let v=t.get(m.id),w=m.spawnId?t.get(m.spawnId):void 0;return!!(v&&w?v.at>=w.at?v:w:v??w)?.stopped}function AS(m,v,w){return m.stopped?"stopped":m.running!==void 0?m.running&&v?"running":"done":w?"done":v?"running":"done"}async function TS(m){let v=e;if(!n.listChildren)return{ok:!1,error:"this harness has no child transcripts"};let w=n.listChildren(v.cwd,v.sessionId).find(A=>A.id===m);return w?(v.thread="child",v.child=w,se(w.file,v.sessionId),be(w.file),{ok:!0}):{ok:!1,error:"child not found"}}async function PS(){let m=r;return!li()||!m?{ok:!0}:(se(m,e.sessionId),be(m),{ok:!0})}function li(){let m=e;return m.thread==="main"?!1:(m.thread="main",m.child=void 0,!0)}return N(e.cwd),M(e.cwd),K(),{info:$,poll:Ee,logInlineStatus:W,listSessions:bS,searchSessions:wS,sessionPeek:SS,attach:kS,listChildren:xS,openChild:TS,closeChild:PS,composerSend:Zt,composerStop:ul,composerNew:fS,composerFiles:pS,composerUiRespond:xt,composerRpc:cl,composerPaste:mS,composerPasteRead:gS,summarizeTurn:yS,shutdownComposer:hS}}var lC,cC,fw,uC,fC,La=S(()=>{"use strict";Ht();Yb();Ks();Ud();nw();ow();aw();lC=".typebulb",cC=`${lC}/locks`,fw=5e3,uC=6e4;fC=50});import{existsSync as Hd,mkdirSync as pC,readFileSync as pw,writeFileSync as hC}from"fs";import{join as Tn,isAbsolute as mC}from"path";async function Vd(n,e){let t=mC(n)?n:Tn(G,n);return Hd(t)?(qu(t,e),{ok:!0}):{ok:!1,error:"file not found"}}async function zd(n){let e=G,t=Uu(n),r=Tn(e,"typebulbs");pC(r,{recursive:!0});let s=Bu(t),i=`${s}.bulb.md`;for(let c=2;Hd(Tn(r,i))&&pw(Tn(r,i),"utf8")!==t;c++)i=`${s}-${c}.bulb.md`;let o=Tn(r,i);Hd(o)||hC(o,t);let a=Tn("typebulbs",i),l=await ks(a,{cwd:e,open:!1});return{ok:!0,file:a,pid:l.pid,url:l.url}}async function Gd(){return X(G)}async function Xd(n){let e=(await X()).find(t=>t.pid===n);return e?{ok:!0,outcome:await Bt(e)}:(await Qn(n),{ok:!0})}async function Qd(){let n=await ln(G);return Fo(G).filter(e=>!e.serverOnly).map(e=>({...e,trusted:hn(e.path),lastRunAt:n(e.path)}))}async function Zd(n){let e=n.toLowerCase(),t=[];for(let r of Fo(G).filter(s=>!s.serverOnly).sort((s,i)=>i.mtime-s.mtime)){let s="";try{s=pw(r.path,"utf8")}catch{continue}let i=[];for(let l of s.split(`
|
|
2047
|
+
`)){let c=l.replace(/\s+/g," ").trim();c&&i.push({text:c,lower:c.toLowerCase()})}let{hitCount:o,snippet:a}=Hs(i,e);o&&t.push({path:r.path,hitCount:o,snippet:a})}return t}async function ef(n,e){let t=G;e!=null&&sr(n,e);let r=await ks(n,{cwd:t,open:!1,trust:e});return{ok:!0,file:r.file,pid:r.pid,url:r.url,trust:!!r.trust}}async function tf(n){return{cap:await ju(n)}}async function nf(n,e){return sr(n,e),{ok:!0}}async function rf(n,e){return He(n,e)}async function sf(){return Ys&&Date.now()-Ys.fetchedAt<=yC?Ys.samples:(Jd??=bC().finally(()=>{Jd=null}),Jd)}async function bC(){try{let n=await fetch(`${gC}/api/scripts/u/samples?stubs`,{signal:AbortSignal.timeout(mw)});if(!n.ok)throw new Error(`HTTP ${n.status}`);let e=await n.json(),t=i=>i.order??Number.MAX_SAFE_INTEGER,r=i=>Date.parse(i.createdAt??"")||0,s=e.filter(i=>i.slug!=="welcome").sort((i,o)=>t(i)-t(o)||r(o)-r(i)).map(i=>({slug:i.slug,name:i.name,description:wl(i.config)}));return Ys={samples:s,fetchedAt:Date.now()},s}catch{return Ys?.samples??[]}}async function of(n){return Yd.test(n)?yw(hw,"samples",n,!0):{ok:!1,error:"bad slug"}}async function lf(){let n=af();if(!n)return{bulbs:[]};let e=`${Ma()}
|
|
2048
|
+
${n}`;return Yt?.key===e&&Date.now()-Yt.fetchedAt<=wC?{user:Yt.user,bulbs:Yt.bulbs}:(Wd??=vC(e,n).finally(()=>{Wd=null}),Wd)}async function Kd(n,e,t){let r=await fetch(`${n}${e}`,{headers:t,signal:AbortSignal.timeout(mw)});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 vC(n,e){let t={Authorization:`Bearer ${e}`};try{let r=Ma(),s;try{s=await Kd(r,"/api/me",t)}catch{let a=new URL(r);r=`${a.protocol}//api.${a.host}`,s=await Kd(r,"/api/me",t)}let o=(await Kd(r,"/api/scripts/list",t)).filter(a=>a.userSlug===s.slug&&!a.isTemplate).map(a=>({slug:a.slug,name:a.name,description:wl(a.config)}));return Yt={key:n,user:s.slug,bulbs:o,fetchedAt:Date.now()},{user:s.slug,bulbs:o}}catch{return Yt?.key===n?{user:Yt.user,bulbs:Yt.bulbs}:{bulbs:[]}}}async function cf(n,e,t=!1){return!Yd.test(e)||!Yd.test(n)?{ok:!1,error:"bad slug"}:yw(Ma(),n,e,t)}async function yw(n,e,t,r){let s=ba(e,t);try{let i=await Sa({origin:n,userSlug:e,slug:t,dest:Tn(G,s)},{force:r,token:af(),timeoutMs:gw});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 uf(n,e=!1){let t=af();if(!t)return{ok:!1,error:"no TYPEBULB_TOKEN in .env"};try{let r=va(n,G,Ma()),s=await xa(r,{token:t,force:e,timeoutMs:gw});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 gC,hw,yC,mw,gw,Ys,Jd,Yd,wC,Yt,Wd,Ma,af,Ba=S(()=>{"use strict";kr();Ht();Ud();Z();gC="https://api.typebulb.com",hw="https://typebulb.com",yC=3600*1e3,mw=5e3,gw=15e3,Ys=null,Jd=null;Yd=/^[a-z0-9][a-z0-9-]*$/,wC=300*1e3,Yt=null,Wd=null,Ma=()=>Xo("TYPEBULB_ORIGIN",G)||hw,af=()=>Xo("TYPEBULB_TOKEN",G)});import{readFileSync as pf,writeFileSync as ww,mkdirSync as SC,appendFileSync as vw,rmSync as bw}from"fs";import{join as Fa,dirname as kC}from"path";import{createServer as xC}from"http";function Vt(n){try{return JSON.parse(pf(n,"utf8"))}catch{return null}}function ja(n,e){SC(kC(n),{recursive:!0}),ww(n,JSON.stringify(e,null,2)+`
|
|
2049
2049
|
`)}function kw(n,e,t){let r=Fa(n,".gitignore"),s="";try{s=pf(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(`
|
|
2050
2050
|
`)?`
|
|
2051
2051
|
`:"";try{vw(r,a+t+`
|
|
2052
2052
|
`+o.join(`
|
|
2053
2053
|
`)+`
|
|
2054
|
-
`)}catch(l){console.error("[switcher] .gitignore update failed",z(l))}}function
|
|
2054
|
+
`)}catch(l){console.error("[switcher] .gitignore update failed",z(l))}}function OC(n){let e=i=>{let o=i.exec(n);return o?Number(o[1]):0},t=e(/"cache_read_input_tokens":\s*(\d+)/),r=e(/"cache_creation_input_tokens":\s*(\d+)/),s=e(/"input_tokens":\s*(\d+)/);t>0||r>0?Gs="live":s>PC&&(Gs="uncached")}function Ew(n,e){let t={"content-type":"application/json",authorization:`Bearer ${e}`,"anthropic-version":n.headers["anthropic-version"]||"2023-06-01",...zu},r=n.headers["anthropic-beta"];return typeof r=="string"&&(t["anthropic-beta"]=r),t}function _C(n){if(Array.isArray(n?.messages))for(let e of n.messages){if(!Array.isArray(e?.content))continue;let t=e.content.filter(r=>r?.type!=="thinking"&&r?.type!=="redacted_thinking");t.length&&t.length!==e.content.length&&(e.content=t)}}function Aw(n){let e;try{e=JSON.parse(n)}catch{return n}zs=typeof e?.model=="string"?e.model:null,it&&(e.model=it),On&&(e.provider=xw(On));let t=/haiku/i.test(zs||"");return Xs!=null&&!t&&(e.reasoning={effort:df[Xs]}),delete e.thinking,e.output_config&&delete e.output_config.effort,_C(e),JSON.stringify(e)}function CC(){let n="",e=0,t=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 t.clear(),e=0,i;case"content_block_start":{if(r.has(a.content_block?.type))return t.set(a.index,null),null;let l=e++;return t.set(a.index,l),a.index=l,`event: ${a.type}
|
|
2055
2055
|
data: ${JSON.stringify(a)}
|
|
2056
2056
|
|
|
2057
2057
|
`}case"content_block_delta":case"content_block_stop":{let l=t.get(a.index);return l==null?null:(a.index=l,`event: ${a.type}
|
|
@@ -2059,11 +2059,11 @@ data: ${JSON.stringify(a)}
|
|
|
2059
2059
|
|
|
2060
2060
|
`)}default:return i}};return i=>{n+=i;let o="",a;for(;(a=n.indexOf(`
|
|
2061
2061
|
|
|
2062
|
-
`))!==-1;){let l=n.slice(0,a);if(n=n.slice(a+2),!l.trim())continue;let c=s(l);c!==null&&(o+=c)}return o}}function
|
|
2062
|
+
`))!==-1;){let l=n.slice(0,a);if(n=n.slice(a+2),!l.trim())continue;let c=s(l);c!==null&&(o+=c)}return o}}function RC(n){return new Promise(e=>{let t=[];n.on("data",r=>t.push(r)),n.on("end",()=>e(Buffer.concat(t).toString("utf8"))),n.on("error",()=>e(Buffer.concat(t).toString("utf8")))})}function Vs(n,e,t,r){n.writableEnded||(n.writeHead(e,{"content-type":"application/json"}),n.end(JSON.stringify({type:"error",error:{type:t,message:r}})))}async function IC(n,e,t){if(!it){Vs(e,400,"invalid_request_error",TC);return}let r=process.env.OPENROUTER_API_KEY;if(!r){Vs(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(hf,{method:"POST",headers:Ew(n,r),body:Aw(t),signal:s.signal})}catch(u){Vs(e,502,"api_error",`proxy upstream failed: ${z(u)}`);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?CC():null;try{for(;;){let{done:u,value:d}=await l.read();if(u)break;if(d)if(f){let h=c.decode(d,{stream:!0});OC(h);let g=f(h);g&&e.write(g)}else e.write(Buffer.from(d))}}catch{}finally{e.writableEnded||e.end()}}async function NC(n,e,t){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(t.length/4))}))};if(!it||!r)return s();try{let i=await fetch(`${hf}/count_tokens`,{method:"POST",headers:Ew(n,r),body:Aw(t)});if(!i.ok)return s();let o=await i.text();e.writeHead(200,{"content-type":"application/json"}),e.end(o)}catch{s()}}function $C(n,e){let t=n.url||"/";if(n.method==="HEAD"){e.writeHead(200),e.end();return}if(n.method!=="POST"){Vs(e,404,"not_found_error",t);return}RC(n).then(r=>{if(t.includes("count_tokens"))return NC(n,e,r);if(t.includes("/v1/messages"))return IC(n,e,r);Vs(e,404,"not_found_error",t)})}function LC(){return Pr&&Pn?Promise.resolve(Pn):new Promise((n,e)=>{let t=xC($C);t.on("error",e),t.listen(0,"127.0.0.1",()=>{Pr=t,Pn=t.address().port,console.log(`[switcher] wire proxy listening on ${Da(Pn)}`),n(Pn)})})}function MC(){try{Pr?.close()}catch{}Pr=null,Pn=null}function BC(n,e){let t=Ua(n),r=Vt(t),s=r||{};if((!s.env||typeof s.env!="object")&&(s.env={}),s.env.ANTHROPIC_BASE_URL===Da(e)&&s.env.ANTHROPIC_AUTH_TOKEN)return;let i=qa(n);if(!Vt(i)){let a={};for(let l of Sw)a[l]=l in s.env?s.env[l]:null;ja(i,{managedBy:"agent-switcher",fileExisted:r!==null,snapshot:a,active:null})}s.env.ANTHROPIC_BASE_URL=Da(e),s.env.ANTHROPIC_AUTH_TOKEN=AC,ja(t,s),kw(n,[".claude/settings.local.json",".claude/.cc-switcher.json"],"# agent switcher (local Claude Code model override)")}function DC(n,e,t){let r=qa(n),s=Vt(r)||{managedBy:"agent-switcher",fileExisted:!1,snapshot:{}};s.active={model:e,provider:t},ja(r,s)}function Tw(n){let e=Ua(n),t=qa(n),r=Vt(t),s=Vt(e);if(s?.env){let i=r?.snapshot||{};for(let o of Sw){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{bw(e,{force:!0})}catch{}else ja(e,s)}try{bw(t,{force:!0})}catch{}}async function jC(){let n=!!process.env.OPENROUTER_API_KEY,e=[];try{e=(await ft()).filter(r=>r.provider==="openrouter"&&!mf(r.name)).map(r=>({id:r.name,label:r.friendlyName||r.name}))}catch(r){console.error("[switcher] model list failed",z(r))}let t=e.length?void 0:Hu()??void 0;return{hasKey:n,models:e,error:t}}async function FC(){if(Pr&&it)return{active:!0,managed:!0,model:it,port:Pn,provider:On,routedModel:zs,caching:Gs,reasoning:Xs,externalBaseUrl:null};let n=Vt(Ua(G))?.env||{};return{active:!1,managed:!1,model:null,port:null,provider:null,routedModel:null,caching:"unknown",reasoning:Xs,externalBaseUrl:n.ANTHROPIC_BASE_URL||null}}async function Pw(n,e){let t=await LC();return it=n,On=e,BC(G,t),t}async function UC({model:n}){if(!process.env.OPENROUTER_API_KEY)return{ok:!1,error:"OPENROUTER_API_KEY not set \u2014 add a key first"};if(!n)return{ok:!1,error:"no model given"};if(mf(n))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 Pw(n,gf[n]??null),zs=null,Gs="unknown",DC(G,n,On)}catch(e){return{ok:!1,error:`failed to start the wire proxy: ${z(e)}`}}return{ok:!0}}async function qC({level:n}){return n!=null&&(!Number.isInteger(n)||n<0||n>=df.length)?{ok:!1,error:`reasoning level must be 0\u2013${df.length-1} or null`}:(Xs=n,{ok:!0,level:n})}async function JC(){return Tw(G),it=null,On=null,zs=null,Gs="unknown",{ok:!0}}async function WC({key:n}){let e=(n||"").trim();if(!e)return{ok:!1,error:"empty key"};let t=G,r=Fa(t,".env"),s="";try{s=pf(r,"utf8")}catch{}try{if(/^\s*OPENROUTER_API_KEY\s*=/m.test(s))ww(r,s.replace(/^\s*OPENROUTER_API_KEY\s*=.*$/m,`OPENROUTER_API_KEY=${e}`));else{let i=s&&!s.endsWith(`
|
|
2063
2063
|
`)?`
|
|
2064
2064
|
`:"";vw(r,i+`OPENROUTER_API_KEY=${e}
|
|
2065
|
-
`)}}catch(i){return{ok:!1,error:z(i)}}return process.env.OPENROUTER_API_KEY=e,kw(t,[".env"],"# secrets"),{ok:!0}}function
|
|
2066
|
-
`)}catch(o){return{ok:!1,error:`could not write ${n}: ${z(o)}`}}return{ok:!0,count:e.length}}var
|
|
2065
|
+
`)}}catch(i){return{ok:!1,error:z(i)}}return process.env.OPENROUTER_API_KEY=e,kw(t,[".env"],"# secrets"),{ok:!0}}function KC(){if(!(!Pr&&!it)){try{Tw(G)}catch{}MC()}}function HC(n,e){return Ow.test(e)?"blocked by your OpenRouter data policy":n===401||n===403||/unauthor|invalid api key|no auth|forbidden/i.test(e)?"auth rejected \u2014 check your OpenRouter key":n===404||/not a valid model|no such model|unknown model|model not found/i.test(e)?"model not found on this route":n===429||/rate limit/i.test(e)?"rate limited":n===402||/insufficient|credit|quota|balance/i.test(e)?"out of credits / quota":e.slice(0,160)}function YC(n){if(Ow.test(n))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 VC(n,e,t){if(!n)return{works:null,read:0,note:t?`couldn't re-test on ${t} \u2014 caching unconfirmed`:"caching unconfirmed"};let r=ff(e?.cache_read_input_tokens)||ff(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 zC({model:n}){let e=process.env.OPENROUTER_API_KEY;if(!e)return{ok:!1,error:"OPENROUTER_API_KEY not set \u2014 add a key first"};if(!n)return{ok:!1,error:"no model given"};if(mf(n))return{ok:!1,error:"Anthropic model \u2014 not offered or probed via OpenRouter"};let t=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:n,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:xw(a)}:i),u=await fetch(hf,{method:"POST",signal:l.signal,headers:s,body:f}),d=await u.json().catch(()=>({}));return{r:u,j:d}}finally{clearTimeout(c)}};try{let{r:a,j:l}=await o();if(!a.ok){let E=l?.error?.message||l?.message||JSON.stringify(l).slice(0,300);return{ok:!0,callable:!1,status:a.status,ms:Date.now()-t,error:HC(a.status,E),restriction:YC(E)}}let c=typeof l?.provider=="string"?l.provider:void 0,f=l?.content?.find?.(E=>E.type==="text")?.text??l?.content?.[0]?.text??"ok",u=ff(l?.usage?.cache_creation_input_tokens),{r:d,j:h}=await o(c),{works:g,read:p,note:y}=VC(d.ok,h?.usage,c);return g===!0&&c&&(gf[n]=c,it===n&&(On=c)),{ok:!0,callable:!0,status:a.status,ms:Date.now()-t,provider:c,sample:String(f).trim().slice(0,60),cache:{works:g,created:u,read:p,note:y}}}catch(a){let l=z(a);return{ok:!0,callable:!1,ms:Date.now()-t,error:/abort/i.test(l)?"timed out (20s)":l}}}var EC,hf,AC,TC,Sw,PC,df,Ua,qa,Da,mf,Pr,Pn,it,On,zs,Gs,Xs,gf,ff,xw,Ow,_w=S(()=>{"use strict";kr();Ht();Dt();EC="https://openrouter.ai/api",hf=`${EC}/v1/messages`,AC="typebulb-proxy-managed",TC="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.",Sw=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],PC=5e3,df=["low","medium","high"],Ua=n=>Fa(n,".claude","settings.local.json"),qa=n=>Fa(n,".claude",".cc-switcher.json"),Da=n=>`http://127.0.0.1:${n}`;mf=n=>/^anthropic\//i.test(n)||/claude/i.test(n),Pr=null,Pn=null,it=null,On=null,zs=null,Gs="unknown",Xs=1,gf={},ff=n=>typeof n=="number"?n:0,xw=n=>({order:[n],allow_fallbacks:!1});Ow=/data policy|no endpoints|no allowed providers|privacy|requires.*(training|logging|data)/i;(async function(){try{let e=Vt(qa(G)),t=e?.active?.model;if(!t)return;let s=(Vt(Ua(G))?.env||{}).ANTHROPIC_BASE_URL||"";if(!/127\.0\.0\.1|localhost/.test(s))return;let i=await Pw(t,e.active.provider??gf[t]??null);console.log(`[switcher] re-adopted override after restart: ${t} via ${Da(i)}`)}catch(e){console.error("[switcher] boot reconcile failed",z(e))}})()});var Rw={};ui(Rw,{agentMessage:()=>ko,attach:()=>rR,blockToMarkdown:()=>So,breakout:()=>zd,capText:()=>Ae,cleanUserText:()=>Lt,clearSwitchModel:()=>JC,closeChild:()=>oR,composerPasteRead:()=>aR,displayName:()=>GC,downloadSample:()=>of,firstLineDigest:()=>Ne,git:()=>Xe,gitChangedFiles:()=>jd,gitDiff:()=>Fd,info:()=>XC,isHiddenTurn:()=>ys,launchBulb:()=>ef,listBreakouts:()=>Gd,listBulbFiles:()=>Qd,listChildren:()=>sR,listMyBulbs:()=>lf,listSamples:()=>sf,listSessions:()=>eR,listSwitchModels:()=>jC,logInlineStatus:()=>ZC,openChild:()=>iR,openFile:()=>Vd,poll:()=>QC,predictTrustOf:()=>tf,probeModel:()=>zC,pullRemoteBulb:()=>cf,pushLocalBulb:()=>uf,readBulbLog:()=>rf,repoRoot:()=>En,saveOpenRouterKey:()=>WC,searchBulbs:()=>Zd,searchSessions:()=>tR,sessionPeek:()=>nR,setBulbTrust:()=>nf,setReasoning:()=>qC,setSwitchModel:()=>UC,shutdownSwitcher:()=>KC,stopBreakout:()=>Xd,summarizeTurn:()=>lR,switchState:()=>FC,toolResultDigest:()=>bu});var Cw,GC,XC,QC,ZC,eR,tR,nR,rR,sR,iR,oR,aR,lR,Iw=S(()=>{"use strict";La();xo();Ba();Ks();_w();xo();ms();Cw=new Yn,GC=Cw.displayName,{info:XC,poll:QC,logInlineStatus:ZC,listSessions:eR,searchSessions:tR,sessionPeek:nR,attach:rR,listChildren:sR,openChild:iR,closeChild:oR,composerPasteRead:aR,summarizeTurn:lR}=Tr(Cw)});var $w={};ui($w,{attach:()=>gR,breakout:()=>zd,closeChild:()=>wR,composerPasteRead:()=>vR,displayName:()=>cR,downloadSample:()=>of,git:()=>Xe,gitChangedFiles:()=>jd,gitDiff:()=>Fd,info:()=>uR,launchBulb:()=>ef,listBreakouts:()=>Gd,listBulbFiles:()=>Qd,listChildren:()=>yR,listMyBulbs:()=>lf,listSamples:()=>sf,listSessions:()=>pR,logInlineStatus:()=>fR,openChild:()=>bR,openFile:()=>Vd,poll:()=>dR,predictTrustOf:()=>tf,pullRemoteBulb:()=>cf,pushLocalBulb:()=>uf,readBulbLog:()=>rf,repoRoot:()=>En,searchBulbs:()=>Zd,searchSessions:()=>hR,sessionPeek:()=>mR,setBulbTrust:()=>nf,stopBreakout:()=>Xd,summarizeTurn:()=>SR});var Nw,cR,uR,dR,fR,pR,hR,mR,gR,yR,bR,wR,vR,SR,Lw=S(()=>{"use strict";La();Su();Ba();Ks();Nw=new zn,cR=Nw.displayName,{info:uR,poll:dR,logInlineStatus:fR,listSessions:pR,searchSessions:hR,sessionPeek:mR,attach:gR,listChildren:yR,openChild:bR,closeChild:wR,composerPasteRead:vR,summarizeTurn:SR}=Tr(Nw)});import{readFileSync as kR,writeFileSync as xR,mkdirSync as ER}from"fs";import{homedir as AR}from"os";import*as Ja from"path";async function Dw(){try{let n=await fetch(new URL("/api/tags",Bw()).toString(),{signal:AbortSignal.timeout(TR)});return n.ok?((await n.json()).models??[]).map(t=>t.name).filter(t=>!!t):[]}catch{return[]}}function jw(n){let e;try{e=kR(n,"utf-8")}catch{return{json:void 0,unreadable:!1}}try{let t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;return{json:r,unreadable:"providers"in r&&!yf(r)}}}catch{}return{json:void 0,unreadable:!0}}function yf(n){let e=n?.providers;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function PR(n){let e=yf(n);if(!e||!("ollama"in e))return null;let t=e.ollama?.models;return Array.isArray(t)?t.map(r=>r?.id).filter(r=>typeof r=="string"):[]}async function Fw(){let{json:n,unreadable:e}=jw(Mw());return e?{installed:[],configured:null}:{installed:await Dw(),configured:PR(n)}}async function Uw(){let n=await Dw();return n.length?OR(Mw(),n,Bw()):{ok:!1,error:"Ollama is not running (or has no models installed)"}}function OR(n,e,t){let{json:r,unreadable:s}=jw(n);if(s)return{ok:!1,error:`could not parse ${n} \u2014 edit the ollama provider there yourself`};let i={...r??{},providers:{...yf(r)??{},ollama:{baseUrl:`${t}/v1`,api:"openai-completions",apiKey:"ollama",models:e.map(o=>({id:o}))}}};try{ER(Ja.dirname(n),{recursive:!0}),xR(n,JSON.stringify(i,null,2)+`
|
|
2066
|
+
`)}catch(o){return{ok:!1,error:`could not write ${n}: ${z(o)}`}}return{ok:!0,count:e.length}}var TR,Mw,Bw,qw=S(()=>{"use strict";Ht();kr();TR=1500,Mw=()=>Ja.join(AR(),".pi","agent","models.json"),Bw=()=>or(process.env.OLLAMA_HOST??"http://localhost:11434")});var Ww={};ui(Ww,{attach:()=>MR,breakout:()=>zd,closeChild:()=>jR,composerFiles:()=>JR,composerNew:()=>qR,composerPaste:()=>HR,composerPasteRead:()=>YR,composerRpc:()=>KR,composerSend:()=>FR,composerStop:()=>UR,composerUiRespond:()=>WR,displayName:()=>_R,downloadSample:()=>of,git:()=>Xe,gitChangedFiles:()=>jd,gitDiff:()=>Fd,info:()=>CR,launchBulb:()=>ef,listBreakouts:()=>Gd,listBulbFiles:()=>Qd,listChildren:()=>BR,listMyBulbs:()=>lf,listSamples:()=>sf,listSessions:()=>NR,logInlineStatus:()=>IR,ollamaOffer:()=>Fw,ollamaSync:()=>Uw,openChild:()=>DR,openFile:()=>Vd,poll:()=>RR,predictTrustOf:()=>tf,pullRemoteBulb:()=>cf,pushLocalBulb:()=>uf,readBulbLog:()=>rf,repoRoot:()=>En,searchBulbs:()=>Zd,searchSessions:()=>$R,sessionPeek:()=>LR,setBulbTrust:()=>nf,shutdownComposer:()=>zR,stopBreakout:()=>Xd,summarizeTurn:()=>VR});var Jw,_R,CR,RR,IR,NR,$R,LR,MR,BR,DR,jR,FR,UR,qR,JR,WR,KR,HR,YR,VR,zR,Kw=S(()=>{"use strict";La();Bd();Ba();Ks();qw();Jw=new Er,_R=Jw.displayName,{info:CR,poll:RR,logInlineStatus:IR,listSessions:NR,searchSessions:$R,sessionPeek:LR,attach:MR,listChildren:BR,openChild:DR,closeChild:jR,composerSend:FR,composerStop:UR,composerNew:qR,composerFiles:JR,composerUiRespond:WR,composerRpc:KR,composerPaste:HR,composerPasteRead:YR,summarizeTurn:VR,shutdownComposer:zR}=Tr(Jw)});import*as dS from"fs/promises";import*as kt from"path";di();Z();function uu(n){if(!qe.includes(n))throw new Error(`Unknown block kind '${n}' (one of: ${qe.join(", ")})`);return n}function Pg(n){let e=[];for(let t of n){let r=t.indexOf("=");if(r<=0||r===t.length-1)throw new Error(`Expected <kind>=<source>, got '${t}' (e.g. data=results.json, or data=- for stdin)`);let s=uu(t.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:t.slice(r+1)})}if(e.filter(t=>t.source==="-").length>1)throw new Error("Only one <kind>=- can read stdin");return e}xo();Su();Bd();var Wa={claude:{adapter:()=>new Yn,server:()=>Promise.resolve().then(()=>(Iw(),Rw))},codex:{adapter:()=>new zn,server:()=>Promise.resolve().then(()=>(Lw(),$w))},pi:{adapter:()=>new Er,server:()=>Promise.resolve().then(()=>(Kw(),Ww))}};function Hw(n){return n in Wa}function Or(){return Object.keys(Wa)}function Yw(){return Object.fromEntries(Object.entries(Wa).map(([n,e])=>[n,e.adapter]))}function Vw(n){return Wa[n].server()}var Qs=Yw();function zw(){for(let n of Object.values(Qs))try{n().ensureHarnessSupport()}catch{}}function _n(){for(let n of Object.keys(Qs))try{if(Qs[n]().detectsSelf())return n}catch{}}function Gw(n){let e=Or(),t=new Map(e.filter(i=>Qs[i]).map(i=>[i,Qs[i]()]));for(let[i,o]of t)if(o.detectsSelf())return{name:i};let r=[...t].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=>t.get(i).listSessionFiles(n).length>0;return{ambiguous:[...r].sort((i,o)=>Number(s(o))-Number(s(i)))}}var wf=5e3;function bf(n){try{return n()}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}}function Xw(n){let t={subcommand:"run",file:"",watch:!0,open:process.env.TERM_PROGRAM==="vscode"||_n()!==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","trust","untrust","models","slug","send","pull","push","get","put"],s=n[0];if(s==="agent"||s?.startsWith("agent:")){t.subcommand="agent";let o=s.indexOf(":");if(o!==-1){let a=s.slice(o+1);a&&(t.agentTarget=a)}n=n.slice(1)}else s&&r.includes(s)&&(t.subcommand=s,n=n.slice(1));let i=[];for(let o=0;o<n.length;o++){let a=n[o];if(a==="--help"||a==="-h")t.help=!0;else if(a==="--version"||a==="-V")t.version=!0;else if(a==="--no-watch")t.watch=!1;else if(a==="--open")t.open="window";else if(a==="--no-open")t.open="none";else if(a==="--server")t.server=!0;else if(a==="--trust")t.trust=!0;else if(a==="--no-trust")t.noTrust=!0;else if(a==="--force")t.force=!0;else if(a==="--mode"){let l=n[++o];(!l||l.startsWith("-"))&&(console.error("Missing value for --mode (e.g. --mode staging)"),process.exit(1)),t.mode=l}else if(a==="--follow"||a==="-f")t.follow=!0;else if(a==="--clear")t.clear=!0;else if(a==="--run"){let l=n[++o];if(l==="latest")t.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)),t.run=c}}else if(a==="--bulbs")t.stopScope="bulbs";else if(a==="--agent")t.stopScope="agent";else if(a==="--global")t.stopScope="global";else if(a==="--match"){let l=n[++o];l===void 0&&(console.error("Missing value for --match (a literal substring new log lines must contain)"),process.exit(1)),t.match=l}else if(a==="--timeout"){let l=parseInt(n[++o],10);(isNaN(l)||l<=0)&&(console.error(`Invalid --timeout value: ${n[o]} (seconds)`),process.exit(1)),t.timeoutSec=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)),t.sendWaitMs=l}else t.sendWaitMs=wf;else if(a==="--lines"||a==="-n"){let l=parseInt(n[++o],10);(isNaN(l)||l<0)&&(console.error(`Invalid --lines value: ${n[o]}`),process.exit(1)),t.lines=l}else if(a==="--port"||a==="-p"){let l=n[++o],c=parseInt(l,10);isNaN(c)&&(console.error(`Invalid port: ${l}`),process.exit(1)),t.port=c}else if(a==="--replace"||a.startsWith("--replace=")){let l=a.startsWith("--replace=")?a.slice(10):n[++o]??"",c=bf(()=>Hf(l));t.local&&(console.error(`--replace can only be used once (got '${t.local.name}' and '${c.name}')`),process.exit(1)),t.local=c}else if(a==="--args"||a.startsWith("--args=")){t.hasArgsFlag=!0;let l=a.startsWith("--args=")?a.slice(7):n[++o];l===void 0&&(console.error("Missing value for --args (a JSON array, or - to read it from stdin)"),process.exit(1)),t.argsJson=l}else if(!a.startsWith("-")||a==="-"&&t.subcommand==="send")["call","send","get","put","slug"].includes(t.subcommand)?i.push(a):t.file=a;else{let l=t.subcommand==="call"?" (for a negative or dash-leading argument, use --args '<json-array>')":"";console.error(`Unknown option: ${a}${l}`),process.exit(1)}}return t.subcommand==="call"&&(i.length<2&&(console.error("Usage: typebulb call <file> <fn> [arg\u2026]"),process.exit(1)),t.file=i[0],t.fn=i[1],t.callArgs=i.slice(2)),t.subcommand==="send"&&(i.length<1&&(console.error("Usage: typebulb send <file> [message]"),process.exit(1)),t.file=i[0],t.sendMessage=i[1]),t.subcommand==="slug"&&(i.length||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1)),t.slugName=i.join(" ")),t.subcommand==="get"&&(i.length!==2&&(console.error("Usage: typebulb get <file> <kind>"),process.exit(1)),t.file=i[0],t.blockKind=bf(()=>uu(i[1]))),t.subcommand==="put"&&(i.length<2&&(console.error("Usage: typebulb put <file> <kind>=<source> [<kind>=<source> \u2026]"),process.exit(1)),t.file=i[0],t.blockPairs=bf(()=>Pg(i.slice(1)))),t}function Qw(){console.log(`
|
|
2067
2067
|
typebulb - Local bulb runner for Typebulb
|
|
2068
2068
|
|
|
2069
2069
|
Usage:
|
|
@@ -2236,7 +2236,7 @@ Examples:
|
|
|
2236
2236
|
typebulb my-editor.bulb.md
|
|
2237
2237
|
typebulb --no-watch my-editor.bulb.md
|
|
2238
2238
|
typebulb .
|
|
2239
|
-
`)}wt();xs();di();Ts();wt();import*as Ue from"path";import{spawn as
|
|
2239
|
+
`)}wt();xs();di();Ts();wt();import*as Ue from"path";import{spawn as xI,execSync as EI}from"child_process";import{createRequire as AI}from"module";import{existsSync as TI}from"fs";import*as ye from"fs/promises";import*as me from"path";var vf=[{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"}],Sf=[{name:"dom"},{name:"dom.iterable"},{name:"dom.asynciterable"}];function kf(n,e){if(!e)return n.filter(s=>!s.since);let t={"5.0":0,"5.5":1},r=t[e];return n.filter(s=>!s.since||t[s.since]<=r)}Z();var GR=`
|
|
2240
2240
|
/**
|
|
2241
2241
|
* Get raw data chunk from the Data tab.
|
|
2242
2242
|
* @param index - Chunk index (0-based). Separate chunks with 2 blank lines.
|
|
@@ -2247,7 +2247,7 @@ Examples:
|
|
|
2247
2247
|
* @param index - Chunk index (0-based)
|
|
2248
2248
|
* @throws If chunk is not valid JSON/JSON-ish
|
|
2249
2249
|
*/
|
|
2250
|
-
json<T = unknown>(index: number): T;`,
|
|
2250
|
+
json<T = unknown>(index: number): T;`,XR=`
|
|
2251
2251
|
/**
|
|
2252
2252
|
* Get the insight data produced by the inference layer.
|
|
2253
2253
|
*
|
|
@@ -2256,7 +2256,7 @@ Examples:
|
|
|
2256
2256
|
*
|
|
2257
2257
|
* @returns The parsed insight JSON, or undefined if no insight is available
|
|
2258
2258
|
*/
|
|
2259
|
-
insight<T = unknown>(): T | undefined;`,
|
|
2259
|
+
insight<T = unknown>(): T | undefined;`,QR=`
|
|
2260
2260
|
/**
|
|
2261
2261
|
* Replace the data this run is working on.
|
|
2262
2262
|
*
|
|
@@ -2363,7 +2363,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2363
2363
|
* \`tb.mode\` or the length of \`tb.models()\` \u2014 which hosts offer a courtesy
|
|
2364
2364
|
* model is the host's business and changes without your bulb changing.
|
|
2365
2365
|
*/
|
|
2366
|
-
aiAccess(): Promise<AiAccess>;`,
|
|
2366
|
+
aiAccess(): Promise<AiAccess>;`,ZR="\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;",sv=`
|
|
2367
2367
|
/**
|
|
2368
2368
|
* The mode this bulb is running in.
|
|
2369
2369
|
*
|
|
@@ -2402,7 +2402,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2402
2402
|
* \`tb.fs\` already resolves relative paths against it, so bulb code writing
|
|
2403
2403
|
* its own files never needs it. CLI only \u2014 throws in ide/published/inline mode.
|
|
2404
2404
|
*/
|
|
2405
|
-
readonly dir: string;`,
|
|
2405
|
+
readonly dir: string;`,eI=`
|
|
2406
2406
|
/**
|
|
2407
2407
|
* Async value inspector for tensor-like objects.
|
|
2408
2408
|
*
|
|
@@ -2455,14 +2455,14 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
2455
2455
|
*
|
|
2456
2456
|
* @returns The full canonical URL
|
|
2457
2457
|
*/
|
|
2458
|
-
url(): Promise<string>;`,
|
|
2458
|
+
url(): Promise<string>;`,tI="\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;",nI="\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;",rI="\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>>;",xf=`${ev}${tv}
|
|
2459
2459
|
/**
|
|
2460
2460
|
* Typebulb utilities namespace.
|
|
2461
2461
|
* Type \`tb.\` to discover available helpers.
|
|
2462
2462
|
*/
|
|
2463
|
-
declare const tb: {${
|
|
2463
|
+
declare const tb: {${GR}${eI}${XR}${QR}${nI}${rI}${tI}${nv}${iv}${ov}${rv}${ZR}${sv}
|
|
2464
2464
|
};
|
|
2465
|
-
`,
|
|
2465
|
+
`,sI=`
|
|
2466
2466
|
/**
|
|
2467
2467
|
* Print to the CLI's stdout \u2014 the same channel as \`console.log\` here (the server's console IS
|
|
2468
2468
|
* the bulb's log). One log verb across blocks: page-side \`tb.log\` reaches this same stdout.
|
|
@@ -2472,30 +2472,30 @@ declare const tb: {${zR}${ZR}${GR}${XR}${tI}${nI}${eI}${nv}${iv}${ov}${rv}${QR}$
|
|
|
2472
2472
|
* Typebulb utilities namespace (server-side).
|
|
2473
2473
|
* Type \`tb.\` to discover available helpers.
|
|
2474
2474
|
*/
|
|
2475
|
-
declare const tb: {${
|
|
2475
|
+
declare const tb: {${sI}${nv}${iv}${ov}${rv}${sv}
|
|
2476
2476
|
};
|
|
2477
|
-
`;mt();import
|
|
2477
|
+
`;mt();import lI from"p-limit";mt();import{resolve as lv}from"resolve.exports";var vt={maxRelativeTypeRefs:500,maxBareDeps:8,maxBareDepth:3,prefetchConcurrency:4,negativeTtlMs:1e4},Zs=["index.d.ts","index.d.mts"],Af=/\.d\.(ts|mts|cts)$/i;function Ka(n){return/\.d\.(ts|mts|cts)(?:[?#].*)?$/i.test(n)||/[?&]dts(?:[&#]|$)/i.test(n)}function av(n){return[`${n}.d.ts`,`${n}.d.mts`]}function zt(n){if(!n||n==="./"||n==="/")return[...Zs];let e=n.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),t=av(e),r=e.endsWith("/")?e:`${e}/`;return t.push(...av(`${r}index`)),t}async function _r(n,{retries:e=2,timeoutMs:t=15e3,init:r}={}){for(let s=0;s<=e;s++){let i=new AbortController,o=setTimeout(()=>i.abort(),t);try{let a=await fetch(n,{...r,signal:i.signal});if(iI(a.status)&&s<e)continue;return a}catch{if(s<e)continue;return}finally{clearTimeout(o)}}}function iI(n){return n===408||n===429||n>=500&&n<600}var Ha=class{constructor(e,t){this.fetchDts=e,this.cdnClient=t}async tryUrls(e){for(let t of e){let r=await this.fetchDts(t);if(r&&(this.looksLikeDts(r.dts)||Ka(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,t){let r=this.cdnClient.packageJson(new F({name:e,version:t})),s=await _r(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:t??i.version})),version:t}}extractPathFromResult(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.find(t=>typeof t=="string")}async tryUntilSuccess(e,t){for(let r of e){let s=await t(r);if(s)return s}}async resolveFromSelected(e,t,r){if(e.kind==="types"){let o=wn(e.path);if(!o||o==="/"||o===".")return this.tryUntilSuccess([...Zs],t);if(!Af.test(o)){let a=await this.tryUntilSuccess(zt(o),t);if(a)return a}return t(o)}let s=zt(e.path),i=r?.subpath?[...s,...Zs]:[...Zs,...s];return this.tryUntilSuccess(i,t)}toResolutionResult(e){return{kind:Af.test(e)?"types":"probe",path:e}}resolveExportsPath(e,t){let r=t||".",s=e;try{let i=this.extractPathFromResult(lv(s,r,{conditions:["types"]}));if(i)return i}catch{}try{return this.extractPathFromResult(lv(s,r,{browser:!0,conditions:["import","default","module","browser","node"]}))}catch{return}}async resolve(e){try{let t=F.parse(e),{pkg:r,baseDir:s}=await this.loadPackageAtVersionedRoot(t.name,t.version)||{};if(!r||!s)return;let i={name:t.name,version:t.version},o=new F(i).format(),a=new F({...i,subpath:t.subpath}).format(),l=u=>this.fetchCandidateFrom(s,t.name,u);if(t.subpath){let u=fd(t.subpath),d=this.resolveExportsPath(r,u);if(d){let g=await this.resolveFromSelected(this.toResolutionResult(d),l,{subpath:!0});if(g)return{...g,resolvedPkg:a}}let h=await this.tryUntilSuccess(zt(u),l);if(h)return{...h,resolvedPkg:a}}let c=r.types??r.typings;if(c){let u=await this.resolveFromSelected({kind:"types",path:c},l);if(u)return{...u,resolvedPkg:o}}let f=this.resolveExportsPath(r,".");if(f){let u=await this.resolveFromSelected(this.toResolutionResult(f),l);if(u)return{...u,resolvedPkg:o}}return}catch{return}}async fetchCandidateFrom(e,t,r){let s=wn(r),i=new URL(s,e).toString(),o=await this.tryUrls([i]);return o?{dts:o.dts,url:o.url,resolvedPkg:t}:void 0}};mt();import{gunzipSync as oI}from"fflate";var Ya=class{async fetchAndExtract(e,t){let r=this.getTarballUrl(e,t),s=await _r(r,{timeoutMs:3e4});if(!s?.ok)return new Map;let i=new Uint8Array(await s.arrayBuffer());return this.extractDtsFiles(i)}getTarballUrl(e,t){return`https://registry.npmjs.org/${e.replace("/","%2F")}/-/${e.split("/").pop()}-${t}.tgz`}normalizeTarPath(e){let t=e.replace(/^package\//,""),r=t.indexOf("/");return r>0?t.substring(r+1):t}extractDtsFiles(e){let t=new Map;try{let r=oI(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),u=s.decode(f).trim().replace(/\0/g,""),d=parseInt(u,8)||0,h=String.fromCharCode(o[156]);if(i+=512,(h==="0"||h==="\0")&&(c.endsWith(".d.ts")||c.endsWith(".d.mts"))){let g=r.slice(i,i+d);t.set(this.normalizeTarPath(c),s.decode(g))}i+=Math.ceil(d/512)*512}}catch{}return t}};var Va=class{constructor(e,t,r=new Ya){this.cdnClient=e,this.cache=t,this.tarballFetcher=r}typesNameCandidates(e){let t=e.startsWith("@")?e.slice(1).replace("/","__"):e;return t.includes(".")?[t,t.split(".").join("-"),t.split(".").join("")]:[t]}selectTypesVersion(e,t,r){try{if(r){let i=vn.majorOf(r),o=e.filter(a=>vn.majorOf(a)===i);if(o.length)return o.sort((a,l)=>vn.cmp(l,a))[0]}let s=t?.latest;return s&&e.includes(s)?s:e[0]}catch{return e[0]}}subpathCandidates(e){let t=e.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),r=zt(e);return t!==e&&r.push(`${e}.d.ts`,`${e}/index.d.ts`),r}async fetchFromVersionedRoot(e,t){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=t.subpath?this.subpathCandidates(t.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:t.subpath?new F(t).format():t.name}}}async resolve(e){let t=F.parse(e);if(t.name)for(let r of this.typesNameCandidates(t.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,t.version),a=await this.fetchFromVersionedRoot(`${s}@${o}`,t);if(a)return a}}};var za=class{collectRelativeTypeRefs(e){return this.collectRefs(e).filter(t=>t.startsWith("./")||t.startsWith("../"))}collectBareModuleRefs(e){return this.collectRefs(e).filter(t=>this.isBare(t))}collectRefs(e){let t=e.split(`
|
|
2478
2478
|
`).filter(s=>{let i=s.trimStart();return!(i.startsWith("*")||i.startsWith("//")||i.startsWith("/*"))}).join(`
|
|
2479
|
-
`),r=new Set;for(let s of t.matchAll(/(import|export)\s+[^'"\n]*from\s*['"]([^'"\n]+)['"]/g))r.add(s[2]);for(let s of t.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://"))}};mt();var cv="file:///node_modules",Ga=class{constructor(){this.epoch=0}bumpEpoch(){this.epoch+=1}epochDir(){return`__tsepoch_${this.epoch}`}pathForMain(e){return`${cv}/${this.epochDir()}/${e}/index.d.ts`}pathFor(e,t){let r=wn(t);return`${cv}/${this.epochDir()}/${e}/${r}`}};import{LRUCache as
|
|
2480
|
-
`);await this.prefetchBareDeps(
|
|
2481
|
-
`,"utf8"),await ye.writeFile(me.join(e,"code.tsx"),n.code,"utf8"),await ye.writeFile(me.join(e,"tb.d.ts"),xf,"utf8"),{dir:e}}var Pf={target:"es2023",module:"esnext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0};function
|
|
2482
|
-
`,"utf8"),{dir:e}}function
|
|
2483
|
-
`))console.log(`${e} ${r}`);return n.length>0}function
|
|
2479
|
+
`),r=new Set;for(let s of t.matchAll(/(import|export)\s+[^'"\n]*from\s*['"]([^'"\n]+)['"]/g))r.add(s[2]);for(let s of t.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://"))}};mt();var cv="file:///node_modules",Ga=class{constructor(){this.epoch=0}bumpEpoch(){this.epoch+=1}epochDir(){return`__tsepoch_${this.epoch}`}pathForMain(e){return`${cv}/${this.epochDir()}/${e}/index.d.ts`}pathFor(e,t){let r=wn(t);return`${cv}/${this.epochDir()}/${e}/${r}`}};import{LRUCache as aI}from"lru-cache";function uv(n){let e=new aI({ttl:vt.negativeTtlMs,max:500}),t=new Map;return async function(s){try{if(await n.isNegative(s)||e.has(s))return;let i=await n.getCachedFile(s);if(i)return{dts:i,url:s};let o=t.get(s);if(o)return o;let a=(async()=>{let l=await _r(s,{init:{cache:"no-store"}});if(!l?.ok){l?.status===404&&(e.set(s,!0),await n.recordNegative(s));return}let c=await l.text(),f=l.url||s;return await n.clearNegative(s),await n.setCachedFile(f,c),{dts:c,url:f}})();return t.set(s,a),await a.finally(()=>t.delete(s))}catch{return}}}var ei=class{constructor(e){this.inFlight=new Map,this.scanner=new za,this.cache=e.cache,this.cdnClient=e.cdnClient,this.versionResolver=e.versionResolver,this.packageService=e.packageService,this.fetchDts=uv(e.cache),this.typescriptProvider=new Ha(this.fetchDts,e.cdnClient),this.definitelyTypedProvider=new Va(e.cdnClient,e.cache),this.virtualFs=new Ga}withInFlight(e,t){let r=this.inFlight.get(e);if(r)return r;let s=t().finally(()=>this.inFlight.delete(e));return this.inFlight.set(e,s),s}invalidate(){this.virtualFs.bumpEpoch(),this.inFlight.clear()}pushFileIfNew(e,t,r){e.some(s=>s.path===t)||e.push({path:t,content:r})}createStubDef(e){let t=this.virtualFs.pathForMain(e);return{pkg:e,mainPath:t,files:[{path:t,content:"export const _shim: any; export default _shim;"}],shims:[{module:e,path:t}]}}async fetchViaProviders(e){for(let t of[this.typescriptProvider,this.definitelyTypedProvider])try{let r=await t.resolve(e);if(r?.dts)return r}catch{}}async fetchRootDts(e,t){let{effectivePackage:r,root:s,pinned:i}=await this.versionResolver.effectivePackage(e,t),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 t=e.pathname.match(/^(.+@[^/]+\/)/);return t?new URL(t[1],e.origin):new URL("./",e)}toVirtualPath(e,t,r){let s=t.pathname.startsWith(e.pathname)?t.pathname.slice(e.pathname.length):`__deps__/${encodeURIComponent(t.toString()).replace(/%/g,"_")}.d.ts`;return this.virtualFs.pathFor(r,s)}computeEntryPath(e,t){if(!e)return{mainPath:this.virtualFs.pathForMain(t),packageRootUrl:void 0};let r=new URL(e),s=this.extractPackageRootUrl(r);return{mainPath:this.toVirtualPath(s,r,t),packageRootUrl:s}}async expandRelativeRefs(e,t,r,s,i=new Set,o){if(!i.has(t)&&(i.add(t),!(i.size>vt.maxRelativeTypeRefs)))try{let a=new URL(t),l=new URL("./",a);o??(o=this.extractPackageRootUrl(a));let c=this.scanner.collectRelativeTypeRefs(e).slice(0,vt.maxRelativeTypeRefs);for(let f of c)await this.tryRelativeRef(f,l,o,r,s,i)}catch{}}async tryRelativeRef(e,t,r,s,i,o){try{let a=new URL(e,t),l=a.pathname+a.search,c=Ka(l)?[l]:zt(l);for(let f of c){let d=new URL(f,a).toString();if(o.has(d))return;let h=await this.fetchDts(d);if(h?.dts){let g=this.toVirtualPath(r,new URL(h.url),s);this.pushFileIfNew(i,g,h.dts),await this.expandRelativeRefs(h.dts,h.url,s,i,o,r);return}}}catch{}}isDifferentPackage(e,t){return e===t?!1:new F(e).name!==new F(t).name}ambientlyDeclares(e,t){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===t||s.endsWith("/*")&&t.startsWith(s.slice(0,-1)))return!0}return!1}markFileAmbient(e,t){let r=e.find(s=>s.path===t);r&&(r.ambient=!0)}async prefetchBareDeps(e,t,r,s,i){try{let o=this.scanner.collectBareModuleRefs(e).slice(0,vt.maxBareDeps).filter(c=>this.isDifferentPackage(c,t));if(!o.length)return;let a=new Set([t]),l=lI(vt.prefetchConcurrency);await Promise.all(o.map(c=>l(()=>this.prefetchBareDepsRecursive(c,r,s,vt.maxBareDepth,a,i).catch(()=>{}))))}catch{}}async prefetchBareDepsRecursive(e,t,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(t,c,a.dts),this.ambientlyDeclares(a.dts,e)?this.markFileAmbient(t,c):r.push({module:e,path:c}),a.url&&await this.expandRelativeRefs(a.dts,a.url,l,t);let f=this.scanner.collectBareModuleRefs(a.dts).slice(0,vt.maxBareDeps).filter(u=>!i.has(u));for(let u of f)await this.prefetchBareDepsRecursive(u,t,r,s-1,i,o)}async resolve(e,t,r){let s=await this.packageService.extractImports(e),i=r?[...s,...r]:s;return(await Promise.all(i.map(a=>this.resolveOne(a,t)))).filter(a=>!!a)}async resolveOne(e,t){let{effectivePackage:r}=await this.versionResolver.effectivePackage(e,t);return this.withInFlight(r,async()=>{let s=new F(e),i=await this.fetchRootDts(e,t)??(s.subpath?await this.fetchRootDts(s.name,t):void 0);return i?this.buildDefFromContent(e,i,i.resolvedPkg||e,t):this.createStubDef(e)})}async buildDefFromContent(e,t,r,s){let{dts:i,url:o,resolvedPkg:a}=t,l=new F(a||r),c=l.version?`${l.name}@${l.version}`:l.name,{mainPath:f,packageRootUrl:u}=this.computeEntryPath(o,c),d=[{path:f,content:i}],h=[];o&&await this.expandRelativeRefs(i,o,c,d,void 0,u);let g=d.map(P=>P.content).join(`
|
|
2480
|
+
`);await this.prefetchBareDeps(g,c,d,h,s);let p=l.format(),y=e===p?[e]:[e,p],E=y.some(P=>this.ambientlyDeclares(i,P));return E?this.markFileAmbient(d,f):h.push(...y.map(P=>({module:P,path:f}))),{pkg:e,mainPath:f,files:d,shims:h,ambient:E}}};kd();mt();mr();Fs();vd();hr();import*as Cr from"path";var cI=Cr.join(ra,"pkg"),uI=Cr.join(ra,"files"),dI=Cr.join(ra,"negative.json"),Qa=class{pkgMem=new Map;fileMem=new Map;negativeCache=new Sn(new gr(dI));async getCachedDts(e){if(this.pkgMem.has(e))return this.pkgMem.get(e);await te();let t=await gt(dv(e));return this.pkgMem.set(e,t),t}async setCachedDts(e,t,r){let s={content:t,url:r};this.pkgMem.set(e,s),await Xa(async()=>{await te(),await Be(dv(e),JSON.stringify(s))})}async getCachedFile(e){if(this.fileMem.has(e))return this.fileMem.get(e);await te();let t=await na(fv(e));return this.fileMem.set(e,t),t}async setCachedFile(e,t){this.fileMem.set(e,t),await Xa(async()=>{await te(),await Be(fv(e),t)})}isNegative(e){return this.negativeCache.isNegative(e)}async recordNegative(e){await Xa(async()=>{await te(),await this.negativeCache.recordNegative(e)})}clearNegative(e){return Xa(()=>this.negativeCache.clearNegative(e))}};async function Xa(n){try{await n()}catch{}}function dv(n){return Cr.join(cI,Ve(n)+".json")}function fv(n){return Cr.join(uI,Ve(n)+".txt")}mr();var Tf;function fI(){return Tf||(Tf=new ei({cache:new Qa,cdnClient:pb,packageService:aa,versionResolver:fb})),Tf}var pv="file:///node_modules/";async function hv(n){let e=sa(n.emitKey,"typecheck");await te(),await ye.rm(e,{recursive:!0,force:!0}),await ye.mkdir(e,{recursive:!0});let t=gI(n.jsxImportSource,n.dependencies),r=await fI().resolve(n.code,n.dependencies,t),s=n.local?.name,i=s?r.filter(f=>f.pkg!==s):r,o=new Set;for(let f of i)for(let u of f.files){let d=Za(u.path);if(!d||o.has(d))continue;o.add(d);let h=me.join(e,"node_modules",d);await ye.mkdir(me.dirname(h),{recursive:!0}),await ye.writeFile(h,u.content,"utf8")}let a={};for(let f of i)for(let u of f.shims){let d=Za(u.path);d&&(a[u.module]=[`./node_modules/${d}`])}for(let f of i){if(f.ambient)continue;let u=Za(f.mainPath);u&&(a[f.pkg]=[`./node_modules/${u}`])}let l=new Set;for(let f of i)for(let u of f.files){if(!u.ambient)continue;let d=Za(u.path);d&&l.add(`node_modules/${d}`)}if(n.local){delete a[n.local.name];let f=await yI(n.local,e);f?a[n.local.name]=[`./node_modules/${n.local.name}/${f}`]:console.warn(` local: '${n.local.name}' ships no type defs; check cannot type against it.`)}let c=pI(n.jsxImportSource,a,[...l]);return await ye.writeFile(me.join(e,"tsconfig.json"),JSON.stringify(c,null,2)+`
|
|
2481
|
+
`,"utf8"),await ye.writeFile(me.join(e,"code.tsx"),n.code,"utf8"),await ye.writeFile(me.join(e,"tb.d.ts"),xf,"utf8"),{dir:e}}var Pf={target:"es2023",module:"esnext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0};function pI(n,e,t=[]){return{compilerOptions:{...Pf,lib:hI([...vf,...Sf]),jsx:"react-jsx",jsxImportSource:n??"react",paths:e},include:["code.tsx","tb.d.ts",...t]}}function hI(n){return kf(n).map(e=>mI(e.name))}function mI(n){return n.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 gI(n,e){let t=n??("react"in e?"react":void 0);return t?[`${t}/jsx-runtime`,`${t}/jsx-dev-runtime`]:[]}function Za(n){if(!n.startsWith(pv))return;let e=n.slice(pv.length),t=e.indexOf("/");if(!(t<0))return e.slice(t+1)}async function yI(n,e){if(!n.typesAbs)return;let t=me.dirname(n.typesAbs),r=me.join(e,"node_modules",n.name);for(let s of await bI(t)){let i=me.join(r,me.relative(t,s));await ye.mkdir(me.dirname(i),{recursive:!0}),await ye.copyFile(s,i)}return me.basename(n.typesAbs)}async function bI(n){let e=[];async function t(r){let s=await ye.readdir(r,{withFileTypes:!0});for(let i of s){let o=me.join(r,i.name);i.isDirectory()?await t(o):/\.d\.ts(\.map)?$/.test(i.name)&&e.push(o)}}return await t(n),e}import*as Fe from"fs/promises";import*as St from"path";import{existsSync as wI}from"fs";mr();Ed();var vI="^22";async function mv(n){let e=sa(n.emitKey,"typecheck-server");await te(),await Fe.rm(e,{recursive:!0,force:!0}),await Fe.mkdir(e,{recursive:!0});let t=St.join(n.bulbDir,".typebulb"),r=ha(n.server).filter(o=>o!==n.local?.name);await pa([`@types/node@${vI}`,...r],t,n.dependencies,{ignoreScripts:!0});let s=St.join(t,"node_modules"),i=St.join(e,"node_modules");return await kI(s,i),await Fe.writeFile(St.join(e,"server.ts"),n.server,"utf8"),await Fe.writeFile(St.join(e,"tb.d.ts"),Ef,"utf8"),await Fe.writeFile(St.join(e,"tsconfig.json"),JSON.stringify(SI(n.local),null,2)+`
|
|
2482
|
+
`,"utf8"),{dir:e}}function SI(n){let e={...Pf,lib:["ES2023"],types:["node"]};if(n?.typesAbs){let t=i=>i.replace(/\\/g,"/"),r=t(St.dirname(n.typesAbs)),s=t(n.typesAbs).replace(/\.d\.ts$/,"");e.paths={[n.name]:[s],[`${n.name}/*`]:[`${r}/*`]}}return{compilerOptions:e,include:["server.ts","tb.d.ts"]}}async function kI(n,e){if(!wI(n)){await Fe.mkdir(e,{recursive:!0});return}await Fe.rm(e,{recursive:!0,force:!0});let t=process.platform==="win32"?"junction":"dir";await Fe.symlink(n,e,t)}qo();Z();async function yv(n,e){let{bulb:t,config:r,warnings:s,starts:i}=await Ge(n),o=Ue.basename(n),a=p=>i.get(p)??1;!t.code&&!t.server&&(console.error("Bulb has neither **code.tsx** nor **server.ts**; nothing to check."),process.exit(1));let l=!1,c=!1;for(let p of s)console.log(`structure ${p}`);s.length&&(l=!0);let f=vr(Ue.resolve(n)),u=f?Kn(t.name):"";f&&u&&u!==f.slug&&(console.log(`naming filename '${f.slug}.bulb.md' doesn't match the title '${t.name}' \u2014 its slug derives to '${u}'. Rename the file to '${u}.bulb.md', or change name: to suit the filename.`),c=!0),t.code&&(l=gv(Es(t.code,{target:"client",dependencies:r.dependencies??{},lineOffset:a("code.tsx")}),"client")||l),t.server&&(l=gv(Es(t.server,{target:"server",lineOffset:a("server.ts")}),"server")||l);let d=CI([process.cwd(),Ue.dirname(n)]);if(!d){let p=Ue.relative(process.cwd(),n)||n;console.error("check: TypeScript not found \u2014 install it once, then re-run:"),console.error(" npm i -g typescript"),console.error(` typebulb check ${p}`),process.exit(2)}let h=[];if(t.code){let{dir:p}=await hv({code:t.code,dependencies:r.dependencies??{},jsxImportSource:r.ts?.jsxImportSource,emitKey:n,local:e});h.push({role:"client",dir:p})}if(t.server){let{dir:p}=await mv({server:t.server,bulbDir:Ue.dirname(n),emitKey:n,local:e?{name:e.name,typesAbs:e.typesAbs}:void 0,dependencies:r.dependencies});h.push({role:"server",dir:p})}for(let{role:p,dir:y}of h){let{stdout:E,exitCode:P}=await OI(d,y);for(let C of E.split(/\r?\n/))C.trim()&&console.log(`${p} ${PI(C,o,a)}`);P!==0&&(l=!0)}l&&process.exit(1);let g=[t.code&&"code.tsx",t.server&&"server.ts"].filter(Boolean).join(", ");console.error(c?`\u2713 type-checks (${g}) \u2014 see the naming warning above`:`\u2713 no issues (${g})`)}function gv(n,e){for(let t of n)for(let r of t.message.split(`
|
|
2483
|
+
`))console.log(`${e} ${r}`);return n.length>0}function PI(n,e,t){return n.replace(/\b(code\.tsx|server\.ts)\((\d+),(\d+)\)/g,(r,s,i,o)=>`${e}(${Number(i)+t(s)-1},${o})`)}function OI(n,e){return new Promise(t=>{let r=xI(process.execPath,[n,"--noEmit"],{cwd:e}),s="";r.stdout?.on("data",i=>{s+=i.toString()}),r.stderr?.on("data",i=>{s+=i.toString()}),r.on("close",i=>t({stdout:s,exitCode:i??1}))})}var _I=AI(import.meta.url);function CI(n){let e=r=>{try{let s=_I.resolve("typescript/package.json",{paths:r}),i=Ue.join(Ue.dirname(s),"lib","tsc.js");return TI(i)?i:void 0}catch{return}},t=e(n);if(t)return t;try{let r=EI("npm root -g",{encoding:"utf8"}).trim();return e([r])}catch{return}}wt();Uo();Ts();async function bv(n,e){let{bulb:t}=await Ge(n),r=rr(t);if(hn(n)){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.)")}Ts();import*as ti from"path";async function wv(n,e){if(!n){e||(console.error("Usage: typebulb untrust <file.bulb.md>"),process.exit(1));let r=Ku();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 t=ti.resolve(n);t.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1));try{sr(t,e)}catch(r){console.error(r.message),process.exit(1)}console.log(e?`Trusted ${ti.basename(t)} \u2014 runs with fs / AI / server.ts (no --trust needed).`:`Untrusted ${ti.basename(t)} \u2014 runs Restricted.`),console.log(` ${t}`)}$e();import*as kv from"readline";cd();function Of(n){let e=t=>r=>n?`\x1B[${t}m${r}\x1B[0m`:r;return{lit:e("38;5;70"),litLink:e("4;38;5;70"),brand:e("38;5;135")}}var RI=5e3,el=()=>Math.round(performance.now()),vv=n=>n>=1e3?`${(n/1e3).toFixed(1)}s`:`${n}ms`;async function xv(n){let e=Gw(process.cwd()),t=el();if("ambiguous"in e){let r=await II(n,e.ambiguous);return r?Sv(n,r,{boot:t,from:el()}):NI(n,e.ambiguous)}return Sv(n,e.name,{boot:t,from:el()})}async function Sv(n,e,t){let r,s;try{r=await Mu(e)}catch(h){s=h instanceof Error?h.message:String(h)}let i=el()-t.from,{lit:o,litLink:a,brand:l}=Of(process.stdout.isTTY===!0),c=[" Read the authoring skill before writing a bulb:",` \u2022 ${o(Cs())}`],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')}`," raise the shell tool's timeout_ms to 130000"," (its 10s default kills even a clean ok)"]:[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],u=t.boot+i>RI?[` slow launch: boot ${vv(t.boot)} \xB7 mirror ${vv(i)}`]:[],d=[` ${l(`typebulb v${n}`)}`,...u,...f,""];process.stdout.write(d.join(`
|
|
2484
2484
|
`)+`
|
|
2485
|
-
`)}async function
|
|
2485
|
+
`)}async function II(n,e){if(!process.stdin.isTTY||!process.stdout.isTTY)return;let{lit:t,brand:r}=Of(!0),s=[` ${r(`typebulb v${n}`)}`," More than one agent harness is available here.",...e.map((o,a)=>` ${t(String(a+1))}) ${o}`),""];process.stdout.write(s.join(`
|
|
2486
2486
|
`)+`
|
|
2487
|
-
`);let i=kv.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
|
|
2487
|
+
`);let i=kv.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 NI(n,e){let{lit:t,brand:r}=Of(process.stdout.isTTY===!0),s=[` ${r(`typebulb v${n}`)}`," More than one agent harness is available here."," Open the mirror for the one you want:",...e.map(i=>` \u2022 ${t(`npx typebulb agent:${i}`)}`),""];process.stdout.write(s.join(`
|
|
2488
2488
|
`)+`
|
|
2489
|
-
`)}pt();mn();async function Ev(n){Me(n);let e=await ft();if(e.length>0){console.log(Iy(e,process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL));return}if(!Yu()){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[t,r]of Object.entries(
|
|
2490
|
-
`+e)}function Rf(n,e,t,r,s){let i=
|
|
2489
|
+
`)}pt();mn();async function Ev(n){Me(n);let e=await ft();if(e.length>0){console.log(Iy(e,process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL));return}if(!Yu()){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[t,r]of Object.entries(ir))console.log(` ${r.padEnd(20)} (${t})`);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.")}Z();function Av(n){n?.trim()||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1));let e=Kn(n);e||(console.error(`'${n}' has no slug \u2014 a bulb name needs at least one letter or digit.`),process.exit(1)),console.log(e)}tt();import*as Ov from"path";import{valid as Pv,lt as LI}from"semver";$e();var Qe={connected:"[page] connected",disconnected:"[page] disconnected",closed:n=>`[page] closed: ${n}`},_f=3e3,Tv=1e4,$I=2500,tl=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,t){this.attached.add(e);for(let s of[...this.arrivalWaiters])s(!0);let r={page:e,firstAttach:t,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 t=this.dropAt=Date.now();setTimeout(()=>{this.attached.size===0&&this.dropAt===t&&this.settledEmpty?.()},_f).unref()}async closeAll(e){let t=[...this.attached];if(!t.length)return{told:0,gone:0};await Promise.all(t.map(s=>s.close(e).catch(()=>{}))),await this.whenGone(t,$I);let r=t.filter(s=>!this.leaving.has(s)).length;for(let s of t)this.leaving.delete(s);return{told:t.length,gone:r}}whenArrives(e){return this.attached.size>0?Promise.resolve(!0):e>0?new Promise(t=>{let r=i=>{clearTimeout(s),this.arrivalWaiters.delete(r),t(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,t){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()},t);i.unref(),this.goneWaiters.add(s)}):Promise.resolve()}drainIfGone(){for(let e of[...this.goneWaiters])e()}};No();function MI(n,e,t,r){if(/^\d+$/.test(e))return n.find(i=>i.pid===parseInt(e,10));let s=e==="agent"?n.filter(ge):n.filter(i=>i.agent===e);if(s.length){if(!t)return s[0];let i=s.filter(o=>er(o,t));return r&&i.find(o=>o.agent===r)||i[0]}return n.find(i=>re(i.file)===re(e))}var Rr=n=>n.agent??Ov.basename(n.file);function _v(n){return n===Le?!1:n&&Pv(n)&&Pv(Le)?LI(n,Le):!0}function BI(n){return n===Le?"":n?_v(n)?` STALE runtime v${n} (this CLI is v${Le} \u2014 relaunch to update)`:` runtime v${n} (newer than this CLI's v${Le})`:" STALE runtime (predates the version stamp \u2014 relaunch to update)"}function DI(n,e){return e===void 0?" pages ?":e>0?` ${e} page${e===1?"":"s"}`:ge(n)?" NO PAGE (no tab open on it)":" NO PAGE (nothing of it is running)"}function Cv(n,e,t){n.forEach((r,s)=>e(` ${r.url} pid ${r.pid} ${r.trust?"trusted":"restricted"}${t?DI(r,t[s]):""}${BI(r.version)} ${r.file}`))}async function Cf(n,e){if(!n.length){console.log("No running bulb servers.");return}let t=await Promise.all(n.map(Lu));console.log("Running bulb servers:"),Cv(n,r=>console.log(r),t),console.log(`
|
|
2490
|
+
`+e)}function Rf(n,e,t,r,s){let i=MI(n,e,r,s);if(i)return i;console.error(`No running server for '${e}'.`),n.length?(console.error(`Running servers (try \`typebulb ${t} <file|pid>\`):`),Cv(n,o=>console.error(o))):console.error("No bulb servers are running."),process.exit(1)}async function Rv(n,e){if(!n){e.clear&&(console.error("Specify which server to clear: typebulb logs --clear <file|pid>"),process.exit(1)),await Cf(await X(process.cwd()),"Run `typebulb logs <file|pid>` to print one server's console.");return}let t=Rf(await X(),n,"logs",process.cwd(),_n());if(e.clear){Ou(t.pid),console.log(`Cleared log for ${Rr(t)} (pid ${t.pid}).`);return}let r=He(t.pid),s=r.text;if(e.run!==void 0?(s=Cu(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(`
|
|
2491
2491
|
`);i.length&&i[i.length-1]===""&&i.pop(),s=i.slice(-e.lines).join(`
|
|
2492
2492
|
`)}if(process.stdout.write(s),s&&!s.endsWith(`
|
|
2493
2493
|
`)&&process.stdout.write(`
|
|
2494
|
-
`),e.follow&&e.run===void 0){let i=r.offset,o=setInterval(()=>{let l=He(t.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
|
|
2495
|
-
`);y=x.pop()??"";let I=!1;for(let N of x)N.trim()&&(
|
|
2496
|
-
`).trimEnd()}function
|
|
2494
|
+
`),e.follow&&e.run===void 0){let i=r.offset,o=setInterval(()=>{let l=He(t.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 jI=n=>new Promise(e=>setTimeout(e,n));async function Iv(n,e){if(!n){Cf(await X(process.cwd()),"Run `typebulb wait <file|pid>` to block until one logs a new line.");return}let t=Rf(await X(),n,"wait",process.cwd(),_n()),r=process.env.TYPEBULB_WAIT_SHIM==="1",s=process.env.TYPEBULB_WAIT_FOLLOW==="1",i=r||s,o=e.timeoutSec??1800,a=e.match??"",l=He(t.pid).offset,c=s?void 0:Lo(t.pid,a)??(a?Lo(t.pid):void 0),f=s?l:c!==void 0&&c<=l?c:a?0:l,u=Date.now()+o*1e3,d=ge(t)?1e4:1e3,h=2e3,g=!ge(t)&&!s,p,y="",E=0;for(;;){let P=f>=l,C=He(t.pid,f);if(f=C.offset,C.text){y+=C.text;let x=y.split(`
|
|
2495
|
+
`);y=x.pop()??"";let I=!1;for(let N of x)N.trim()&&(g&&P&&N.startsWith(Qe.disconnected)&&(I=!0),!(e.match&&!N.includes(e.match))&&(console.log(N),!s&&(p??=Date.now()+d,ge(t)&&(N.includes("] compile error")||N.includes("] runtime error"))&&(p=Math.min(p,Date.now()+h)))));if(I&&!p){console.error(`the last page of ${Rr(t)} closed while waiting \u2014 a bulb runs in its page, so nothing can log ${e.match?`'${e.match}'`:"anything"} now`),E=3;break}}if(p&&Date.now()>=p)break;if(!i&&!p&&Date.now()>=u){console.error(`timeout: no ${e.match?`line matching '${e.match}'`:"new output"} from ${Rr(t)} within ${o}s`),E=2;break}if(!Xn(t.pid)){p||(console.error(`server ${Rr(t)} (pid ${t.pid}) exited while waiting`),process.exit(3));break}await jI(400)}s||vs(t.pid,f,a),process.exit(E)}function Nv(n,e){if(e==="killed")return` \u2014 forced (${_v(n.version)?`its runtime ${n.version?`v${n.version} `:""}predates the stop route`:"it did not answer"}); a page it opened may still be open`;let t=[];return e.closed&&t.push(`closed ${e.closed} page${e.closed===1?"":"s"}`),e.stuck&&t.push(`${e.stuck} did not close`),t.length?` \u2014 ${t.join(", ")}`:""}async function $v(n){if(!n){await Cf(await X(process.cwd()),"Run `typebulb stop <file|pid>` to stop one.");return}let e=Rf(await X(),n,"stop",process.cwd(),_n()),t=await Bt(e);console.log(`Stopped ${Rr(e)} (pid ${e.pid}, ${e.url}).${Nv(e,t)}`)}async function Lv(n){let e=process.cwd(),t=n==="agent"?_n():void 0,r=n==="global"?await X():n==="bulbs"?await X(e):(await X()).filter(o=>er(o,e)&&(!t||o.agent===t)),s=n==="global"?"server":n==="agent"?"mirror":"bulb";if(!r.length){console.log(n==="global"?"No running bulb servers.":`No running ${s}s for this project.`);return}let i=await Promise.all(r.map(o=>Bt(o)));console.log(`Stopped ${r.length} ${s}${r.length===1?"":"s"}:`),r.forEach((o,a)=>console.log(` ${o.url} pid ${o.pid} ${Rr(o)}${Nv(o,i[a])}`))}$e();tt();cn();import*as nl from"path";import*as Mv from"http";import{mkdir as FI,writeFile as UI}from"fs/promises";async function Ir(){let n=[];for await(let e of process.stdin)n.push(e);return Buffer.concat(n).toString("utf-8")}function ni(n){return(n.charCodeAt(0)===65279?n.slice(1):n).replace(/\r\n/g,`
|
|
2496
|
+
`).trimEnd()}function qI(n,e){return new Promise((t,r)=>{let s=new URL(n),i=Mv.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",()=>t({status:o.statusCode??0,text:a}))});i.setTimeout(0),i.on("error",r),i.end(e)})}var JI=n=>{let e=Math.round((Date.now()-n)/6e4);return e<1?"moments ago":e<60?`${e}m ago`:`${Math.round(e/60)}h ago`};async function Bv(n,e,t=0){e==="-"&&(e=ni(await Ir()));let r=e!==void 0&&e.startsWith("tb:");r&&t<=0&&(t=wf);let s=e!==void 0&&/^tb:(click|set)( |$)/.test(e),i=nl.resolve(n),o=dn(await X(),i)[0];if(!o){let g=(await ln(process.cwd()))(i);console.error(g?`No running server for '${n}' \u2014 it last ran ${JI(g)}. Relaunching reuses the same URL (a stale tab is one reload from live): npx typebulb ${n}`:`No running server for '${n}'. Start it first: npx typebulb ${n}`),process.exit(1)}let a=async g=>{let p=[g>0?`reply=${g}`:"",s?"solo=1":"","open=1"].filter(Boolean).join("&"),y=await qI(`${o.url}/__send${p?`?${p}`:""}`,e??"");(y.status<200||y.status>=300)&&(console.error(`send failed: HTTP ${y.status} from ${o.url}/__send`),process.exit(1));try{return JSON.parse(y.text)}catch{return{}}},l={},c=Date.now();try{l=await a(t)}catch(g){console.error(`send failed: ${g instanceof Error?g.message:String(g)}`),process.exit(1)}let f=l.clients??0,u=`${f} page${f===1?"":"s"}`;if(l.refused&&(console.error(`Actuation needs exactly one connected page; ${u} are open on ${o.url} \u2014 the reset is \`typebulb stop ${n}\` then relaunch.`),process.exit(1)),f===0){let g=l.droppedMsAgo,p=l.opening==="none"?" and no agent mirror page is open to open one through":"",y=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?`:g!==void 0?` \u2014 a page disconnected ${Math.round(g/1e3)}s ago and hasn't reconnected${p}; reload it, or open ${o.url}`:` \u2014 no page has ever connected${p}; share ${o.url} and arm: typebulb wait ${n} --match "${Qe.connected}"`;console.error(`No page connected after ${((Date.now()-c)/1e3).toFixed(1)}s, so nothing was delivered${y}`),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 ${u}.`);let d=l.results??[],h=l.errors??[];for(let g of h)console.error(`handler error: ${g}`);if(h.length&&process.exit(1),d.length>1&&(console.error(`${d.length} replies from ${u} \u2014 one reply owns stdout: at most one tb.onMessage handler, in one page, may return a value.`),process.exit(1)),d.length===1){if(e!==void 0&&/^tb:png( |$)/.test(e)){let p={};try{p=JSON.parse(d[0])}catch{}typeof p.png!="string"&&(console.error("tb:png replied with an unexpected shape \u2014 an older runtime? (`typebulb logs` lists server versions)"),process.exit(1));let y=Gg(i);await FI(nl.dirname(y),{recursive:!0}),await UI(y,Buffer.from(p.png,"base64"));let E=[p.via?`inside "${p.via}"`:"",p.backdrop?`backdrop ${p.backdrop}`:""].filter(Boolean);console.error(`canvas ${p.width}\xD7${p.height} \u2192 PNG${E.length?` (${E.join("; ")})`:""}`),console.log(y);return}let g;try{g=JSON.parse(d[0])}catch{g=void 0}console.log(typeof g=="string"?g:d[0])}else l.timedOut&&(r&&(console.error(`No reply to '${e}' within ${t/1e3}s \u2014 reload the page and retry.`),process.exit(1)),console.error(`(no reply within ${t/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)`))}ka();Nd();Z();import*as Dv from"fs/promises";async function jv(n,e){let t=await Dv.readFile(n,"utf-8"),r=Nn(t),s=ue[e].path,i=r.files.get(s);i||(console.error(i===void 0?`No **${s}** block in ${n}`:`The **${s}** block in ${n} is empty`),process.exit(2)),process.stdout.write(i.endsWith(`
|
|
2497
2497
|
`)?i:i+`
|
|
2498
|
-
`)}Z();import*as ri from"fs/promises";async function qv(n,e){let t=await ri.readFile(n,"utf-8"),r=[];for(let{kind:i,source:o}of e){let a;try{a=o==="-"?await
|
|
2498
|
+
`)}Z();import*as ri from"fs/promises";async function qv(n,e){let t=await ri.readFile(n,"utf-8"),r=[];for(let{kind:i,source:o}of e){let a;try{a=o==="-"?await Ir():await ri.readFile(o,"utf-8")}catch(l){Uv(`Cannot read ${i}'s source: ${l instanceof Error?l.message:String(l)}`)}r.push({kind:i,content:ni(a),label:o==="-"?"stdin":o})}let s;try{s=WI(t,r)}catch(i){Uv(`${n}: ${i instanceof Error?i.message:String(i)}`)}for(let i of s.upToDate)console.log(`${ue[i].path}: already up to date`);if(s.written.length){await ri.writeFile(n,s.text);for(let i of s.written)console.log(i.action==="removed"?`${ue[i.kind].path}: removed (${i.label} is empty)`:`${ue[i.kind].path}: ${i.action} from ${i.label} (${i.chars.toLocaleString()} chars)`)}}function WI(n,e){let t=Nn(n),r=n,s=[],i=[];for(let{kind:o,content:a,label:l}of e){let c=ue[o].path,f=t.files.get(c);if(!a){if(f===void 0){i.push(o);continue}r=Fv(op(r,o),r,c),s.push({kind:o,action:"removed",chars:0,label:l});continue}if(f!==void 0&&ni(f)===a){i.push(o);continue}r=Fv(Nr(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 Fv(n,e,t){if(n===e)throw new Error(`the **${t}** block's fence is unterminated; refusing to rewrite inside it`);return n}function Uv(n){console.error(n),process.exit(1)}pt();wt();Z();Uo();import*as Xt from"fs/promises";import*as Cn from"path";import{EventEmitter as fN}from"events";Dt();Z();import{Hono as GI}from"hono";import{serve as XI}from"@hono/node-server";import{streamSSE as QI}from"hono/streaming";import*as $f from"fs/promises";import ZI from"open";mr();Fs();hr();import*as If from"fs/promises";import*as si from"path";var rl=class{async get(e){let t=Ve(e),r=si.join(js,t+".bin"),s=si.join(js,t+".json");try{let[i,o]=await Promise.all([If.readFile(r),If.readFile(s,"utf8")]),a=JSON.parse(o);return{body:i,contentType:a.contentType,cacheControl:a.cacheControl}}catch{return}}async set(e,t){await te();let r=Ve(e),s=si.join(js,r+".bin"),i=si.join(js,r+".json"),o={url:e,contentType:t.contentType,cacheControl:t.cacheControl};await Promise.all([Be(s,t.body),Be(i,JSON.stringify(o))])}};var Jv=`
|
|
2499
2499
|
const CSS = '\\n' +
|
|
2500
2500
|
/* The agent mirror's token set, verbatim (agents/core/client/styles.css) \u2014 one system across CLI
|
|
2501
2501
|
chrome: app chrome sits on --panel, content wells paint --veil, grays ride one neutral tint.
|
|
@@ -2878,22 +2878,22 @@ export function runInference(ctx) {
|
|
|
2878
2878
|
showConfirm();
|
|
2879
2879
|
document.body.appendChild(host);
|
|
2880
2880
|
}
|
|
2881
|
-
`;
|
|
2882
|
-
${d}`:"";return b.text(`Forbidden: this capability requires --trust.${B}`,403)}await k()},M=async(b,k)=>{let
|
|
2883
|
-
`+
|
|
2884
|
-
Shutting down...`),(p?.pages??(ge(c)?"keep":"close"))==="close"&&await u?.closePages("stopped"),u?.close();for(let y of f)try{await y()}catch{}a(),await un(process.pid),process.exit(0)}},
|
|
2885
|
-
${i}`),console.log(` ${l}`),t&&console.log(` ${t}`),process.on("SIGINT",()=>{h()}),process.on("SIGTERM",()=>{h()}),{port:e,url:l,pageCount:()=>
|
|
2881
|
+
`;yr();$e();mn();Qo();Dt();import{stream as KI}from"hono/streaming";var HI="X-TB-Stream";function ii(n){return n instanceof Pe?{message:n.message,code:n.code,retryable:n.retryable}:{message:n instanceof Error?n.message:"Unknown error",code:"unknown",retryable:!1}}function sl(n,e){return n.header("Content-Type","application/x-ndjson; charset=utf-8"),n.header("Cache-Control","no-cache"),n.header(HI,"1"),KI(n,async t=>{let r=e[Symbol.asyncIterator]();t.onAbort(()=>{r.return?.()});try{for(;;){let{done:s,value:i}=await r.next();if(s)break;await t.writeln(JSON.stringify({type:"chunk",value:i}))}}catch(s){await t.writeln(JSON.stringify({type:"error",error:ii(s)}))}finally{try{await r.return?.()}catch{}}})}var il={log:(...n)=>console.log(...n)};function ol(n,e){let t=n?.[e]??(Object.hasOwn(il,e)?il[e]:void 0);return typeof t=="function"?t:void 0}function al(n){return n.constructor?.name==="AsyncGeneratorFunction"}Ad();var YI=/^\/(v\d+\/|stable\/|node\/|gh\/|@[^/]+\/[^@/]+@|[^@/]+@)/,VI=/[?&]target=/,zI=/^\/(?:@[^/]+\/)?[^/@]+\/[^/]+/;function Wv(n,e=""){return YI.test(n)?!0:zI.test(n)&&VI.test(e)}var eN="127.0.0.1",tN=new Set(["localhost","127.0.0.1","::1"]),zv=(n,e)=>!!n&&typeof n=="object"&&e in n,Kv=n=>{let e={};return Array.isArray(n.data)&&(e.data=n.data),zv(n,"insight")&&(e.insight=n.insight),e},Hv=8*1024*1024,nN=0;function rN(n){if(n)try{return new URL(n.includes("://")?n:`http://${n}`).hostname}catch{return}}function Gv(n){let e=rN(n);return!!e&&tN.has(e)}function sN(n){try{let e=new URL(n);return(e.protocol==="http:"||e.protocol==="https:")&&Gv(e.host)}catch{return!1}}function iN(n){return!!n&&/\bCode\/\d/.test(n)&&/\bElectron\//.test(n)}function oN(n,e){if(!e)return!1;try{return new URL(n).host===e}catch{return!1}}function oi(n){return n instanceof Error?n.message:"Unknown error"}var Yv=n=>n.how==="editor"||n.how==="unreached"?n.via:void 0,aN=2e3;async function Xv(n){let{getHtml:e,basePath:t,fsBase:r,port:s,reloadEmitter:i,sendChannel:o,getServerExports:a,getBulbBlocks:l,saveInferenceResult:c,localOverride:f,trusted:u=!1,trustHint:d,staticAssets:h,bulbAssets:g,sourceFile:p,bulbKey:y,onStop:E}=n,P=`${process.pid}-${++nN}-${Date.now()}`,C=r??t,x=new GI;x.use("*",async(b,k)=>{if(!Gv(b.req.header("host")))return b.text("Forbidden: untrusted Host",403);await k()}),x.use("*",async(b,k)=>{await k(),b.res.headers.set("Cross-Origin-Opener-Policy","same-origin"),b.res.headers.set("Cross-Origin-Embedder-Policy","credentialless")});let I=[["/__fs/*","the filesystem"],["/__api/*","server-side code (server.ts)"],["/__ai","AI (your API keys)"],["/__infer","AI (your API keys)"],["/__infer-save","the filesystem"]],N=async(b,k)=>{if(!u){let O=new URL(b.req.url).pathname,$=I.find(([J])=>J.endsWith("/*")?O.startsWith(J.slice(0,-2)):O===J)?.[1]??"server-side code (server.ts)";Iu(process.pid,$);let B=d?`
|
|
2882
|
+
${d}`:"";return b.text(`Forbidden: this capability requires --trust.${B}`,403)}await k()},M=async(b,k)=>{let O=b.req.header("sec-fetch-site");if(O){if(O!=="same-origin")return b.text(`Forbidden: ${O} request`,403)}else{let $=b.req.header("origin");if($&&!oN($,b.req.header("host")))return b.text("Forbidden: cross-origin request",403)}await k()};for(let[b]of I)x.use(b,N),x.use(b,M);x.use("/__log",M),x.post("/__log",async b=>{try{let{args:k}=await b.req.json();console.log(...k||[])}catch{}return b.json({ok:!0})});let T=new tl,K=new Set,ee=new Set,Q=Date.now();T.onArrival(({page:b,firstAttach:k,count:O})=>{o&&O===1&&console.log(Qe.connected),k&&O>1&&b.close("yielded").catch(()=>{})}),o&&T.onSettledEmpty(()=>console.log(Qe.disconnected));let U,se=0,ae=async b=>{let k=Math.max(b.fresh?0:Q,T.lastDropAt);if(await T.whenArrives(_f-(Date.now()-k)))return{how:"attached"};if(Date.now()-se<aN)return{how:"none"};let O=`http://localhost:${s}#tb-relay`,$=await $u(O,t),B;return $?.where==="editor"?B={how:"editor",via:$.via}:(b.external==="force"||b.external==="follow"&&$?.where==="external")&&(await ZI(O),B={how:"external"}),B?await T.whenArrives(Tv)?B:{how:"unreached",via:Yv(B)}:(se=Date.now(),{how:"none"})},be=b=>T.count>0?Promise.resolve({how:"attached"}):U??=ae(b).finally(()=>{U=void 0});if(o){let b=0,k=new Map;x.use("/__send",M),x.post("/__send",async O=>{let $="";try{$=await O.req.text()}catch{}let B=Number(O.req.query("reply"))||0,J=T.count===0&&O.req.query("open")!==void 0?await be({external:"follow",fresh:!1}):void 0,W=T.count,Ce=W===0&&T.lastDropAt?Date.now()-T.lastDropAt:void 0,H={clients:W,droppedMsAgo:Ce,...J?{opening:J.how,via:Yv(J)}:{}};if(O.req.query("solo")!==void 0&&W!==1)return O.json({...H,refused:W>1});if(W===0)return O.json(H);let le=Zt=>{for(let xt of T)xt.send(Zt).catch(()=>{})};if(B<=0)return le({payload:$}),O.json(H);let Ee=++b,Rn=await new Promise(Zt=>{let xt={expected:W,received:0,results:[],errors:[],finish:ul=>{clearTimeout(cl),k.delete(Ee),Zt({results:xt.results,errors:xt.errors,timedOut:ul})}},cl=setTimeout(()=>xt.finish(!0),B);k.set(Ee,xt),le({id:Ee,payload:$})});return O.json({...H,...Rn})}),x.use("/__send-reply",M),x.post("/__send-reply",async O=>{try{let{id:$,results:B,errors:J}=await O.req.json(),W=k.get($);W&&(W.results.push(...B??[]),W.errors.push(...J??[]),++W.received>=W.expected&&W.finish(!1))}catch{}return O.json({ok:!0})})}x.get("/",b=>b.html(e())),x.post("/__fs/read",async b=>{try{let{path:k}=await b.req.json(),O=await Us(k,C);return new Response(new Uint8Array(O),{headers:{"Content-Type":"application/octet-stream"}})}catch(k){let O=oi(k);return b.json({error:O},400)}}),x.post("/__fs/write",async b=>{try{let k=b.req.query("path");return k?(await ma(k,new Uint8Array(await b.req.arrayBuffer()),C),b.json({success:!0})):b.json({error:"Missing path"},400)}catch(k){let O=oi(k);return b.json({error:O},400)}}),x.post("/__fs/list",async b=>{try{let{path:k}=await b.req.json();return b.json(await ga(k??".",C))}catch(k){return b.json({error:oi(k)},400)}}),x.post("/__fs/remove",async b=>{try{let{path:k}=await b.req.json();return await ya(k,C),b.json({success:!0})}catch(k){return b.json({error:oi(k)},400)}}),x.post("/__api/:name",async b=>{try{let k=b.req.param("name"),O=ol(a?.(),k);if(!O)return b.json({error:`API function '${k}' not found`},404);let{args:$}=await b.req.json();if(al(O))return sl(b,O(...$||[]));let B=await O(...$||[]);return b.json({result:B})}catch(k){let O=oi(k);return b.json({error:O},500)}}),x.post("/__ai",async b=>{try{let{messages:k,system:O,effort:$,provider:B,model:J,webSearch:W,stream:Ce}=await b.req.json();if(!k||!Array.isArray(k)||k.length===0)return b.json({message:"messages array is required",code:"unknown",retryable:!1},400);let H=ht(B,J);if(typeof H=="string")return b.json({message:H,code:"unknown",retryable:!1},400);let le=await Ft(H,{messages:k,system:O,effort:$,webSearch:W,signal:b.req.raw.signal});if(!le.ok){let Zt=await cr(le,H.protocol);return b.json(Zt,le.status)}if(Ce)return sl(b,bn(le,H.protocol));let{text:Ee,usage:Rn}=await ur(le,H.protocol);return Ee||console.warn("[tb.ai] Empty response from provider"),b.json({text:Ee,usage:Rn})}catch(k){return b.json(ii(k),500)}}),x.post("/__infer",async b=>{try{let{data:k}=await b.req.json().catch(()=>({})),O=l?.();if(!O?.infer.trim())return b.json({message:"This bulb has no infer.md block.",code:"unknown",retryable:!1},400);let $=ht();if(typeof $=="string")return b.json({message:$,code:"unknown",retryable:!1},400);let B=Array.isArray(k)?k.map(String):[],J=id(O,B),W=await Ft($,{messages:[{role:"user",content:J}],signal:b.req.raw.signal});if(!W.ok){let H=await cr(W,$.protocol);return b.json(H,W.status)}let Ce=(async function*(){let H="";for await(let Ee of bn(W,$.protocol))Ee.kind!=="text"||!Ee.text||(H+=Ee.text,yield{kind:"delta",text:Ee.text});let le=od(H);if(le.parsed===void 0)throw console.warn(`[tb.infer] output not valid JSON after sanitize; raw output (last 4000 chars):
|
|
2883
|
+
`+H.slice(-4e3)),new Pe("LLM output is not valid JSON","parse_error",!0);le.fixesApplied.length&&console.warn("[tb.infer] sanitized output, fixes applied:",le.fixesApplied.join(", ")),yield{kind:"complete",insight:le.parsed,data:B,fixesApplied:le.fixesApplied}})();return sl(b,Ce)}catch(k){return b.json(ii(k),500)}}),x.post("/__infer-save",async b=>{try{if(!c)return b.json({message:"Save is not available for this server.",code:"unknown",retryable:!1},400);let k=Kv(await b.req.json().catch(()=>({})));return Object.keys(k).length?(await c(k.data,zv(k,"insight")?JSON.stringify(k.insight,null,2):void 0),b.json({ok:!0})):b.json({message:"Nothing to save \u2014 this page holds no runtime state.",code:"unknown",retryable:!1},400)}catch(k){return b.json(ii(k),500)}}),x.get("/__infer-info",b=>{let k=l?.(),O=$r(k?.config??"").inference,$=ho(k?.data??""),B=!!k?.infer.trim(),J=ht();return typeof J=="string"?b.json({error:J,inference:O,data:$,hasInfer:B}):b.json({provider:J.protocol,model:J.model,inference:O,data:$,hasInfer:B})}),x.use("/__tb-decode",M),x.post("/__tb-decode",async b=>{let{hash:k}=await b.req.json().catch(()=>({})),O=typeof k=="string"?ld(k):void 0;return b.json(O??{error:"invalid fragment"})}),x.use("/__tb-encode",M),x.post("/__tb-encode",async b=>{let k=Number(b.req.header("content-length"));if(Number.isFinite(k)&&k>Hv)return b.json({hash:""});let O=await b.req.text().catch(()=>"");if(O.length>Hv)return b.json({hash:""});let $;try{$=JSON.parse(O)}catch{return b.json({hash:""})}return b.json({hash:ad(Kv($))})}),x.get("/__infer-ui.js",b=>b.body(Jv,200,{"Content-Type":"text/javascript; charset=utf-8"})),x.get("/__models",async b=>{try{let k=await ft();return b.json(k)}catch{return b.json([],200)}}),x.get("/__ai-access",async b=>{try{return b.json(await Wo())}catch{return b.json("none",200)}}),p&&x.get("/__source/*",async b=>{let k=await $f.readFile(p,"utf-8").catch(()=>{});return k===void 0?b.text("Not Found",404):new Response(k,{headers:{"Content-Type":"text/plain; charset=utf-8"}})});let ot=["esm.sh","unpkg.com","cdn.jsdelivr.net","cdnjs.cloudflare.com"],fe=new rl;x.get("/proxy/*",async b=>{let k=new URL(b.req.url),$=(k.pathname+k.search).slice(7),B=$.lastIndexOf("https://");return B===-1?b.text("Invalid proxy URL",400):xe(b,$.slice(B))}),f&&Vv(x,`/local/${f.name}/`,f.serveDir),h&&Vv(x,h.mount,h.dir),g&&x.get("/assets/*",async b=>{let{pathname:k}=new URL(b.req.url),O=k.slice(8),$;try{$=decodeURIComponent(O)}catch{return b.text("Not Found",404)}let B=up($);if(B)return b.text(`${B} is not an asset type: a bulb's code and markup live in the bulb; assets are media and data`,403);try{let W=await Qv($,g.dir,{"Cache-Control":"no-cache"});if(W)return W}catch{return b.text("Not Found",404)}let J=g.remoteBase;return J?b.redirect(J+O,302):b.text("Not Found",404)});async function xe(b,k){let O;try{O=new URL(k)}catch{return b.text("Invalid URL",400)}if(O.protocol!=="https:")return b.text("HTTPS only",400);if(!ot.includes(O.hostname))return b.text("Host not allowed",403);let $=await fe.get(k);if($)return new Response($.body,{status:200,headers:Nf($.contentType,$.cacheControl)});try{let B=await fetch(k,{headers:{Accept:b.req.header("Accept")||"*/*"},redirect:"follow"});if(!B.ok)return b.text(`Upstream ${B.status}`,B.status);let J=B.headers.get("Content-Type")||void 0,W=B.headers.get("Cache-Control")||void 0;if(B.body){let[Ce,H]=B.body.tee();return(async()=>{try{let le=await new Response(H).arrayBuffer();await fe.set(k,{body:Buffer.from(le),contentType:J,cacheControl:W})}catch{}})(),new Response(Ce,{status:B.status,headers:Nf(J,W)})}return new Response(null,{status:B.status,headers:Nf(J,W)})}catch(B){return b.text(`Proxy fetch failed: ${B instanceof Error?B.message:B}`,502)}}(i||o)&&(x.get("/__reload",b=>QI(b,async k=>{let O=b.req.query("bulb")||void 0;if(y&&O&&O!==y){K.has(O)||(K.add(O),console.log(Qe.closed("foreign"))),await k.writeSSE({event:"close",data:"foreign"});return}let $=()=>{k.writeSSE({event:"reload",data:""})};i?.on("reload",$);let B=()=>i?.removeListener("reload",$),J=b.req.query("relay")||void 0,W={inEditor:iN(b.req.header("user-agent")),doc:J,open:H=>k.writeSSE({event:"open-url",data:H}),send:H=>k.writeSSE({event:"message",data:JSON.stringify(H)}),close:H=>(B(),T.closing(W),console.log(Qe.closed(H)),k.writeSSE({event:"close",data:H}))},Ce=!!J&&!ee.has(J);for(J&&ee.add(J),T.add(W,Ce),k.onAbort(()=>{B(),T.dropped(W)}),await k.writeSSE({event:"hello",data:P,retry:xd});!k.aborted;)await k.sleep(3e4)})),x.use("/__open",M),x.post("/__open",async b=>{let k="";try{k=String((await b.req.json()).url??"")}catch{}if(!sN(k))return b.json({error:"a local http URL is required"},400);let O=[...T].find($=>$.inEditor);return await O?.open(k),b.json({opened:!!O,pages:T.count})})),x.use("/__stop",M),x.post("/__stop",async b=>{if(b.req.header("sec-fetch-site")||b.req.header("origin"))return b.text("Forbidden: browser request",403);let k="close";try{let $=await b.req.json();($?.pages==="keep"||$?.pages==="close")&&(k=$.pages)}catch{}let O=k==="close"?await T.closeAll("stopped"):{told:0,gone:0};return E&&setTimeout(()=>{E({pages:k})},50),b.json({closed:O.gone,stuck:O.told-O.gone,exiting:!!E})}),x.get("/__pages",b=>b.json({pages:T.count})),x.notFound(async b=>{if(b.req.method!=="GET")return b.text("Not Found",404);let k=new URL(b.req.url);return Wv(k.pathname,k.search)?xe(b,"https://esm.sh"+k.pathname+k.search):b.text("Not Found",404)});let Qt=XI({fetch:x.fetch,port:s,hostname:eN});return Qt.listening||await new Promise((b,k)=>{let O=$=>k($);Qt.once("error",O),Qt.once("listening",()=>{Qt.removeListener("error",O),b()})}),{port:s,close:()=>Qt.close(),requestPage:be,closePages:b=>T.closeAll(b),pageCount:()=>T.count}}function Nf(n,e){let t=new Headers;return n&&t.set("Content-Type",n),e&&t.set("Cache-Control",e),t.set("Access-Control-Allow-Origin","*"),t.set("Cross-Origin-Resource-Policy","cross-origin"),t}function Vv(n,e,t){n.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 Qv(decodeURIComponent(s.slice(e.length)),t)??r.text("Not Found",404)}catch{return r.text("Not Found",404)}})}async function Qv(n,e,t={}){let r=br(n,e),s=await $f.readFile(r).catch(()=>{});if(s)return new Response(s,{headers:{"Content-Type":cp(r),...t}})}$e();cn();async function ll(n){let{port:e,portNote:t,makeServerOptions:r,makeEntry:s,displayName:i,waitTarget:o,stopLog:a}=n,l=`http://localhost:${e}`,c=s(e,l),f=[],u,d=!1,h=async p=>{if(!d){d=!0,console.log(`
|
|
2884
|
+
Shutting down...`),(p?.pages??(ge(c)?"keep":"close"))==="close"&&await u?.closePages("stopped"),u?.close();for(let y of f)try{await y()}catch{}a(),await un(process.pid),process.exit(0)}},g=await Xv({...r(e),onStop:h}).catch(async p=>{if(p?.code!=="EADDRINUSE")throw p;return xu(e)});return u=g,await Ru(c),console.log(`
|
|
2885
|
+
${i}`),console.log(` ${l}`),t&&console.log(` ${t}`),process.on("SIGINT",()=>{h()}),process.on("SIGTERM",()=>{h()}),{port:e,url:l,pageCount:()=>g.pageCount(),async handOver({mode:p,fresh:y,replacedLive:E}){if(p==="none")return;let P={fresh:y,external:E?"never":p==="window"?"force":"follow"},C=await g.requestPage(P);C.how==="attached"?console.log(` Reusing the open browser tab.
|
|
2886
2886
|
`):C.how==="editor"?console.log(` Opened in VS Code via ${C.via}.
|
|
2887
2887
|
`):C.how==="external"?console.log(` Opened in your browser.
|
|
2888
2888
|
`):console.log(` ${C.how==="unreached"?`Opened ${C.via?`in VS Code via ${C.via}`:"in your browser"}, but no page attached \u2014 is the browser it opened in still there?`:ge(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."}
|
|
2889
2889
|
Share ${l}, and wake on the arrival:
|
|
2890
2890
|
typebulb wait ${o} --match "${Qe.connected}"
|
|
2891
|
-
`)},onCleanup(p){f.push(p)}}}cn();import
|
|
2892
|
-
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
|
|
2891
|
+
`)},onCleanup(p){f.push(p)}}}cn();import lN from"chokidar";import Zv from"node:fs";import cN from"node:path";var uN={persistent:!0,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}};function Gt(n){let{target:e,onChange:t,events:r="change",debounceMs:s=150}=n,i,o=lN.watch(e,uN);o.on("error",l=>console.warn(`watch: ${l instanceof Error?l.message:l} \u2014 continuing`));let a=()=>{i&&clearTimeout(i),i=setTimeout(t,s)};return r==="all"?o.on("all",a):o.on("change",a),()=>{i&&clearTimeout(i),o.close()}}var dN=n=>process.platform==="win32"||process.platform==="darwin"?n.toLowerCase()==="assets":n==="assets";function eS(n,e,t=150){let r,s=()=>{r&&clearTimeout(r),r=setTimeout(e,t)};try{let i=Zv.watch(n,{recursive:!0},(o,a)=>{a&&dN(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=cN.join(n,"assets");return Zv.existsSync(i)?Gt({target:i,onChange:e,events:"all",debounceMs:t}):()=>{}}}$e();tt();yr();async function tS(n,e,t,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=Ss(process.pid),o=e.watch?new fN:void 0,a=Me(e.mode),l=(await ln(process.cwd()))(n),c=await Gn({kind:"bulb",file:n},process.cwd()),f=await Bo(n,c);f.length&&console.log(`Replacing the running server for this bulb (pid ${f.map(ae=>ae.pid).join(", ")})`);let u=f.length>0||Date.now()-l<mb,{port:d,note:h}=await Io({target:{kind:"bulb",file:n},cwd:process.cwd()});c!==void 0&&d!==c&&u&&(console.error(`
|
|
2892
|
+
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 g=0,p=()=>console.log(_u(++g));p(),console.log(`Loading ${Cn.basename(n)}...`);let{html:y,bulb:E,serverExports:P}=await Pd(n,e.watch,e.trust,r);jt(a,n,E.server);let C=kn(n),x=vr(Cn.resolve(n)),I=e.trust?void 0:rr(E),{port:N,onCleanup:M,handOver:T,pageCount:K}=await ll({port:d,portNote:h,displayName:E.name,stopLog:i,makeServerOptions:ae=>({getHtml:()=>y,basePath:s,fsBase:wr(n),port:ae,reloadEmitter:o,sendChannel:!0,getServerExports:()=>P,getBulbBlocks:()=>({infer:E.infer,insight:E.insight,code:E.code,config:E.config,data:E.data}),saveInferenceResult:async(be,ot)=>{let fe=await Xt.readFile(n,"utf-8");be!==void 0&&(fe=Nr(fe,"data",be.join(cg))),ot!==void 0&&(fe=Nr(fe,"insight",ot)),await Xt.writeFile(n,fe)},localOverride:r?{name:r.name,serveDir:r.serveDir}:void 0,bulbAssets:{dir:C,remoteBase:x&&mi(x.userSlug,x.slug)},sourceFile:n,bulbKey:ws(n),trusted:e.trust,trustHint:t}),makeEntry:(ae,be)=>({pid:process.pid,port:ae,url:be,file:n,cwd:process.cwd(),startedAt:Date.now(),trust:e.trust,mode:e.mode,predicted:I}),waitTarget:Cn.relative(process.cwd(),n)||Cn.basename(n)});e.trust?console.log(" trust: granted (filesystem, AI, server.ts enabled)"):console.log(I?` trust: restricted \u2014 this bulb appears to use ${I}; re-run with --trust to enable it:
|
|
2893
2893
|
${t}
|
|
2894
2894
|
`:` trust: restricted \u2014 re-run with --trust to enable filesystem / AI / server.ts
|
|
2895
2895
|
`),e.watch&&console.log(` Watching for changes...
|
|
2896
|
-
`);let ee,Q,U=()=>{K()===0&&console.log(" No page attached \u2014 nothing reloaded; this change is not live."),o?.emit("reload")},se=ae=>{console.log(ae),p(),U()};if(e.watch&&o){let ae=0,be=Promise.resolve();if(ee=Gt({target:n,onChange:()=>{let fe=++ae;be=be.then(async()=>{if(fe===ae)try{console.log("Recompiling...");let
|
|
2896
|
+
`);let ee,Q,U=()=>{K()===0&&console.log(" No page attached \u2014 nothing reloaded; this change is not live."),o?.emit("reload")},se=ae=>{console.log(ae),p(),U()};if(e.watch&&o){let ae=0,be=Promise.resolve();if(ee=Gt({target:n,onChange:()=>{let fe=++ae;be=be.then(async()=>{if(fe===ae)try{console.log("Recompiling...");let xe=await Pd(n,!0,e.trust,r);y=xe.html,P=xe.serverExports,E=xe.bulb,xe.buildError||p(),U()}catch(xe){console.error("Recompile failed:",xe)}})}}),r){let{name:fe,serveDir:xe}=r;Q=Gt({target:xe,events:"all",onChange:()=>se(`Local package '${fe}' changed.`)})}let ot=wr(n);await Xt.stat(ot).then(fe=>fe.isDirectory()).catch(()=>!1)&&M(eS(ot,()=>se("Assets changed.")))}ee&&M(ee),Q&&M(Q),M(()=>Xt.rm(Td(n),{force:!0})),await T({mode:e.open,fresh:!u,replacedLive:f.some(ae=>ae.port===N)})}pt();import{readFileSync as Mf,copyFileSync as hN,existsSync as mN}from"fs";import*as he from"path";import{fileURLToPath as gN}from"url";import{EventEmitter as yN}from"events";import bN from"open";cn();$e();yr();var Lf=n=>`/agents/${n}/client.js`,pN=`
|
|
2897
2897
|
(() => {
|
|
2898
2898
|
const api = async (name, ...args) => {
|
|
2899
2899
|
const resp = await fetch('/__api/' + name, {
|
|
@@ -2948,18 +2948,18 @@ ${i}
|
|
|
2948
2948
|
${o?"<script>window.__TYPEBULB_WATCH__ = true;</script>":""}
|
|
2949
2949
|
|
|
2950
2950
|
<script>
|
|
2951
|
-
${
|
|
2951
|
+
${pN}
|
|
2952
2952
|
</script>
|
|
2953
2953
|
|
|
2954
2954
|
<script type="module" src="${l}"></script>
|
|
2955
2955
|
</body>
|
|
2956
|
-
</html>`}async function rS(n){let e=process.cwd(),t=n.agentTarget;Hw(t)||(console.error(`Unknown agent '${t}'. Known: ${
|
|
2957
|
-
${r.url}`),n.open==="window"&&await
|
|
2958
|
-
`);let M=he.join(u,t,"client"),T=he.join(u,"core","client");async function K(){await(await import("esbuild")).build({entryPoints:[he.join(M,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:he.join(f,"client.js")});for(let U of["styles.css","index.html","typebulb.png","typebulb-inv.png"])
|
|
2956
|
+
</html>`}async function rS(n){let e=process.cwd(),t=n.agentTarget;Hw(t)||(console.error(`Unknown agent '${t}'. Known: ${Or().join(", ")}.`),process.exit(1));let r=await Mo(e,t);if(r){console.log(`Mirror '${t}' is already running for this project:
|
|
2957
|
+
${r.url}`),n.open==="window"&&await bN(r.url);return}let s=Ss(process.pid),i=n.watch?new yN:void 0,o=Me(n.mode),a=await Vw(t),l=a.displayName||`${t} mirror`;jt(o,he.join(e,"mirror"));let c=he.dirname(gN(import.meta.url)),f=he.join(c,"agents",t),u=he.join(c,"..","cli","agents"),d=he.join(f,"styles.css"),h=he.join(f,"katex.min.css"),g=he.join(f,"index.html"),p=()=>nS({name:l,agent:t,styles:Mf(d,"utf8"),katex:Mf(h,"utf8"),mountHtml:Mf(g,"utf8"),watch:n.watch}),{port:y,note:E}=await Io({explicit:n.port,target:{kind:"mirror",agent:t},cwd:e}),{port:P,url:C,onCleanup:x,handOver:I,pageCount:N}=await ll({port:y,portNote:E,displayName:l,stopLog:s,waitTarget:"agent",makeServerOptions:Q=>({getHtml:p,basePath:e,port:Q,reloadEmitter:i,getServerExports:()=>a,trusted:!0,staticAssets:{mount:`${he.posix.dirname(Lf(t))}/`,dir:f}}),makeEntry:(Q,U)=>({pid:process.pid,port:Q,url:U,file:`agent:${t}`,cwd:e,startedAt:Date.now(),trust:!0,agent:t})});n.watch&&console.log(` Watching for changes...
|
|
2958
|
+
`);let M=he.join(u,t,"client"),T=he.join(u,"core","client");async function K(){await(await import("esbuild")).build({entryPoints:[he.join(M,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:he.join(f,"client.js")});for(let U of["styles.css","index.html","typebulb.png","typebulb-inv.png"])hN(he.join(T,U),he.join(f,U))}let ee;if(n.watch&&i){let Q=mN(M),U=!1;ee=Gt({target:Q?u:f,events:"all",onChange:async()=>{if(!U){U=!0;try{Q&&await K(),console.log(N()?`Mirror rebuilt. Reloading.
|
|
2959
2959
|
`:`Mirror rebuilt. No tab open on it \u2014 nobody is reading this.
|
|
2960
2960
|
`),i.emit("reload")}catch(se){console.error("Mirror rebuild failed:",se instanceof Error?se.message:se)}finally{U=!1}}}})}await I({mode:n.open,fresh:!1,replacedLive:!1}),x(()=>a.shutdownSwitcher?.()),x(()=>a.shutdownComposer?.()),ee&&x(ee)}pt();wt();import*as sS from"path";async function iS(n,e,t,r){let s=Me(t),i=!1,o=async()=>{let{bulb:a,config:l}=await Ge(n);i||(jt(s,n,a.server),i=!0),await qs(a.server,n,r,l.dependencies)};if(console.log(`Running ${sS.basename(n)}...`),await o(),e){console.log(`Watching for changes...
|
|
2961
|
-
`);let a=0,l=Promise.resolve();Gt({target:n,onChange:()=>{let c=++a;l=l.then(async()=>{if(c===a)try{console.log("Re-running..."),await o()}catch(f){console.error("Error:",f)}})}})}}pt();wt();import{Console as
|
|
2962
|
-
`)}catch(d){ai(d instanceof Error?d.stack??d.message:String(d))}return oS(0)}let f;try{f=await l(...c)}catch(d){ai(d instanceof Error?d.stack??d.message:String(d))}let u=
|
|
2963
|
-
`),oS(0)}function oS(n){process.exitCode=n,setTimeout(()=>process.exit(n),2e3).unref?.()}async function
|
|
2964
|
-
`),process.exit(1)}function
|
|
2965
|
-
${e}`),process.exit(1))}async function
|
|
2961
|
+
`);let a=0,l=Promise.resolve();Gt({target:n,onChange:()=>{let c=++a;l=l.then(async()=>{if(c===a)try{console.log("Re-running..."),await o()}catch(f){console.error("Error:",f)}})}})}}pt();wt();import{Console as wN}from"node:console";$e();async function lS(n,e,t,r){EN();try{let d=dn(await X(),n)[0];d&&(vs(d.pid,He(d.pid).offset),console.error(`note: 'call' boots a fresh server.ts instance; the running server (${d.url}) is not contacted \u2014 state shared with it must live on disk.`))}catch{}let s=Me(t),{bulb:i,config:o}=await Ge(n);i.server||ai("This bulb has no **server.ts** block; nothing to call."),jt(s,n,i.server);let a;try{a=await qs(i.server,n,r,o.dependencies)}catch(d){ai(d instanceof Error?d.message:String(d))}let l=ol(a,e.fn);if(!l){let d=[...Object.keys(a).filter(h=>typeof a[h]=="function"),...Object.keys(il)];ai(`Function '${e.fn}' not found. Available: ${d.length?d.join(", "):"(none)"}.`)}let c=await vN(e);if(al(l)){try{for await(let d of l(...c))await aS(JSON.stringify(d,cS)+`
|
|
2962
|
+
`)}catch(d){ai(d instanceof Error?d.stack??d.message:String(d))}return oS(0)}let f;try{f=await l(...c)}catch(d){ai(d instanceof Error?d.stack??d.message:String(d))}let u=xN(f);u!==void 0&&await aS(u+`
|
|
2963
|
+
`),oS(0)}function oS(n){process.exitCode=n,setTimeout(()=>process.exit(n),2e3).unref?.()}async function vN(n){if(n.hasArgsFlag){let e=n.argsJson??"";return e==="-"&&(e=await Ir()),kN(e)}return SN(n.positional)}function SN(n){return n.map(e=>{try{return JSON.parse(e)}catch{return e}})}function kN(n){let e;try{e=JSON.parse(n)}catch(t){throw new Error(`--args must be a JSON array: ${t instanceof Error?t.message:String(t)}`)}if(!Array.isArray(e))throw new Error(`--args must be a JSON array, got ${e===null?"null":typeof e}`);return e}function xN(n){if(n!==void 0)return JSON.stringify(n,cS,2)}function cS(n,e){return typeof e=="bigint"?e.toString():e}function ai(n){process.stderr.write(n+`
|
|
2964
|
+
`),process.exit(1)}function EN(){let n=new wN(process.stderr,process.stderr);console.log=n.log.bind(n),console.info=n.info.bind(n),console.debug=n.debug.bind(n),console.dir=n.dir.bind(n)}function aS(n){return new Promise((e,t)=>{process.stdout.write(n,r=>r?t(r):e())})}No();for(let n of[process.stdout,process.stderr])n.on("error",e=>{if(e?.code!=="EPIPE")throw e});function uS(n,e){n||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
|
|
2965
|
+
${e}`),process.exit(1))}async function AN(){let n=Xw(process.argv.slice(2));if(n.version&&(console.log(`typebulb ${Le}`),process.exit(0)),n.help&&(Qw(),process.exit(0)),zw(),n.subcommand==="logs"){await Rv(n.file||void 0,{follow:n.follow,clear:n.clear,run:n.run,lines:n.lines});return}if(n.subcommand==="wait"){await Iv(n.file||void 0,{match:n.match,timeoutSec:n.timeoutSec});return}if(n.subcommand==="stop"){n.stopScope?await Lv(n.stopScope):await $v(n.file||void 0);return}if(n.subcommand==="send"){await Bv(n.file,n.sendMessage,n.sendWaitMs??0);return}if(n.subcommand==="models"){await Ev(n.mode);return}if(n.subcommand==="slug"){Av(n.slugName);return}if(n.subcommand==="pull"){await Tb(n.file||void 0,{force:n.force,mode:n.mode});return}if(n.subcommand==="push"){await Ob(n.file||void 0,{force:n.force,mode:n.mode});return}if(n.subcommand==="agent"){await(n.agentTarget?rS(n):xv(Le));return}if(n.subcommand==="trust"||n.subcommand==="untrust"){await wv(n.file||void 0,n.subcommand==="trust");return}let e;if(!n.file||n.file==="."){let l=await Eb(process.cwd());l||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=l}else e=kt.resolve(n.file);if(await dS.access(e).then(()=>!0,()=>!1)||(Or().includes(n.file)&&(console.error(`To open the ${n.file} agent mirror, run: npx typebulb agent:${n.file}`),process.exit(1)),console.error(`File not found: ${e}`+(kt.isAbsolute(n.file)?"":` (resolved from cwd ${process.cwd()})`)),process.exit(1)),e.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),n.subcommand==="get"){await jv(e,n.blockKind);return}if(n.subcommand==="put"){await qv(e,n.blockPairs);return}let r=n.file&&n.file!=="."?n.file:kt.relative(process.cwd(),e)||kt.basename(e),s=`npx typebulb --trust ${r.includes(" ")?`"${r}"`:r}`;if(n.subcommand==="predict"){await bv(e,s);return}let i=!n.noTrust&&hn(e);i&&!n.trust&&console.error("trust: granted from memory (run `typebulb untrust` to revoke)"),n.trust=n.noTrust?!1:n.trust||i;let o;try{o=await Ge(e)}catch{}let a;if(n.local){o&&!(n.local.name in(o.config.dependencies??{}))&&(console.error(`--replace: '${n.local.name}' is not a dependency in this bulb's config.json; nothing to replace.`),process.exit(1)),o&&n.subcommand!=="call"&&(!o.bulb.code||n.server)&&console.warn("warning: --replace has no effect in server mode (the override is client-only).");try{a=await Yf(n.local)}catch(l){console.error(l instanceof Error?l.message:String(l)),process.exit(1)}console.error(`replace: ${a.name} \u2192 ${kt.relative(process.cwd(),a.dir)||"."}`)}if(n.subcommand==="check"){await yv(e,a);return}if(n.subcommand==="call"){uS(n.trust,s),await lS(e,{fn:n.fn,positional:n.callArgs,argsJson:n.argsJson,hasArgsFlag:n.hasArgsFlag},n.mode,a);return}if(o&&o.bulb.server&&(Do(o.bulb)||n.server)){uS(n.trust,s),await iS(e,n.watch,n.mode,a);return}await tS(e,n,s,a)}AN().catch(n=>{console.error("Error:",n.message),process.exit(1)});
|