typebulb 0.47.1 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -8
- package/SKILL.md +16 -10
- package/dist/agents/claude/client.js +159 -57
- package/dist/agents/codex/client.js +1912 -0
- package/dist/agents/codex/index.html +2 -0
- package/dist/agents/codex/styles.css +1887 -0
- package/dist/agents/codex/typebulb-inv.png +0 -0
- package/dist/agents/codex/typebulb.png +0 -0
- package/dist/agents/pi/client.js +159 -57
- package/dist/agents/pi/matchu-patchu.ts +1 -1
- package/dist/index.js +389 -284
- package/dist/render.js +130 -28
- package/dist/servers.js +207 -105
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
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 null;t++;let
|
|
5
|
-
`)),o.set(u,h),c=t}else t++}return{frontmatter:s,files:i,warnings:a,bodyEndLine:c,starts:o}}catch{return null}}function
|
|
3
|
+
var Uw=Object.create;var xa=Object.defineProperty;var Jw=Object.getOwnPropertyDescriptor;var Kw=Object.getOwnPropertyNames;var Hw=Object.getPrototypeOf,Ww=Object.prototype.hasOwnProperty;var Ps=(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 v=(n,e)=>()=>(n&&(e=n(n=0)),e);var O=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ea=(n,e)=>{for(var t in e)xa(n,t,{get:e[t],enumerable:!0})},Yw=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Kw(e))!Ww.call(n,s)&&s!==t&&xa(n,s,{get:()=>e[s],enumerable:!(r=Jw(e,s))||r.enumerable});return n};var Vw=(n,e,t)=>(t=n!=null?Uw(Hw(n)):{},Yw(e||!n||!n.__esModule?xa(t,"default",{value:n,enumerable:!0}):t,n));import*as Fd from"fs/promises";import{existsSync as pn,readFileSync as zw}from"fs";import*as ne from"path";import{pathToFileURL as Gw}from"url";import{resolve as Ta}from"resolve.exports";import{init as qd,parse as Ud}from"es-module-lexer";function Jd(n,e){let t=ne.join(n,"package.json");try{return JSON.parse(zw(t,"utf8"))}catch{throw new Error(`--replace package '${e}' has no readable package.json at ${t}`)}}function Kd(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:ne.resolve(r)}}async function Hd(n){let{name:e,dir:t}=n;if(!pn(t))throw new Error(`--replace path for '${e}' does not exist: ${t}`);let r=Jd(t,e),s=Xw(r,e),i=ne.resolve(t,s);if(!pn(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=ne.dirname(i),a=`/local/${e}/${ne.basename(i)}`,c=Qw(r,t);return await Zw(e,i,o),{name:e,dir:t,entryAbs:i,serveDir:o,entryUrl:a,typesAbs:c}}function Xw(n,e){if(n.exports!==void 0){let r;try{r=Ta(n,".",{browser:!0,conditions:Aa})}catch(i){throw new Error(`--replace package '${e}' "exports" does not resolve a browser entry (conditions: ${Aa.join(", ")}): ${i instanceof Error?i.message:i}`)}let s=Oa(r);if(!s)throw new Error(`--replace package '${e}' "exports" did not resolve "." to a single file (conditions: ${Aa.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 Qw(n,e){if(n.exports!==void 0)try{let r=Ta(n,".",{conditions:["types"]}),s=Oa(r);if(s){let i=ne.resolve(e,s);if(pn(i))return i}}catch{}let t=n.types??n.typings;if(t){let r=ne.resolve(e,t);if(pn(r))return r}}function Oa(n){if(typeof n=="string")return n;if(Array.isArray(n))return n.find(e=>typeof e=="string")}async function Zw(n,e,t){await qd;let r=ne.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 Fd.readFile(o,"utf8")}catch{continue}let c,l;try{[c,,,l]=Ud(a,o)}catch{continue}if(o===e&&!l)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 d of c){if(d.d===-2)continue;let u=d.n;if(u&&!u.startsWith("node:")){if(u.startsWith("./")||u.startsWith("../")||u.startsWith("/")){let f=ev(o,u,r);f&&!s.has(f)&&i.push(f);continue}throw new Error(`override package must ship self-contained (bundle its dependencies); ${n} externalizes '${u}'`)}}}}function ev(n,e,t){let r=e.replace(/[?#].*$/,""),s=ne.resolve(ne.dirname(n),r),i=[s,s+".js",s+".mjs",ne.join(s,"index.js"),ne.join(s,"index.mjs")];for(let o of i)if(ne.normalize(o).startsWith(t)&&pn(o))return o}function tv(n,e,t){let r=Jd(n,e),s;if(r.exports!==void 0)try{s=Oa(Ta(r,t,{conditions:jd}))}catch(o){throw new Error(`--replace package '${e}' "exports" does not resolve a node entry for '${t}' (conditions: ${jd.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=ne.resolve(n,s);if(!pn(i))throw new Error(`--replace package '${e}' built file not found: ${i} \u2014 did you build it (e.g. \`pnpm run build\`)?`);return Gw(i).href}async function Wd(n,e){await qd;let t;try{[t]=Ud(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),c=tv(e.dir,e.name,a);r+=n.slice(s,i.s)+c,s=i.e}return r+n.slice(s)}var Aa,jd,Cs=v(()=>{Aa=["browser","import","default"],jd=["node","import","default"]});function Yd(n){return _e.find(e=>ae[e].path===n)}function zd(n){return!!n?.startsWith("typebulb")}var ae,_e,Vd,Rs=v(()=>{ae={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"}},_e=["code","css","html","data","infer","insight","config","notes"];Vd="typebulb/v1"});function Pa(n){return/[:\n"']/.test(n)||n.startsWith(" ")||n.endsWith(" ")?`"${n.replace(/"/g,'\\"')}"`:n}function Ca(n){return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\"/g,'"'):n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}var _s=v(()=>{});function ue(n){try{let e=n.split(`
|
|
4
|
+
`),t=0;if(e[t]?.trim()!=="---")return null;t++;let r=[];for(;t<e.length&&e[t]?.trim()!=="---";)r.push(e[t]),t++;if(e[t]?.trim()!=="---")return null;t++;let s=iv(r);if(!s)return null;let i=new Map,o=new Map,a=[],c=t;for(;t<e.length;){let d=e[t]?.trim()?.match(Gd);if(d){let u=d[1].trim();for(t++;t<e.length&&e[t]?.trim()==="";)t++;let f=e[t]?.match(Ns);if(!f){a.push(`**${u}** has no code fence \u2014 block skipped`);continue}let p=f[1];t++;let h=t+1,m=[],b=Ra(p);for(;t<e.length&&!e[t]?.match(b);)m.push(e[t]),t++;let A=t<e.length;t++,a.push(...rv(u,m,A)),i.set(u,m.join(`
|
|
5
|
+
`)),o.set(u,h),c=t}else t++}return{frontmatter:s,files:i,warnings:a,bodyEndLine:c,starts:o}}catch{return null}}function rv(n,e,t){let r=[];for(let s=0;s<e.length;s++){let i=e[s]?.trim().match(Gd);i&&nv.has(i[1].trim())&&sv(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 sv(n,e){let t=e+1;for(;t<n.length&&n[t]?.trim()==="";)t++;return!!n[t]?.match(Ns)}function iv(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=Ca(i);break}}return!zd(e.format)||!e.name?null:e}function Xd(n){return ue(n)?.warnings??[]}function Qd(n){let e=Object.fromEntries(_e.map(t=>[t,n.files.get(ae[t].path)||""]));return{name:n.frontmatter.name,...e}}var Gd,Ns,nv,Ra,_a=v(()=>{Rs();_s();Gd=/^\*\*(.+)\*\*$/,Ns=/^(`{3,})(\w*)\s*$/,nv=new Set(_e.map(n=>ae[n].path)),Ra=n=>new RegExp(`^${n}\\s*$`)});function Zd(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 ef(n,e){let{path:t}=ae[n],r=t.split(".").pop(),s=Zd(e);return`**${t}**
|
|
6
6
|
|
|
7
|
-
${s}${
|
|
7
|
+
${s}${r}
|
|
8
8
|
${e}
|
|
9
|
-
${s}`}function
|
|
10
|
-
`)}function
|
|
11
|
-
`),s=
|
|
12
|
-
|
|
13
|
-
${
|
|
14
|
-
`;let i=
|
|
15
|
-
`),o,...
|
|
16
|
-
`)}function
|
|
17
|
-
`),
|
|
9
|
+
${s}`}function tf(n){let e=_e.filter(t=>n[t]).map(t=>ef(t,n[t]));return["---",`format: ${Vd}`,`name: ${Pa(n.name)}`,"---","",...e].join(`
|
|
10
|
+
`)}function nf(n,e){for(let t=0;t<n.length;t++){if(n[t]?.trim()!==`**${e}**`)continue;let r=t+1;for(;r<n.length&&n[r]?.trim()==="";)r++;let s=n[r]?.match(Ns);if(!s)continue;let i=Ra(s[1]),o=r+1;for(;o<n.length&&!n[o]?.match(i);)o++;return o>=n.length?"unterminated":{header:t,open:r,close:o,fence:s[1],lang:s[2]}}return null}function rr(n,e,t){let r=n.split(`
|
|
11
|
+
`),s=nf(r,ae[e].path);if(s==="unterminated")return n;if(!s)return`${n.replace(/\s*$/,"")}
|
|
12
|
+
|
|
13
|
+
${ef(e,t)}
|
|
14
|
+
`;let i=Zd(t),o=i.length>s.fence.length?i:s.fence;return[...r.slice(0,s.open),o+s.lang,...t.split(`
|
|
15
|
+
`),o,...r.slice(s.close+1)].join(`
|
|
16
|
+
`)}function rf(n,e){let t=n.split(`
|
|
17
|
+
`),r=nf(t,ae[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(`
|
|
18
18
|
`).replace(/\s*$/,"")+`
|
|
19
|
-
`}var
|
|
20
|
-
>/]`,i);if(
|
|
21
|
-
>]`),m
|
|
22
|
-
`)}};
|
|
23
|
-
`)?
|
|
19
|
+
`}var sf=v(()=>{Rs();_a();_s()});function sr(n){if(!n.trim())return{};try{return JSON.parse(n)}catch{return{}}}function af(n){switch(of(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 cf(n){let e=of(n);return e!==void 0&&av.has(e)?e:void 0}function lv(n){return n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"")}function Na(n){let e=sr(n??"").description?.trim();if(!e)return cv;let t=lv(e);return(t.length>200?t.slice(0,197)+"...":t).replace(/\n/g," ")}var ov,Is,of,av,cv,lf=v(()=>{ov="https://assets.typebulb.com",Is=(n,e)=>`${ov}/u/${encodeURIComponent(n)}/${encodeURIComponent(e)}/`,of=n=>/\.[^./\\]+$/.exec(n)?.[0]?.toLowerCase();av=new Set([".html",".htm",".xhtml",".js",".mjs",".cjs",".ts",".tsx",".css"]);cv="A Typebulb bulb."});var uf=v(()=>{});function Ia(n,e,t){let s=new RegExp(e).exec(n.slice(t));return s?t+s.index:-1}var df=v(()=>{});function ir(n,e,t){let s=new RegExp(e).exec(n.slice(t));return s?t+s.index+s[0].length-1:-1}var ff=v(()=>{});function $s(n,e){let t=new RegExp(e,"g"),r=n.match(t);return r?r.length:0}var pf=v(()=>{});function or(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=Ia(n,`<${e}[
|
|
20
|
+
>/]`,i);if(r&&console.log("[xml-utils] start:",o),o===-1)return;let a=n.slice(o+e.length),c=ir(a,"^[^<]*[ /]>",0),l=c!==-1&&a[c-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",l),l===!1)if(s){let p=0,h=1,m=0;for(;(c=ir(a,"[ /]"+e+">",p))!==-1;){let b=a.substring(p,c+1);if(h+=$s(b,"<"+e+`[
|
|
21
|
+
>]`),m+=$s(b,"</"+e+">"),m>=h)break;p=c}}else c=ir(a,"[ /]"+e+">",0);let d=o+e.length+c+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;let u=n.slice(o,d),f;return l?f=null:f=u.slice(u.indexOf(">")+1,u.lastIndexOf("<")),{inner:f,outer:u,start:o,end:d}}var $a=v(()=>{df();ff();pf()});var La=v(()=>{$a()});var Ma=v(()=>{La()});var mf=v(()=>{Ma()});var hf=v(()=>{});var gf=v(()=>{uf();$a();La();mf();Ma();hf()});var q=O(ce=>{"use strict";var Ba=Symbol.for("yaml.alias"),yf=Symbol.for("yaml.document"),Ls=Symbol.for("yaml.map"),bf=Symbol.for("yaml.pair"),Da=Symbol.for("yaml.scalar"),Ms=Symbol.for("yaml.seq"),Qe=Symbol.for("yaml.node.type"),fv=n=>!!n&&typeof n=="object"&&n[Qe]===Ba,pv=n=>!!n&&typeof n=="object"&&n[Qe]===yf,mv=n=>!!n&&typeof n=="object"&&n[Qe]===Ls,hv=n=>!!n&&typeof n=="object"&&n[Qe]===bf,wf=n=>!!n&&typeof n=="object"&&n[Qe]===Da,gv=n=>!!n&&typeof n=="object"&&n[Qe]===Ms;function vf(n){if(n&&typeof n=="object")switch(n[Qe]){case Ls:case Ms:return!0}return!1}function yv(n){if(n&&typeof n=="object")switch(n[Qe]){case Ba:case Ls:case Da:case Ms:return!0}return!1}var bv=n=>(wf(n)||vf(n))&&!!n.anchor;ce.ALIAS=Ba;ce.DOC=yf;ce.MAP=Ls;ce.NODE_TYPE=Qe;ce.PAIR=bf;ce.SCALAR=Da;ce.SEQ=Ms;ce.hasAnchor=bv;ce.isAlias=fv;ce.isCollection=vf;ce.isDocument=pv;ce.isMap=mv;ce.isNode=yv;ce.isPair=hv;ce.isScalar=wf;ce.isSeq=gv});var ar=O(ja=>{"use strict";var re=q(),he=Symbol("break visit"),Sf=Symbol("skip children"),Ke=Symbol("remove node");function Bs(n,e){let t=kf(e);re.isDocument(n)?mn(null,n.contents,t,Object.freeze([n]))===Ke&&(n.contents=null):mn(null,n,t,Object.freeze([]))}Bs.BREAK=he;Bs.SKIP=Sf;Bs.REMOVE=Ke;function mn(n,e,t,r){let s=xf(n,e,t,r);if(re.isNode(s)||re.isPair(s))return Ef(n,r,s),mn(n,s,t,r);if(typeof s!="symbol"){if(re.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=mn(i,e.items[i],t,r);if(typeof o=="number")i=o-1;else{if(o===he)return he;o===Ke&&(e.items.splice(i,1),i-=1)}}}else if(re.isPair(e)){r=Object.freeze(r.concat(e));let i=mn("key",e.key,t,r);if(i===he)return he;i===Ke&&(e.key=null);let o=mn("value",e.value,t,r);if(o===he)return he;o===Ke&&(e.value=null)}}return s}async function Ds(n,e){let t=kf(e);re.isDocument(n)?await hn(null,n.contents,t,Object.freeze([n]))===Ke&&(n.contents=null):await hn(null,n,t,Object.freeze([]))}Ds.BREAK=he;Ds.SKIP=Sf;Ds.REMOVE=Ke;async function hn(n,e,t,r){let s=await xf(n,e,t,r);if(re.isNode(s)||re.isPair(s))return Ef(n,r,s),hn(n,s,t,r);if(typeof s!="symbol"){if(re.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=await hn(i,e.items[i],t,r);if(typeof o=="number")i=o-1;else{if(o===he)return he;o===Ke&&(e.items.splice(i,1),i-=1)}}}else if(re.isPair(e)){r=Object.freeze(r.concat(e));let i=await hn("key",e.key,t,r);if(i===he)return he;i===Ke&&(e.key=null);let o=await hn("value",e.value,t,r);if(o===he)return he;o===Ke&&(e.value=null)}}return s}function kf(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 xf(n,e,t,r){if(typeof t=="function")return t(n,e,r);if(re.isMap(e))return t.Map?.(n,e,r);if(re.isSeq(e))return t.Seq?.(n,e,r);if(re.isPair(e))return t.Pair?.(n,e,r);if(re.isScalar(e))return t.Scalar?.(n,e,r);if(re.isAlias(e))return t.Alias?.(n,e,r)}function Ef(n,e,t){let r=e[e.length-1];if(re.isCollection(r))r.items[n]=t;else if(re.isPair(r))n==="key"?r.key=t:r.value=t;else if(re.isDocument(r))r.contents=t;else{let s=re.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}ja.visit=Bs;ja.visitAsync=Ds});var Fa=O(Tf=>{"use strict";var Af=q(),wv=ar(),vv={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Sv=n=>n.replace(/[!,[\]{}]/g,e=>vv[e]),cr=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+Sv(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&&Af.isNode(e.contents)){let i={};wv.visit(e.contents,(o,a)=>{Af.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(`
|
|
22
|
+
`)}};cr.defaultYaml={explicit:!1,version:"1.2"};cr.defaultTags={"!!":"tag:yaml.org,2002:"};Tf.Directives=cr});var js=O(lr=>{"use strict";var Of=q(),kv=ar();function xv(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 Pf(n){let e=new Set;return kv.visit(n,{Value(t,r){r.anchor&&e.add(r.anchor)}}),e}function Cf(n,e){for(let t=1;;++t){let r=`${n}${t}`;if(!e.has(r))return r}}function Ev(n,e){let t=[],r=new Map,s=null;return{onAnchor:i=>{t.push(i),s??(s=Pf(n));let o=Cf(e,s);return s.add(o),o},setAnchors:()=>{for(let i of t){let o=r.get(i);if(typeof o=="object"&&o.anchor&&(Of.isScalar(o.node)||Of.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}}lr.anchorIsValid=xv;lr.anchorNames=Pf;lr.createNodeAnchors=Ev;lr.findNewAnchor=Cf});var qa=O(Rf=>{"use strict";function ur(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=ur(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=ur(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=ur(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=ur(n,r,s,i);o===void 0?delete r[s]:o!==i&&(r[s]=o)}return n.call(e,t,r)}Rf.applyReviver=ur});var ft=O(Nf=>{"use strict";var Av=q();function _f(n,e,t){if(Array.isArray(n))return n.map((r,s)=>_f(r,String(s),t));if(n&&typeof n.toJSON=="function"){if(!t||!Av.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}Nf.toJS=_f});var Fs=O($f=>{"use strict";var Tv=qa(),If=q(),Ov=ft(),Ua=class{constructor(e){Object.defineProperty(this,If.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(!If.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=Ov.toJS(this,"",o);if(typeof s=="function")for(let{count:c,res:l}of o.anchors.values())s(l,c);return typeof i=="function"?Tv.applyReviver(i,{"":a},"",a):a}};$f.NodeBase=Ua});var dr=O(Lf=>{"use strict";var Pv=js(),Cv=ar(),gn=q(),Rv=Fs(),_v=ft(),Ja=class extends Rv.NodeBase{constructor(e){super(gn.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=[],Cv.visit(e,{Node:(i,o)=>{(gn.isAlias(o)||gn.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 c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(o);if(a||(_v.toJS(o,null,t),a=r.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=qs(s,o,r)),a.count*a.aliasCount>i)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,t,r){let s=`*${this.source}`;if(e){if(Pv.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 qs(n,e,t){if(gn.isAlias(e)){let r=e.resolve(n),s=t&&r&&t.get(r);return s?s.count*s.aliasCount:0}else if(gn.isCollection(e)){let r=0;for(let s of e.items){let i=qs(n,s,t);i>r&&(r=i)}return r}else if(gn.isPair(e)){let r=qs(n,e.key,t),s=qs(n,e.value,t);return Math.max(r,s)}return 1}Lf.Alias=Ja});var te=O(Ka=>{"use strict";var Nv=q(),Iv=Fs(),$v=ft(),Lv=n=>!n||typeof n!="function"&&typeof n!="object",pt=class extends Iv.NodeBase{constructor(e){super(Nv.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:$v.toJS(this.value,e,t)}toString(){return String(this.value)}};pt.BLOCK_FOLDED="BLOCK_FOLDED";pt.BLOCK_LITERAL="BLOCK_LITERAL";pt.PLAIN="PLAIN";pt.QUOTE_DOUBLE="QUOTE_DOUBLE";pt.QUOTE_SINGLE="QUOTE_SINGLE";Ka.Scalar=pt;Ka.isScalarValue=Lv});var fr=O(Bf=>{"use strict";var Mv=dr(),qt=q(),Mf=te(),Bv="tag:yaml.org,2002:";function Dv(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 jv(n,e,t){if(qt.isDocument(n)&&(n=n.contents),qt.isNode(n))return n;if(qt.isPair(n)){let u=t.schema[qt.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,c;if(r&&n&&typeof n=="object"){if(c=a.get(n),c)return c.anchor??(c.anchor=s(n)),new Mv.Alias(c.anchor);c={anchor:null,node:null},a.set(n,c)}e?.startsWith("!!")&&(e=Bv+e.slice(2));let l=Dv(n,e,o.tags);if(!l){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let u=new Mf.Scalar(n);return c&&(c.node=u),u}l=n instanceof Map?o[qt.MAP]:Symbol.iterator in Object(n)?o[qt.SEQ]:o[qt.MAP]}i&&(i(l),delete t.onTagObj);let d=l?.createNode?l.createNode(t.schema,n,t):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(t.schema,n,t):new Mf.Scalar(n);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}Bf.createNode=jv});var Js=O(Us=>{"use strict";var Fv=fr(),He=q(),qv=Fs();function Ha(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 Fv.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 Df=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Wa=class extends qv.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=>He.isNode(r)||He.isPair(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Df(e))this.add(t);else{let[r,...s]=e,i=this.get(r,!0);if(He.isCollection(i))i.addIn(s,t);else if(i===void 0&&this.schema)this.set(r,Ha(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(He.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&&He.isScalar(i)?i.value:i:He.isCollection(i)?i.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!He.isPair(t))return!1;let r=t.value;return r==null||e&&He.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 He.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(He.isCollection(i))i.setIn(s,t);else if(i===void 0&&this.schema)this.set(r,Ha(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}};Us.Collection=Wa;Us.collectionFromPath=Ha;Us.isEmptyPath=Df});var pr=O(Ks=>{"use strict";var Uv=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function Ya(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var Jv=(n,e,t)=>n.endsWith(`
|
|
23
|
+
`)?Ya(t,e):t.includes(`
|
|
24
24
|
`)?`
|
|
25
|
-
`+
|
|
26
|
-
`)t===
|
|
27
|
-
`&&p!==" "){let _=
|
|
28
|
-
`&&_!==" "&&(f=m)}if(m>=u)if(f)l.push(f),u=f+c,f=void 0;else if(t===
|
|
29
|
-
${e}${
|
|
30
|
-
${e}${
|
|
31
|
-
`);
|
|
32
|
-
`){if(i-o>
|
|
25
|
+
`+Ya(t,e):(n.endsWith(" ")?"":" ")+t;Ks.indentComment=Ya;Ks.lineComment=Jv;Ks.stringifyComment=Uv});var Ff=O(mr=>{"use strict";var Kv="flow",Va="block",Hs="quoted";function Hv(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 c=Math.max(1+i,1+s-e.length);if(n.length<=c)return n;let l=[],d={},u=s-e.length;typeof r=="number"&&(r>s-Math.max(2,i)?l.push(0):u=s-r);let f,p,h=!1,m=-1,b=-1,A=-1;t===Va&&(m=jf(n,m,e.length),m!==-1&&(u=m+c));for(let P;P=n[m+=1];){if(t===Hs&&P==="\\"){switch(b=m,n[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}A=m}if(P===`
|
|
26
|
+
`)t===Va&&(m=jf(n,m,e.length)),u=m+e.length+c,f=void 0;else{if(P===" "&&p&&p!==" "&&p!==`
|
|
27
|
+
`&&p!==" "){let _=n[m+1];_&&_!==" "&&_!==`
|
|
28
|
+
`&&_!==" "&&(f=m)}if(m>=u)if(f)l.push(f),u=f+c,f=void 0;else if(t===Hs){for(;p===" "||p===" ";)p=P,P=n[m+=1],h=!0;let _=m>A+1?m-2:b-1;if(d[_])return n;l.push(_),d[_]=!0,u=_+c,f=void 0}else h=!0}p=P}if(h&&a&&a(),l.length===0)return n;o&&o();let S=n.slice(0,l[0]);for(let P=0;P<l.length;++P){let _=l[P],C=l[P+1]||n.length;_===0?S=`
|
|
29
|
+
${e}${n.slice(0,C)}`:(t===Hs&&d[_]&&(S+=`${n[_]}\\`),S+=`
|
|
30
|
+
${e}${n.slice(_+1,C)}`)}return S}function jf(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!==`
|
|
31
|
+
`);r=e,s=e+1,i=n[s]}return r}mr.FOLD_BLOCK=Va;mr.FOLD_FLOW=Kv;mr.FOLD_QUOTED=Hs;mr.foldFlowLines=Hv});var gr=O(qf=>{"use strict";var Ne=te(),mt=Ff(),Ys=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),Vs=n=>/^(%|---|\.\.\.)/m.test(n);function Wv(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]===`
|
|
32
|
+
`){if(i-o>r)return!0;if(o=i+1,s-o<=r)return!1}return!0}function hr(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:r}=e,s=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Vs(n)?" ":""),o="",a=0;for(let c=0,l=t[c];l;l=t[++c])if(l===" "&&t[c+1]==="\\"&&t[c+2]==="n"&&(o+=t.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(t[c+1]){case"u":{o+=t.slice(a,c);let d=t.substr(c+2,4);switch(d){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:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=t.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||t[c+2]==='"'||t.length<s)c+=1;else{for(o+=t.slice(a,c)+`
|
|
33
33
|
|
|
34
34
|
`;t[c+2]==="\\"&&t[c+3]==="n"&&t[c+4]!=='"';)o+=`
|
|
35
|
-
`,c+=2;o+=i,t[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+t.slice(a):t,
|
|
36
|
-
`)||/[ \t]\n|\n[ \t]/.test(
|
|
37
|
-
${t}`)+"'";return e.implicitKey?
|
|
35
|
+
`,c+=2;o+=i,t[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+t.slice(a):t,r?o:mt.foldFlowLines(o,i,mt.FOLD_QUOTED,Ys(e,!1))}function za(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
36
|
+
`)||/[ \t]\n|\n[ \t]/.test(n))return hr(n,e);let t=e.indent||(Vs(n)?" ":""),r="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
37
|
+
${t}`)+"'";return e.implicitKey?r:mt.foldFlowLines(r,t,mt.FOLD_FLOW,Ys(e,!1))}function yn(n,e){let{singleQuote:t}=e.options,r;if(t===!1)r=hr;else{let s=n.includes('"'),i=n.includes("'");s&&!i?r=za:i&&!s?r=hr:r=t?za:hr}return r(n,e)}var Ga;try{Ga=new RegExp(`(^|(?<!
|
|
38
38
|
))
|
|
39
39
|
+(?!
|
|
40
|
-
|$)`,"g")}catch{
|
|
40
|
+
|$)`,"g")}catch{Ga=/\n+(?!\n|$)/g}function Ws({comment:n,type:e,value:t},r,s,i){let{blockQuote:o,commentString:a,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(t))return yn(t,r);let l=r.indent||(r.forceBlockIndent||Vs(t)?" ":""),d=o==="literal"?!0:o==="folded"||e===Ne.Scalar.BLOCK_FOLDED?!1:e===Ne.Scalar.BLOCK_LITERAL?!0:!Wv(t,c,l.length);if(!t)return d?`|
|
|
41
41
|
`:`>
|
|
42
42
|
`;let u,f;for(f=t.length;f>0;--f){let C=t[f-1];if(C!==`
|
|
43
43
|
`&&C!==" "&&C!==" ")break}let p=t.substring(f),h=p.indexOf(`
|
|
44
44
|
`);h===-1?u="-":t===p||h!==p.length-1?(u="+",i&&i()):u="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
45
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
46
|
-
`)A=b;else break}let
|
|
47
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),R=!1,$=
|
|
45
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Ga,`$&${l}`));let m=!1,b,A=-1;for(b=0;b<t.length;++b){let C=t[b];if(C===" ")m=!0;else if(C===`
|
|
46
|
+
`)A=b;else break}let S=t.substring(0,A<b?A+1:b);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${l}`));let _=(m?l?"2":"1":"")+u;if(n&&(_+=" "+a(n.replace(/ ?[\r\n]+/g," ")),s&&s()),!d){let C=t.replace(/\n+/g,`
|
|
47
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),R=!1,$=Ys(r,!0);o!=="folded"&&e!==Ne.Scalar.BLOCK_FOLDED&&($.onOverflow=()=>{R=!0});let x=mt.foldFlowLines(`${S}${C}${p}`,l,mt.FOLD_BLOCK,$);if(!R)return`>${_}
|
|
48
48
|
${l}${x}`}return t=t.replace(/\n+/g,`$&${l}`),`|${_}
|
|
49
|
-
${l}${
|
|
50
|
-
`)||d&&/[[\]{},]/.test(i))return
|
|
51
|
-
`)?
|
|
52
|
-
`))return
|
|
53
|
-
${c}`);if(o){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:p,tags:h}=e.doc.schema;if(h.some(f)||p?.some(f))return
|
|
54
|
-
${e.indent}${a}`:a}
|
|
55
|
-
${a}:`):(b=`${b}:`,f&&(b+=
|
|
56
|
-
`:"",
|
|
57
|
-
${
|
|
58
|
-
`&&
|
|
49
|
+
${l}${S}${t}${p}`}function Yv(n,e,t,r){let{type:s,value:i}=n,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:d}=e;if(a&&i.includes(`
|
|
50
|
+
`)||d&&/[[\]{},]/.test(i))return yn(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||d||!i.includes(`
|
|
51
|
+
`)?yn(i,e):Ws(n,e,t,r);if(!a&&!d&&s!==Ne.Scalar.PLAIN&&i.includes(`
|
|
52
|
+
`))return Ws(n,e,t,r);if(Vs(i)){if(c==="")return e.forceBlockIndent=!0,Ws(n,e,t,r);if(a&&c===l)return yn(i,e)}let u=i.replace(/\n+/g,`$&
|
|
53
|
+
${c}`);if(o){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:p,tags:h}=e.doc.schema;if(h.some(f)||p?.some(f))return yn(i,e)}return a?u:mt.foldFlowLines(u,c,mt.FOLD_FLOW,Ys(e,!1))}function Vv(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!==Ne.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Ne.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case Ne.Scalar.BLOCK_FOLDED:case Ne.Scalar.BLOCK_LITERAL:return s||i?yn(o.value,e):Ws(o,e,t,r);case Ne.Scalar.QUOTE_DOUBLE:return hr(o.value,e);case Ne.Scalar.QUOTE_SINGLE:return za(o.value,e);case Ne.Scalar.PLAIN:return Yv(o,e,t,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=s&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}qf.stringifyString=Vv});var yr=O(Xa=>{"use strict";var zv=js(),ht=q(),Gv=pr(),Xv=gr();function Qv(n,e){let t=Object.assign({blockQuote:!0,commentString:Gv.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 Zv(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(ht.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 eS(n,e,{anchors:t,doc:r}){if(!r.directives)return"";let s=[],i=(ht.isScalar(n)||ht.isCollection(n))&&n.anchor;i&&zv.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 tS(n,e,t,r){if(ht.isPair(n))return n.toString(e,t,r);if(ht.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=ht.isNode(n)?n:e.doc.createNode(n,{onTagObj:c=>s=c});s??(s=Zv(e.doc.schema.tags,i));let o=eS(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):ht.isScalar(i)?Xv.stringifyString(i,e,t,r):i.toString(e,t,r);return o?ht.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
54
|
+
${e.indent}${a}`:a}Xa.createStringifyContext=Qv;Xa.stringify=tS});var Hf=O(Kf=>{"use strict";var Ze=q(),Uf=te(),Jf=yr(),br=pr();function nS({key:n,value:e},t,r,s){let{allNullValues:i,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=t,f=Ze.isNode(n)&&n.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Ze.isCollection(n)||!Ze.isNode(n)&&typeof n=="object"){let $="With simple keys, collection cannot be used as a key value";throw new Error($)}}let p=!u&&(!n||f&&e==null&&!t.inFlow||Ze.isCollection(n)||(Ze.isScalar(n)?n.type===Uf.Scalar.BLOCK_FOLDED||n.type===Uf.Scalar.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(u||!i),indent:a+c});let h=!1,m=!1,b=Jf.stringify(n,t,()=>h=!0,()=>m=!0);if(!p&&!t.inFlow&&b.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(i||e==null)return h&&r&&r(),b===""?"?":p?`? ${b}`:b}else if(i&&!u||e==null&&p)return b=`? ${b}`,f&&!h?b+=br.lineComment(b,t.indent,l(f)):m&&s&&s(),b;h&&(f=null),p?(f&&(b+=br.lineComment(b,t.indent,l(f))),b=`? ${b}
|
|
55
|
+
${a}:`):(b=`${b}:`,f&&(b+=br.lineComment(b,t.indent,l(f))));let A,S,P;Ze.isNode(e)?(A=!!e.spaceBefore,S=e.commentBefore,P=e.comment):(A=!1,S=null,P=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!f&&Ze.isScalar(e)&&(t.indentAtStart=b.length+1),m=!1,!d&&c.length>=2&&!t.inFlow&&!p&&Ze.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let _=!1,C=Jf.stringify(e,t,()=>_=!0,()=>m=!0),R=" ";if(f||A||S){if(R=A?`
|
|
56
|
+
`:"",S){let $=l(S);R+=`
|
|
57
|
+
${br.indentComment($,t.indent)}`}C===""&&!t.inFlow?R===`
|
|
58
|
+
`&&P&&(R=`
|
|
59
59
|
|
|
60
60
|
`):R+=`
|
|
61
|
-
${t.indent}`}else if(!p&&
|
|
61
|
+
${t.indent}`}else if(!p&&Ze.isCollection(e)){let $=C[0],x=C.indexOf(`
|
|
62
62
|
`),D=x!==-1,K=t.inFlow??e.flow??e.items.length===0;if(D||!K){let U=!1;if(D&&($==="&"||$==="!")){let y=C.indexOf(" ");$==="&"&&y!==-1&&y<x&&C[y+1]==="!"&&(y=C.indexOf(" ",y+1)),(y===-1||x<y)&&(U=!0)}U||(R=`
|
|
63
63
|
${t.indent}`)}}else(C===""||C[0]===`
|
|
64
|
-
`)&&(R="");return b+=R+C,t.inFlow?_&&
|
|
64
|
+
`)&&(R="");return b+=R+C,t.inFlow?_&&r&&r():P&&!_?b+=br.lineComment(b,t.indent,l(P)):m&&s&&s(),b}Kf.stringifyPair=nS});var Za=O(Qa=>{"use strict";var Wf=Ps("process");function rS(n,...e){n==="debug"&&console.log(...e)}function sS(n,e){(n==="debug"||n==="warn")&&(typeof Wf.emitWarning=="function"?Wf.emitWarning(e):console.warn(e))}Qa.debug=rS;Qa.warn=sS});var Qs=O(Xs=>{"use strict";var wr=q(),Yf=te(),zs="<<",Gs={identify:n=>n===zs||typeof n=="symbol"&&n.description===zs,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Yf.Scalar(Symbol(zs)),{addToJSMap:Vf}),stringify:()=>zs},iS=(n,e)=>(Gs.identify(e)||wr.isScalar(e)&&(!e.type||e.type===Yf.Scalar.PLAIN)&&Gs.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===Gs.tag&&t.default);function Vf(n,e,t){if(t=n&&wr.isAlias(t)?t.resolve(n.doc):t,wr.isSeq(t))for(let r of t.items)ec(n,e,r);else if(Array.isArray(t))for(let r of t)ec(n,e,r);else ec(n,e,t)}function ec(n,e,t){let r=n&&wr.isAlias(t)?t.resolve(n.doc):t;if(!wr.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}Xs.addMergeToJSMap=Vf;Xs.isMergeKey=iS;Xs.merge=Gs});var nc=O(Xf=>{"use strict";var oS=Za(),zf=Qs(),aS=yr(),Gf=q(),tc=ft();function cS(n,e,{key:t,value:r}){if(Gf.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,r);else if(zf.isMergeKey(n,t))zf.addMergeToJSMap(n,e,r);else{let s=tc.toJS(t,"",n);if(e instanceof Map)e.set(s,tc.toJS(r,s,n));else if(e instanceof Set)e.add(s);else{let i=lS(t,s,n),o=tc.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 lS(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Gf.isNode(n)&&t?.doc){let r=aS.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)+'..."'),oS.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)}Xf.addPairToJSMap=cS});var gt=O(rc=>{"use strict";var Qf=fr(),uS=Hf(),dS=nc(),Zs=q();function fS(n,e,t){let r=Qf.createNode(n,void 0,t),s=Qf.createNode(e,void 0,t);return new ei(r,s)}var ei=class n{constructor(e,t=null){Object.defineProperty(this,Zs.NODE_TYPE,{value:Zs.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;return Zs.isNode(t)&&(t=t.clone(e)),Zs.isNode(r)&&(r=r.clone(e)),new n(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return dS.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?uS.stringifyPair(this,e,t,r):JSON.stringify(this)}};rc.Pair=ei;rc.createPair=fS});var sc=O(ep=>{"use strict";var Ut=q(),Zf=yr(),ti=pr();function pS(n,e,t){return(e.inFlow??n.flow?hS:mS)(n,e,t)}function mS({comment:n,items:e},t,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=t,d=Object.assign({},t,{indent:i,type:null}),u=!1,f=[];for(let h=0;h<e.length;++h){let m=e[h],b=null;if(Ut.isNode(m))!u&&m.spaceBefore&&f.push(""),ni(t,f,m.commentBefore,u),m.comment&&(b=m.comment);else if(Ut.isPair(m)){let S=Ut.isNode(m.key)?m.key:null;S&&(!u&&S.spaceBefore&&f.push(""),ni(t,f,S.commentBefore,u))}u=!1;let A=Zf.stringify(m,d,()=>b=null,()=>u=!0);b&&(A+=ti.lineComment(A,i,l(b))),u&&b&&(u=!1),f.push(r+A)}let p;if(f.length===0)p=s.start+s.end;else{p=f[0];for(let h=1;h<f.length;++h){let m=f[h];p+=m?`
|
|
65
65
|
${c}${m}`:`
|
|
66
|
-
`}}return
|
|
67
|
-
`+
|
|
66
|
+
`}}return n?(p+=`
|
|
67
|
+
`+ti.indentComment(l(n),c),a&&a()):u&&o&&o(),p}function hS({items:n},e,{flowChars:t,itemIndent:r}){let{indent:s,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;r+=i;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let h=0;h<n.length;++h){let m=n[h],b=null;if(Ut.isNode(m))m.spaceBefore&&u.push(""),ni(e,u,m.commentBefore,!1),m.comment&&(b=m.comment);else if(Ut.isPair(m)){let S=Ut.isNode(m.key)?m.key:null;S&&(S.spaceBefore&&u.push(""),ni(e,u,S.commentBefore,!1),S.comment&&(l=!0));let P=Ut.isNode(m.value)?m.value:null;P?(P.comment&&(b=P.comment),P.commentBefore&&(l=!0)):m.value==null&&S?.comment&&(b=S.comment)}b&&(l=!0);let A=Zf.stringify(m,c,()=>b=null);h<n.length-1&&(A+=","),b&&(A+=ti.lineComment(A,r,a(b))),!l&&(u.length>d||A.includes(`
|
|
68
68
|
`))&&(l=!0),u.push(A),d=u.length}let{start:f,end:p}=t;if(u.length===0)return f+p;if(!l){let h=u.reduce((m,b)=>m+b.length+2,2);l=e.options.lineWidth>0&&h>e.options.lineWidth}if(l){let h=f;for(let m of u)h+=m?`
|
|
69
69
|
${i}${s}${m}`:`
|
|
70
70
|
`;return`${h}
|
|
71
|
-
${s}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function
|
|
72
|
-
`:" ")}return
|
|
73
|
-
${s.key.commentBefore}`:
|
|
74
|
-
${i.comment}`:n.comment}n=s}r.items[t]=ii.isPair(n)?n:new uc.Pair(n)}}else e("Expected a sequence for this tag");return r}function Zf(r,e,t){let{replacer:n}=t,s=new US.YAMLSeq(r);s.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;s.items.push(uc.createPair(a,c,t))}return s}var JS={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Qf,createNode:Zf};oi.createPairs=Zf;oi.pairs=JS;oi.resolvePairs=Qf});var pc=P(fc=>{"use strict";var ep=q(),dc=lt(),vn=ht(),KS=gt(),tp=ai(),Dt=class r extends KS.YAMLSeq{constructor(){super(),this.add=vn.YAMLMap.prototype.add.bind(this),this.delete=vn.YAMLMap.prototype.delete.bind(this),this.get=vn.YAMLMap.prototype.get.bind(this),this.has=vn.YAMLMap.prototype.has.bind(this),this.set=vn.YAMLMap.prototype.set.bind(this),this.tag=r.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let s of this.items){let i,o;if(ep.isPair(s)?(i=dc.toJS(s.key,"",t),o=dc.toJS(s.value,i,t)):i=dc.toJS(s,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){let s=tp.createPairs(e,t,n),i=new this;return i.items=s.items,i}};Dt.tag="tag:yaml.org,2002:omap";var HS={collection:"seq",identify:r=>r instanceof Map,nodeClass:Dt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(r,e){let t=tp.resolvePairs(r,e),n=[];for(let{key:s}of t.items)ep.isScalar(s)&&(n.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new Dt,t)},createNode:(r,e,t)=>Dt.from(r,e,t)};fc.YAMLOMap=Dt;fc.omap=HS});var op=P(mc=>{"use strict";var rp=te();function np({value:r,source:e},t){return e&&(r?sp:ip).test.test(e)?e:r?t.options.trueStr:t.options.falseStr}var sp={identify:r=>r===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new rp.Scalar(!0),stringify:np},ip={identify:r=>r===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new rp.Scalar(!1),stringify:np};mc.falseTag=ip;mc.trueTag=sp});var ap=P(ci=>{"use strict";var WS=te(),hc=hr(),YS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hc.stringifyNumber},VS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r.replace(/_/g,"")),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():hc.stringifyNumber(r)}},zS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(r){let e=new WS.Scalar(parseFloat(r.replace(/_/g,""))),t=r.indexOf(".");if(t!==-1){let n=r.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:hc.stringifyNumber};ci.float=zS;ci.floatExp=VS;ci.floatNaN=YS});var lp=P(kn=>{"use strict";var cp=hr(),Sn=r=>typeof r=="bigint"||Number.isInteger(r);function li(r,e,t,{intAsBigInt:n}){let s=r[0];if((s==="-"||s==="+")&&(e+=1),r=r.substring(e).replace(/_/g,""),n){switch(t){case 2:r=`0b${r}`;break;case 8:r=`0o${r}`;break;case 16:r=`0x${r}`;break}let o=BigInt(r);return s==="-"?BigInt(-1)*o:o}let i=parseInt(r,t);return s==="-"?-1*i:i}function gc(r,e,t){let{value:n}=r;if(Sn(n)){let s=n.toString(e);return n<0?"-"+t+s.substr(1):t+s}return cp.stringifyNumber(r)}var GS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(r,e,t)=>li(r,2,2,t),stringify:r=>gc(r,2,"0b")},XS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(r,e,t)=>li(r,1,8,t),stringify:r=>gc(r,8,"0")},QS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(r,e,t)=>li(r,0,10,t),stringify:cp.stringifyNumber},ZS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(r,e,t)=>li(r,2,16,t),stringify:r=>gc(r,16,"0x")};kn.int=QS;kn.intBin=GS;kn.intHex=ZS;kn.intOct=XS});var bc=P(yc=>{"use strict";var fi=q(),ui=pt(),di=ht(),jt=class r extends di.YAMLMap{constructor(e){super(e),this.tag=r.tag}add(e){let t;fi.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new ui.Pair(e.key,null):t=new ui.Pair(e,null),di.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=di.findPair(this.items,e);return!t&&fi.isPair(n)?fi.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=di.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ui.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:s}=n,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(ui.createPair(o,null,n));return i}};jt.tag="tag:yaml.org,2002:set";var ek={collection:"map",identify:r=>r instanceof Set,nodeClass:jt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(r,e,t)=>jt.from(r,e,t),resolve(r,e){if(fi.isMap(r)){if(r.hasAllNullValues(!0))return Object.assign(new jt,r);e("Set items must all have null values")}else e("Expected a mapping for this tag");return r}};yc.YAMLSet=jt;yc.set=ek});var vc=P(pi=>{"use strict";var tk=hr();function wc(r,e){let t=r[0],n=t==="-"||t==="+"?r.substring(1):r,s=o=>e?BigInt(o):Number(o),i=n.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*i:i}function up(r){let{value:e}=r,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return tk.stringifyNumber(r);let n="";e<0&&(n="-",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))),n+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var rk={identify:r=>typeof r=="bigint"||Number.isInteger(r),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(r,e,{intAsBigInt:t})=>wc(r,t),stringify:up},nk={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:r=>wc(r,!1),stringify:up},dp={identify:r=>r 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(r){let e=r.match(dp.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,s,i,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,n-1,s,i||0,o||0,a||0,c),d=e[8];if(d&&d!=="Z"){let u=wc(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:r})=>r?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};pi.floatTime=nk;pi.intTime=rk;pi.timestamp=dp});var mp=P(pp=>{"use strict";var sk=pr(),ik=ei(),ok=mr(),ak=bn(),ck=lc(),fp=op(),Sc=ap(),mi=lp(),lk=Ws(),uk=pc(),dk=ai(),fk=bc(),kc=vc(),pk=[sk.map,ok.seq,ak.string,ik.nullTag,fp.trueTag,fp.falseTag,mi.intBin,mi.intOct,mi.int,mi.intHex,Sc.floatNaN,Sc.floatExp,Sc.float,ck.binary,lk.merge,uk.omap,dk.pairs,fk.set,kc.intTime,kc.floatTime,kc.timestamp];pp.schema=pk});var Ep=P(Ac=>{"use strict";var bp=pr(),mk=ei(),wp=mr(),hk=bn(),gk=tc(),xc=nc(),Ec=ic(),yk=Yf(),bk=Gf(),vp=lc(),xn=Ws(),Sp=pc(),kp=ai(),hp=mp(),xp=bc(),hi=vc(),gp=new Map([["core",yk.schema],["failsafe",[bp.map,wp.seq,hk.string]],["json",bk.schema],["yaml11",hp.schema],["yaml-1.1",hp.schema]]),yp={binary:vp.binary,bool:gk.boolTag,float:xc.float,floatExp:xc.floatExp,floatNaN:xc.floatNaN,floatTime:hi.floatTime,int:Ec.int,intHex:Ec.intHex,intOct:Ec.intOct,intTime:hi.intTime,map:bp.map,merge:xn.merge,null:mk.nullTag,omap:Sp.omap,pairs:kp.pairs,seq:wp.seq,set:xp.set,timestamp:hi.timestamp},wk={"tag:yaml.org,2002:binary":vp.binary,"tag:yaml.org,2002:merge":xn.merge,"tag:yaml.org,2002:omap":Sp.omap,"tag:yaml.org,2002:pairs":kp.pairs,"tag:yaml.org,2002:set":xp.set,"tag:yaml.org,2002:timestamp":hi.timestamp};function vk(r,e,t){let n=gp.get(e);if(n&&!r)return t&&!n.includes(xn.merge)?n.concat(xn.merge):n.slice();let s=n;if(!s)if(Array.isArray(r))s=[];else{let i=Array.from(gp.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(r))for(let i of r)s=s.concat(i);else typeof r=="function"&&(s=r(s.slice()));return t&&(s=s.concat(xn.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?yp[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(yp).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(a)||i.push(a),i},[])}Ac.coreKnownTags=wk;Ac.getTags=vk});var Oc=P(Ap=>{"use strict";var Tc=q(),Sk=pr(),kk=mr(),xk=bn(),gi=Ep(),Ek=(r,e)=>r.key<e.key?-1:r.key>e.key?1:0,Pc=class r{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?gi.getTags(e,"compat"):e?gi.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?gi.coreKnownTags:{},this.tags=gi.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Tc.MAP,{value:Sk.map}),Object.defineProperty(this,Tc.SCALAR,{value:xk.string}),Object.defineProperty(this,Tc.SEQ,{value:kk.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ek:null}clone(){let e=Object.create(r.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Ap.Schema=Pc});var Pp=P(Tp=>{"use strict";var Ak=q(),Cc=mn(),En=un();function Tk(r,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&r.directives){let c=r.directives.toString(r);c?(t.push(c),n=!0):r.directives.docStart&&(n=!0)}n&&t.push("---");let s=Cc.createStringifyContext(r,e),{commentString:i}=s.options;if(r.commentBefore){t.length!==1&&t.unshift("");let c=i(r.commentBefore);t.unshift(En.indentComment(c,""))}let o=!1,a=null;if(r.contents){if(Ak.isNode(r.contents)){if(r.contents.spaceBefore&&n&&t.push(""),r.contents.commentBefore){let d=i(r.contents.commentBefore);t.push(En.indentComment(d,""))}s.forceBlockIndent=!!r.comment,a=r.contents.comment}let c=a?void 0:()=>o=!0,l=Cc.stringify(r.contents,s,()=>a=null,c);a&&(l+=En.lineComment(l,"",i(a))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(Cc.stringify(r.contents,s));if(r.directives?.docEnd)if(r.comment){let c=i(r.comment);c.includes(`
|
|
75
|
-
`)?(t.push("..."),t.push(
|
|
71
|
+
${s}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function ni({indent:n,options:{commentString:e}},t,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){let i=ti.indentComment(e(r),n);t.push(i.trimStart())}}ep.stringifyCollection=pS});var bt=O(oc=>{"use strict";var gS=sc(),yS=nc(),bS=Js(),yt=q(),ri=gt(),wS=te();function vr(n,e){let t=yt.isScalar(e)?e.value:e;for(let r of n)if(yt.isPair(r)&&(r.key===e||r.key===t||yt.isScalar(r.key)&&r.key.value===t))return r}var ic=class extends bS.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(yt.MAP,e),this.items=[]}static from(e,t,r){let{keepUndefined:s,replacer:i}=r,o=new this(e),a=(c,l)=>{if(typeof i=="function")l=i.call(t,c,l);else if(Array.isArray(i)&&!i.includes(c))return;(l!==void 0||s)&&o.items.push(ri.createPair(c,l,r))};if(t instanceof Map)for(let[c,l]of t)a(c,l);else if(t&&typeof t=="object")for(let c of Object.keys(t))a(c,t[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let r;yt.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new ri.Pair(e,e?.value):r=new ri.Pair(e.key,e.value);let s=vr(this.items,r.key),i=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${r.key} already set`);yt.isScalar(s.value)&&wS.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=vr(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let s=vr(this.items,e)?.value;return(!t&&yt.isScalar(s)?s.value:s)??void 0}has(e){return!!vr(this.items,e)}set(e,t){this.add(new ri.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)yS.addPairToJSMap(t,s,i);return s}toString(e,t,r){if(!e)return JSON.stringify(this);for(let s of this.items)if(!yt.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})),gS.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}};oc.YAMLMap=ic;oc.findPair=vr});var bn=O(np=>{"use strict";var vS=q(),tp=bt(),SS={collection:"map",default:!0,nodeClass:tp.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return vS.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>tp.YAMLMap.from(n,e,t)};np.map=SS});var wt=O(rp=>{"use strict";var kS=fr(),xS=sc(),ES=Js(),ii=q(),AS=te(),TS=ft(),ac=class extends ES.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ii.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=si(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let r=si(e);if(typeof r!="number")return;let s=this.items[r];return!t&&ii.isScalar(s)?s.value:s}has(e){let t=si(e);return typeof t=="number"&&t<this.items.length}set(e,t){let r=si(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[r];ii.isScalar(s)&&AS.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(TS.toJS(i,String(s++),t));return r}toString(e,t,r){return e?xS.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 c=t instanceof Set?a:String(o++);a=s.call(t,c,a)}i.items.push(kS.createNode(a,void 0,r))}}return i}};function si(n){let e=ii.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}rp.YAMLSeq=ac});var wn=O(ip=>{"use strict";var OS=q(),sp=wt(),PS={collection:"seq",default:!0,nodeClass:sp.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return OS.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>sp.YAMLSeq.from(n,e,t)};ip.seq=PS});var Sr=O(op=>{"use strict";var CS=gr(),RS={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),CS.stringifyString(n,e,t,r)}};op.string=RS});var oi=O(lp=>{"use strict";var ap=te(),cp={identify:n=>n==null,createNode:()=>new ap.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ap.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&cp.test.test(n)?n:e.options.nullStr};lp.nullTag=cp});var cc=O(dp=>{"use strict";var _S=te(),up={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new _S.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&up.test.test(n)){let r=n[0]==="t"||n[0]==="T";if(e===r)return n}return e?t.options.trueStr:t.options.falseStr}};dp.boolTag=up});var vn=O(fp=>{"use strict";function NS({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}fp.stringifyNumber=NS});var uc=O(ai=>{"use strict";var IS=te(),lc=vn(),$S={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:lc.stringifyNumber},LS={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():lc.stringifyNumber(n)}},MS={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 IS.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:lc.stringifyNumber};ai.float=MS;ai.floatExp=LS;ai.floatNaN=$S});var fc=O(li=>{"use strict";var pp=vn(),ci=n=>typeof n=="bigint"||Number.isInteger(n),dc=(n,e,t,{intAsBigInt:r})=>r?BigInt(n):parseInt(n.substring(e),t);function mp(n,e,t){let{value:r}=n;return ci(r)&&r>=0?t+r.toString(e):pp.stringifyNumber(n)}var BS={identify:n=>ci(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>dc(n,2,8,t),stringify:n=>mp(n,8,"0o")},DS={identify:ci,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>dc(n,0,10,t),stringify:pp.stringifyNumber},jS={identify:n=>ci(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>dc(n,2,16,t),stringify:n=>mp(n,16,"0x")};li.int=DS;li.intHex=jS;li.intOct=BS});var gp=O(hp=>{"use strict";var FS=bn(),qS=oi(),US=wn(),JS=Sr(),KS=cc(),pc=uc(),mc=fc(),HS=[FS.map,US.seq,JS.string,qS.nullTag,KS.boolTag,mc.intOct,mc.int,mc.intHex,pc.floatNaN,pc.floatExp,pc.float];hp.schema=HS});var wp=O(bp=>{"use strict";var WS=te(),YS=bn(),VS=wn();function yp(n){return typeof n=="bigint"||Number.isInteger(n)}var ui=({value:n})=>JSON.stringify(n),zS=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:ui},{identify:n=>n==null,createNode:()=>new WS.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ui},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:ui},{identify:yp,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})=>yp(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:ui}],GS={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},XS=[YS.map,VS.seq].concat(zS,GS);bp.schema=XS});var gc=O(vp=>{"use strict";var kr=Ps("buffer"),hc=te(),QS=gr(),ZS={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof kr.Buffer=="function")return kr.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 kr.Buffer=="function")a=o instanceof kr.Buffer?o.toString("base64"):kr.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=hc.Scalar.BLOCK_LITERAL),e!==hc.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=a.substr(f,c);a=d.join(e===hc.Scalar.BLOCK_LITERAL?`
|
|
72
|
+
`:" ")}return QS.stringifyString({comment:n,type:e,value:a},r,s,i)}};vp.binary=ZS});var pi=O(fi=>{"use strict";var di=q(),yc=gt(),ek=te(),tk=wt();function Sp(n,e){if(di.isSeq(n))for(let t=0;t<n.items.length;++t){let r=n.items[t];if(!di.isPair(r)){if(di.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let s=r.items[0]||new yc.Pair(new ek.Scalar(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore}
|
|
73
|
+
${s.key.commentBefore}`:r.commentBefore),r.comment){let i=s.value??s.key;i.comment=i.comment?`${r.comment}
|
|
74
|
+
${i.comment}`:r.comment}r=s}n.items[t]=di.isPair(r)?r:new yc.Pair(r)}}else e("Expected a sequence for this tag");return n}function kp(n,e,t){let{replacer:r}=t,s=new tk.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,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;s.items.push(yc.createPair(a,c,t))}return s}var nk={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Sp,createNode:kp};fi.createPairs=kp;fi.pairs=nk;fi.resolvePairs=Sp});var vc=O(wc=>{"use strict";var xp=q(),bc=ft(),xr=bt(),rk=wt(),Ep=pi(),Jt=class n extends rk.YAMLSeq{constructor(){super(),this.add=xr.YAMLMap.prototype.add.bind(this),this.delete=xr.YAMLMap.prototype.delete.bind(this),this.get=xr.YAMLMap.prototype.get.bind(this),this.has=xr.YAMLMap.prototype.has.bind(this),this.set=xr.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(xp.isPair(s)?(i=bc.toJS(s.key,"",t),o=bc.toJS(s.value,i,t)):i=bc.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=Ep.createPairs(e,t,r),i=new this;return i.items=s.items,i}};Jt.tag="tag:yaml.org,2002:omap";var sk={collection:"seq",identify:n=>n instanceof Map,nodeClass:Jt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=Ep.resolvePairs(n,e),r=[];for(let{key:s}of t.items)xp.isScalar(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new Jt,t)},createNode:(n,e,t)=>Jt.from(n,e,t)};wc.YAMLOMap=Jt;wc.omap=sk});var Cp=O(Sc=>{"use strict";var Ap=te();function Tp({value:n,source:e},t){return e&&(n?Op:Pp).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var Op={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 Ap.Scalar(!0),stringify:Tp},Pp={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 Ap.Scalar(!1),stringify:Tp};Sc.falseTag=Pp;Sc.trueTag=Op});var Rp=O(mi=>{"use strict";var ik=te(),kc=vn(),ok={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:kc.stringifyNumber},ak={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():kc.stringifyNumber(n)}},ck={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 ik.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:kc.stringifyNumber};mi.float=ck;mi.floatExp=ak;mi.floatNaN=ok});var Np=O(Ar=>{"use strict";var _p=vn(),Er=n=>typeof n=="bigint"||Number.isInteger(n);function hi(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 xc(n,e,t){let{value:r}=n;if(Er(r)){let s=r.toString(e);return r<0?"-"+t+s.substr(1):t+s}return _p.stringifyNumber(n)}var lk={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>hi(n,2,2,t),stringify:n=>xc(n,2,"0b")},uk={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>hi(n,1,8,t),stringify:n=>xc(n,8,"0")},dk={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>hi(n,0,10,t),stringify:_p.stringifyNumber},fk={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>hi(n,2,16,t),stringify:n=>xc(n,16,"0x")};Ar.int=dk;Ar.intBin=lk;Ar.intHex=fk;Ar.intOct=uk});var Ac=O(Ec=>{"use strict";var bi=q(),gi=gt(),yi=bt(),Kt=class n extends yi.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;bi.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new gi.Pair(e.key,null):t=new gi.Pair(e,null),yi.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=yi.findPair(this.items,e);return!t&&bi.isPair(r)?bi.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=yi.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new gi.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(gi.createPair(o,null,r));return i}};Kt.tag="tag:yaml.org,2002:set";var pk={collection:"map",identify:n=>n instanceof Set,nodeClass:Kt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>Kt.from(n,e,t),resolve(n,e){if(bi.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new Kt,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};Ec.YAMLSet=Kt;Ec.set=pk});var Oc=O(wi=>{"use strict";var mk=vn();function Tc(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 Ip(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return mk.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 hk={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})=>Tc(n,t),stringify:Ip},gk={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=>Tc(n,!1),stringify:Ip},$p={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($p.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),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,r-1,s,i||0,o||0,a||0,c),d=e[8];if(d&&d!=="Z"){let u=Tc(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};wi.floatTime=gk;wi.intTime=hk;wi.timestamp=$p});var Bp=O(Mp=>{"use strict";var yk=bn(),bk=oi(),wk=wn(),vk=Sr(),Sk=gc(),Lp=Cp(),Pc=Rp(),vi=Np(),kk=Qs(),xk=vc(),Ek=pi(),Ak=Ac(),Cc=Oc(),Tk=[yk.map,wk.seq,vk.string,bk.nullTag,Lp.trueTag,Lp.falseTag,vi.intBin,vi.intOct,vi.int,vi.intHex,Pc.floatNaN,Pc.floatExp,Pc.float,Sk.binary,kk.merge,xk.omap,Ek.pairs,Ak.set,Cc.intTime,Cc.floatTime,Cc.timestamp];Mp.schema=Tk});var Yp=O(Nc=>{"use strict";var qp=bn(),Ok=oi(),Up=wn(),Pk=Sr(),Ck=cc(),Rc=uc(),_c=fc(),Rk=gp(),_k=wp(),Jp=gc(),Tr=Qs(),Kp=vc(),Hp=pi(),Dp=Bp(),Wp=Ac(),Si=Oc(),jp=new Map([["core",Rk.schema],["failsafe",[qp.map,Up.seq,Pk.string]],["json",_k.schema],["yaml11",Dp.schema],["yaml-1.1",Dp.schema]]),Fp={binary:Jp.binary,bool:Ck.boolTag,float:Rc.float,floatExp:Rc.floatExp,floatNaN:Rc.floatNaN,floatTime:Si.floatTime,int:_c.int,intHex:_c.intHex,intOct:_c.intOct,intTime:Si.intTime,map:qp.map,merge:Tr.merge,null:Ok.nullTag,omap:Kp.omap,pairs:Hp.pairs,seq:Up.seq,set:Wp.set,timestamp:Si.timestamp},Nk={"tag:yaml.org,2002:binary":Jp.binary,"tag:yaml.org,2002:merge":Tr.merge,"tag:yaml.org,2002:omap":Kp.omap,"tag:yaml.org,2002:pairs":Hp.pairs,"tag:yaml.org,2002:set":Wp.set,"tag:yaml.org,2002:timestamp":Si.timestamp};function Ik(n,e,t){let r=jp.get(e);if(r&&!n)return t&&!r.includes(Tr.merge)?r.concat(Tr.merge):r.slice();let s=r;if(!s)if(Array.isArray(n))s=[];else{let i=Array.from(jp.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(Tr.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?Fp[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(Fp).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(a)||i.push(a),i},[])}Nc.coreKnownTags=Nk;Nc.getTags=Ik});var Lc=O(Vp=>{"use strict";var Ic=q(),$k=bn(),Lk=wn(),Mk=Sr(),ki=Yp(),Bk=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,$c=class n{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ki.getTags(e,"compat"):e?ki.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?ki.coreKnownTags:{},this.tags=ki.getTags(t,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Ic.MAP,{value:$k.map}),Object.defineProperty(this,Ic.SCALAR,{value:Mk.string}),Object.defineProperty(this,Ic.SEQ,{value:Lk.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Bk:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Vp.Schema=$c});var Gp=O(zp=>{"use strict";var Dk=q(),Mc=yr(),Or=pr();function jk(n,e){let t=[],r=e.directives===!0;if(e.directives!==!1&&n.directives){let c=n.directives.toString(n);c?(t.push(c),r=!0):n.directives.docStart&&(r=!0)}r&&t.push("---");let s=Mc.createStringifyContext(n,e),{commentString:i}=s.options;if(n.commentBefore){t.length!==1&&t.unshift("");let c=i(n.commentBefore);t.unshift(Or.indentComment(c,""))}let o=!1,a=null;if(n.contents){if(Dk.isNode(n.contents)){if(n.contents.spaceBefore&&r&&t.push(""),n.contents.commentBefore){let d=i(n.contents.commentBefore);t.push(Or.indentComment(d,""))}s.forceBlockIndent=!!n.comment,a=n.contents.comment}let c=a?void 0:()=>o=!0,l=Mc.stringify(n.contents,s,()=>a=null,c);a&&(l+=Or.lineComment(l,"",i(a))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(Mc.stringify(n.contents,s));if(n.directives?.docEnd)if(n.comment){let c=i(n.comment);c.includes(`
|
|
75
|
+
`)?(t.push("..."),t.push(Or.indentComment(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=n.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(Or.indentComment(i(c),"")))}return t.join(`
|
|
76
76
|
`)+`
|
|
77
|
-
`}
|
|
78
|
-
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=t.linePos[1];c?.line===
|
|
77
|
+
`}zp.stringifyDocument=jk});var Pr=O(Xp=>{"use strict";var Fk=dr(),Sn=Js(),xe=q(),qk=gt(),Uk=ft(),Jk=Lc(),Kk=Gp(),Bc=js(),Hk=qa(),Wk=fr(),Dc=Fa(),jc=class n{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xe.NODE_TYPE,{value:xe.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 Dc.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,{[xe.NODE_TYPE]:{value:xe.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=xe.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){kn(this.contents)&&this.contents.add(e)}addIn(e,t){kn(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=Bc.anchorNames(this);e.anchor=!t||r.has(t)?Bc.findNewAnchor(t||"a",r):t}return new Fk.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 b=S=>typeof S=="number"||S instanceof String||S instanceof Number,A=t.filter(b).map(String);A.length>0&&(t=t.concat(A)),s=t}else r===void 0&&t&&(r=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:d}=r??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=Bc.createNodeAnchors(this,o||"a"),h={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:s,schema:this.schema,sourceObjects:p},m=Wk.createNode(e,d,h);return a&&xe.isCollection(m)&&(m.flow=!0),f(),m}createPair(e,t,r={}){let s=this.createNode(e,null,r),i=this.createNode(t,null,r);return new qk.Pair(s,i)}delete(e){return kn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Sn.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):kn(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return xe.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Sn.isEmptyPath(e)?!t&&xe.isScalar(this.contents)?this.contents.value:this.contents:xe.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return xe.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Sn.isEmptyPath(e)?this.contents!==void 0:xe.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Sn.collectionFromPath(this.schema,[e],t):kn(this.contents)&&this.contents.set(e,t)}setIn(e,t){Sn.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Sn.collectionFromPath(this.schema,Array.from(e),t):kn(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 Dc.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 Dc.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 Jk.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},c=Uk.toJS(this.contents,t??"",a);if(typeof i=="function")for(let{count:l,res:d}of a.anchors.values())i(d,l);return typeof o=="function"?Hk.applyReviver(o,{"":c},"",c):c}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 Kk.stringifyDocument(this,e)}};function kn(n){if(xe.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}Xp.Document=jc});var _r=O(Rr=>{"use strict";var Cr=class extends Error{constructor(e,t,r,s){super(),this.name=e,this.code=r,this.message=s,this.pos=t}},Fc=class extends Cr{constructor(e,t,r){super("YAMLParseError",e,t,r)}},qc=class extends Cr{constructor(e,t,r){super("YAMLWarning",e,t,r)}},Yk=(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
|
|
78
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=t.linePos[1];c?.line===r&&c.col>s&&(a=Math.max(1,Math.min(c.col-s,80-i)));let l=" ".repeat(i)+"^".repeat(a);t.message+=`:
|
|
79
79
|
|
|
80
80
|
${o}
|
|
81
81
|
${l}
|
|
82
|
-
`}};
|
|
83
|
-
`))return!0;if(
|
|
84
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
85
|
-
`+
|
|
86
|
-
`+R.comment:l.comment=R.comment),u=R.end;continue}!o&&t.options.strict&&
|
|
87
|
-
`+$:x.comment=$,R.comment=R.comment.substring($.length+1)}}if(!o&&!_&&!R.found){let $=C?
|
|
88
|
-
`+D.comment:x.comment=D.comment);let U=new
|
|
89
|
-
`+b.comment:l.comment=b.comment),l.range=[
|
|
90
|
-
`.repeat(Math.max(1,o.length-1)):"",b=
|
|
91
|
-
`;for(let m=d;m<a;++m){let[b,A]=o[m];l+=b.length+A.length+1;let
|
|
82
|
+
`}};Rr.YAMLError=Cr;Rr.YAMLParseError=Fc;Rr.YAMLWarning=qc;Rr.prettifyError=Yk});var Nr=O(Qp=>{"use strict";function Vk(n,{flow:e,indicator:t,next:r,offset:s,onError:i,parentIndent:o,startOnNewline:a}){let c=!1,l=a,d=a,u="",f="",p=!1,h=!1,m=null,b=null,A=null,S=null,P=null,_=null,C=null;for(let x of n)switch(h&&(x.type!=="space"&&x.type!=="newline"&&x.type!=="comma"&&i(x.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(l&&x.type!=="comment"&&x.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),x.type){case"space":!e&&(t!=="doc-start"||r?.type!=="flow-collection")&&x.source.includes(" ")&&(m=x),d=!0;break;case"comment":{d||i(x,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=x.source.substring(1)||" ";u?u+=f+D:u=D,f="",l=!1;break}case"newline":l?u?u+=x.source:(!_||t!=="seq-item-ind")&&(c=!0):f+=x.source,l=!0,p=!0,(b||A)&&(S=x),d=!0;break;case"anchor":b&&i(x,"MULTIPLE_ANCHORS","A node can have at most one anchor"),x.source.endsWith(":")&&i(x.offset+x.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),b=x,C??(C=x.offset),l=!1,d=!1,h=!0;break;case"tag":{A&&i(x,"MULTIPLE_TAGS","A node can have at most one tag"),A=x,C??(C=x.offset),l=!1,d=!1,h=!0;break}case t:(b||A)&&i(x,"BAD_PROP_ORDER",`Anchors and tags must be after the ${x.source} indicator`),_&&i(x,"UNEXPECTED_TOKEN",`Unexpected ${x.source} in ${e??"collection"}`),_=x,l=t==="seq-item-ind"||t==="explicit-key-ind",d=!1;break;case"comma":if(e){P&&i(x,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),P=x,l=!1,d=!1;break}default:i(x,"UNEXPECTED_TOKEN",`Unexpected ${x.type} token`),l=!1,d=!1}let R=n[n.length-1],$=R?R.offset+R.source.length:s;return h&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:P,found:_,spaceBefore:c,comment:u,hasNewline:p,anchor:b,tag:A,newlineAfterProp:S,end:$,start:C??$}}Qp.resolveProps=Vk});var xi=O(Zp=>{"use strict";function Uc(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
83
|
+
`))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(Uc(e.key)||Uc(e.value))return!0}return!1;default:return!0}}Zp.containsNewline=Uc});var Jc=O(em=>{"use strict";var zk=xi();function Gk(n,e,t){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===n&&(r.source==="]"||r.source==="}")&&zk.containsNewline(e)&&t(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}em.flowIndentCheck=Gk});var Kc=O(nm=>{"use strict";var tm=q();function Xk(n,e,t){let{uniqueKeys:r}=n.options;if(r===!1)return!1;let s=typeof r=="function"?r:(i,o)=>i===o||tm.isScalar(i)&&tm.isScalar(o)&&i.value===o.value;return e.some(i=>s(i.key,t))}nm.mapIncludes=Xk});var cm=O(am=>{"use strict";var rm=gt(),Qk=bt(),sm=Nr(),Zk=xi(),im=Jc(),ex=Kc(),om="All mapping items must start at the same column";function tx({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=i?.nodeClass??Qk.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let c=r.offset,l=null;for(let d of r.items){let{start:u,key:f,sep:p,value:h}=d,m=sm.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0}),b=!m.found;if(b){if(f&&(f.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&s(c,"BAD_INDENT",om)),!m.anchor&&!m.tag&&!p){l=m.end,m.comment&&(a.comment?a.comment+=`
|
|
84
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Zk.containsNewline(f))&&s(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&s(c,"BAD_INDENT",om);t.atKey=!0;let A=m.end,S=f?n(t,f,m,s):e(t,A,u,null,m,s);t.schema.compat&&im.flowIndentCheck(r.indent,f,s),t.atKey=!1,ex.mapIncludes(t,a.items,S)&&s(A,"DUPLICATE_KEY","Map keys must be unique");let P=sm.resolveProps(p??[],{indicator:"map-value-ind",next:h,offset:S.range[2],onError:s,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=P.end,P.found){b&&(h?.type==="block-map"&&!P.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&m.start<P.found.offset-1024&&s(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=h?n(t,h,P,s):e(t,c,p,null,P,s);t.schema.compat&&im.flowIndentCheck(r.indent,h,s),c=_.range[2];let C=new rm.Pair(S,_);t.options.keepSourceTokens&&(C.srcToken=d),a.items.push(C)}else{b&&s(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),P.comment&&(S.comment?S.comment+=`
|
|
85
|
+
`+P.comment:S.comment=P.comment);let _=new rm.Pair(S);t.options.keepSourceTokens&&(_.srcToken=d),a.items.push(_)}}return l&&l<c&&s(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}am.resolveBlockMap=tx});var um=O(lm=>{"use strict";var nx=wt(),rx=Nr(),sx=Jc();function ix({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=i?.nodeClass??nx.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let c=r.offset,l=null;for(let{start:d,value:u}of r.items){let f=rx.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?s(f.end,"BAD_INDENT","All sequence items must start at the same column"):s(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=u?n(t,u,f,s):e(t,f.end,d,null,f,s);t.schema.compat&&sx.flowIndentCheck(r.indent,u,s),c=p.range[2],a.items.push(p)}return a.range=[r.offset,c,l??c],a}lm.resolveBlockSeq=ix});var xn=O(dm=>{"use strict";function ox(n,e,t,r){let s="";if(n){let i=!1,o="";for(let a of n){let{source:c,type:l}=a;switch(l){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 d=c.substring(1)||" ";s?s+=o+d:s=d,o="";break}case"newline":s&&(o+=c),i=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:s,offset:e}}dm.resolveEnd=ox});var hm=O(mm=>{"use strict";var ax=q(),cx=gt(),fm=bt(),lx=wt(),ux=xn(),pm=Nr(),dx=xi(),fx=Kc(),Hc="Block collections are not allowed within flow collections",Wc=n=>n&&(n.type==="block-map"||n.type==="block-seq");function px({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=r.start.source==="{",a=o?"flow map":"flow sequence",c=i?.nodeClass??(o?fm.YAMLMap:lx.YAMLSeq),l=new c(t.schema);l.flow=!0;let d=t.atRoot;d&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=r.offset+r.start.source.length;for(let b=0;b<r.items.length;++b){let A=r.items[b],{start:S,key:P,sep:_,value:C}=A,R=pm.resolveProps(S,{flow:a,indicator:"explicit-key-ind",next:P??_?.[0],offset:u,onError:s,parentIndent:r.indent,startOnNewline:!1});if(!R.found){if(!R.anchor&&!R.tag&&!_&&!C){b===0&&R.comma?s(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):b<r.items.length-1&&s(R.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),R.comment&&(l.comment?l.comment+=`
|
|
86
|
+
`+R.comment:l.comment=R.comment),u=R.end;continue}!o&&t.options.strict&&dx.containsNewline(P)&&s(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(b===0)R.comma&&s(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(R.comma||s(R.start,"MISSING_CHAR",`Missing , between ${a} items`),R.comment){let $="";e:for(let x of S)switch(x.type){case"comma":case"space":break;case"comment":$=x.source.substring(1);break e;default:break e}if($){let x=l.items[l.items.length-1];ax.isPair(x)&&(x=x.value??x.key),x.comment?x.comment+=`
|
|
87
|
+
`+$:x.comment=$,R.comment=R.comment.substring($.length+1)}}if(!o&&!_&&!R.found){let $=C?n(t,C,R,s):e(t,R.end,_,null,R,s);l.items.push($),u=$.range[2],Wc(C)&&s($.range,"BLOCK_IN_FLOW",Hc)}else{t.atKey=!0;let $=R.end,x=P?n(t,P,R,s):e(t,$,S,null,R,s);Wc(P)&&s(x.range,"BLOCK_IN_FLOW",Hc),t.atKey=!1;let D=pm.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:C,offset:x.range[2],onError:s,parentIndent:r.indent,startOnNewline:!1});if(D.found){if(!o&&!R.found&&t.options.strict){if(_)for(let y of _){if(y===D.found)break;if(y.type==="newline"){s(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}R.start<D.found.offset-1024&&s(D.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?s(C,"MISSING_CHAR",`Missing space after : in ${a}`):s(D.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let K=C?n(t,C,D,s):D.found?e(t,D.end,_,null,D,s):null;K?Wc(C)&&s(K.range,"BLOCK_IN_FLOW",Hc):D.comment&&(x.comment?x.comment+=`
|
|
88
|
+
`+D.comment:x.comment=D.comment);let U=new cx.Pair(x,K);if(t.options.keepSourceTokens&&(U.srcToken=A),o){let y=l;fx.mapIncludes(t,y.items,x)&&s($,"DUPLICATE_KEY","Map keys must be unique"),y.items.push(U)}else{let y=new fm.YAMLMap(t.schema);y.flow=!0,y.items.push(U);let E=(K??x).range;y.range=[x.range[0],E[1],E[2]],l.items.push(y)}u=K?K.range[2]:D.end}}let f=o?"}":"]",[p,...h]=r.end,m=u;if(p?.source===f)m=p.offset+p.source.length;else{let b=a[0].toUpperCase()+a.substring(1),A=d?`${b} must end with a ${f}`:`${b} in block collection must be sufficiently indented and end with a ${f}`;s(u,d?"MISSING_CHAR":"BAD_INDENT",A),p&&p.source.length!==1&&h.unshift(p)}if(h.length>0){let b=ux.resolveEnd(h,m,t.options.strict,s);b.comment&&(l.comment?l.comment+=`
|
|
89
|
+
`+b.comment:l.comment=b.comment),l.range=[r.offset,m,b.offset]}else l.range=[r.offset,m,m];return l}mm.resolveFlowCollection=px});var ym=O(gm=>{"use strict";var mx=q(),hx=te(),gx=bt(),yx=wt(),bx=cm(),wx=um(),vx=hm();function Yc(n,e,t,r,s,i){let o=t.type==="block-map"?bx.resolveBlockMap(n,e,t,r,i):t.type==="block-seq"?wx.resolveBlockSeq(n,e,t,r,i):vx.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 Sx(n,e,t,r,s){let i=r.tag,o=i?e.directives.tagName(i.source,f=>s(i,"TAG_RESOLVE_FAILED",f)):null;if(t.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,h=f&&i?f.offset>i.offset?f:i:f??i;h&&(!p||p.offset<h.offset)&&s(h,"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===gx.YAMLMap.tagName&&a==="map"||o===yx.YAMLSeq.tagName&&a==="seq")return Yc(n,e,t,s,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!c){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?s(i,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Yc(n,e,t,s,o)}let l=Yc(n,e,t,s,o,c),d=c.resolve?.(l,f=>s(i,"TAG_RESOLVE_FAILED",f),e.options)??l,u=mx.isNode(d)?d:new hx.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}gm.composeCollection=Sx});var zc=O(bm=>{"use strict";var Vc=te();function kx(n,e,t){let r=e.offset,s=xx(e,n.options.strict,t);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};let i=s.mode===">"?Vc.Scalar.BLOCK_FOLDED:Vc.Scalar.BLOCK_LITERAL,o=e.source?Ex(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let b=o[m][1];if(b===""||b==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&o.length>0?`
|
|
90
|
+
`.repeat(Math.max(1,o.length-1)):"",b=r+s.length;return e.source&&(b+=e.source.length),{value:m,type:i,comment:s.comment,range:[r,b,b]}}let c=e.indent+s.indent,l=e.offset+s.length,d=0;for(let m=0;m<a;++m){let[b,A]=o[m];if(A===""||A==="\r")s.indent===0&&b.length>c&&(c=b.length);else{b.length<c&&t(l+b.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=b.length),d=m,c===0&&!n.atRoot&&t(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=b.length+A.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>c&&(a=m+1);let u="",f="",p=!1;for(let m=0;m<d;++m)u+=o[m][0].slice(c)+`
|
|
91
|
+
`;for(let m=d;m<a;++m){let[b,A]=o[m];l+=b.length+A.length+1;let S=A[A.length-1]==="\r";if(S&&(A=A.slice(0,-1)),A&&b.length<c){let _=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;t(l-A.length-(S?2:1),"BAD_INDENT",_),b=""}i===Vc.Scalar.BLOCK_LITERAL?(u+=f+b.slice(c)+A,f=`
|
|
92
92
|
`):b.length>c||A[0]===" "?(f===" "?f=`
|
|
93
93
|
`:!p&&f===`
|
|
94
94
|
`&&(f=`
|
|
@@ -101,90 +101,90 @@ ${l}
|
|
|
101
101
|
`+o[m][0].slice(c);u[u.length-1]!==`
|
|
102
102
|
`&&(u+=`
|
|
103
103
|
`);break;default:u+=`
|
|
104
|
-
`}let h=
|
|
104
|
+
`}let h=r+s.length+e.source.length;return{value:u,type:i,comment:s.comment,range:[r,h,h]}}function xx({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="",c=-1;for(let f=1;f<s.length;++f){let p=s[f];if(!a&&(p==="-"||p==="+"))a=p;else{let h=Number(p);!o&&h?o=h:c===-1&&(c=n+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let l=!1,d="",u=s.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":u+=p.source.length;break;case"comment":t&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let h=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",h);let m=p.source;m&&typeof m=="string"&&(u+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:d,length:u}}function Ex(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}bm.resolveBlockScalar=kx});var Xc=O(vm=>{"use strict";var Gc=te(),Ax=xn();function Tx(n,e,t){let{offset:r,type:s,source:i,end:o}=n,a,c,l=(f,p,h)=>t(r+f,p,h);switch(s){case"scalar":a=Gc.Scalar.PLAIN,c=Ox(i,l);break;case"single-quoted-scalar":a=Gc.Scalar.QUOTE_SINGLE,c=Px(i,l);break;case"double-quoted-scalar":a=Gc.Scalar.QUOTE_DOUBLE,c=Cx(i,l);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 d=r+i.length,u=Ax.resolveEnd(o,d,e,t);return{value:c,type:a,comment:u.comment,range:[r,d,u.offset]}}function Ox(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}`),wm(n)}function Px(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),wm(n.slice(1,-1)).replace(/''/g,"'")}function wm(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
105
105
|
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
106
|
-
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let
|
|
106
|
+
`,"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===`
|
|
107
107
|
`?s+=i:i=`
|
|
108
|
-
`:(s+=i+
|
|
108
|
+
`:(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 Cx(n,e){let t="";for(let r=1;r<n.length-1;++r){let s=n[r];if(!(s==="\r"&&n[r+1]===`
|
|
109
109
|
`))if(s===`
|
|
110
|
-
`){let{fold:i,offset:o}=
|
|
111
|
-
`)for(i=r
|
|
112
|
-
`)for(i=
|
|
113
|
-
`&&!(o==="\r"&&r
|
|
114
|
-
`)&&(t+=
|
|
115
|
-
`||
|
|
116
|
-
`);)
|
|
110
|
+
`){let{fold:i,offset:o}=Rx(n,r);t+=i,r=o}else if(s==="\\"){let i=n[++r],o=_x[i];if(o)t+=o;else if(i===`
|
|
111
|
+
`)for(i=n[r+1];i===" "||i===" ";)i=n[++r+1];else if(i==="\r"&&n[r+1]===`
|
|
112
|
+
`)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+=Nx(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!==`
|
|
113
|
+
`&&!(o==="\r"&&n[r+2]===`
|
|
114
|
+
`)&&(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 Rx(n,e){let t="",r=n[e+1];for(;(r===" "||r===" "||r===`
|
|
115
|
+
`||r==="\r")&&!(r==="\r"&&n[e+2]!==`
|
|
116
|
+
`);)r===`
|
|
117
117
|
`&&(t+=`
|
|
118
|
-
`),e+=1,n
|
|
119
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
118
|
+
`),e+=1,r=n[e+1];return t||(t=" "),{fold:t,offset:e}}var _x={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
119
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Nx(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)}vm.resolveFlowScalar=Tx});var xm=O(km=>{"use strict";var Ht=q(),Sm=te(),Ix=zc(),$x=Xc();function Lx(n,e,t,r){let{value:s,type:i,comment:o,range:a}=e.type==="block-scalar"?Ix.resolveBlockScalar(n,e,r):$x.resolveFlowScalar(e,n.options.strict,r),c=t?n.directives.tagName(t.source,u=>r(t,"TAG_RESOLVE_FAILED",u)):null,l;n.options.stringKeys&&n.atKey?l=n.schema[Ht.SCALAR]:c?l=Mx(n.schema,s,c,t,r):e.type==="scalar"?l=Bx(n,s,e,r):l=n.schema[Ht.SCALAR];let d;try{let u=l.resolve(s,f=>r(t??e,"TAG_RESOLVE_FAILED",f),n.options);d=Ht.isScalar(u)?u:new Sm.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);r(t??e,"TAG_RESOLVE_FAILED",f),d=new Sm.Scalar(s)}return d.range=a,d.source=s,i&&(d.type=i),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Mx(n,e,t,r,s){if(t==="!")return n[Ht.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[Ht.SCALAR])}function Bx({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[Ht.SCALAR];if(t.compat){let a=t.compat.find(c=>c.default&&c.test?.test(r))??t[Ht.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),d=`Value may be parsed as either ${c} or ${l}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return o}km.composeScalar=Lx});var Am=O(Em=>{"use strict";function Dx(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}Em.emptyScalarPosition=Dx});var Pm=O(Zc=>{"use strict";var jx=dr(),Fx=q(),qx=ym(),Tm=xm(),Ux=xn(),Jx=Am(),Kx={composeNode:Om,composeEmptyNode:Qc};function Om(n,e,t,r){let s=n.atKey,{spaceBefore:i,comment:o,anchor:a,tag:c}=t,l,d=!0;switch(e.type){case"alias":l=Hx(n,e,r),(a||c)&&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":l=Tm.composeScalar(n,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=qx.composeCollection(Kx,n,e,t,r),a&&(l.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),l=Qc(n,e.offset,void 0,null,t,r),d=!1}}return a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&n.options.stringKeys&&(!Fx.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),n.options.keepSourceTokens&&d&&(l.srcToken=e),l}function Qc(n,e,t,r,{spaceBefore:s,comment:i,anchor:o,tag:a,end:c},l){let d={type:"scalar",offset:Jx.emptyScalarPosition(e,t,r),indent:-1,source:""},u=Tm.composeScalar(n,d,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=c),u}function Hx({options:n},{offset:e,source:t,end:r},s){let i=new jx.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=Ux.resolveEnd(r,o,n.strict,s);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}Zc.composeEmptyNode=Qc;Zc.composeNode=Om});var _m=O(Rm=>{"use strict";var Wx=Pr(),Cm=Pm(),Yx=xn(),Vx=Nr();function zx(n,e,{offset:t,start:r,value:s,end:i},o){let a=Object.assign({_directives:e},n),c=new Wx.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Vx.resolveProps(r,{indicator:"doc-start",next:s??i?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?Cm.composeNode(l,s,d,o):Cm.composeEmptyNode(l,d.end,r,null,d,o);let u=c.contents.range[2],f=Yx.resolveEnd(i,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[t,u,f.offset],c}Rm.composeDoc=zx});var tl=O($m=>{"use strict";var Gx=Ps("process"),Xx=Fa(),Qx=Pr(),Ir=_r(),Nm=q(),Zx=_m(),e0=xn();function $r(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 Im(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?`
|
|
120
120
|
|
|
121
121
|
`:`
|
|
122
|
-
`)+(i.substring(1)||" "),t=!0,
|
|
123
|
-
${
|
|
124
|
-
${a}`:
|
|
125
|
-
${o}`:
|
|
126
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new
|
|
122
|
+
`)+(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 el=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,s,i)=>{let o=$r(t);i?this.warnings.push(new Ir.YAMLWarning(o,r,s)):this.errors.push(new Ir.YAMLParseError(o,r,s))},this.directives=new Xx.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:s}=Im(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
123
|
+
${r}`:r;else if(s||e.directives.docStart||!i)e.commentBefore=r;else if(Nm.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];Nm.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${r}
|
|
124
|
+
${a}`:r}else{let o=i.commentBefore;i.commentBefore=o?`${r}
|
|
125
|
+
${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:Im(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(Gx.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,s)=>{let i=$r(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Zx.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 Ir.YAMLParseError($r(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 Ir.YAMLParseError($r(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let t=e0.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}
|
|
126
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Ir.YAMLParseError($r(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 Qx.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}}};$m.Composer=el});var Bm=O(Ei=>{"use strict";var t0=zc(),n0=Xc(),r0=_r(),Lm=gr();function s0(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 r0.YAMLParseError([a,a+1],i,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return n0.resolveFlowScalar(n,e,r);case"block-scalar":return t0.resolveBlockScalar({options:{strict:e}},n,r)}}return null}function i0(n,e){let{implicitKey:t=!1,indent:r,inFlow:s=!1,offset:i=-1,type:o="PLAIN"}=e,a=Lm.stringifyString({type:o,value:n},{implicitKey:t,indent:r>0?" ".repeat(r):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
127
127
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
128
128
|
`),d=a.substring(0,l),u=a.substring(l+1)+`
|
|
129
|
-
`,f=[{type:"block-scalar-header",offset:i,indent:
|
|
130
|
-
`}),{type:"block-scalar",offset:i,indent:
|
|
131
|
-
`),
|
|
132
|
-
`;if(
|
|
133
|
-
`});for(let c of Object.keys(
|
|
134
|
-
`};delete
|
|
129
|
+
`,f=[{type:"block-scalar-header",offset:i,indent:r,source:d}];return Mm(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
|
|
130
|
+
`}),{type:"block-scalar",offset:i,indent:r,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:r,source:a,end:c};default:return{type:"scalar",offset:i,indent:r,source:a,end:c}}}function o0(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 l=n.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Lm.stringifyString({type:o,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":a0(n,c);break;case'"':nl(n,c,"double-quoted-scalar");break;case"'":nl(n,c,"single-quoted-scalar");break;default:nl(n,c,"scalar")}}function a0(n,e){let t=e.indexOf(`
|
|
131
|
+
`),r=e.substring(0,t),s=e.substring(t+1)+`
|
|
132
|
+
`;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}];Mm(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
133
|
+
`});for(let c of Object.keys(n))c!=="type"&&c!=="offset"&&delete n[c];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:s})}}function Mm(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 nl(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:`
|
|
134
|
+
`};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})}}}Ei.createScalarToken=i0;Ei.resolveAsScalar=s0;Ei.setScalarValue=o0});var jm=O(Dm=>{"use strict";var c0=n=>"type"in n?Ti(n):Ai(n);function Ti(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=Ti(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=Ai(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=Ai(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=Ai(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 Ai({start:n,key:e,sep:t,value:r}){let s="";for(let i of n)s+=i.source;if(e&&(s+=Ti(e)),t)for(let i of t)s+=i.source;return r&&(s+=Ti(r)),s}Dm.stringify=c0});var Jm=O(Um=>{"use strict";var rl=Symbol("break visit"),l0=Symbol("skip children"),Fm=Symbol("remove item");function Wt(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),qm(Object.freeze([]),n,e)}Wt.BREAK=rl;Wt.SKIP=l0;Wt.REMOVE=Fm;Wt.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};Wt.parentCollection=(n,e)=>{let t=Wt.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 qm(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=qm(Object.freeze(n.concat([[s,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===rl)return rl;a===Fm&&(i.items.splice(o,1),o-=1)}}typeof r=="function"&&s==="key"&&(r=r(e,n))}}return typeof r=="function"?r(e,n):r}Um.visit=Wt});var Oi=O(ge=>{"use strict";var sl=Bm(),u0=jm(),d0=Jm(),il="\uFEFF",ol="",al="",cl="",f0=n=>!!n&&"items"in n,p0=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function m0(n){switch(n){case il:return"<BOM>";case ol:return"<DOC>";case al:return"<FLOW_END>";case cl:return"<SCALAR>";default:return JSON.stringify(n)}}function h0(n){switch(n){case il:return"byte-order-mark";case ol:return"doc-mode";case al:return"flow-error-end";case cl:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
135
135
|
`:case`\r
|
|
136
|
-
`: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(
|
|
137
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
138
|
-
\r `),
|
|
136
|
+
`: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}ge.createScalarToken=sl.createScalarToken;ge.resolveAsScalar=sl.resolveAsScalar;ge.setScalarValue=sl.setScalarValue;ge.stringify=u0.stringify;ge.visit=d0.visit;ge.BOM=il;ge.DOCUMENT=ol;ge.FLOW_END=al;ge.SCALAR=cl;ge.isCollection=f0;ge.isScalar=p0;ge.prettyToken=m0;ge.tokenType=h0});var dl=O(Hm=>{"use strict";var Lr=Oi();function Ie(n){switch(n){case void 0:case" ":case`
|
|
137
|
+
`:case"\r":case" ":return!0;default:return!1}}var Km=new Set("0123456789ABCDEFabcdef"),g0=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pi=new Set(",[]{}"),y0=new Set(` ,[]{}
|
|
138
|
+
\r `),ll=n=>!n||y0.has(n),ul=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===`
|
|
139
139
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
140
|
-
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let
|
|
141
|
-
`||!s&&!this.atEnd)return e+
|
|
142
|
-
`||
|
|
143
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
144
|
-
`,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=
|
|
145
|
-
`,i)}s!==-1&&(t=s-(
|
|
140
|
+
`:!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===`
|
|
141
|
+
`||!s&&!this.atEnd)return e+r+1}return t===`
|
|
142
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Ie(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
143
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Lr.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,r=e.indexOf("#");for(;r!==-1;){let i=e[r-1];if(i===" "||i===" "){t=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Lr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&Ie(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ie(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Ie(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ll),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=r=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&s[0]!=="#"||r===0&&(s.startsWith("---")||s.startsWith("..."))&&Ie(s[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield Lr.FLOW_END,yield*this.parseLineStart();let i=0;for(;s[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),s[i]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(ll),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Ie(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),s=r.indexOf(`
|
|
144
|
+
`,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=r.indexOf(`
|
|
145
|
+
`,i)}s!==-1&&(t=s-(r[s-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Ie(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":t+=1;break;case`
|
|
146
146
|
`:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
147
|
-
`)break}default:break e}if(!
|
|
148
|
-
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(
|
|
149
|
-
`;)
|
|
150
|
-
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield
|
|
151
|
-
`?(
|
|
152
|
-
`,i=this.buffer[
|
|
153
|
-
`){let o=this.continueScalar(
|
|
147
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
|
148
|
+
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
149
|
+
`;)r=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
|
150
|
+
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield Lr.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(Ie(i)||e&&Pi.has(i))break;t=r}else if(Ie(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===`
|
|
151
|
+
`?(r+=1,s=`
|
|
152
|
+
`,i=this.buffer[r+1]):t=r),i==="#"||e&&Pi.has(i))break;if(s===`
|
|
153
|
+
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Pi.has(s))break;t=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield Lr.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(ll))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Ie(t)||e&&Pi.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(;!Ie(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(g0.has(t))t=this.buffer[++e];else if(t==="%"&&Km.has(this.buffer[e+1])&&Km.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===`
|
|
154
154
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
155
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,
|
|
155
|
+
`?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)}};Hm.Lexer=ul});var pl=O(Wm=>{"use strict";var fl=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}}}};Wm.LineCounter=fl});var hl=O(Xm=>{"use strict";var b0=Ps("process"),Ym=Oi(),w0=dl();function vt(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function Vm(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 Gm(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 Ci(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 En(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 zm(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!vt(e.start,"explicit-key-ind")&&!vt(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Gm(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 ml=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 w0.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,b0.env.LOG_TOKENS&&console.log("|",Ym.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Ym.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"&&zm(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&&Vm(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":{Vm(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=Ci(this.peek(2)),r=En(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(`
|
|
156
156
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
157
|
-
`,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
|
|
157
|
+
`,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 c=t.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.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(vt(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(Gm(t.key)&&!vt(t.sep,"newline")){let o=En(t.start),a=t.key,c=t.sep;c.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:c}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(vt(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=En(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]}):vt(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&&!vt(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||vt(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=Ci(r),i=En(s);zm(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(`
|
|
158
158
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
159
|
-
`,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=
|
|
160
|
-
`),t=e.trim();if(
|
|
161
|
-
`).length}];let
|
|
162
|
-
`),s=[],i=0,o=-1,a=0,c=()=>{if(o>=i){let l=
|
|
163
|
-
`).trim();l&&s.push({text:l,startLine:i+1,endLine:o+1})}};for(let l=0;l<
|
|
159
|
+
`,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=Ci(e),r=En(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=Ci(e),r=En(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())}}};Xm.Parser=ml});var nh=O(Br=>{"use strict";var Qm=tl(),v0=Pr(),Mr=_r(),S0=Za(),k0=q(),x0=pl(),Zm=hl();function eh(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new x0.LineCounter||null,prettyErrors:e}}function E0(n,e={}){let{lineCounter:t,prettyErrors:r}=eh(e),s=new Zm.Parser(t?.addNewLine),i=new Qm.Composer(e),o=Array.from(i.compose(s.parse(n)));if(r&&t)for(let a of o)a.errors.forEach(Mr.prettifyError(n,t)),a.warnings.forEach(Mr.prettifyError(n,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function th(n,e={}){let{lineCounter:t,prettyErrors:r}=eh(e),s=new Zm.Parser(t?.addNewLine),i=new Qm.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 Mr.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&t&&(o.errors.forEach(Mr.prettifyError(n,t)),o.warnings.forEach(Mr.prettifyError(n,t))),o}function A0(n,e,t){let r;typeof e=="function"?r=e:t===void 0&&e&&typeof e=="object"&&(t=e);let s=th(n,t);if(!s)return null;if(s.warnings.forEach(i=>S0.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 T0(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 k0.isDocument(n)&&!r?n.toString(t):new v0.Document(n,r,t).toString(t)}Br.parse=A0;Br.parseAllDocuments=E0;Br.parseDocument=th;Br.stringify=T0});var sh=O(J=>{"use strict";var O0=tl(),P0=Pr(),C0=Lc(),gl=_r(),R0=dr(),St=q(),_0=gt(),N0=te(),I0=bt(),$0=wt(),L0=Oi(),M0=dl(),B0=pl(),D0=hl(),Ri=nh(),rh=ar();J.Composer=O0.Composer;J.Document=P0.Document;J.Schema=C0.Schema;J.YAMLError=gl.YAMLError;J.YAMLParseError=gl.YAMLParseError;J.YAMLWarning=gl.YAMLWarning;J.Alias=R0.Alias;J.isAlias=St.isAlias;J.isCollection=St.isCollection;J.isDocument=St.isDocument;J.isMap=St.isMap;J.isNode=St.isNode;J.isPair=St.isPair;J.isScalar=St.isScalar;J.isSeq=St.isSeq;J.Pair=_0.Pair;J.Scalar=N0.Scalar;J.YAMLMap=I0.YAMLMap;J.YAMLSeq=$0.YAMLSeq;J.CST=L0;J.Lexer=M0.Lexer;J.LineCounter=B0.LineCounter;J.Parser=D0.Parser;J.parse=Ri.parse;J.parseAllDocuments=Ri.parseAllDocuments;J.parseDocument=Ri.parseDocument;J.stringify=Ri.stringify;J.visit=rh.visit;J.visitAsync=rh.visitAsync});function F0(n){try{return JSON.parse(n.trim()),!0}catch{return!1}}function q0(n){let e=n.trim();if(!e.startsWith("<"))return!1;let t=e.match(j0);return t?or(e,t[1])!==null:!1}function U0(n){let e=n.trim();if(!e.match(/^(---|#|\w+:|-)/)||"[{<".includes(e[0]))return!1;try{let t=ih.parse(e);return t!==null&&typeof t=="object"}catch{return!1}}function oh(n){return F0(n)||q0(n)||U0(n)}var ih,j0,yl=v(()=>{gf();ih=Vw(sh(),1),j0=/<([a-zA-Z_][\w.-]*)/});function J0(n){if(!n?.trim())return[];let e=n.replace(/\r\n/g,`
|
|
160
|
+
`),t=e.trim();if(oh(t))return[{text:t,startLine:1,endLine:e.split(`
|
|
161
|
+
`).length}];let r=e.split(`
|
|
162
|
+
`),s=[],i=0,o=-1,a=0,c=()=>{if(o>=i){let l=r.slice(i,o+1).join(`
|
|
163
|
+
`).trim();l&&s.push({text:l,startLine:i+1,endLine:o+1})}};for(let l=0;l<r.length;l++)r[l].trim()?(a>=2&&o>=i&&(c(),i=l),a=0,o=l):a++;return c(),s}function _i(n){return J0(n).map(e=>e.text)}var ah,ch=v(()=>{yl();ah=`
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
`});function Ti(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Fm=S(()=>{});var _0,N0,dl,qm=S(()=>{_0=[["\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","-"]],N0=new Map(_0),dl=N0});var Um,Pi,fl,Jm=S(()=>{Um=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],Pi={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:Um,nb:Um,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 r of Object.keys(Pi))Pi[r]=new Map(Pi[r]);fl=Pi});function pl(r,e){if(typeof r!="string")throw new TypeError(`Expected a string, got \`${typeof r}\``);e={customReplacements:[],...e};let t=$0(e.locale),n=dl,s=e.customReplacements.length>0||e.customReplacements.size>0;if(t||s){if(n=new Map(dl),t)for(let[i,o]of t)n.set(i,o);for(let[i,o]of e.customReplacements)n.set(i,o)}return r=r.normalize(),r=I0(r,n),r=r.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),r=r.replaceAll(/\p{Dash_Punctuation}/gu,"-"),r}var I0,$0,Km=S(()=>{qm();Jm();I0=(r,e)=>{for(let[t,n]of e)r=r.replaceAll(t,n);return r},$0=r=>{if(!r)return;let e=r.toLowerCase().replace(/^no(-|$)/,"nb$1");return fl[e]||fl[e.split("-")[0]]||void 0}});var L0,Hm,Wm=S(()=>{L0=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],Hm=L0});function ml(r,e){if(typeof r!="string")throw new TypeError(`Expected a string, got \`${typeof r}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let t=e.preserveLeadingUnderscore&&r.startsWith("_"),n=e.preserveTrailingDash&&r.endsWith("-");if(e.transliterate){let i=new Map([...Hm,...e.customReplacements]);r=pl(r,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)r=r.replaceAll(i,o);e.decamelize&&(r=M0(r));let s=D0(e);return e.lowercase&&(r=e.locale?r.toLocaleLowerCase(e.locale):r.toLowerCase()),r=r.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),r=r.replace(s,e.separator),r=r.replaceAll("\\",""),e.separator&&(r=B0(r,e.separator)),t&&(r=`_${r}`),n&&(r=`${r}-`),r}var M0,B0,D0,Ym=S(()=>{Fm();Km();Wm();M0=r=>r.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"),B0=(r,e)=>{let t=Ti(e);return r.replaceAll(new RegExp(`(?:${t}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${t})|(?:${t})$`,"g"),"")},D0=r=>{let e=String.raw`a-z\d`;if(e+=r.lowercase?"":"A-Z",r.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),r.preserveCharacters.length>0)for(let n of r.preserveCharacters){if(n===r.separator)throw new Error(`The separator character \`${r.separator}\` cannot be included in preserved characters: ${r.preserveCharacters}`);e+=Ti(n)}let t=r.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,t)}});function vr(r){return ml(r)}var Vm=S(()=>{Ym()});var Ln,hl,zm=S(()=>{Ln=` *, *::before, *::after { box-sizing: border-box; }
|
|
166
|
+
`});function Ni(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var lh=v(()=>{});var K0,H0,bl,uh=v(()=>{K0=[["\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","-"]],H0=new Map(K0),bl=H0});var dh,Ii,wl,fh=v(()=>{dh=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],Ii={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:dh,nb:dh,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(Ii))Ii[n]=new Map(Ii[n]);wl=Ii});function vl(n,e){if(typeof n!="string")throw new TypeError(`Expected a string, got \`${typeof n}\``);e={customReplacements:[],...e};let t=Y0(e.locale),r=bl,s=e.customReplacements.length>0||e.customReplacements.size>0;if(t||s){if(r=new Map(bl),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=W0(n,r),n=n.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),n=n.replaceAll(/\p{Dash_Punctuation}/gu,"-"),n}var W0,Y0,ph=v(()=>{uh();fh();W0=(n,e)=>{for(let[t,r]of e)n=n.replaceAll(t,r);return n},Y0=n=>{if(!n)return;let e=n.toLowerCase().replace(/^no(-|$)/,"nb$1");return wl[e]||wl[e.split("-")[0]]||void 0}});var V0,mh,hh=v(()=>{V0=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],mh=V0});function Sl(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([...mh,...e.customReplacements]);n=vl(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=z0(n));let s=X0(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=G0(n,e.separator)),t&&(n=`_${n}`),r&&(n=`${n}-`),n}var z0,G0,X0,gh=v(()=>{lh();ph();hh();z0=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"),G0=(n,e)=>{let t=Ni(e);return n.replaceAll(new RegExp(`(?:${t}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${t})|(?:${t})$`,"g"),"")},X0=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+=Ni(r)}let t=n.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,t)}});function An(n){return Sl(n)}var yh=v(()=>{gh()});var Dr,kl,bh=v(()=>{Dr=` *, *::before, *::after { box-sizing: border-box; }
|
|
167
167
|
canvas { max-width: 100%; }
|
|
168
168
|
body { margin: 0; display: flow-root; font-family: system-ui, -apple-system, sans-serif; }
|
|
169
169
|
html[data-theme="dark"] { color-scheme: dark; }
|
|
170
|
-
html[data-theme="light"] { color-scheme: light; }`,
|
|
171
|
-
\u2026[${
|
|
172
|
-
`).map(i=>i.trim()).filter(Boolean),t=e[0];if(!t)return"";let
|
|
173
|
-
`):
|
|
174
|
-
`).length,"line")}`;if(t.mode==="content")return
|
|
175
|
-
`)){if(!p.includes(`"${d}"`))continue;let h;try{h=JSON.parse(p)}catch{continue}let m=h?.[u];h?.type===d&&typeof m=="string"&&m&&(f=m)}return f},o=s(0,Math.min(65536,
|
|
176
|
-
`)){if(!l.trim())continue;let d;try{d=JSON.parse(l)}catch{continue}if(!d||
|
|
177
|
-
`),c=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||c.length){let u=Date.parse(e.timestamp??""),f=!isNaN(u)&&u>=t;
|
|
178
|
-
`),
|
|
179
|
-
`)}function
|
|
180
|
-
`&&(e[a]=" ")},
|
|
181
|
-
`;)a++;t(
|
|
182
|
-
`;){let l=
|
|
183
|
-
`;)
|
|
184
|
-
`).length-1}));return
|
|
185
|
-
`),a=
|
|
186
|
-
`);for(let c=0;c<o.length;c++){let l=a[c],d=c+1+s;for(let u of
|
|
187
|
-
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+
|
|
170
|
+
html[data-theme="light"] { color-scheme: light; }`,kl=" html, body { height: 100%; }"});var le=v(()=>{Rs();_a();sf();lf();yl();ch();yh();bh();_s()});function we(n){return n.length>5e4?n.slice(0,5e4)+`
|
|
171
|
+
\u2026[${n.length-5e4} more characters truncated]`:n}function $e(n){let e=n.replace(Q0,"").split(`
|
|
172
|
+
`).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 Q0,$i,jr=v(()=>{Q0=/\u001b\[[0-9;]*m/g;$i=(n,e)=>``});import{existsSync as Z0,readdirSync as eE,statSync as tE}from"fs";import{join as nE}from"path";function Li(n){if(!Z0(n))return[];let e;try{e=eE(n)}catch{return[]}let t=[];for(let r of e){if(!r.endsWith(".jsonl"))continue;let s=nE(n,r);try{let i=tE(s);i.isFile()&&t.push({sessionId:r.slice(0,-6),file:s,mtime:i.mtimeMs})}catch{}}return t}var El=v(()=>{});var kt,Mi=v(()=>{kt=class{ensureHarnessSupport(){}}});import{openSync as rE,readSync as sE,closeSync as iE,statSync as oE,readdirSync as aE,readFileSync as cE,existsSync as lE}from"fs";import{join as qr}from"path";import{homedir as Ol}from"os";function uE(n){return n.replace(/[^a-zA-Z0-9]/g,"-")}function Bi(n){let e=n?.type==="image"?n.source:void 0;return e?.type==="base64"&&e.data?$i(e.data,e.media_type):""}function Al(n){return typeof n=="string"?we(n):Array.isArray(n)?n.map(e=>{if(typeof e=="string")return we(e);let t=e;return typeof t?.text=="string"?we(t.text):t?.content!=null?Al(t.content):Bi(t)}).join(`
|
|
173
|
+
`):n==null?"":we(JSON.stringify(n))}function fE(n){let e=n.trim();return!!e&&xh.some(t=>t.test(e))}function pE(n){let e=n.trim();return e?xh.some(t=>{let r=t.exec(e);return!!r&&r.index===0}):!0}function hE(n){return n.replace(mE,"")}function gE(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 xt(n){let e=hE(n).trim();return e?gE(e)??(fE(e)?"":e):""}function Tl(n){return n?.type==="text"&&typeof n.text=="string"?xt(n.text):""}function Pl(n,e){if(typeof n=="string")return $e(n);if(!n||typeof n!="object")return $e(e);let t=n;if(t.type==="text"&&typeof t.file?.numLines=="number")return Le(t.file.numLines,"line");if(t.type==="image"){let r=Sh(t.file?.originalSize);return r?`image (${r})`:"image"}if(t.type==="pdf"){let r=Sh(t.file?.originalSize);return r?`PDF (${r})`:"PDF"}if(t.type==="parts"&&typeof t.file?.count=="number")return Le(t.file.count,"page");if(t.type==="file_unchanged")return"unchanged since last read";if(t.type==="create"&&typeof t.content=="string")return`created, ${Le(t.content.split(`
|
|
174
|
+
`).length,"line")}`;if(t.mode==="content")return Le(t.numLines??0,"line");if(t.mode==="count")return`${Le(t.numMatches??0,"match","matches")} (${Le(t.numFiles??0,"file")})`;if(t.mode==="files_with_matches")return Le(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":$e(t.stdout||t.stderr||"")||"no output":typeof t.code=="number"&&typeof t.codeText=="string"?`${t.code} ${t.codeText}`:typeof t.searchCount=="number"?Le(t.searchCount,"search","searches"):Array.isArray(t.matches)&&typeof t.total_deferred_tools=="number"?Le(t.matches.length,"tool"):Array.isArray(t.newTodos)?Le(t.newTodos.length,"todo"):typeof t.numFiles=="number"?Le(t.numFiles,"file"):$e(e)}function Fr(n){return!!n.isSidechain||!!n.isMeta}function yE(n){let e;try{e=rE(n,"r")}catch{return""}try{let r=65536;try{r=oE(n).size}catch{}let s=(l,d)=>{if(d<=0)return"";let u=Buffer.alloc(d),f=sE(e,u,0,d,l);return u.subarray(0,f).toString("utf8")},i=(l,d,u)=>{let f="";for(let p of l.split(`
|
|
175
|
+
`)){if(!p.includes(`"${d}"`))continue;let h;try{h=JSON.parse(p)}catch{continue}let m=h?.[u];h?.type===d&&typeof m=="string"&&m&&(f=m)}return f},o=s(0,Math.min(65536,r)),a=r>65536?s(r-65536,65536):"",c=i(a,"custom-title","customTitle")||i(o,"custom-title","customTitle")||i(a,"ai-title","aiTitle")||i(o,"ai-title","aiTitle");if(c)return c.replace(/\s+/g," ").trim().slice(0,200);for(let l of o.split(`
|
|
176
|
+
`)){if(!l.trim())continue;let d;try{d=JSON.parse(l)}catch{continue}if(!d||Fr(d)||d.type!=="user")continue;let u=d.message?.content,f="";typeof u=="string"?f=xt(u):Array.isArray(u)&&(f=u.map(Tl).filter(Boolean).join(" "));let p=f.replace(/\s+/g," ").trim();if(p)return(p.replace(/^Continuing from a prior session\. Here is the summary of our work so far:\s*/i,"").trim()||p).slice(0,200)}return""}finally{iE(e)}}function bE(n){let e;try{e=aE(kh)}catch{return!1}for(let t of e)if(t.endsWith(".json"))try{let r=JSON.parse(cE(qr(kh,t),"utf8"));if(r?.sessionId!==n)continue;return process.kill(r.pid,0),!0}catch{}return!1}var dE,vh,xh,mE,Le,Sh,kh,Tn,Di=v(()=>{jr();El();Mi();dE=qr(Ol(),".claude","projects"),vh=n=>qr(dE,uE(n));xh=[/\[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];mE=/<ide_[a-z_]+>[\s\S]*?<\/ide_[a-z_]+>/gi;Le=(n,e,t=e+"s")=>`${n} ${n===1?e:t}`,Sh=n=>typeof n!="number"?"":n<1024?`${n}B`:n<1048576?`${Math.round(n/1024)}KB`:`${(n/1048576).toFixed(1)}MB`;kh=qr(Ol(),".claude","sessions");Tn=class extends kt{displayName="Claude Mirror";detectsSelf(){return process.env.CLAUDECODE==="1"}detectsInstalled(){return lE(qr(Ol(),".claude"))}sessionsDir(e){return vh(e)}listSessionFiles(e){return Li(vh(e))}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){return!!e.isSidechain}isLeafType(e){return e.type==="user"||e.type==="assistant"}isRecoveryNoise(e){return!!e.isApiErrorMessage}apply(e,t){if(Fr(e))return{events:[]};let r=[];if(e.type==="user"){let s=e.message?.content;if(typeof s=="string"){let i=xt(s);i&&r.push({type:"user",text:i})}else if(Array.isArray(s))for(let i of s)if(i?.type==="tool_result"){let o=Al(i.content);r.push({type:"tool_result",id:i.tool_use_id??"",content:o,isError:!!i.is_error,digest:Pl(e.toolUseResult,o)})}else{let o=Tl(i)||Bi(i);o&&r.push({type:"user",text:o})}return{events:r}}if(e.type==="attachment"&&e.attachment?.type==="queued_command"){let s=xt(Al(e.attachment.prompt));return s&&r.push({type:"user",text: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=>!pE(u)).join(""),a=i.filter(u=>u.type==="thinking").map(u=>u.thinking??"").join(`
|
|
177
|
+
`),c=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||c.length){let u=Date.parse(e.timestamp??""),f=!isNaN(u)&&u>=t;r.push({type:"assistant",text:o,thinking:a,tools:c,live:f})}let l=e.message?.usage??e.usage,d=l&&{in:l.input_tokens??0,out:l.output_tokens??0,cached:l.cache_read_input_tokens??0,cacheCreate:l.cache_creation_input_tokens??0};return{events:r,usage:d,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(l=>l&&l.type==="text").map(l=>l.text??"").join(""):"";if(!(Array.isArray(o)&&o.some(l=>l&&l.type==="tool_result"))&&a.trim()&&xt(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!1;let i=new Set;for(let o of e){let a=o.message?.content;if(Array.isArray(a))for(let c of a)c.type==="tool_result"&&c.tool_use_id&&i.add(c.tool_use_id)}return s.some(o=>o&&!i.has(o))}sessionAlive(e){return bE(e)}readPreview(e){return yE(e)}searchText(e){if(!e||Fr(e)||e.type!=="user"&&e.type!=="assistant")return"";let t=e.message?.content,r="";if(typeof t=="string")r=xt(t);else if(Array.isArray(t)){let s=t;r=e.type==="user"?s.map(Tl).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{realpathSync as wE}from"fs";import{createHash as vE}from"crypto";import{join as ji,resolve as SE}from"path";import{homedir as kE}from"os";function Et(){let n=process.env.TYPEBULB_SERVERS_DIR;return n?ji(n,".."):ji(kE(),".typebulb")}function et(){Eh||(Eh=!0,console.error(`${Et()} not writable \u2014 continuing stateless: ports won't stick, caches stay cold, and typebulb logs/wait/send/stop may not see this run`))}function tt(){return process.env.TYPEBULB_SERVERS_DIR||ji(Et(),"servers")}function Ah(n){let e=X(n),t=vE("sha1").update(e).digest("hex").slice(0,8),r=e.slice(e.lastIndexOf("/")+1).replace(/\.bulb\.md$/,"");return ji(Et(),"canvas",`${r}-${t}.png`)}function X(n){let e=SE(n),t=e;try{t=wE.native(e)}catch{}return(process.platform==="win32"?t.toLowerCase():t).replace(/\\/g,"/")}function Th(n,e){let t=X(n),r=X(e);return t.startsWith(r.endsWith("/")?r:r+"/")?!t.includes("/node_modules/"):!1}var Eh,At=v(()=>{Eh=!1});var Me,Fi=v(()=>{Me="0.48.0"});import{spawn as Oh}from"child_process";import{readdir as xE,readFile as Ch,writeFile as Rh,unlink as Cl,mkdir as EE}from"fs/promises";import{mkdirSync as _h,writeFileSync as qi,appendFileSync as AE,readFileSync as Rl}from"fs";import*as Ee from"path";import{fileURLToPath as TE}from"url";function _l(n){return Ee.join(tt(),`${n}.json`)}function Jr(n){return Ee.join(tt(),`${n}.log`)}function Nl(n){return Ee.join(tt(),`${n}.wait.json`)}function Nh(n){try{let e=JSON.parse(Rl(Nl(n),"utf8"));return e.cursors&&typeof e.cursors=="object"?e.cursors:{}}catch{return{}}}function Il(n,e=""){let t=Nh(n)[e];return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0}function Ui(n,e,t=""){try{_h(tt(),{recursive:!0});let r=Nh(n);r[t]=e,qi(Nl(n),JSON.stringify({cursors:r}))}catch{}}function Ji(n){let e=Jr(n);try{_h(tt(),{recursive:!0}),qi(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 c=typeof a=="string"?Buffer.from(a,"utf8"):Buffer.from(a);if(AE(e,c),s+=c.length,s>2*Ph){let l=Rl(e),d=l.subarray(Math.max(0,l.length-Ph));qi(e,d),s=d.length}}catch{i=!0}};return process.stdout.write=((a,...c)=>(o(a),t(a,...c))),process.stderr.write=((a,...c)=>(o(a),r(a,...c))),()=>{process.stdout.write=t,process.stderr.write=r}}function Ih(n){try{qi(Jr(n),"")}catch{}}function We(n,e=0){try{let t=Rl(Jr(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 $l(n){return`\u2500\u2500 run ${n} \u2500\u2500 ${new Date().toTimeString().slice(0,8)}`}function PE(n){let e=OE.exec(n);return e?Number(e[1]):void 0}function $h(n,e){let t=n.split(`
|
|
178
|
+
`),r=[];if(t.forEach((o,a)=>{let c=PE(o);c!==void 0&&r.push({id:c,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(`
|
|
179
|
+
`)}function Ll(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function Lh(n){try{await EE(tt(),{recursive:!0}),await Rh(_l(n.pid),JSON.stringify({version:Me,...n}))}catch{et()}}async function Mh(n,e){let t=_l(n);try{let r=JSON.parse(await Ch(t,"utf8"));if(r.denied===e)return;r.denied=e,await Rh(t,JSON.stringify(r))}catch{}}async function Ur(n){await Cl(_l(n)).catch(()=>{}),await Cl(Jr(n)).catch(()=>{}),await Cl(Nl(n)).catch(()=>{})}async function Q(n){let e;try{e=await xE(tt())}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 Ch(Ee.join(tt(),s),"utf8"))}catch{await Ur(i);return}o&&typeof o.pid=="number"&&Ll(o.pid)?t.push(o):await Ur(i)})),(n?t.filter(s=>s.agent==null&&Th(s.file,n)):t).sort((s,i)=>s.startedAt-i.startedAt)}async function Ml(n,e){let t=X(n);return(await Q()).find(r=>r.cwd!=null&&X(r.cwd)===t&&(e?r.agent===e:r.agent!=null))}async function Yt(n){try{process.kill(n,"SIGTERM")}catch{}await Ur(n)}function On(n,e){let t=X(e);return n.filter(r=>r.agent==null&&r.pid!==process.pid&&X(r.file)===t)}async function Bl(n){let e=On(await Q(),n);for(let t of e)await Yt(t.pid);return e}function RE(n,e,t){(process.platform==="win32"?Oh("cmd",["/c","start","","/b",n,...e],{cwd:t,stdio:"ignore",windowsHide:!0}):Oh(n,e,{cwd:t,detached:!0,stdio:"ignore"})).unref()}function Bh(){return Ee.join(Ee.dirname(TE(import.meta.url)),"index.js")}function _E(n,e={}){return{command:process.execPath,args:[Bh(),...e.trust?["--trust"]:[],...e.batch?["--batch",e.batch]:[],...e.mode?["--mode",e.mode]:[],n,...e.open===!1?["--no-open"]:[]]}}function NE(n){return{command:process.execPath,args:[Bh(),`agent:${n}`,"--no-open"]}}async function Dh(n,e,t,r){let s=await n();if(s)return s;RE(e.command,e.args,t);let i=Date.now()+2e4;for(;Date.now()<i;){await CE(150);let o=await n();if(o)return o}throw new Error(`Launched ${r} but it did not register within 20s.`)}async function Ki(n,e={}){let t=e.cwd??process.cwd(),r=Ee.resolve(t,n),[s]=await Bl(r),i={...e,batch:e.batch??s?.batch,mode:e.mode??s?.mode};return Dh(async()=>On(await Q(),r)[0],_E(n,i),t,Ee.basename(n))}async function jh(n,e=process.cwd()){return Dh(()=>Ml(e,n),NE(n),e,`the ${n} mirror`)}var Ph,OE,CE,Be=v(()=>{At();Fi();Ph=1e6;OE=/^── run (\d+) ── /;CE=n=>new Promise(e=>setTimeout(e,n))});function Pn(n){return{...Qd(n),server:n.files.get("server.ts")??""}}function Hi(n){return!!n.server&&!n.code}var Kr=v(()=>{le();le()});function Wi(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 Dl(n){return An(Wi(n)??"bulb")||"bulb"}var jl=v(()=>{le()});import{transform as IE}from"sucrase";function Fl(n,e={}){let t=e.serverOnly?["typescript"]:["typescript","jsx"];try{let{code:r}=IE(n,{transforms:t,jsxRuntime:"automatic",jsxImportSource:e.jsxImportSource||"react",production:!0});return{code:r}}catch(r){return{code:"",error:String(r)}}}var Fh=v(()=>{});function ql(n){let e=n.split(""),t=(i,o)=>{for(let a=i;a<o&&a<e.length;a++)e[a]!==`
|
|
180
|
+
`&&(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]!==`
|
|
181
|
+
`;)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==="/"&&$E.has(s)){let a=r+1,c=!1;for(;a<n.length&&n[a]!==`
|
|
182
|
+
`;){let l=n[a];if(l==="\\")a++;else if(l==="[")c=!0;else if(l==="]")c=!1;else if(l==="/"&&!c)break;a++}r=a+1,s="/"}else if(i==='"'||i==="'"){let a=r+1;for(;a<n.length&&n[a]!==i&&n[a]!==`
|
|
183
|
+
`;)n[a]==="\\"&&a++,a++;r=a+1,s=i}else if(i==="`"){let a=qh(n,r);t(r,a),r=a,s="`"}else/\s/.test(i)||(s=i),r++}return e.join("")}function qh(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=qh(n,t);continue}if(s==="$"&&n[t+1]==="{"){r++,t+=2;continue}if(s==="}"&&r>0){r--,t++;continue}t++}return n.length}var $E,Uh=v(()=>{$E=new Set(["","(",",","=",":","[","!","&","|","?",";","{"])});function BE(n){if(/^[./]/.test(n)||/^[a-z][a-z0-9+.-]*:/i.test(n))return null;let e=n.split("/");return n.startsWith("@")?e.slice(0,2).join("/"):e[0]}function Jh(n){let e=[];for(let s of ME)for(let i of n.matchAll(s)){let o=BE(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(`
|
|
184
|
+
`).length-1}));return r}function Kh(n){return Jh(ql(n)).map(e=>e.root)}function Hr(n,e){if(!n)return[];let{target:t,dependencies:r}=e,s=(e.lineOffset??1)-1,i=[],o=n.split(`
|
|
185
|
+
`),a=ql(n).split(`
|
|
186
|
+
`);for(let c=0;c<o.length;c++){let l=a[c],d=c+1+s;for(let u of LE)u.targets.includes(t)&&u.pattern.test(l)&&i.push({type:u.type,severity:"error",message:FE(u.type,d),lineNumber:d,lineContent:o[c]})}return t==="client"&&r&&i.push(...DE(a,o,r,s)),i}function DE(n,e,t,r){let s=new Set(Object.keys(t));return Jh(n.join(`
|
|
187
|
+
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+r;return{type:"UNDECLARED_IMPORT",severity:"error",message:jE(i,a),lineNumber:a,lineContent:e[o]}})}function jE(n,e){return`Import "${n}" is not declared in config.json dependencies! Found on line ${e}.
|
|
188
188
|
|
|
189
189
|
**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.
|
|
190
190
|
|
|
@@ -193,12 +193,12 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
193
193
|
{
|
|
194
194
|
"description": "\u2026",
|
|
195
195
|
"dependencies": {
|
|
196
|
-
"${
|
|
196
|
+
"${n}": "*"
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
\`\`\`
|
|
200
200
|
|
|
201
|
-
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${
|
|
201
|
+
**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 FE(n,e){return n==="URL_IMPORT"?`Direct URL imports are not supported! Found on line ${e}.
|
|
202
202
|
|
|
203
203
|
**CRITICAL**: Import packages by name only. Do NOT use CDN URLs:
|
|
204
204
|
|
|
@@ -215,7 +215,7 @@ import _ from "https://cdn.skypack.dev/lodash"
|
|
|
215
215
|
import x from "https://unpkg.com/some-package"
|
|
216
216
|
\`\`\`
|
|
217
217
|
|
|
218
|
-
**Fix:** Use the package name only. Package resolution is handled automatically.`:
|
|
218
|
+
**Fix:** Use the package name only. Package resolution is handled automatically.`:n==="VERSION_SPECIFIER_IMPORT"?`Version specifiers in imports are not supported! Found on line ${e}.
|
|
219
219
|
|
|
220
220
|
**CRITICAL**: Import packages by name only. Do NOT include version numbers:
|
|
221
221
|
|
|
@@ -233,7 +233,7 @@ import _ from "lodash@^4.17.0"
|
|
|
233
233
|
import { x } from "@scope/package@1.0.0"
|
|
234
234
|
\`\`\`
|
|
235
235
|
|
|
236
|
-
**Fix:** Remove the version specifier (everything from @ onwards). Versions are managed separately.`:
|
|
236
|
+
**Fix:** Remove the version specifier (everything from @ onwards). Versions are managed separately.`:n==="JS_EXTENSION_IMPORT"?`Deep import paths must NOT include \`.js\` extension! Found on line ${e}.
|
|
237
237
|
|
|
238
238
|
**CRITICAL**: Remove the \`.js\` extension from deep import paths (paths with \`/\`):
|
|
239
239
|
|
|
@@ -249,7 +249,7 @@ import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"
|
|
|
249
249
|
|
|
250
250
|
**Note:** Package names that literally end with ".js" (like \`decimal.js\`) are fine - this rule only applies to file paths within packages.
|
|
251
251
|
|
|
252
|
-
**Fix:** Remove \`.js\` from the end of the import path.`:
|
|
252
|
+
**Fix:** Remove \`.js\` from the end of the import path.`:n==="DYNAMIC_IMPORT"?`Dynamic imports are not supported! You used \`import('...')\` on line ${e}.
|
|
253
253
|
|
|
254
254
|
**CRITICAL**: All imports MUST be at the TOP of the file using standard ES6 import syntax:
|
|
255
255
|
|
|
@@ -271,8 +271,8 @@ import('react-dom/client').then(({ createRoot }) => {
|
|
|
271
271
|
})
|
|
272
272
|
\`\`\`
|
|
273
273
|
|
|
274
|
-
**Fix:** Move ALL import statements to the top of the file using standard \`import\` syntax.`:
|
|
275
|
-
The \`tb\` global is already provided by the environment. Remove this declaration.`:
|
|
274
|
+
**Fix:** Move ALL import statements to the top of the file using standard \`import\` syntax.`:n==="REDUNDANT_TB_DECLARATION"?`Redundant \`declare const tb\` found on line ${e}.
|
|
275
|
+
The \`tb\` global is already provided by the environment. Remove this declaration.`:n==="CONST_ENUM"?`\`const enum\` is not supported! Found on line ${e}.
|
|
276
276
|
|
|
277
277
|
**Fix:** Use a regular \`enum\` or an object with \`as const\`:
|
|
278
278
|
|
|
@@ -284,7 +284,7 @@ enum Direction { Up, Down, Left, Right }
|
|
|
284
284
|
const Direction = { Up: 0, Down: 1, Left: 2, Right: 3 } as const
|
|
285
285
|
\`\`\`
|
|
286
286
|
|
|
287
|
-
\`const enum\` requires the full TypeScript compiler to inline values at compile time. Regular \`enum\` and object literals work identically at runtime.`:
|
|
287
|
+
\`const enum\` requires the full TypeScript compiler to inline values at compile time. Regular \`enum\` and object literals work identically at runtime.`:n==="NAMESPACE_DECLARATION"?`TypeScript \`namespace\` is not supported! Found on line ${e}.
|
|
288
288
|
|
|
289
289
|
**Fix:** Use ES modules instead:
|
|
290
290
|
|
|
@@ -294,23 +294,23 @@ const Direction = { Up: 0, Down: 1, Left: 2, Right: 3 } as const
|
|
|
294
294
|
export function foo() {}
|
|
295
295
|
\`\`\`
|
|
296
296
|
|
|
297
|
-
Namespaces are a legacy TypeScript pattern. Use standard ES module imports/exports instead.`:
|
|
297
|
+
Namespaces are a legacy TypeScript pattern. Use standard ES module imports/exports instead.`:n==="COMMONJS_EXPORT_EQUALS"?`\`export =\` syntax is not supported! Found on line ${e}.
|
|
298
298
|
|
|
299
299
|
**Fix:** Use ES module \`export default\` instead:
|
|
300
300
|
|
|
301
301
|
\`\`\`typescript
|
|
302
302
|
// Instead of: export = myValue
|
|
303
303
|
export default myValue
|
|
304
|
-
\`\`\``:
|
|
304
|
+
\`\`\``:n==="COMMONJS_IMPORT_EQUALS"?`\`import x =\` syntax is not supported! Found on line ${e}.
|
|
305
305
|
|
|
306
306
|
**Fix:** Use ES module \`import\` instead:
|
|
307
307
|
|
|
308
308
|
\`\`\`typescript
|
|
309
309
|
// Instead of: import x = require('module')
|
|
310
310
|
import x from 'module'
|
|
311
|
-
\`\`\``:
|
|
311
|
+
\`\`\``:n==="MODULE_DECLARATION"?`TypeScript \`module\` declarations are not supported! Found on line ${e}.
|
|
312
312
|
|
|
313
|
-
**Fix:** Use ES modules instead. The \`module Foo {}\` syntax is a legacy TypeScript pattern \u2014 use standard imports/exports.`:
|
|
313
|
+
**Fix:** Use ES modules instead. The \`module Foo {}\` syntax is a legacy TypeScript pattern \u2014 use standard imports/exports.`:n==="CSS_FILE_IMPORT"?`Importing CSS files is not supported! Found on line ${e}.
|
|
314
314
|
|
|
315
315
|
**CRITICAL**: CSS imports don't work here. The styles.css block is already applied to the page automatically.
|
|
316
316
|
|
|
@@ -322,7 +322,7 @@ import "./styles.css"
|
|
|
322
322
|
import styles from "./styles.css"
|
|
323
323
|
\`\`\`
|
|
324
324
|
|
|
325
|
-
**Fix:** Delete the CSS import line entirely. Write styles in the styles.css block \u2014 they are loaded automatically.`:
|
|
325
|
+
**Fix:** Delete the CSS import line entirely. Write styles in the styles.css block \u2014 they are loaded automatically.`:n==="NAVIGATION"?`Navigation is forbidden in this sandboxed environment! Found on line ${e}.
|
|
326
326
|
|
|
327
327
|
**CRITICAL**: \`window.location\` changes, \`window.open()\`, and page reloads will break the app.
|
|
328
328
|
|
|
@@ -352,18 +352,18 @@ import { something } from 'module-name'
|
|
|
352
352
|
const something = require('module-name') // NOT SUPPORTED!
|
|
353
353
|
\`\`\`
|
|
354
354
|
|
|
355
|
-
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var
|
|
355
|
+
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var Vt,zt,LE,ME,Yi=v(()=>{Uh();Vt=["client"],zt=["client","server"],LE=[{type:"DYNAMIC_IMPORT",pattern:/\bimport\s*\(\s*['"`]/,targets:Vt},{type:"COMMONJS_REQUIRE",pattern:/\brequire\s*\(\s*['"`]/,targets:zt},{type:"JS_EXTENSION_IMPORT",pattern:/from\s+['"][^'"]*\/[^'"]*\.js['"]/,targets:Vt},{type:"URL_IMPORT",pattern:/from\s+['"]https?:\/\//,targets:Vt},{type:"VERSION_SPECIFIER_IMPORT",pattern:/from\s+['"][^'"]*@[\d^~]/,targets:Vt},{type:"REDUNDANT_TB_DECLARATION",pattern:/declare\s+(const|var|let)\s+tb\b/,targets:zt},{type:"CONST_ENUM",pattern:/\bconst\s+enum\b/,targets:zt},{type:"NAMESPACE_DECLARATION",pattern:/\bnamespace\s+\w+/,targets:zt},{type:"COMMONJS_EXPORT_EQUALS",pattern:/\bexport\s*=/,targets:zt},{type:"COMMONJS_IMPORT_EQUALS",pattern:/\bimport\s+\w+\s*=/,targets:zt},{type:"MODULE_DECLARATION",pattern:/\bmodule\s+\w+\s*\{/,targets:zt},{type:"CSS_FILE_IMPORT",pattern:/(?:from|import)\s+['"][^'"]*\.css['"]/,targets:Vt},{type:"NAVIGATION",pattern:/window\.(location\.(reload|assign|replace)\s*\(|open\s*\()/,targets:Vt},{type:"NAVIGATION",pattern:/window\.location(\.href)?\s*=[^=]/,targets:Vt}],ME=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});function qE(n){return n.map(e=>`${e.type} (line ${e.lineNumber}): ${e.message.split(`
|
|
356
356
|
`)[0]}`).join(`
|
|
357
|
-
`)}function
|
|
358
|
-
${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="https://cdn.jsdelivr.net/npm/",Ml="https://data.jsdelivr.com/v1/package/npm/"});function xh(r){let e=(r||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var j,Tr,Eh,Kn=S(()=>{Jn();j=class r{constructor(e,t,n){let s=typeof e=="string"?r.parse(e):e;this.name=s.name,this.version=Tr(t??s.version),this.subpath=Tr(n??s.subpath)}static parse(e){let t=xh(e||"");if(!t.length)return new r({name:""});if(t[0].startsWith("@")){let s=t[0],[i,o]=Eh(t[1]??""),a=Tr(t.slice(2).join("/"));return new r({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=Eh(t[0]),o=Tr(t.slice(1).join("/"));return new r({name:s,version:i,subpath:o})}}static fromUrl(e){try{let t=new URL(e),n=new URL(vt).host,s=new URL(Un).host;if(t.host===n){let i=xh(t.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return r.parse(o)}if(t.host===s){let i=t.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return r.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 r.parse(e).name}withVersion(e){return new r({name:this.name,version:Tr(e),subpath:this.subpath})}static isBare(e){if(!e||e.startsWith(".")||e.startsWith("/"))return!1;let t=e.toLowerCase();return!t.startsWith("http://")&&!t.startsWith("https://")}},Tr=r=>r&&r.length?r:void 0,Eh=r=>{let e=r.indexOf("@");return e<0?[r,void 0]:[r.slice(0,e),Tr(r.slice(e+1))]}});async function ye(r){try{return await r()}catch{return}}var Ui=S(()=>{});function Wt(r){let e=r||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function Bl(r){return r.startsWith("./")?r:`./${r}`}var Hn,Dl=S(()=>{Kn();Ui();Jn();Hn=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 j(e):e;return`${Un}${t.name}${t.version?`@${t.version}`:""}/`}file(e,t){return new URL(Wt(t),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,t={}){let{target:n="es2022",bundle:s=!1,external:i}=t,o=new URLSearchParams({target:n});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${vt}/${e}?${o.toString()}`}async resolveExactVersion(e){let t=Date.now(),n=this.pinCache.get(e);if(n&&t-n.ts<this.pinMs)return n.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${vt}/${e}`]);return this.pinCache.set(e,{value:s,ts:t}),s}async tryResolveFromUrls(e){for(let t of e){let n=await ye(()=>this.http.head(t)),s=this.parseVersionFromUrl(n?.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 n=await ye(()=>this.http.getJson(`${Ml}${encodeURIComponent(e)}`));if(!n?.versions?.length){await this.cache.recordNegative(e);return}await this.cache.clearNegative(e);let s=n.tags&&Object.keys(n.tags).length?n.tags:void 0;return await this.cache.setIndex(e,n.versions,s),{versions:n.versions,distTags:s}}parseVersionFromUrl(e){let t=j.fromUrl(e)?.version;return t&&/\d+\.\d+\.\d+/.test(t)?t:void 0}async fetchPackageMeta(e,t){let n=await this.cache.getMeta(e,t);if(n&&Date.now()-n.updatedAt<this.metaTtlMs){let{dependencies:d,peerDependencies:u,peerDependenciesMeta:f}=n;return{name:e,version:t,dependencies:d,peerDependencies:u,peerDependenciesMeta:f}}let s=this.packageJson(new j(`${e}@${t}`)),i=await ye(()=>this.http.getJson(s));if(!i)return;let o=d=>d&&Object.keys(d).length?d:void 0,a=o(i.dependencies),c=o(i.peerDependencies),l=o(i.peerDependenciesMeta);return await this.cache.setMeta(e,t,a,c,l),{name:e,version:t,dependencies:a,peerDependencies:c,peerDependenciesMeta:l}}}});var Ah,Wn,jl,CE,Yn,Ji=S(()=>{Ah=r=>r.startsWith("@types/"),Wn=r=>Object.keys(r?.peerDependencies||{}).filter(e=>!Ah(e)),jl=r=>Object.keys(r?.dependencies||{}).filter(e=>!Ah(e)),CE=r=>Wn(r).filter(e=>!r?.peerDependenciesMeta?.[e]?.optional),Yn=class{constructor(e){this.cdn=e}async resolve(e,t){let n=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(n,t),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:t,version:n})=>({name:t,version:n,meta:await this.cdn.fetchPackageMeta(t,n)})))}async expandWithPeers(e,t){let n=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of CE(i.meta))!n.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),c=await this.cdn.fetchPackageMeta(i,a);n.set(i,{name:i,version:a,meta:c})}catch(a){console.warn(`[typebulb] Failed to resolve peer "${i}" for "${o}":`,a)}return{allRoots:[...n.values()],autoAddedPeers:s.filter(i=>n.has(i.name))}}computeFlags(e){let t=new Set(e.flatMap(i=>Wn(i.meta))),n=new Map;for(let i of e)for(let o of jl(i.meta))n.set(o,(n.get(o)||0)+1);let s=new Set([...n.entries()].filter(([,i])=>i>=2).map(([i])=>i));return new Map(e.map(i=>[i.name,{isPeerRoot:t.has(i.name),hasPeers:Wn(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var Vn,Fl=S(()=>{Kn();Ui();Vn=class{constructor(e,t,n){this.cache=e,this.cdn=t,this.semver=n}async learnExactVersion(e){let t=await ye(()=>this.cdn.fetchVersionsIndex(e));if(t?.versions?.length){let n=this.semver.selectBestVersion(t.versions,{distTags:t.distTags});if(n)return n}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,t){if(!t)return this.learnExactVersion(e);let n=await this.cache.getPinnedExact(e,t);if(n){if(this.semver.isExactVersion(n))return n;console.debug("[typebulb] cached version for",e,"is not exact (",n,"); re-resolving from registry")}let s=async o=>{if(o&&this.semver.isExactVersion(o))return await this.cache.setPinnedExact(e,t,o),o},i=await ye(()=>this.cdn.fetchVersionsIndex(e));if(i?.versions?.length){let o=this.semver.selectBestVersion(i.versions,{range:t,distTags:i.distTags});if(o){let a=await s(o);if(a)return a}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 a=await ye(()=>this.cdn.fetchVersionsIndex(e));if(a?.versions?.length){let c=await s(this.semver.selectBestVersion(a.versions,{range:t,distTags:a.distTags}));if(c)return c}}}return s(await this.cdn.resolveExactVersion(`${e}@${t}`))}async effectivePackage(e,t){let n=new j(e),s=n.root(),i=t[s],o=i?await ye(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?n.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as RE,parse as _E}from"es-module-lexer";var Pr,ql=S(()=>{Kn();Jn();Ji();Pr=class r{constructor(e,t,n){this.version=e,this.cdn=t,this.peer=n}extractImportsSync(e){let t=new Set;for(let n of r.importPatterns){n.lastIndex=0;for(let s of e.matchAll(n))j.isBare(s[1])&&t.add(s[1])}return Array.from(t)}async extractImports(e){let t=new Set,n=s=>{j.isBare(s)&&t.add(s)};try{await RE;let[s]=_E(e);s.forEach(i=>n(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(t)}async buildImportMap(e,t,n){let s=(await this.extractImports(e)).filter(u=>!n?.has(j.rootOf(u))),i=[...new Set(s.map(j.rootOf))],o=await Promise.all(i.map(async u=>({name:u,version:await this.resolveVersion(u,t)}))),{allRoots:a,flags:c,autoAddedPeers:l}=await this.peer.resolve(o,u=>this.resolveVersion(u,t)),d=this.buildEntries([...s,...l.map(u=>u.name)],a,c);return{importMap:{imports:Object.fromEntries(d)},prefetchUrls:d.map(([,u])=>u)}}async resolveVersion(e,t){let n=t[e],s=await this.version.resolveExactForRoot(e,n);if(!s)throw new Error(`Cannot resolve ${n?`${e}@${n}`:e}: no matching version is published (the package or version may not exist, or the registry was unreachable).`);return s}buildEntries(e,t,n){let s=new Map(t.map(p=>[p.name,p])),i=p=>{let h=s.get(j.rootOf(p));return new j(p).withVersion(h.version).format()},o=new Set([...n.entries()].filter(([,p])=>p.isPeerRoot||p.isSharedDep).map(([p])=>p)),a=new Set(e.filter(p=>p!==j.rootOf(p)).map(j.rootOf)),c=[],l=new Set,d=new Set(e.filter(p=>p===j.rootOf(p))),u=new Set;for(let p of e){let h=j.rootOf(p),m=s.get(h),{isPeerRoot:b,hasPeers:A,isSharedDep:v}=n.get(h),O=a.has(h),_=p!==h,R=!(b||v)&&(O||!A),$=this.singletonDepsOf(m,o),x=_&&d.has(h);x&&u.add(h);let D=x?[...$,h]:$.length?$:void 0;c.push([p,this.cdn.buildEsmUrl(i(p),{bundle:R,external:D})]),l.add(p)}let f=new Set([...o,...u]);for(let p of f)s.has(p)&&(l.has(p)||c.push([p,this.cdn.buildEsmUrl(i(p),{})]),c.push([`${p}/`,`${vt}/${i(p)}/`]));return c}singletonDepsOf(e,t){return[...new Set([...Wn(e.meta),...jl(e.meta)])].filter(n=>t.has(n))}};Pr.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as Th,satisfies as NE,maxSatisfying as Ph,major as IE,valid as $E}from"semver";var Ki,Yt,Ul=S(()=>{Ki=class{cmp(e,t){return e===t?0:Th(e,t)?1:Th(t,e)?-1:0}satisfies(e,t){return!e||!e.trim()?!0:!!NE(t,e,{includePrerelease:!0})}selectBestVersion(e,t){if(!e?.length)return;let n=t?.range?.trim()||"*",s=t?.preferStable??!0,i=t?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(n,i))return i;if(s){let a=Ph(e,n,{includePrerelease:!1});if(a)return a}return Ph(e,n,{includePrerelease:!0})??void 0}majorOf(e){return IE(e)}isExactVersion(e){return $E(e)!==null}},Yt=new Ki});function LE(r){return Math.min(9e5*Math.pow(2,Math.max(0,r-1)),864e5)}var Vt,Oh=S(()=>{Ui();Vt=class{constructor(e){this.store=e}async isNegative(e){let t=await ye(()=>this.store.get(e));return!!t&&t.until>Date.now()}async recordNegative(e){let n=((await ye(()=>this.store.get(e)))?.attempts||0)+1;await ye(()=>this.store.set(e,{until:Date.now()+LE(n),attempts:n}))}async clearNegative(e){await ye(()=>this.store.delete(e))}}});function Ch(r,e){let t=new Hn(r,e),n=new Yn(t),s=new Vn(r,t,Yt);return{packageService:new Pr(s,t,n),versionResolver:s,cdnClient:t,peerResolver:n}}var tt=S(()=>{Dl();Ji();Fl();ql();Ul();Kn();Ul();Jn();Dl();Ji();Fl();ql();Oh()});import*as Jl from"fs/promises";import*as Rh from"crypto";function Me(r){return Rh.createHash("sha1").update(r).digest("hex")}async function rt(r){try{return JSON.parse(await Jl.readFile(r,"utf8"))}catch{return}}async function Hi(r){try{return await Jl.readFile(r,"utf8")}catch{return}}var Or=S(()=>{});import*as kt from"fs/promises";import*as nt from"path";import*as Nh from"os";function Z(){return Kl||(Kl=BE()),Kl}function Yi(r,e){return nt.join(ME,Me(r),e)}async function BE(){await kt.mkdir(St,{recursive:!0});let r=nt.join(St,"version.json");if((await rt(r))?.version===_h)return;let t=await kt.readdir(St).catch(()=>[]);await Promise.all(t.map(n=>kt.rm(nt.join(St,n),{recursive:!0,force:!0}))),await kt.writeFile(r,JSON.stringify({version:_h})+`
|
|
359
|
-
`,"utf8")}var
|
|
357
|
+
`)}function Hh(n,e){let t=Hr(n,{target:"client",dependencies:e}).filter(r=>r.type==="UNDECLARED_IMPORT");if(t.length)throw new Error(`Lint failed:
|
|
358
|
+
${qE(t)}`)}var Wh=v(()=>{Yi()});var Tt,Wr,Ul,Yr=v(()=>{Tt="https://esm.sh",Wr="https://cdn.jsdelivr.net/npm/",Ul="https://data.jsdelivr.com/v1/package/npm/"});function Yh(n){let e=(n||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var j,Cn,Vh,Vr=v(()=>{Yr();j=class n{constructor(e,t,r){let s=typeof e=="string"?n.parse(e):e;this.name=s.name,this.version=Cn(t??s.version),this.subpath=Cn(r??s.subpath)}static parse(e){let t=Yh(e||"");if(!t.length)return new n({name:""});if(t[0].startsWith("@")){let s=t[0],[i,o]=Vh(t[1]??""),a=Cn(t.slice(2).join("/"));return new n({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=Vh(t[0]),o=Cn(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(Tt).host,s=new URL(Wr).host;if(t.host===r){let i=Yh(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:Cn(e),subpath:this.subpath})}static isBare(e){if(!e||e.startsWith(".")||e.startsWith("/"))return!1;let t=e.toLowerCase();return!t.startsWith("http://")&&!t.startsWith("https://")}},Cn=n=>n&&n.length?n:void 0,Vh=n=>{let e=n.indexOf("@");return e<0?[n,void 0]:[n.slice(0,e),Cn(n.slice(e+1))]}});async function ye(n){try{return await n()}catch{return}}var Vi=v(()=>{});function Gt(n){let e=n||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function Jl(n){return n.startsWith("./")?n:`./${n}`}var zr,Kl=v(()=>{Vr();Vi();Yr();zr=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 j(e):e;return`${Wr}${t.name}${t.version?`@${t.version}`:""}/`}file(e,t){return new URL(Gt(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(",")),`${Tt}/${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),`${Tt}/${e}`]);return this.pinCache.set(e,{value:s,ts:t}),s}async tryResolveFromUrls(e){for(let t of e){let r=await ye(()=>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 ye(()=>this.http.getJson(`${Ul}${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=j.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:d,peerDependencies:u,peerDependenciesMeta:f}=r;return{name:e,version:t,dependencies:d,peerDependencies:u,peerDependenciesMeta:f}}let s=this.packageJson(new j(`${e}@${t}`)),i=await ye(()=>this.http.getJson(s));if(!i)return;let o=d=>d&&Object.keys(d).length?d:void 0,a=o(i.dependencies),c=o(i.peerDependencies),l=o(i.peerDependenciesMeta);return await this.cache.setMeta(e,t,a,c,l),{name:e,version:t,dependencies:a,peerDependencies:c,peerDependenciesMeta:l}}}});var zh,Gr,Hl,UE,Xr,zi=v(()=>{zh=n=>n.startsWith("@types/"),Gr=n=>Object.keys(n?.peerDependencies||{}).filter(e=>!zh(e)),Hl=n=>Object.keys(n?.dependencies||{}).filter(e=>!zh(e)),UE=n=>Gr(n).filter(e=>!n?.peerDependenciesMeta?.[e]?.optional),Xr=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 UE(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),c=await this.cdn.fetchPackageMeta(i,a);r.set(i,{name:i,version:a,meta:c})}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=>Gr(i.meta))),r=new Map;for(let i of e)for(let o of Hl(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:Gr(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var Qr,Wl=v(()=>{Vr();Vi();Qr=class{constructor(e,t,r){this.cache=e,this.cdn=t,this.semver=r}async learnExactVersion(e){let t=await ye(()=>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=await this.cache.getPinnedExact(e,t);if(r){if(this.semver.isExactVersion(r))return r;console.debug("[typebulb] cached version for",e,"is not exact (",r,"); re-resolving from registry")}let s=async o=>{if(o&&this.semver.isExactVersion(o))return await this.cache.setPinnedExact(e,t,o),o},i=await ye(()=>this.cdn.fetchVersionsIndex(e));if(i?.versions?.length){let o=this.semver.selectBestVersion(i.versions,{range:t,distTags:i.distTags});if(o){let a=await s(o);if(a)return a}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 a=await ye(()=>this.cdn.fetchVersionsIndex(e));if(a?.versions?.length){let c=await s(this.semver.selectBestVersion(a.versions,{range:t,distTags:a.distTags}));if(c)return c}}}return s(await this.cdn.resolveExactVersion(`${e}@${t}`))}async effectivePackage(e,t){let r=new j(e),s=r.root(),i=t[s],o=i?await ye(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?r.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as JE,parse as KE}from"es-module-lexer";var Rn,Yl=v(()=>{Vr();Yr();zi();Rn=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))j.isBare(s[1])&&t.add(s[1])}return Array.from(t)}async extractImports(e){let t=new Set,r=s=>{j.isBare(s)&&t.add(s)};try{await JE;let[s]=KE(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(j.rootOf(u))),i=[...new Set(s.map(j.rootOf))],o=await Promise.all(i.map(async u=>({name:u,version:await this.resolveVersion(u,t)}))),{allRoots:a,flags:c,autoAddedPeers:l}=await this.peer.resolve(o,u=>this.resolveVersion(u,t)),d=this.buildEntries([...s,...l.map(u=>u.name)],a,c);return{importMap:{imports:Object.fromEntries(d)},prefetchUrls:d.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(p=>[p.name,p])),i=p=>{let h=s.get(j.rootOf(p));return new j(p).withVersion(h.version).format()},o=new Set([...r.entries()].filter(([,p])=>p.isPeerRoot||p.isSharedDep).map(([p])=>p)),a=new Set(e.filter(p=>p!==j.rootOf(p)).map(j.rootOf)),c=[],l=new Set,d=new Set(e.filter(p=>p===j.rootOf(p))),u=new Set;for(let p of e){let h=j.rootOf(p),m=s.get(h),{isPeerRoot:b,hasPeers:A,isSharedDep:S}=r.get(h),P=a.has(h),_=p!==h,R=!(b||S)&&(P||!A),$=this.singletonDepsOf(m,o),x=_&&d.has(h);x&&u.add(h);let D=x?[...$,h]:$.length?$:void 0;c.push([p,this.cdn.buildEsmUrl(i(p),{bundle:R,external:D})]),l.add(p)}let f=new Set([...o,...u]);for(let p of f)s.has(p)&&(l.has(p)||c.push([p,this.cdn.buildEsmUrl(i(p),{})]),c.push([`${p}/`,`${Tt}/${i(p)}/`]));return c}singletonDepsOf(e,t){return[...new Set([...Gr(e.meta),...Hl(e.meta)])].filter(r=>t.has(r))}};Rn.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as Gh,satisfies as HE,maxSatisfying as Xh,major as WE,valid as YE}from"semver";var Gi,Xt,Vl=v(()=>{Gi=class{cmp(e,t){return e===t?0:Gh(e,t)?1:Gh(t,e)?-1:0}satisfies(e,t){return!e||!e.trim()?!0:!!HE(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=Xh(e,r,{includePrerelease:!1});if(a)return a}return Xh(e,r,{includePrerelease:!0})??void 0}majorOf(e){return WE(e)}isExactVersion(e){return YE(e)!==null}},Xt=new Gi});function VE(n){return Math.min(9e5*Math.pow(2,Math.max(0,n-1)),864e5)}var Qt,Qh=v(()=>{Vi();Qt=class{constructor(e){this.store=e}async isNegative(e){let t=await ye(()=>this.store.get(e));return!!t&&t.until>Date.now()}async recordNegative(e){let r=((await ye(()=>this.store.get(e)))?.attempts||0)+1;await ye(()=>this.store.set(e,{until:Date.now()+VE(r),attempts:r}))}async clearNegative(e){await ye(()=>this.store.delete(e))}}});function Zh(n,e){let t=new zr(n,e),r=new Xr(t),s=new Qr(n,t,Xt);return{packageService:new Rn(s,t,r),versionResolver:s,cdnClient:t,peerResolver:r}}var nt=v(()=>{Kl();zi();Wl();Yl();Vl();Vr();Vl();Yr();Kl();zi();Wl();Yl();Qh()});import*as zl from"fs/promises";import*as eg from"crypto";function De(n){return eg.createHash("sha1").update(n).digest("hex")}async function rt(n){try{return JSON.parse(await zl.readFile(n,"utf8"))}catch{return}}async function Xi(n){try{return await zl.readFile(n,"utf8")}catch{return}}var _n=v(()=>{});import*as Pt from"fs/promises";import*as st from"path";import*as ng from"os";function Z(){return Gl||(Gl=GE().catch(()=>et())),Gl}function Zi(n,e){return st.join(zE,De(n),e)}async function GE(){await Pt.mkdir(Ot,{recursive:!0});let n=st.join(Ot,"version.json");if((await rt(n))?.version===tg)return;let t=await Pt.readdir(Ot).catch(()=>[]);await Promise.all(t.map(r=>Pt.rm(st.join(Ot,r),{recursive:!0,force:!0}))),await Pt.writeFile(n,JSON.stringify({version:tg})+`
|
|
359
|
+
`,"utf8")}var tg,Ot,Zr,es,Qi,zE,Gl,Nn=v(()=>{_n();At();tg=1,Ot=st.join(ng.homedir(),".typebulb","cache"),Zr=st.join(Ot,"packages"),es=st.join(Ot,"proxy"),Qi=st.join(Ot,"dts"),zE=st.join(Ot,"emit")});import*as Ct from"fs/promises";import*as rg from"path";async function Ae(n,e){let t=`${n}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;try{await Ct.mkdir(rg.dirname(n),{recursive:!0}),await Ct.writeFile(t,e,"utf8")}catch{et();return}await Ct.rename(t,n).catch(async()=>{await Ct.rm(t,{force:!0}).catch(()=>{})})}var ts=v(()=>{At()});var In,Xl=v(()=>{ts();_n();In=class{constructor(e){this.filePath=e}mem;loadPromise;load(){return this.mem?Promise.resolve(this.mem):(this.loadPromise||(this.loadPromise=rt(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 Ae(this.filePath,JSON.stringify(Object.fromEntries(e)))}}});import*as og from"fs/promises";import*as je from"path";function ig(n,e){return je.join(XE,eo(n),encodeURIComponent(e)+".json")}function eo(n){return n.replace(/\//g,"__")}var Ql,sg,XE,QE,to,ag=v(()=>{nt();Nn();ts();Xl();_n();Ql=je.join(Zr,"indexes"),sg=je.join(Zr,"pinned"),XE=je.join(Zr,"meta"),QE=je.join(Zr,"negative.json"),to=class{pinnedMem=new Map;indexMem=new Map;metaMem=new Map;negativeCache=new Qt(new In(QE));async getPinnedExact(e,t){let r=`${e}@${t}`;if(this.pinnedMem.has(r))return this.pinnedMem.get(r);await Z();let s=await Xi(je.join(sg,De(r)+".txt"));return this.pinnedMem.set(r,s),s}async setPinnedExact(e,t,r){let s=`${e}@${t}`;this.pinnedMem.set(s,r),await Z(),await Ae(je.join(sg,De(s)+".txt"),r)}async getIndex(e){if(this.indexMem.has(e))return this.indexMem.get(e);await Z();let t=await rt(je.join(Ql,eo(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 Z(),await Ae(je.join(Ql,eo(e)+".json"),JSON.stringify(s))}async invalidateVersionsCache(e){this.indexMem.delete(e),await og.rm(je.join(Ql,eo(e)+".json"),{force:!0}).catch(()=>{})}async isNegative(e){return await Z(),this.negativeCache.isNegative(e)}async recordNegative(e){await Z(),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 Z();let s=await rt(ig(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 Z(),await Ae(ig(e,t),JSON.stringify(o))}}});var cg,lg=v(()=>{cg={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 ZE,no,ug,dg,r$,Zl=v(()=>{nt();ag();lg();ZE=new to,{packageService:no,versionResolver:ug,cdnClient:dg,peerResolver:r$}=Zh(ZE,cg)});function ro(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function so(n,e){return` <script>
|
|
360
360
|
(function() {
|
|
361
361
|
try {
|
|
362
|
-
var KEY = ${
|
|
362
|
+
var KEY = ${Rt(JSON.stringify("tb-theme:"+n))};
|
|
363
363
|
var doc = document.documentElement;
|
|
364
364
|
var mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
365
365
|
var os = function() { return mq.matches ? 'dark' : 'light'; };
|
|
366
|
-
var FORCED = ${
|
|
366
|
+
var FORCED = ${Rt(JSON.stringify(e??null))};
|
|
367
367
|
var stored = function() {
|
|
368
368
|
try { var v = localStorage.getItem(KEY); return (v === 'dark' || v === 'light') ? v : undefined; }
|
|
369
369
|
catch (e) { return undefined; }
|
|
@@ -391,7 +391,7 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
391
391
|
});
|
|
392
392
|
} catch (e) {}
|
|
393
393
|
})();
|
|
394
|
-
</script>`}var
|
|
394
|
+
</script>`}var Rt,io,oo=v(()=>{le();Rt=n=>n.replace(/<\/script/gi,"<\\/script");io=`
|
|
395
395
|
const es = new EventSource('/__reload');
|
|
396
396
|
let bootId = null;
|
|
397
397
|
let firstErrorAt = 0;
|
|
@@ -408,7 +408,7 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
408
408
|
es.onerror = () => {
|
|
409
409
|
if (!firstErrorAt) firstErrorAt = Date.now();
|
|
410
410
|
if (Date.now() - firstErrorAt > RETRY_WINDOW_MS) es.close();
|
|
411
|
-
};`});var
|
|
411
|
+
};`});var fg,pg=v(()=>{oo();fg=`
|
|
412
412
|
(() => {
|
|
413
413
|
// Embedded (bulb-in-a-bulb): runs inside a sandboxed iframe with no parent
|
|
414
414
|
// bridge, so privileged tb.* (AI, fs, server RPC) can't reach a host and would
|
|
@@ -930,9 +930,35 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
930
930
|
// several is a reported error, never a guess. Errors throw \u2014 the reply leg carries them to
|
|
931
931
|
// stderr and a non-zero exit.
|
|
932
932
|
const describeEl = (el) => el.tagName.toLowerCase() + (el.id ? '#' + el.id : '') + (typeof el.className === 'string' && el.className ? '.' + el.className.split(/\\s+/)[0] : '');
|
|
933
|
+
// Why a name the author DID write isn't in the outline. Both causes are silent by construction:
|
|
934
|
+
// an element with no role is descended through transparently, and an unrendered one is skipped \u2014
|
|
935
|
+
// so the label is on the page while the target is not, with nothing said. Same posture as the
|
|
936
|
+
// dead-control finding: name the cause rather than report an absence. Advisory only; it never
|
|
937
|
+
// decides resolution, so a wrong guess costs a clause, never a target.
|
|
938
|
+
// The recourse differs by family: naming a container for a READ is a role away, but telling an
|
|
939
|
+
// author to put role="button" on a <div> would coach the very onClick-div the actuation invariant
|
|
940
|
+
// keeps untargetable (TB-Interrogation-Actuation.md) \u2014 so an actuable role asks for a real control.
|
|
941
|
+
const ACTUABLE_ROLES = { button: 1, checkbox: 1, radio: 1, combobox: 1, textbox: 1, slider: 1, spinbutton: 1, searchbox: 1, option: 1 };
|
|
942
|
+
const labelledButUntargetable = (name, role) => {
|
|
943
|
+
const q = String(name).toLowerCase();
|
|
944
|
+
for (const el of document.querySelectorAll('[aria-label]')) {
|
|
945
|
+
const label = squash(el.getAttribute('aria-label'));
|
|
946
|
+
if (!label || label.toLowerCase().indexOf(q) === -1) continue;
|
|
947
|
+
const shown = '<' + el.tagName.toLowerCase() + ' aria-label="' + label + '">';
|
|
948
|
+
const actual = roleOf(el);
|
|
949
|
+
if (!actual) return ' \u2014 ' + shown + ' has no role, so the walk descends through it without a line; '
|
|
950
|
+
+ (ACTUABLE_ROLES[role]
|
|
951
|
+
? 'a ' + role + ' has to be a real control (<button>, <input>, <select>), never a labelled <div>'
|
|
952
|
+
: 'add role="' + role + '" to name it');
|
|
953
|
+
if (hiddenEl(el) || !el.getClientRects().length) return ' \u2014 ' + shown + ' is not rendered, so the walk skips it';
|
|
954
|
+
if (actual !== role) return ' \u2014 ' + shown + ' is a ' + actual + ', not a ' + role;
|
|
955
|
+
}
|
|
956
|
+
return '';
|
|
957
|
+
};
|
|
933
958
|
const resolveTarget = (role, name) => {
|
|
934
959
|
const ofRole = collectOutline().targets.filter((t) => t.role === role);
|
|
935
|
-
if (!ofRole.length) throw new Error('no ' + role + ' in the outline
|
|
960
|
+
if (!ofRole.length) throw new Error('no ' + role + ' in the outline'
|
|
961
|
+
+ (labelledButUntargetable(name, role) || ' \u2014 run tb:snapshot for the vocabulary'));
|
|
936
962
|
const named = ofRole.filter((t) => t.name);
|
|
937
963
|
const exact = named.filter((t) => t.name === name);
|
|
938
964
|
const q = name.toLowerCase();
|
|
@@ -942,7 +968,8 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
942
968
|
const unnamed = ofRole.length - named.length;
|
|
943
969
|
throw new Error('no ' + role + ' named "' + name + '"'
|
|
944
970
|
+ (named.length ? ' \u2014 ' + role + ' names here: ' + named.slice(0, 8).map((t) => '"' + t.name + '"').join(', ') : '')
|
|
945
|
-
+ (unnamed ? ' (' + unnamed + ' unnamed \u2014 an aria-label would make them targetable)' : '')
|
|
971
|
+
+ (unnamed ? ' (' + unnamed + ' unnamed \u2014 an aria-label would make them targetable)' : '')
|
|
972
|
+
+ labelledButUntargetable(name, role));
|
|
946
973
|
}
|
|
947
974
|
throw new Error(hits.length + ' ' + role + 's match "' + name + '" (' + hits.map((t) => '"' + t.name + '"').join(', ') + ') \u2014 name one exactly');
|
|
948
975
|
};
|
|
@@ -1039,16 +1066,74 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
1039
1066
|
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1040
1067
|
return postFrameSnapshot();
|
|
1041
1068
|
};
|
|
1069
|
+
// getComputedStyle serializes an ordinary color as rgb()/rgba(), so the 4th comma-part is the
|
|
1070
|
+
// alpha. Anything else \u2014 oklch(\u2026 / .5), color(srgb \u2026) \u2014 is VISIBLE BUT NOT KNOWN OPAQUE (-1), the
|
|
1071
|
+
// safe direction: the walk keeps going and an opaque base still lands underneath, because the one
|
|
1072
|
+
// thing the composite must guarantee is a PNG with no alpha left in it to composite on white.
|
|
1073
|
+
const colorAlpha = (c) => {
|
|
1074
|
+
if (!c || c.indexOf('(') === -1) return 0;
|
|
1075
|
+
const parts = c.slice(c.indexOf('(') + 1, c.lastIndexOf(')')).split(',');
|
|
1076
|
+
if (parts.length === 3) return 1;
|
|
1077
|
+
if (parts.length !== 4) return -1;
|
|
1078
|
+
const a = parseFloat(parts[3]);
|
|
1079
|
+
return a === a ? a : -1;
|
|
1080
|
+
};
|
|
1081
|
+
// The UA's own page color, read from a Canvas system-color probe rather than hardcoded per
|
|
1082
|
+
// theme: html/body compute to rgba(0,0,0,0) in exactly the dark case that matters, so only the
|
|
1083
|
+
// system color knows what the user is actually looking at.
|
|
1084
|
+
const uaPageColor = () => {
|
|
1085
|
+
const probe = document.createElement('div');
|
|
1086
|
+
probe.style.cssText = 'position:fixed;left:-9999px;top:0;width:1px;height:1px;background-color:Canvas';
|
|
1087
|
+
document.body.appendChild(probe);
|
|
1088
|
+
try { return getComputedStyle(probe).backgroundColor; }
|
|
1089
|
+
finally { probe.parentNode.removeChild(probe); }
|
|
1090
|
+
};
|
|
1091
|
+
// The fills behind a canvas, bottom-up. Starts at the canvas ITSELF \u2014 a canvas's own background
|
|
1092
|
+
// paints behind its bitmap and is the nearest layer under the pixels \u2014 and stops at the first
|
|
1093
|
+
// opaque one, since nothing behind that shows. Translucent layers in between are collected rather
|
|
1094
|
+
// than treated as the bottom: stopping at a half-transparent panel would paint a half-transparent
|
|
1095
|
+
// backdrop and hand back a PNG that still composites on white, which is the bug this exists to
|
|
1096
|
+
// close. Only when no layer is known-opaque does the UA page color go underneath \u2014 so a page that
|
|
1097
|
+
// styles its own background never pays for the probe.
|
|
1098
|
+
const backdropOf = (el) => {
|
|
1099
|
+
const stack = [];
|
|
1100
|
+
for (let n = el; n; n = n.parentElement) {
|
|
1101
|
+
const c = getComputedStyle(n).backgroundColor;
|
|
1102
|
+
const a = colorAlpha(c);
|
|
1103
|
+
if (a === 0) continue; // fully transparent: not a layer at all
|
|
1104
|
+
stack.unshift(c); // farther layers paint first
|
|
1105
|
+
if (a >= 1) return stack;
|
|
1106
|
+
}
|
|
1107
|
+
const page = uaPageColor();
|
|
1108
|
+
if (colorAlpha(page) >= 1) stack.unshift(page);
|
|
1109
|
+
return stack;
|
|
1110
|
+
};
|
|
1111
|
+
// The canvas as the user sees it: its backdrop painted first, then its own pixels. A chart
|
|
1112
|
+
// library's canvas is transparent, and a bare backing store opens as a WHITE frame in any
|
|
1113
|
+
// viewer \u2014 so the dark-theme render that most needs checking is the one that reads as blank
|
|
1114
|
+
// (TB-Interrogation-Pixels.md). A 0-size source would throw from drawImage, so callers guard it.
|
|
1115
|
+
// The fills are returned, never only applied: they APPROXIMATE the page (flat colors, no gradient
|
|
1116
|
+
// or image), so the reply has to be able to state what it assumed.
|
|
1117
|
+
const compositeOnBackdrop = (el) => {
|
|
1118
|
+
const shot = document.createElement('canvas');
|
|
1119
|
+
shot.width = el.width; shot.height = el.height;
|
|
1120
|
+
const g = shot.getContext('2d');
|
|
1121
|
+
const fills = backdropOf(el);
|
|
1122
|
+
for (const fill of fills) { g.fillStyle = fill; g.fillRect(0, 0, shot.width, shot.height); }
|
|
1123
|
+
g.drawImage(el, 0, 0);
|
|
1124
|
+
return { shot: shot, backdrop: fills.join(' + ') };
|
|
1125
|
+
};
|
|
1042
1126
|
// tb:png (TB-Interrogation-Pixels.md): the page's canvas as PNG \u2014 bytes base64 in the reply
|
|
1043
1127
|
// envelope. The shim knows nothing about files; the CLI decodes, writes one under its own home,
|
|
1044
1128
|
// and prints the path. Resolution is a SUBSET of the outline's vocabulary: the sole visible
|
|
1045
1129
|
// canvas needs no name (an edit is the state loss the verb avoids); several resolve as the
|
|
1046
|
-
// ordinary img role by name,
|
|
1130
|
+
// ordinary img role by name, descending from a named container to the one canvas it holds.
|
|
1047
1131
|
const readPng = (rest) => {
|
|
1048
1132
|
const m = /^\\s*(?:"([^"]*)"|(\\S+))?\\s*$/.exec(rest);
|
|
1049
1133
|
if (!m) throw new Error('usage: tb:png ["<name>"]');
|
|
1050
1134
|
const name = m[1] !== undefined ? m[1] : m[2];
|
|
1051
1135
|
let el;
|
|
1136
|
+
let via = '';
|
|
1052
1137
|
if (name === undefined) {
|
|
1053
1138
|
const canvases = collectOutline().targets.filter((t) => t.el.tagName === 'CANVAS');
|
|
1054
1139
|
if (!canvases.length) throw new Error('no canvas in the page (tb:png reads a canvas element back as PNG)');
|
|
@@ -1061,19 +1146,36 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
1061
1146
|
el = canvases[0].el;
|
|
1062
1147
|
} else {
|
|
1063
1148
|
el = resolveTarget('img', name);
|
|
1064
|
-
if (el.tagName !== 'CANVAS')
|
|
1149
|
+
if (el.tagName !== 'CANVAS') {
|
|
1150
|
+
// A charting library creates its own canvas, so the wrapper is the only element an author
|
|
1151
|
+
// can name at authoring time: descend from a named container to its single canvas. Counted
|
|
1152
|
+
// over the WALK, never querySelectorAll \u2014 a hidden scratch canvas must not force an
|
|
1153
|
+
// ambiguity the sole-canvas form wouldn't (TB-Interrogation-Pixels.md: the counting rule
|
|
1154
|
+
// and the outline must agree, or the verb contradicts itself).
|
|
1155
|
+
const inner = collectOutline().targets.filter((t) => t.el.tagName === 'CANVAS' && el.contains(t.el));
|
|
1156
|
+
if (inner.length !== 1) throw new Error(inner.length
|
|
1157
|
+
? '"' + name + '" holds ' + inner.length + ' visible canvases \u2014 name one of them directly'
|
|
1158
|
+
: 'img "' + name + '" is <' + el.tagName.toLowerCase() + '>, not a canvas');
|
|
1159
|
+
via = name;
|
|
1160
|
+
el = inner[0].el;
|
|
1161
|
+
}
|
|
1065
1162
|
}
|
|
1066
1163
|
// toBlob throws from outside for a canvas that can't be read; name the cause \u2014 a tainted or
|
|
1067
|
-
// transferred canvas must exit non-zero, never read as an empty success.
|
|
1164
|
+
// transferred canvas must exit non-zero, never read as an empty success. (A tainted source
|
|
1165
|
+
// taints the composite instead of throwing at drawImage, so the same throw still lands here.)
|
|
1068
1166
|
return new Promise((resolve, reject) => {
|
|
1069
1167
|
try {
|
|
1070
|
-
el.
|
|
1071
|
-
|
|
1168
|
+
if (!el.width || !el.height) return reject(new Error('the canvas produced no pixels \u2014 is it 0\xD70?'));
|
|
1169
|
+
const composite = compositeOnBackdrop(el);
|
|
1170
|
+
composite.shot.toBlob((blob) => {
|
|
1171
|
+
if (!blob) return reject(new Error('the canvas did not encode to a PNG'));
|
|
1072
1172
|
const fr = new FileReader();
|
|
1073
1173
|
fr.onerror = () => reject(new Error('failed to read the encoded PNG'));
|
|
1074
1174
|
fr.onload = () => {
|
|
1075
1175
|
const s = String(fr.result);
|
|
1076
|
-
|
|
1176
|
+
// backdrop/via ride the reply so the CLI's delivery line can state what the read
|
|
1177
|
+
// assumed and what it resolved through \u2014 an assumption the frame itself can't show.
|
|
1178
|
+
resolve({ png: s.slice(s.indexOf(',') + 1), width: el.width, height: el.height, backdrop: composite.backdrop, via: via });
|
|
1077
1179
|
};
|
|
1078
1180
|
fr.readAsDataURL(blob);
|
|
1079
1181
|
}, 'image/png');
|
|
@@ -1091,7 +1193,7 @@ ${OE(t)}`)}var kh=S(()=>{qi()});var vt,Un,Ml,Jn=S(()=>{vt="https://esm.sh",Un="h
|
|
|
1091
1193
|
// origin, not an embed); a srcdoc embed or a file:// static export has no server, so onMessage just
|
|
1092
1194
|
// stays inert there. Opening it independent of watch is what lets send reach a --no-watch page.
|
|
1093
1195
|
if (!isEmbedded && location.protocol.indexOf('http') === 0) {
|
|
1094
|
-
${
|
|
1196
|
+
${io}
|
|
1095
1197
|
es.addEventListener('message', async (e) => {
|
|
1096
1198
|
// Wire envelope { id?, payload } (JSON \u2014 SSE-line-safe). tb:* payloads are the shim's reserved
|
|
1097
1199
|
// namespace (TB-Interrogation.md): answered by a built-in handler, never delivered to
|
|
@@ -1136,46 +1238,46 @@ ${Zi}
|
|
|
1136
1238
|
});
|
|
1137
1239
|
}
|
|
1138
1240
|
})();
|
|
1139
|
-
`});function
|
|
1140
|
-
`+
|
|
1241
|
+
`});function mg(n){let{name:e,code:t,css:r,html:s,data:i,insight:o,importMap:a,theme:c,embedded:l,dir:d,source:u,compileError:f}=n,p=s.trim()||'<div id="app"></div>',h=l?"":`
|
|
1242
|
+
`+kl,m={imports:sA(a.imports)};return`<!DOCTYPE html>
|
|
1141
1243
|
<html>
|
|
1142
1244
|
<head>
|
|
1143
1245
|
<meta charset="utf-8">
|
|
1144
1246
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1145
|
-
<title>${
|
|
1146
|
-
${
|
|
1247
|
+
<title>${ro(e)} - typebulb</title>
|
|
1248
|
+
${so(e,c)}
|
|
1147
1249
|
<script type="importmap">
|
|
1148
1250
|
${JSON.stringify(m,null,2)}
|
|
1149
1251
|
</script>
|
|
1150
1252
|
<style>
|
|
1151
|
-
${
|
|
1253
|
+
${Dr}${h}
|
|
1152
1254
|
</style>
|
|
1153
1255
|
<style>
|
|
1154
|
-
${
|
|
1256
|
+
${r}
|
|
1155
1257
|
</style>
|
|
1156
1258
|
</head>
|
|
1157
1259
|
<body>
|
|
1158
1260
|
${p}
|
|
1159
1261
|
|
|
1160
|
-
${i.length>0?`<script>window.__TB_DATA__ = ${
|
|
1161
|
-
${o?`<script>window.__TB_INSIGHT__ = ${
|
|
1162
|
-
${d?`<script>window.__TB_DIR__ = ${
|
|
1163
|
-
${f?`<script>window.__TB_COMPILE_ERROR__ = ${
|
|
1262
|
+
${i.length>0?`<script>window.__TB_DATA__ = ${Rt(JSON.stringify(i))};</script>`:""}
|
|
1263
|
+
${o?`<script>window.__TB_INSIGHT__ = ${Rt(JSON.stringify(o))};</script>`:""}
|
|
1264
|
+
${d?`<script>window.__TB_DIR__ = ${Rt(JSON.stringify(d))};</script>`:""}
|
|
1265
|
+
${f?`<script>window.__TB_COMPILE_ERROR__ = ${Rt(JSON.stringify(f))};</script>`:""}
|
|
1164
1266
|
|
|
1165
1267
|
<script>
|
|
1166
|
-
${
|
|
1268
|
+
${fg}
|
|
1167
1269
|
</script>
|
|
1168
1270
|
|
|
1169
|
-
${
|
|
1271
|
+
${rA}
|
|
1170
1272
|
|
|
1171
|
-
${
|
|
1273
|
+
${tA(t,u)}
|
|
1172
1274
|
</body>
|
|
1173
|
-
</html>`}function
|
|
1174
|
-
`);return`<script type="module">${s}${
|
|
1175
|
-
</script>`}function
|
|
1176
|
-
`).length,
|
|
1177
|
-
//# sourceURL=${
|
|
1178
|
-
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(
|
|
1275
|
+
</html>`}function tA(n,e){let t=["",...eA],r=e?Array(Math.max(0,e.codeLine-t.length-1)).fill(""):[],s=[...t,...r,Rt(n)].join(`
|
|
1276
|
+
`);return`<script type="module">${s}${nA(e,s)}
|
|
1277
|
+
</script>`}function nA(n,e){if(!n)return"";let t=e.split(`
|
|
1278
|
+
`).length,r={version:3,file:n.file,sources:[`/__source/${n.file}`],names:[],mappings:["AAAA",...Array(Math.max(0,t-1)).fill("AACA")].join(";")};return`
|
|
1279
|
+
//# sourceURL=${n.file.replace(/\s/g,"%20")}
|
|
1280
|
+
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(r))}`}function sA(n){let e={};for(let[t,r]of Object.entries(n))e[t]=r.startsWith("https://")?"/proxy/"+r:r;return e}var eA,rA,hg=v(()=>{pg();oo();eA=["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) */"];rA=`<script>
|
|
1179
1281
|
(function () {
|
|
1180
1282
|
var framed = window.parent !== window;
|
|
1181
1283
|
var post = function (m) { try { parent.postMessage(m, '*'); } catch (e) {} }; /* framed only */
|
|
@@ -1274,54 +1376,54 @@ ${UE(t,u)}
|
|
|
1274
1376
|
}
|
|
1275
1377
|
});
|
|
1276
1378
|
})();
|
|
1277
|
-
</script>`});import*as
|
|
1278
|
-
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await
|
|
1379
|
+
</script>`});import*as co from"fs/promises";import*as ao from"path";import{existsSync as gg,readFileSync as iA}from"fs";import{execFile as oA}from"child_process";import{promisify as aA}from"util";import{builtinModules as cA}from"node:module";import{satisfies as lA}from"semver";async function lo(n,e,t,r){let i=n.map(l=>pA(l,t)).filter(l=>!mA(l,e));if(i.length===0)return;let o=i.filter(l=>!fA.test(l));if(o.length)throw new Error(`Refusing to install npm spec(s) with unsupported characters: ${o.join(", ")}
|
|
1380
|
+
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await co.mkdir(e,{recursive:!0});let a=ao.join(e,"package.json");gg(a)||await co.writeFile(a,JSON.stringify({name:"typebulb-server",private:!0})),console.log(` Installing: ${i.join(", ")}`);let c=["--no-audit","--no-fund",...r?.ignoreScripts?["--ignore-scripts"]:[]];await uA("npm",["install",...c,...i],{cwd:e,shell:!0})}function pA(n,e){if(!e||j.parse(n).version)return n;let t=e[n];return t?`${n}@${t}`:n}function mA(n,e){let{name:t,version:r}=j.parse(n),s=ao.join(e,"node_modules",t);if(!gg(s))return!1;if(!r)return!0;try{let i=JSON.parse(iA(ao.join(s,"package.json"),"utf-8")).version;return lA(i,r)}catch{return!1}}function uo(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=j.rootOf(s);dA.has(i)||e.add(i)}return[...e]}var uA,dA,fA,eu=v(()=>{nt();uA=aA(oA),dA=new Set(cA),fA=/^(@[a-z0-9._-]+\/)?[a-z0-9._-]+(@[a-zA-Z0-9.^~*x-]+)?$/i});var yg=v(()=>{});var ve,Fe,$n=v(()=>{ve=class extends Error{constructor(e,t="unknown",r=!1){super(e),this.code=t,this.retryable=r}},Fe=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=`
|
|
1279
1381
|
|
|
1280
|
-
`){let
|
|
1281
|
-
`)),!t&&s.type==="message"&&s.content&&(t=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,reasoning:
|
|
1382
|
+
`){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 ve(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 ve(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 fo,tu=v(()=>{$n();fo=class extends Fe{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"}}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!==!1&&(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 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(`
|
|
1383
|
+
`)),!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}}parseProviderStreamChunk(e){if(!this.isResponsesApiEvent(e))return null;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 ve(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};default:return null}}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(`
|
|
1282
1384
|
|
|
1283
|
-
`)}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
|
|
1385
|
+
`)}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 Ln,po=v(()=>{$n();Ln=class extends Fe{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}}parseProviderStreamChunk(e){if(!this.hasChoices(e))return null;let t=e.choices[0];if(!t)return null;let r=t.delta||t.message;if(!r)return null;let s=r.content||void 0,i=r.reasoning||r.reasoning_content||void 0;return!s&&!i?null:{text:s,reasoning:i}}hasChoices(e){return typeof e=="object"&&e!==null&&"choices"in e&&Array.isArray(e.choices)}}});var mo,nu=v(()=>{po();mo=class extends Ln{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"}}buildHeaders(e,t){let r={Authorization:`Bearer ${e}`,"x-api-key":e,"Content-Type":"application/json",Accept:"application/json","X-Title":"Typebulb"};return t&&(r["HTTP-Referer"]=t,r.Referer=t,r.Origin=t),r}buildPayload(e,t,r,s){let i={model:t,messages:e,stream:s};r?.webSearch===!0&&(i.plugins=[{id:"web"}]);let o=r?.effort;return o!==void 0&&(i.reasoning={effort:this.effortMap[o]}),i}}});var ho,ru=v(()=>{$n();ho=class extends Fe{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:this.getMaxTokens(t),messages:this.withTailMessagesCached(o),stream:s};r?.webSearch!==!1&&(a.tools=[{type:"web_search_20250305",name:"web_search"}]),i&&(a.system=[{type:"text",text:i,cache_control:{type:"ephemeral"}}]);let c=r?.effort;if(c!==void 0){if(this.isModernModel(t))if(c===0)this.alwaysThinks(t)||(a.thinking={type:"disabled"}),a.output_config={effort:"low"};else{let l={1:"low",2:"medium",3:"high"};a.thinking={type:"adaptive",display:"summarized"},a.output_config={effort:l[c]}}else if(c!==0){let l={1:2048,2:4096,3:8192};a.thinking={type:"enabled",budget_tokens:l[c]}}}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(`
|
|
1284
1386
|
|
|
1285
|
-
`);return{text:t,reasoning:
|
|
1286
|
-
`),c={contents:o.map(d=>({role:d.role==="assistant"?"model":"user",parts:[{text:d.content}]}))};
|
|
1287
|
-
`)[0],type:s.status,code:s.code?.toString()}:
|
|
1387
|
+
`);return{text:t,reasoning:r||void 0}}parseProviderStreamChunk(e){return this.isAnthropicEvent(e)&&e.type==="content_block_delta"?e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:null:null}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 go,su=v(()=>{$n();go=class extends Fe{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}}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,`
|
|
1388
|
+
`),c={contents:o.map(d=>({role:d.role==="assistant"?"model":"user",parts:[{text:d.content}]}))};r?.webSearch!==!1&&(c.tools=[{google_search:{}}]),i&&(c.systemInstruction={role:"system",parts:[{text:i}]});let l=r?.effort;if(l!==void 0){let d=this.geminiVersion(t),u=d!==null&&d>=3?{thinkingLevel:this.thinkingLevelFor(d,l)}:{thinkingBudget:this.budgetMap[l]};c.generationConfig={thinkingConfig:l===0?u:{includeThoughts:!0,...u}}}return c}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(`
|
|
1389
|
+
`)[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}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return null;let t=this.extractParts(e);return t.text||t.reasoning?t:null}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):null}thinkingLevelFor(e,t){let r=["minimal","low","medium","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 ve(`Prompt blocked: ${t}`)}}}});var yo,iu=v(()=>{po();yo=class extends Ln{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{model:t,messages:e,stream:s}}}});function Zt(n){let e=hA.get(n);if(!e)throw new Error(`Unsupported protocol: ${n}`);return e}function gA(n,e){return n.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)}async function ou(n,e){let t=Zt(n.protocol),r=t.getPath(n.model,e.stream),s=gA(n.baseUrl,r),i=t.buildHeaders(n.apiKey,e.origin),o=t.buildPayload(e.messages,n.model,{effort:e.effort,webSearch:e.webSearch},e.stream);return e.modifyPayload?.(o),fetch(s,{method:"POST",headers:i,body:JSON.stringify(o),signal:e.signal})}function yA(n){return/prompt is too long|context[_ ](length|window)|maximum context|token count exceeds|too many tokens/i.test(n)}async function Mn(n,e){let t=Zt(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||yA(s))&&(o="context_exceeded"),{code:o,message:s,retryable:i===429||i>=500}}var bg,hA,au=v(()=>{tu();nu();ru();su();iu();bg=new yo,hA=new Map([["openai",new fo],["openrouter",new mo],["anthropic",new ho],["gemini",new go],["ollama",bg],["openai-compat",bg]])});function wg(n){let e=n.indexOf(`\r
|
|
1288
1390
|
\r
|
|
1289
|
-
`),t=
|
|
1391
|
+
`),t=n.indexOf(`
|
|
1290
1392
|
|
|
1291
|
-
`);return e!==-1&&(t===-1||e<t)?{pos:e,len:4}:t!==-1?{pos:t,len:2}:{pos:-1,len:0}}function
|
|
1292
|
-
`).trim();if(!
|
|
1393
|
+
`);return e!==-1&&(t===-1||e<t)?{pos:e,len:4}:t!==-1?{pos:t,len:2}:{pos:-1,len:0}}function cu(n){let t=n.split(/\r?\n/).filter(s=>s.startsWith("data:"));if(!t.length)return null;let r=t.map(s=>s.replace(/^data:\s?/,"")).join(`
|
|
1394
|
+
`).trim();if(!r)return null;if(r==="[DONE]")return"done";try{return JSON.parse(r)}catch{return null}}async function*vg(n,e,t){let r=new TextDecoder,s="",i,o=e?new Promise((a,c)=>{e.aborted&&c(new Error("Aborted")),i=()=>c(new Error("Aborted")),e.addEventListener("abort",i,{once:!0})}):null;o?.catch(()=>{});try{for(;;){let{done:a,value:c}=o?await Promise.race([n.read(),o]):await n.read();if(a){if(s.trim()){let u=cu(s);u!==null&&u!=="done"&&(yield u)}return}t?.(),s+=r.decode(c,{stream:!0});let{pos:l,len:d}=wg(s);for(;l!==-1;){let u=s.slice(0,l);s=s.slice(l+d);let f=cu(u);if(f==="done")return;f!==null&&(yield f),{pos:l,len:d}=wg(s)}}}finally{i&&e?.removeEventListener("abort",i);try{await n.cancel()}catch{}}}async function en(n,e){if(!n.body)throw new Error("Response body is missing");let t="";for await(let r of tn(n,e))r.kind==="text"&&(t+=r.text);return t}async function*tn(n,e){let t=e??(n.headers.get("X-Provider-Protocol")||"openai"),r=Zt(t);if(!n.body)return;let s=n.body.getReader();for await(let i of vg(s)){let o=r.parseStreamChunk(i);o?.reasoning&&(yield{kind:"reasoning",text:o.reasoning}),o?.text&&(yield{kind:"text",text:o.text})}}var Sg=v(()=>{au()});import{strToU8 as bA,strFromU8 as wA,deflateSync as vA,inflateSync as SA}from"fflate";function uu(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.
|
|
1293
1395
|
|
|
1294
1396
|
---
|
|
1295
1397
|
Instructions:
|
|
1296
|
-
${
|
|
1398
|
+
${n.infer||"Process the data and return a JSON object."}`),n.insight&&t.push(`---
|
|
1297
1399
|
Example output:
|
|
1298
|
-
${
|
|
1400
|
+
${n.insight}`),n.code&&t.push(`---
|
|
1299
1401
|
Code that will consume your output:
|
|
1300
|
-
${
|
|
1402
|
+
${n.code}`),e.length>0){let r=e.length===1?e[0]:e.map((s,i)=>`[Chunk ${i+1}]
|
|
1301
1403
|
${s}`).join(`
|
|
1302
1404
|
|
|
1303
1405
|
`);t.push(`---
|
|
1304
1406
|
Data to process:
|
|
1305
1407
|
<data>
|
|
1306
|
-
${
|
|
1408
|
+
${r}
|
|
1307
1409
|
</data>`)}return t.push(`
|
|
1308
1410
|
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(`
|
|
1309
1411
|
|
|
1310
|
-
`)}function
|
|
1311
|
-
`)}var Lr,hA,gA,yA,bA,Zn,fo,es,Qt=S(()=>{Lr={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};hA="https://api.typebulb.com/api/models",gA=1440*60*1e3,yA=5e3,bA=60*1e3,Zn=null,fo=null,es=null});function it(r,e){let t=r??process.env.TB_AI_PROVIDER,n=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(!n)return"No model specified. Set TB_AI_MODEL in your .env file or pass model in the tb.ai() call.";let s;try{s=zt(t)}catch{return`Unknown provider '${t}'.`}if(t==="ollama")return{apiKey:"",baseUrl:`${Mr(process.env.OLLAMA_HOST??s.defaultBaseUrl)}/v1`,protocol:t,model:n,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:n,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=Lr[t];if(!i)return`Unknown provider '${t}'.`;let o=process.env[i];return o?{apiKey:o,baseUrl:s.defaultBaseUrl,protocol:t,model:n,isFreeModel:!1}:`No API key for '${t}'. Set ${i} in your .env file.`}function At(r,e){let t=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(s=>({role:s.role,content:s.content}))],n=e.effort;return eu(r,{messages:t,stream:!0,effort:n!=null&&n>=0&&n<=3?n:void 0,webSearch:e.webSearch??!0,signal:e.signal})}var mo=S(()=>{$r();Qt()});import*as Br from"fs/promises";import*as ot from"path";function ho(r,e,t=e){let n=ot.resolve(e,r),s=ot.normalize(t),i=ot.normalize(n);if(i!==s&&!i.startsWith(s+ot.sep))throw new Error("Path traversal detected - access denied");return n}async function ts(r,e,t){return Br.readFile(ho(r,e,t))}async function go(r,e,t,n){let s=ho(r,t,n);await Br.mkdir(ot.dirname(s),{recursive:!0}),await Br.writeFile(s,typeof e=="string"?e:Buffer.from(e))}var uu=S(()=>{});async function ng(r){let e=it(r.provider,r.model);if(typeof e=="string")throw new Error(e);let t=await At(e,r);if(!t.ok){let n=await Ir(t,e.protocol);throw new Error(n.message)}return{response:t,protocol:e.protocol}}async function kA(r){let{response:e,protocol:t}=await ng(r);return{text:await Gt(e,t)}}async function*xA(r){let{response:e,protocol:t}=await ng(r);yield*Xt(e,t)}function sg(r,e=process.cwd()){let t=Object.assign(kA,{stream:xA}),n={read:async s=>{let i=await ts(s,r,e);try{return new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{throw new Error(`File is not valid UTF-8 text: ${s} \u2014 use tb.fs.readBytes() for binary files.`)}},readBytes:async s=>new Uint8Array(await ts(s,r,e)),write:async(s,i)=>(await go(s,i,r,e),!0)};globalThis.tb=Object.freeze({log:(...s)=>{console.log(...s)},ai:t,fs:n,dir:r,models:()=>st(),aiAccess:po,mode:"local"})}var ig=S(()=>{$r();mo();Qt();uu()});import*as je from"fs/promises";import*as se from"path";import{pathToFileURL as EA}from"url";async function og(r){let t=(await je.readdir(r)).find(n=>n.endsWith(".bulb.md"));return t?se.join(r,t):null}function Tt(r,e){let t=se.resolve(r),n=se.join(se.dirname(t),se.basename(t).replace(/\.bulb\.md$/,""));return e?se.join(n,"batches",e):n}async function Dr(r,e){let t=Tt(r,e);await je.mkdir(t,{recursive:!0});let n=new Date;await je.utimes(t,n,n).catch(()=>{})}function jr(r){let[e,t,n,s]=r.split(se.sep).slice(-4);if(!(e!=="typebulbs"||t!=="u"||!n||!s?.endsWith(".bulb.md")))return{userSlug:n,slug:s.slice(0,-8)}}async function Fe(r){let e=await je.readFile(r,"utf-8"),t=ue(e);if(!t)throw new Error("Invalid .bulb.md file format");let n=Ar(t);return{bulb:n,config:en(n.config),warnings:Od(e),starts:t.starts}}function du(r){let e=se.basename(r).replace(/\.bulb\.md$/i,"");return se.join(se.dirname(r),".typebulb",`${e}.server.mjs`)}async function rs(r,e,t,n,s){let i=$l(r,{serverOnly:!0});if(i.error)throw new Error(`Server compilation error: ${i.error}`);let o=i.code;t&&(o=await xd(o,t));let a=se.join(se.dirname(e),".typebulb");await je.mkdir(a,{recursive:!0});let c=so(o);c.length>0&&await no(c,a,n);let l=du(e);return await je.writeFile(l,o,"utf-8"),sg(Tt(e,s)),await import(`${EA(l).href}?t=${Date.now()}`)}async function fu(r,e,t,n,s){let{bulb:i,config:o,starts:a}=await Fe(r),c=Ai(i.data);Sh(i.code,o.dependencies??{});let l=$l(i.code,{jsxImportSource:o.ts?.jsxImportSource});l.error&&console.error("Compilation error:",l.error);let{importMap:d}=await Gi.buildImportMap(l.code,o.dependencies??{},n?new Set([n.name]):void 0);n&&(d.imports[n.name]=n.entryUrl);let u=Kh({name:i.name,code:l.code,css:i.css,html:i.html,data:c,insight:i.insight,importMap:d,dir:Tt(r,s),watch:e,source:{file:se.basename(r),codeLine:a.get("code.tsx")??1},compileError:l.error?String(l.error):void 0}),f=null;return i.server&&t&&(f=await rs(i.server,r,n,o.dependencies,s)),{html:u,bulb:i,serverExports:f}}var Pt,He=S(()=>{Fn();gh();kh();Yl();Hh();Vl();xs();ig();Pt=(r,e)=>se.join(Tt(r,e),"assets")});import{readdirSync as ag,readFileSync as AA,statSync as cg}from"fs";import{join as yo,basename as TA}from"path";function lg(r,e,t){if(e>8)return t;let n;try{n=ag(r,{withFileTypes:!0})}catch{return t}for(let s of n)if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;lg(yo(r,s.name),e+1,t)}else s.isFile()&&s.name.endsWith(".bulb.md")&&t.push(yo(r,s.name));return t}function pu(r){let e=yo(Tt(r),"batches"),t;try{t=ag(e,{withFileTypes:!0})}catch{return[]}return t.filter(n=>n.isDirectory()).map(n=>{let s=0;try{s=cg(yo(e,n.name)).mtimeMs}catch{}return{name:n.name,mtime:s}}).sort((n,s)=>s.mtime-n.mtime).map(n=>n.name)}function bo(r){return lg(r,0,[]).map(e=>{let t=0;try{t=cg(e).mtimeMs}catch{}let n,s=!1;try{let i=AA(e,"utf8");n=Fi(i.slice(0,1024));let o=ue(i);s=!!o&&ji(Ar(o))}catch{}return{path:e,name:n??TA(e).replace(/\.bulb\.md$/,""),mtime:t,serverOnly:s}})}var ug=S(()=>{le();Fn();Il();He()});import*as pg from"net";import{mkdir as PA,readFile as OA,writeFile as mg}from"fs/promises";import{existsSync as CA}from"fs";import{join as hg}from"path";function bg(){return hg(Ut(),"blocks")}function mu(r){return hg(bg(),`${r}.json`)}function vo(r){return new Promise(e=>{let t=pg.createServer();t.once("error",()=>e(!1)),t.listen(r,"127.0.0.1",()=>t.close(()=>e(!0)))})}async function NA(r){for(let e=r;e<65535;e++)if(await vo(e))return e;throw new Error(`No free port found above ${r}`)}async function hu(r){let e=(await Q()).find(n=>n.port===r),t=e?` (pid ${e.pid}, ${e.agent?`agent:${e.agent}`:e.file})`:"";console.error(`port ${r} in use${t}`),process.exit(1)}async function So(r){try{let e=JSON.parse(await OA(mu(r),"utf8"));return e&&typeof e.cwd=="string"?{cwd:e.cwd,slots:e.slots??{},mirrors:e.mirrors??{}}:void 0}catch{return}}async function ko(r,e){await mg(mu(r),JSON.stringify(e,null,2))}async function IA(r){let e=X(r);try{await PA(bg(),{recursive:!0})}catch{return}let t=[];for(let o=0;o<yg;o++)t.push(gg+o*Zt);let n=await Promise.all(t.map(async o=>({base:o,block:await So(o)})));for(let{base:o,block:a}of n)if(a?.cwd===e)return o;let s={cwd:e,slots:{},mirrors:{}};for(let{base:o,block:a}of n){if(!a)try{return await mg(mu(o),JSON.stringify(s,null,2),{flag:"wx"}),o}catch{if((await So(o))?.cwd===e)return o;continue}if(!CA(a.cwd))return await ko(o,s),o}let i=n.filter(o=>!!o.block).sort((o,a)=>dg(o.block)-dg(a.block))[0];if(i)return await ko(i.base,s),i.base}function dg(r){return Object.values(r.slots).reduce((e,t)=>Math.max(e,t.usedAt??0),0)}async function $A(r,e){let t=await So(r)??{cwd:"",slots:{},mirrors:{}};if(e.kind==="mirror"){let i=t.mirrors[e.agent];if(i!==void 0)return i;let o=fg(t),a=o.has(0)?_A:0;for(;a>wo&&o.has(a);)a--;return t.mirrors[e.agent]=a,await ko(r,t),a}let n=X(e.file),s=t.slots[n]?.offset;if(s===void 0){let i=fg(t);for(s=wo;s<Zt&&i.has(s);)s++;if(s>=Zt){let o=Object.entries(t.slots).sort((a,c)=>(a[1].usedAt??0)-(c[1].usedAt??0))[0];s=o?o[1].offset:wo,o&&delete t.slots[o[0]]}}return t.slots[n]={offset:s,usedAt:Date.now()},await ko(r,t),s}function fg(r){return new Set([...Object.values(r.mirrors),...Object.values(r.slots).map(e=>e.offset)])}async function LA(r,e){let t=await IA(e);return t===void 0?void 0:t+await $A(t,r)}async function ns(r){let e=X(r);for(let t=0;t<yg;t++){let n=await So(gg+t*Zt);if(n?.cwd===e)return s=>n.slots[X(s)]?.usedAt??0}return()=>0}async function xo(r){if(r.explicit!==void 0)return await vo(r.explicit)||await hu(r.explicit),{port:r.explicit};let e=await LA(r.target,r.cwd);if(e!==void 0){let n=e-e%Zt;for(let s=0;s<4;s++){if(await vo(e))return{port:e};await new Promise(i=>setTimeout(i,150))}for(let s=wo;s<Zt;s++){let i=n+s;if(i!==e&&await vo(i))return{port:i,note:`(slot ${e} was busy)`}}}return{port:await NA(RA),note:e===void 0?"(no port block available)":"(this project's block was full)"}}var gg,Zt,yg,RA,wo,_A,Fr=S(()=>{xr();Le();gg=20100,Zt=100,yg=19,RA=23e3,wo=1,_A=Zt-1});function qr(r){if(r.server.trim())return"server-side code (server.ts)";let e=r.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")||r.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 Eo=S(()=>{});import{readFile as MA}from"fs/promises";async function gu(r){try{let e=ue(await MA(r,"utf-8"));return e?qr(Ar(e)):void 0}catch{return}}var wg=S(()=>{Fn();Eo()});function yu(r){let e=ue(r);if(!e)return r;let t=e.files.get("code.tsx");if(!t)return r;let n=vh(t);if(!n.length)return r;let s=e.files.get("config.json"),i={};if(s)try{let l=JSON.parse(s);l&&typeof l=="object"&&(i=l)}catch{}let o=i.dependencies&&typeof i.dependencies=="object"?{...i.dependencies}:{},a=n.filter(l=>!(l in o));if(!a.length)return r;for(let l of a)o[l]="latest";i.dependencies=o;let c={name:e.frontmatter.name};for(let[l,d]of e.files){let u=Ed(l);u&&(c[u]=d)}return c.config=JSON.stringify(i,null,2),Nd(c)}var vg=S(()=>{le();qi()});import{spawn as Sg}from"child_process";import{basename as BA}from"path";function DA(){return process.env.TYPEBULB_EDITOR||"code"}function FA(r,e,t){return t==null?[e]:jA.test(BA(r))?["-g",`${e}:${t}`]:[`+${t}`,e]}function qA(r,e){let t=DA();return{command:t,args:FA(t,r,e)}}function bu(r,e){let{command:t,args:n}=qA(r,e),s=process.platform==="win32"?Sg("cmd.exe",["/d","/s","/c",t,...n],{detached:!0,stdio:"ignore",windowsHide:!0}):Sg(t,n,{detached:!0,stdio:"ignore"});s.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),s.unref()}var jA,kg=S(()=>{jA=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i});import{readFileSync as UA,writeFileSync as JA,mkdirSync as KA}from"fs";import{join as HA}from"path";function xg(){return HA(Ut(),"trust.json")}function wu(){try{let r=JSON.parse(UA(xg(),"utf8"));return new Set(Array.isArray(r)?r:[])}catch{return new Set}}function WA(r){KA(Ut(),{recursive:!0}),JA(xg(),JSON.stringify([...r]))}function er(r){return wu().has(X(r))}function Ur(r,e){let t=wu(),n=X(r);(e?t.has(n):!t.has(n))||(e?t.add(n):t.delete(n),WA(t))}function vu(){return[...wu()]}var ss=S(()=>{xr()});import{readFileSync as uL,existsSync as YA}from"fs";import*as Jr from"path";import{fileURLToPath as VA}from"url";function zA(){let r=Jr.dirname(VA(import.meta.url));for(;!YA(Jr.join(r,"package.json"));){let e=Jr.dirname(r);if(e===r)break;r=e}return r}function is(){return Jr.join(zA(),"SKILL.md")}var Su=S(()=>{});import{readFileSync as Eg,existsSync as GA}from"fs";import*as We from"path";function Ag(r){return[...r?[`.env.${r}.local`,`.env.${r}`]:[],".env.local",".env"]}function Ae(r,e=process.cwd()){let t={},n=[];for(let s of Ag(r)){let i;try{i=Eg(We.resolve(e,s),"utf-8")}catch{continue}n.push(s);for(let[o,a]of Tg(i))process.env[o]===void 0&&(process.env[o]=a,t[o]=s)}return{mode:r,sources:t,loaded:n}}function*Tg(r){for(let e of r.split(`
|
|
1312
|
-
`)){let t=e.trim();if(!t||t.startsWith("#"))continue;let n=t.indexOf("=");if(n===-1)continue;let s=t.slice(0,n).trim(),i=t.slice(n+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function Ao(r,e=process.cwd()){for(let t of Ag()){let n;try{n=Eg(We.resolve(e,t),"utf-8")}catch{continue}for(let[s,i]of Tg(n))if(s===r)return i}return process.env[r]}function XA(r){let e=new Set,t=/process\.env\.([A-Za-z_$][\w$]*)|process\.env\[\s*['"]([^'"]+)['"]\s*\]/g;for(let n;n=t.exec(r);)e.add(n[1]??n[2]);return[...e]}function Ot(r,e,t){let{sources:n,mode:s,loaded:i}=r,o=process.cwd(),a=We.dirname(e),c=`(mode: ${s??"none"})`,l=t?XA(t):[],d=l.filter(p=>n[p]).map(p=>`${p} \u2190 ${n[p]}`);d.length?console.log(`env: ${d.join(", ")} ${c}`):i.length&&console.log(`env: loaded ${i.join(", ")} ${c}`),s&&!i.some(p=>p===`.env.${s}`||p===`.env.${s}.local`)&&console.log(`env: mode=${s} \u2014 no .env.${s} found; using .env`);let u=We.resolve(a)!==We.resolve(o);if(u)for(let p of[".env.local",".env"])GA(We.join(a,p))&&console.log(`env: ${We.join(a,p)} present but not loaded (cwd is ${o})`);let f=l.filter(p=>process.env[p]===void 0);if(f.length){let p=u?` \u2014 try running from ${a}`:"";console.log(`env: server.ts reads ${f.join(", ")} but ${f.length>1?"they are":"it's"} unset${p}`)}}var Ct=S(()=>{});import*as ve from"fs/promises";import*as Te from"path";import{createHash as QA}from"crypto";async function xu(r,e,t){let n=[...r],s=async()=>{for(let i=n.shift();i!==void 0;i=n.shift())await t(i)};await Promise.all(Array.from({length:Math.min(e,r.length)},s))}function Kr(r){try{return JSON.parse(r).error||r}catch{return r}}async function Au(r,e){try{let t=await fetch(os(r),{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}): ${Kr(await t.text())}`}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function Tu(r,e){Ae(e);let t=process.env.TYPEBULB_ORIGIN||ZA;try{return Oo(r,process.cwd(),t)}catch(n){console.error(n instanceof Error?n.message:String(n)),process.exit(1)}}function Oo(r,e,t){if(/^https?:\/\//i.test(r)){let i=new URL(r),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: ${r}
|
|
1313
|
-
Expected <origin>/u/<user>/<slug>`);let c=a[1],l=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:c,slug:l,dest:
|
|
1314
|
-
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:
|
|
1315
|
-
`),
|
|
1412
|
+
`)}function ns(n){try{return JSON.parse(n)}catch{return null}}function xA(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 EA(n){let e=xA(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:null}function AA(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 TA(n){let e=null,t=0;for(;t<n.length;){let r=n[t];if(r==="{"||r==="["){let s=AA(n,t);if(s!==-1){let i=n.slice(t,s+1),o=ns(i);o!==null&&(e={parsed:o,json:i}),t=s+1;continue}}t++}return e}function du(n){let e=[],t=n.trim();t.startsWith("```")&&(t=t.replace(/^```(?:json)?\s*\n?/,"").replace(/\n?```\s*$/,""),e.push("markdown fences"));let r=ns(t);if(r!==null)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=ns(t),r!==null))return{parsed:r,json:t,fixesApplied:e};if(!t.startsWith("{")&&!t.startsWith("[")){let o=t.indexOf("{"),a=t.indexOf("["),c=o>=0&&a>=0?Math.min(o,a):o>=0?o:a;if(c>0&&(t=t.slice(c),e.push("preamble text"),r=ns(t),r!==null))return{parsed:r,json:t,fixesApplied:e}}for(let[o,a]of kA){let c=a(t);if(c!==null){let l=ns(c);if(l!==null)return{parsed:l,json:c,fixesApplied:[...e,o]}}}let i=TA(n);return i!==null?{...i,fixesApplied:[...e,"extracted last JSON value"]}:{parsed:null,json:t,fixesApplied:e}}function fu(n){try{let e={i:n.insight,d:n.data},t=JSON.stringify(e),r=vA(bA(t),{level:9}),s=PA(r),i=`${kg}:${s}`;return i.length>OA?"":"#"+lu+i}catch{return""}}function pu(n){try{let e=n.startsWith("#")?n.slice(1):n;if(!e.startsWith(lu))return null;let t=e.slice(lu.length),r=t.indexOf(":");if(r===-1||t.slice(0,r)!==kg)return null;let s=CA(t.slice(r+1)),i=JSON.parse(wA(SA(s)));return!i||typeof i.i>"u"||!Array.isArray(i.d)?null:{insight:i.i,insightJson:JSON.stringify(i.i,null,2),data:i.d}}catch{return null}}function PA(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 CA(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 kA,lu,kg,OA,xg=v(()=>{kA=[["orphan quote",n=>{let e=n.replace(/^[ \t]*"[ \t]*\r?\n/gm,"");return e!==n?e:null}],["trailing }",n=>n.endsWith("}}")?n.slice(0,-1):null],["trailing ]",n=>n.endsWith("]]")?n.slice(0,-1):null],["trailing },",n=>n.endsWith("},")?n.slice(0,-1):null],["trailing ],",n=>n.endsWith("],")?n.slice(0,-1):null],["trailing comma in object",n=>n.match(/,\s*\}$/)?n.replace(/,\s*\}$/,"}"):null],["trailing comma in array",n=>n.match(/,\s*\]$/)?n.replace(/,\s*\]$/,"]"):null],["arithmetic constants",EA]];lu="tb=",kg="1",OA=6e4});var Bn=v(()=>{yg();$n();au();Sg();xg();po();ru();su();tu();nu();iu()});import{readFileSync as Eg,existsSync as RA}from"fs";import*as Ye from"path";function Ag(n){return[...n?[`.env.${n}.local`,`.env.${n}`]:[],".env.local",".env"]}function Te(n,e=process.cwd()){let t={},r=[];for(let s of Ag(n)){let i;try{i=Eg(Ye.resolve(e,s),"utf-8")}catch{continue}r.push(s);for(let[o,a]of Tg(i))process.env[o]===void 0&&(process.env[o]=a,t[o]=s)}return{mode:n,sources:t,loaded:r}}function*Tg(n){for(let e of n.split(`
|
|
1413
|
+
`)){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 bo(n,e=process.cwd()){for(let t of Ag()){let r;try{r=Eg(Ye.resolve(e,t),"utf-8")}catch{continue}for(let[s,i]of Tg(r))if(s===n)return i}return process.env[n]}function _A(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 Og(){return`.env loads from ${process.cwd()} (the directory you ran from, not the bulb's)`}function _t(n,e,t){let{sources:r,mode:s,loaded:i}=n,o=process.cwd(),a=Ye.dirname(e),c=`(mode: ${s??"none"})`,l=t?_A(t):[],d=l.filter(p=>r[p]).map(p=>`${p} \u2190 ${r[p]}`);d.length?console.log(`env: ${d.join(", ")} ${c}`):i.length&&console.log(`env: loaded ${i.join(", ")} ${c}`),s&&!i.some(p=>p===`.env.${s}`||p===`.env.${s}.local`)&&console.log(`env: mode=${s} \u2014 no .env.${s} found; using .env`);let u=Ye.resolve(a)!==Ye.resolve(o);if(u)for(let p of[".env.local",".env"])RA(Ye.join(a,p))&&console.log(`env: ${Ye.join(a,p)} present but not loaded (cwd is ${o})`);let f=l.filter(p=>process.env[p]===void 0);if(f.length){let p=u?` \u2014 try running from ${a}`:"";console.log(`env: server.ts reads ${f.join(", ")} but ${f.length>1?"they are":"it's"} unset${p}`)}}var it=v(()=>{});function jn(n){return(n.includes("://")?n:`http://${n}`).replace(/\/+$/,"")}function mu(){return ss}async function ot(){let[n,e]=await Promise.all([Cg(),BA()]);return MA([...DA(e),...n],process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL)}function MA(n,e,t){return!e||!t?n:n.map(r=>r.provider===e&&r.name===t?{...r,default:!0}:r)}async function Pg(){let n;try{n=await fetch(NA,{signal:AbortSignal.timeout($A)})}catch(e){return ss=`catalog fetch failed: ${e?.message??e}`,null}if(!n.ok)return ss=`catalog fetch failed: HTTP ${n.status}`,null;try{return await n.json()}catch(e){return ss=`catalog returned an unreadable body: ${e?.message??e}`,null}}async function BA(){if(rs&&Date.now()-rs.fetchedAt<=IA)return rs.models;let n=await Pg()??await Pg();return n?(rs={models:n,fetchedAt:Date.now()},ss=null,n):rs?.models??[]}async function Cg(){if(wo&&Date.now()-wo.fetchedAt<=LA)return wo.models;let n=jn(process.env.OLLAMA_HOST??"http://localhost:11434"),e=[];try{let t=await fetch(new URL("/api/tags",n).toString());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 wo={models:e,fetchedAt:Date.now()},e}function DA(n){let e=new Set(Object.entries(Dn).filter(([,t])=>!!process.env[t]).map(([t])=>t));return n.filter(t=>e.has(t.provider))}function hu(){return Object.values(Dn).some(n=>!!process.env[n])}async function vo(){return hu()||process.env.TB_AI_BASE_URL||(await Cg()).length>0?"own":"none"}function Rg(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(`
|
|
1414
|
+
`)}var Dn,NA,IA,$A,LA,rs,wo,ss,nn=v(()=>{Dn={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};NA="https://api.typebulb.com/api/models",IA=1440*60*1e3,$A=5e3,LA=60*1e3,rs=null,wo=null,ss=null});function at(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=Zt(t)}catch{return`Unknown provider '${t}'.`}if(t==="ollama")return{apiKey:"",baseUrl:`${jn(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=Dn[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 ${Og()}.`}function Nt(n,e){let t=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(s=>({role:s.role,content:s.content}))],r=e.effort;return ou(n,{messages:t,stream:!0,effort:r!=null&&r>=0&&r<=3?r:void 0,webSearch:e.webSearch??!0,signal:e.signal})}var So=v(()=>{Bn();it();nn()});import*as Fn from"fs/promises";import*as ct from"path";function ko(n,e,t=e){let r=ct.resolve(e,n),s=ct.normalize(t),i=ct.normalize(r);if(i!==s&&!i.startsWith(s+ct.sep))throw new Error("Path traversal detected - access denied");return r}async function is(n,e,t){return Fn.readFile(ko(n,e,t))}async function xo(n,e,t,r){let s=ko(n,t,r);await Fn.mkdir(ct.dirname(s),{recursive:!0}),await Fn.writeFile(s,typeof e=="string"?e:Buffer.from(e))}var gu=v(()=>{});async function _g(n){let e=at(n.provider,n.model);if(typeof e=="string")throw new Error(e);let t=await Nt(e,n);if(!t.ok){let r=await Mn(t,e.protocol);throw new Error(r.message)}return{response:t,protocol:e.protocol}}async function jA(n){let{response:e,protocol:t}=await _g(n);return{text:await en(e,t)}}async function*FA(n){let{response:e,protocol:t}=await _g(n);yield*tn(e,t)}function Ng(n,e=process.cwd()){let t=Object.assign(jA,{stream:FA}),r={read:async s=>{let i=await is(s,n,e);try{return new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{throw new Error(`File is not valid UTF-8 text: ${s} \u2014 use tb.fs.readBytes() for binary files.`)}},readBytes:async s=>new Uint8Array(await is(s,n,e)),write:async(s,i)=>(await xo(s,i,n,e),!0)};globalThis.tb=Object.freeze({log:(...s)=>{console.log(...s)},ai:t,fs:r,dir:n,models:()=>ot(),aiAccess:vo,mode:"local"})}var Ig=v(()=>{Bn();So();nn();gu()});import*as qe from"fs/promises";import*as se from"path";import{pathToFileURL as qA}from"url";async function $g(n){let t=(await qe.readdir(n)).find(r=>r.endsWith(".bulb.md"));return t?se.join(n,t):null}function It(n,e){let t=se.resolve(n),r=se.join(se.dirname(t),se.basename(t).replace(/\.bulb\.md$/,""));return e?se.join(r,"batches",e):r}async function qn(n,e){let t=It(n,e);await qe.mkdir(t,{recursive:!0});let r=new Date;await qe.utimes(t,r,r).catch(()=>{})}function Un(n){let[e,t,r,s]=n.split(se.sep).slice(-4);if(!(e!=="typebulbs"||t!=="u"||!r||!s?.endsWith(".bulb.md")))return{userSlug:r,slug:s.slice(0,-8)}}async function Ue(n){let e=await qe.readFile(n,"utf-8"),t=ue(e);if(!t)throw new Error("Invalid .bulb.md file format");let r=Pn(t);return{bulb:r,config:sr(r.config),warnings:Xd(e),starts:t.starts}}function yu(n){let e=se.basename(n).replace(/\.bulb\.md$/i,"");return se.join(se.dirname(n),".typebulb",`${e}.server.mjs`)}async function os(n,e,t,r,s){let i=Fl(n,{serverOnly:!0});if(i.error)throw new Error(`Server compilation error: ${i.error}`);let o=i.code;t&&(o=await Wd(o,t));let a=se.join(se.dirname(e),".typebulb");await qe.mkdir(a,{recursive:!0});let c=uo(o);c.length>0&&await lo(c,a,r);let l=yu(e);return await qe.writeFile(l,o,"utf-8"),Ng(It(e,s)),await import(`${qA(l).href}?t=${Date.now()}`)}async function bu(n,e,t,r,s){let{bulb:i,config:o,starts:a}=await Ue(n),c=_i(i.data);Hh(i.code,o.dependencies??{});let l=Fl(i.code,{jsxImportSource:o.ts?.jsxImportSource});l.error&&console.error("Compilation error:",l.error);let{importMap:d}=await no.buildImportMap(l.code,o.dependencies??{},r?new Set([r.name]):void 0);r&&(d.imports[r.name]=r.entryUrl);let u=mg({name:i.name,code:l.code,css:i.css,html:i.html,data:c,insight:i.insight,importMap:d,dir:It(n,s),watch:e,source:{file:se.basename(n),codeLine:a.get("code.tsx")??1},compileError:l.error?String(l.error):void 0}),f=null;return i.server&&t&&(f=await os(i.server,n,r,o.dependencies,s)),{html:u,bulb:i,serverExports:f}}var $t,Ve=v(()=>{Kr();Fh();Wh();Zl();hg();eu();Cs();Ig();$t=(n,e)=>se.join(It(n,e),"assets")});import{readdirSync as Lg,readFileSync as UA,statSync as Mg}from"fs";import{join as Eo,basename as JA}from"path";function Bg(n,e,t){if(e>8)return t;let r;try{r=Lg(n,{withFileTypes:!0})}catch{return t}for(let s of r)if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;Bg(Eo(n,s.name),e+1,t)}else s.isFile()&&s.name.endsWith(".bulb.md")&&t.push(Eo(n,s.name));return t}function wu(n){let e=Eo(It(n),"batches"),t;try{t=Lg(e,{withFileTypes:!0})}catch{return[]}return t.filter(r=>r.isDirectory()).map(r=>{let s=0;try{s=Mg(Eo(e,r.name)).mtimeMs}catch{}return{name:r.name,mtime:s}}).sort((r,s)=>s.mtime-r.mtime).map(r=>r.name)}function Ao(n){return Bg(n,0,[]).map(e=>{let t=0;try{t=Mg(e).mtimeMs}catch{}let r,s=!1;try{let i=UA(e,"utf8");r=Wi(i.slice(0,1024));let o=ue(i);s=!!o&&Hi(Pn(o))}catch{}return{path:e,name:r??JA(e).replace(/\.bulb\.md$/,""),mtime:t,serverOnly:s}})}var Dg=v(()=>{le();Kr();jl();Ve()});import*as qg from"net";import{mkdir as KA,readFile as HA,writeFile as Ug}from"fs/promises";import{existsSync as WA}from"fs";import{join as Jg}from"path";function Wg(){return Jg(Et(),"blocks")}function vu(n){return Jg(Wg(),`${n}.json`)}function Oo(n){return new Promise(e=>{let t=qg.createServer();t.once("error",()=>e(!1)),t.listen(n,"127.0.0.1",()=>t.close(()=>e(!0)))})}async function zA(n){for(let e=n;e<65535;e++)if(await Oo(e))return e;throw new Error(`No free port found above ${n}`)}async function Su(n){let e=(await Q()).find(r=>r.port===n),t=e?` (pid ${e.pid}, ${e.agent?`agent:${e.agent}`:e.file})`:"";console.error(`port ${n} in use${t}`),process.exit(1)}async function Po(n){try{let e=JSON.parse(await HA(vu(n),"utf8"));return e&&typeof e.cwd=="string"?{cwd:e.cwd,slots:e.slots??{},mirrors:e.mirrors??{}}:void 0}catch{return}}async function Co(n,e){try{return await Ug(vu(n),JSON.stringify(e,null,2)),!0}catch{return et(),!1}}async function GA(n){let e=X(n);try{await KA(Wg(),{recursive:!0})}catch{return}let t=[];for(let o=0;o<Hg;o++)t.push(Kg+o*rn);let r=await Promise.all(t.map(async o=>({base:o,block:await Po(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 Ug(vu(o),JSON.stringify(s,null,2),{flag:"wx"}),o}catch(c){if((await Po(o))?.cwd===e)return o;c.code!=="EEXIST"&&et();continue}if(!WA(a.cwd))return await Co(o,s)?o:void 0}let i=r.filter(o=>!!o.block).sort((o,a)=>jg(o.block)-jg(a.block))[0];if(i)return await Co(i.base,s)?i.base:void 0}function jg(n){return Object.values(n.slots).reduce((e,t)=>Math.max(e,t.usedAt??0),0)}async function XA(n,e){let t=await Po(n)??{cwd:"",slots:{},mirrors:{}};if(e.kind==="mirror"){let i=t.mirrors[e.agent];if(i!==void 0)return i;let o=Fg(t),a=o.has(0)?VA:0;for(;a>To&&o.has(a);)a--;return t.mirrors[e.agent]=a,await Co(n,t),a}let r=X(e.file),s=t.slots[r]?.offset;if(s===void 0){let i=Fg(t);for(s=To;s<rn&&i.has(s);)s++;if(s>=rn){let o=Object.entries(t.slots).sort((a,c)=>(a[1].usedAt??0)-(c[1].usedAt??0))[0];s=o?o[1].offset:To,o&&delete t.slots[o[0]]}}return t.slots[r]={offset:s,usedAt:Date.now()},await Co(n,t),s}function Fg(n){return new Set([...Object.values(n.mirrors),...Object.values(n.slots).map(e=>e.offset)])}async function QA(n,e){let t=await GA(e);return t===void 0?void 0:t+await XA(t,n)}async function as(n){let e=X(n);for(let t=0;t<Hg;t++){let r=await Po(Kg+t*rn);if(r?.cwd===e)return s=>r.slots[X(s)]?.usedAt??0}return()=>0}async function Ro(n){if(n.explicit!==void 0)return await Oo(n.explicit)||await Su(n.explicit),{port:n.explicit};let e=await QA(n.target,n.cwd);if(e!==void 0){let r=e-e%rn;for(let s=0;s<4;s++){if(await Oo(e))return{port:e};await new Promise(i=>setTimeout(i,150))}for(let s=To;s<rn;s++){let i=r+s;if(i!==e&&await Oo(i))return{port:i,note:`(slot ${e} was busy)`}}}return{port:await zA(YA),note:e===void 0?"(no port block available)":"(this project's block was full)"}}var Kg,rn,Hg,YA,To,VA,Jn=v(()=>{At();Be();Kg=20100,rn=100,Hg=19,YA=23e3,To=1,VA=rn-1});function Kn(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 _o=v(()=>{});import{readFile as ZA}from"fs/promises";async function ku(n){try{let e=ue(await ZA(n,"utf-8"));return e?Kn(Pn(e)):void 0}catch{return}}var Yg=v(()=>{Kr();_o()});function xu(n){let e=ue(n);if(!e)return n;let t=e.files.get("code.tsx");if(!t)return n;let r=Kh(t);if(!r.length)return n;let s=e.files.get("config.json"),i={};if(s)try{let l=JSON.parse(s);l&&typeof l=="object"&&(i=l)}catch{}let o=i.dependencies&&typeof i.dependencies=="object"?{...i.dependencies}:{},a=r.filter(l=>!(l in o));if(!a.length)return n;for(let l of a)o[l]="latest";i.dependencies=o;let c={name:e.frontmatter.name};for(let[l,d]of e.files){let u=Yd(l);u&&(c[u]=d)}return c.config=JSON.stringify(i,null,2),tf(c)}var Vg=v(()=>{le();Yi()});import{spawn as zg}from"child_process";import{basename as eT}from"path";function tT(){return process.env.TYPEBULB_EDITOR||"code"}function rT(n,e,t){return t==null?[e]:nT.test(eT(n))?["-g",`${e}:${t}`]:[`+${t}`,e]}function sT(n,e){let t=tT();return{command:t,args:rT(t,n,e)}}function Eu(n,e){let{command:t,args:r}=sT(n,e),s=process.platform==="win32"?zg("cmd.exe",["/d","/s","/c",t,...r],{detached:!0,stdio:"ignore",windowsHide:!0}):zg(t,r,{detached:!0,stdio:"ignore"});s.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),s.unref()}var nT,Gg=v(()=>{nT=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i});import{readFileSync as iT,writeFileSync as oT,mkdirSync as aT}from"fs";import{join as cT}from"path";function Au(){return cT(Et(),"trust.json")}function Tu(){try{let n=JSON.parse(iT(Au(),"utf8"));return new Set(Array.isArray(n)?n:[])}catch{return new Set}}function lT(n){try{aT(Et(),{recursive:!0}),oT(Au(),JSON.stringify([...n]))}catch(e){throw new Error(`can't write ${Au()} \u2014 trust not remembered (unwritable home; sandboxed shell?): ${e.message}`)}}function sn(n){return Tu().has(X(n))}function Hn(n,e){let t=Tu(),r=X(n);(e?t.has(r):!t.has(r))||(e?t.add(r):t.delete(r),lT(t))}function Ou(){return[...Tu()]}var cs=v(()=>{At()});import{readFileSync as eM,existsSync as uT}from"fs";import*as Wn from"path";import{fileURLToPath as dT}from"url";function fT(){let n=Wn.dirname(dT(import.meta.url));for(;!uT(Wn.join(n,"package.json"));){let e=Wn.dirname(n);if(e===n)break;n=e}return n}function ls(){return Wn.join(fT(),"SKILL.md")}var Pu=v(()=>{});import*as Se from"fs/promises";import*as Oe from"path";import{createHash as pT}from"crypto";async function Ru(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 Yn(n){try{return JSON.parse(n).error||n}catch{return n}}async function Nu(n,e){try{let t=await fetch(us(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}): ${Yn(await t.text())}`}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function Iu(n,e){Te(e);let t=process.env.TYPEBULB_ORIGIN||mT;try{return $o(n,process.cwd(),t)}catch(r){console.error(r instanceof Error?r.message:String(r)),process.exit(1)}}function $o(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}
|
|
1415
|
+
Expected <origin>/u/<user>/<slug>`);let c=a[1],l=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:c,slug:l,dest:Oe.join(e,No(c,l))}}let r=Oe.resolve(e,n),s=Un(r);if(!s)throw new Error(`Not a conventional bulb path: ${n}
|
|
1416
|
+
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 hT(n,e){let t=await Nu(n,e);if("error"in t||!t.entries.length)return{kind:"none"};let r=t.entries,s=$t(n.dest),i=[],o=[],a=0;for(let c of r){let l=await Se.readFile(Oe.join(s,...c.path.split("/"))).catch(()=>{});l===void 0?i.push(c.path):_u(l)===c.md5?a++:e.force?i.push(c.path):o.push(c.path)}return o.length?{kind:"conflict",paths:o}:{kind:"plan",toGet:i,unchanged:a}}async function gT(n,e,t){let r=$t(n.dest),s=[],i=0;return await Ru(e.toGet,4,async o=>{try{let a=await fetch(`${us(n)}/${Io(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 c=Oe.join(r,...o.split("/"));await Se.mkdir(Oe.dirname(c),{recursive:!0}),await Se.writeFile(c,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 Lo(n,e={}){let t=await fetch(Cu(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};let s=await t.text(),i;try{i=await Se.readFile(n.dest,"utf-8")}catch{}let o=i!==void 0&&yT(i,s);if(i!==void 0&&!o&&!e.force){let{mtime:l}=await Se.stat(n.dest);return{kind:"conflict",dest:n.dest,localMtime:l,remoteLastModified:t.headers.get("last-modified")}}let a=await hT(n,e);if(a.kind==="conflict")return{kind:"asset-conflict",dest:n.dest,paths:a.paths};if(!o){await Se.mkdir(Oe.dirname(n.dest),{recursive:!0}),await Se.writeFile(n.dest,s);let l=new Date(t.headers.get("last-modified")??"");isNaN(l.getTime())||await Se.utimes(n.dest,new Date,l)}let c=a.kind==="plan"?await gT(n,a,e):void 0;return o?{kind:"up-to-date",dest:n.dest,assets:c}:{kind:"written",dest:n.dest,created:i===void 0,assets:c}}function yT(n,e){let t=i=>i.replace(/\r\n/g,`
|
|
1417
|
+
`),r=ue(t(n)),s=ue(t(e));return!r||!s?t(n)===t(e):r.frontmatter.name===s.frontmatter.name&&_e.every(i=>(r.files.get(ae[i].path)||"")===(s.files.get(ae[i].path)||""))}async function Qg(n,e){n||(console.error("Usage: typebulb pull <bulb url | typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1));let t=Iu(n,e.mode),r=`${t.origin}/u/${t.userSlug}/${t.slug}`,s;try{s=await Lo(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=Oe.relative(process.cwd(),t.dest)||t.dest;switch(s.kind){case"written":console.log(`pulled ${r} \u2192 ${i}${s.created?"":" (overwritten)"}`),Xg(s.assets);return;case"up-to-date":console.log(`up to date: ${i}`),Xg(s.assets);return;case"conflict":console.error(`Refusing to overwrite ${i} \u2014 it differs from ${r}
|
|
1316
1418
|
local file modified ${s.localMtime.toISOString()}
|
|
1317
1419
|
remote last saved ${s.remoteLastModified??"unknown"}
|
|
1318
1420
|
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:
|
|
1319
1421
|
`+s.paths.map(o=>` assets/${o}`).join(`
|
|
1320
1422
|
`)+`
|
|
1321
|
-
Re-run with --force to overwrite them.`),process.exitCode=1;return;case"http-error":s.status===404?console.error(`Bulb not found: ${
|
|
1423
|
+
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 Xg(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 mT,No,Cu,Io,us,_u,Mo=v(()=>{it();le();Ve();mT="https://typebulb.com",No=(n,e)=>Oe.join("typebulbs","u",n,`${e}.bulb.md`),Cu=n=>`${n.origin}/u/${encodeURIComponent(n.userSlug)}/${encodeURIComponent(n.slug)}.md`,Io=n=>n.split("/").map(encodeURIComponent).join("/"),us=n=>`${n.origin}/u/${encodeURIComponent(n.userSlug)}/${encodeURIComponent(n.slug)}/assets`;_u=n=>pT("md5").update(n).digest("hex")});import*as ze from"fs/promises";import*as ds from"path";async function Zg(n,e=""){let t=await ze.readdir(n,{withFileTypes:!0}).catch(()=>[]),r=[];for(let s of t)s.isDirectory()?r.push(...await Zg(ds.join(n,s.name),`${e}${s.name}/`)):s.isFile()&&r.push(e+s.name);return r}async function bT(n,e){let t=e.timeoutMs??3e4,r=us(n),s={Authorization:`Bearer ${e.token}`},i=$t(n.dest);if(!await ze.stat(i).then(h=>h.isDirectory()).catch(()=>!1))return{kind:"skipped"};let o=await Zg(i),a=await Nu(n,{token:e.token,timeoutMs:t});if("error"in a)return{kind:"sync-error",message:a.error};let c=a.entries;if(!o.length&&!c.length)return{kind:"skipped"};let l=new Map(c.map(h=>[h.path,h.md5])),d=new Set(o),u=c.map(h=>h.path).filter(h=>!d.has(h)),f=0,p=0;try{await Ru(o,4,async h=>{let m=await ze.readFile(ds.join(i,...h.split("/")));if(l.get(h)===_u(m)){p++;return}let b=await fetch(`${r}/${Io(h)}`,{method:"PUT",body:new Uint8Array(m),headers:s,signal:AbortSignal.timeout(t)});if(!b.ok)throw new Error(`upload of '${h}' refused (${b.status}): ${Yn(await b.text())}`);f++})}catch(h){return{kind:"sync-error",message:h instanceof Error?h.message:String(h)}}return{kind:"synced",uploaded:f,unchanged:p,toDelete:u,base:Is(n.userSlug,n.slug)}}async function wT(n,e,t){let r=t.timeoutMs??3e4,s=us(n),i=[];for(let o of e)try{let a=await fetch(`${s}/${Io(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}): ${Yn(await a.text())}`};i.push(o)}catch(a){return{deleted:i,error:a instanceof Error?a.message:String(a)}}return{deleted:i}}async function Bo(n,e){let t=await ze.readFile(n.dest,"utf-8"),{mtime:r}=await ze.stat(n.dest),s=await bT(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(Cu(n),{method:"PUT",body:t,headers:o,signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0}),c=await a.text();if(a.status===409)return{kind:"conflict",message:Yn(c),assets:i};if(!a.ok)return{kind:"http-error",status:a.status,message:Yn(c),assets:i};let l=JSON.parse(c);if(await ze.utimes(n.dest,new Date,new Date(l.updatedAt)),i&&s.kind==="synced"&&s.toDelete.length){let d=await wT(n,s.toDelete,{token:e.token,timeoutMs:e.timeoutMs});i.deleted=d.deleted,d.error&&(i.pruneError=d.error)}return{kind:"pushed",created:l.created,serverStripped:l.serverStripped,updatedAt:l.updatedAt,assets:i}}async function ey(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=Iu(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=ds.relative(process.cwd(),t.dest)||t.dest,o;try{o=await Bo(t,{token:r,force:e.force})}catch(a){let c=a instanceof Error?a.message:String(a);console.error(a?.code==="ENOENT"?`File not found: ${i}`:`Could not push to ${t.origin}: ${c}`),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}
|
|
1322
1424
|
push refused: the bulb text was not pushed.`),process.exitCode=1;return;case"pushed":{console.log(`pushed ${i} \u2192 ${s}`),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}
|
|
1323
1425
|
pull to see the remote: typebulb pull ${i}
|
|
1324
|
-
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
|
|
1426
|
+
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 $u=v(()=>{le();Mo();Ve()});var Vn=v(()=>{Be();Dg();Jn();Yg();jl();Vg();Gg();cs();nn();nn();So();Pu();Mo();$u();it()});import{copyFileSync as vT,existsSync as ty,mkdirSync as ny,rmSync as ST,writeFileSync as kT}from"fs";import{homedir as xT}from"os";import*as Ge from"path";import{fileURLToPath as ET}from"url";function RT(){return CT.replace('"__TB_SKILL_PATH__"',JSON.stringify(ls()))}function ry(){try{if(!ty(Do()))return}catch{return}try{let n=AT();ny(Ge.dirname(n),{recursive:!0}),kT(n,RT()),ST(TT(),{force:!0})}catch{}try{let n=OT();if(!ty(n))return;let e=PT();ny(Ge.dirname(e),{recursive:!0}),vT(n,e)}catch{}}var Do,AT,TT,OT,PT,CT,sy=v(()=>{Vn();Do=()=>Ge.join(xT(),".pi","agent"),AT=()=>Ge.join(Do(),"extensions","typebulb.ts"),TT=()=>Ge.join(Do(),"extensions","typebulb-wait.ts"),OT=()=>Ge.join(Ge.dirname(ET(import.meta.url)),"agents","pi","matchu-patchu.ts"),PT=()=>Ge.join(Do(),"extensions","matchu-patchu.ts"),CT=String.raw`// Generated by typebulb — do not edit; overwritten on each run.
|
|
1325
1427
|
import { spawn } from "node:child_process";
|
|
1326
1428
|
import { existsSync } from "node:fs";
|
|
1327
1429
|
|
|
@@ -1466,44 +1568,47 @@ export default function (pi) {
|
|
|
1466
1568
|
try { pi.on("session_shutdown", () => { for (const c of pending) { try { c.kill(); } catch (e) {} } pending.clear(); }); } catch (e) {}
|
|
1467
1569
|
} catch (e) { logErr("load", e && e.message); }
|
|
1468
1570
|
}
|
|
1469
|
-
`});function Y(
|
|
1470
|
-
`))>=0;){let o=
|
|
1471
|
-
`)}catch{}await Promise.race([this.#v,
|
|
1472
|
-
`)}catch{}}#p(e,t){let
|
|
1473
|
-
`)}catch(a){clearTimeout(o),this.#
|
|
1474
|
-
`),tool:i?.type==="toolCall"?i.name:void 0};return}case"message_end":this.#
|
|
1475
|
-
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function
|
|
1476
|
-
`),c=i.filter(f=>f.type==="toolCall").map(f=>({id:f.id??"",name:f.name??"",input:f.arguments??{}}));if(o||a||c.length){let f=Date.parse(e.timestamp??""),p=!isNaN(f)&&f>=t;
|
|
1571
|
+
`});function Y(n){return n?.message??String(n)}var z,Lt=v(()=>{z=process.cwd()});import{spawn as iy}from"child_process";import{StringDecoder as _T}from"string_decoder";function jT(n,e){let t=new _T("utf8"),r="";n.on("data",s=>{r+=typeof s=="string"?s:t.write(s);let i;for(;(i=r.indexOf(`
|
|
1572
|
+
`))>=0;){let o=r.slice(0,i);r=r.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var NT,IT,oy,$T,LT,MT,BT,DT,jo,Fo,ay,cy=v(()=>{Lt();NT=3e4,IT=5e3,oy=2e3,$T=2e3,LT=12e4,MT=8e3,BT=15e3,DT=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"]),jo=new Set;process.on("exit",()=>{for(let n of jo)try{n.kill()}catch{}});Fo=class{#e;#t=!1;#n=0;#r=!1;#l=null;#m=null;#s=null;#o=null;#u=new Map;#i=[];#h=null;#w=null;#g=null;#d;#f;#y="";#A=1;#a=new Map;#v;#b;constructor(e,t,r=(s,i)=>iy(s,{cwd:i,shell:!0,stdio:["pipe","pipe","pipe"],env:{...process.env,TYPEBULB_MIRROR:"1"}})){if(this.#v=new Promise(o=>{this.#b=o}),t?.includes('"')){this.#f="session path contains a quote \u2014 cannot drive it",this.#b();return}let s=t?`pi --mode rpc --session "${t}"`:"pi --mode rpc",i;try{i=r(s,e)}catch(o){this.#f=`could not start pi: ${Y(o)}`,this.#b();return}this.#e=i,this.#d=t,jo.add(i),i.stdout&&jT(i.stdout,o=>this.#T(o)),i.stderr&&i.stderr.on("data",o=>{this.#y=(this.#y+o.toString()).slice(-$T)}),i.on("error",o=>this.#x(`could not start pi: ${o.message}`)),i.on("exit",o=>{this.#e===i&&this.#x(o?`pi exited (code ${o})${this.#y.trim()?`: ${this.#y.trim()}`:""}`:"pi exited"),jo.delete(i),this.#b()}),this.#c({type:"get_state"}).then(o=>{let a=o.data?.sessionFile;typeof a=="string"&&a&&(this.#d=a);let c=o.data?.model;c&&typeof c.id=="string"&&c.id&&(this.#g=c.id)}).catch(()=>{}),this.#S()}get streaming(){return this.#t||Date.now()<this.#n}get draft(){return this.#l}get echo(){return this.#m}get queue(){return this.#h}get stats(){return this.#w}get model(){return this.#g}get sessionFile(){return this.#d}get error(){return this.#f}get status(){if(this.#s)return this.#s;if(this.#o){if(Date.now()<this.#o.until)return{text:this.#o.text,kind:this.#o.kind};this.#o=null}return this.#u.size?{text:[...this.#u.values()].join(" \xB7 "),kind:"info"}:null}get dialog(){let e=Date.now();for(;this.#i.length;){let t=this.#i[0];if(e<t.until)return t.req;this.#i.shift(),t.ownTimeout||this.#k({type:"extension_ui_response",id:t.req.id,cancelled:!0})}return null}notice(e,t){this.#p(e,t)}respondUi(e,t){let r=this.#i.findIndex(o=>o.req.id===e);if(r<0)return{ok:!1,error:"dialog expired or already answered"};let[s]=this.#i.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.#k(i),{ok:!0}}async rpc(e){if(!DT.has(e.type))return{ok:!1,error:`command not allowed: ${e.type}`};try{let t=await this.#c(e);if(t.success&&e.type==="set_model"){let r=t.data?.id;typeof r=="string"&&r&&(this.#g=r)}if(t.success&&(e.type==="fork"||e.type==="clone")){try{let s=(await this.#c({type:"get_state"})).data?.sessionFile;typeof s=="string"&&s&&(this.#d=s)}catch{}return{ok:!0,data:{...t.data??{},sessionFile:this.#d}}}return t.success?{ok:!0,data:t.data}:{ok:!1,error:t.error??`pi rejected ${e.type}`}}catch(t){return{ok:!1,error:Y(t)}}}async send(e,t){let r=this.streaming,s=r?e.trimStart().startsWith("/")?{type:"prompt",message:e,streamingBehavior:t?.followUp?"followUp":"steer"}:{type:t?.followUp?"follow_up":"steer",message:e}:{type:"prompt",message:e},i;try{i=await this.#c(s)}catch(o){return{ok:!1,error:Y(o)}}return i.success&&!r&&(this.#n=Date.now()+IT),i.success&&!r&&!e.trimStart().startsWith("/")&&(this.#m=e),i.success?{ok:!0}:{ok:!1,error:i.error??"pi rejected the message"}}async stop(){if(this.#e)try{await this.#c({type:"abort"})}catch{}}clearCompletedDraft(){this.#r||(this.#l=null)}clearEcho(){this.#m=null}async dispose(){let e=this.#e;if(e){if(this.#e=void 0,this.#t){try{e.stdin?.write(JSON.stringify({type:"abort"})+`
|
|
1573
|
+
`)}catch{}await Promise.race([this.#v,ay(oy)])}try{e.stdin?.end()}catch{}if(await Promise.race([this.#v,ay(oy)]),e.exitCode===null&&!e.killed)if(process.platform==="win32"&&e.pid)try{iy("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"})}catch{}else try{e.kill("SIGKILL")}catch{}jo.delete(e),this.#i=[],this.#E("pi was shut down")}}#k(e){try{this.#e?.stdin?.write(JSON.stringify(e)+`
|
|
1574
|
+
`)}catch{}}#p(e,t){let r=e.length>200?e.slice(0,200)+"\u2026":e;r&&(this.#o={text:r,kind:t,until:Date.now()+(t==="info"?MT:BT)})}#S(){this.#c({type:"get_session_stats"}).then(e=>{if(!e.success||!e.data)return;let t=e.data;this.#w={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(()=>{})}#c(e){let t=this.#e;if(!t?.stdin?.writable)return Promise.reject(new Error(this.#f??"pi is not running"));let r=`tb-${this.#A++}`;return new Promise((s,i)=>{let o=setTimeout(()=>{this.#a.delete(r),i(new Error("pi did not respond (30s)"))},NT);o.unref?.(),this.#a.set(r,{resolve:s,timer:o});try{t.stdin.write(JSON.stringify({id:r,...e})+`
|
|
1575
|
+
`)}catch(a){clearTimeout(o),this.#a.delete(r),i(new Error(Y(a)))}})}#T(e){let t;try{t=JSON.parse(e)}catch{return}switch(t.type){case"response":{let r=t,s=r.id?this.#a.get(r.id):void 0;s&&(this.#a.delete(r.id),clearTimeout(s.timer),s.resolve(r));return}case"agent_start":this.#t=!0,this.#n=0;return;case"agent_end":this.#t=!1,this.#n=0,this.#r=!1,this.#s=null,this.#h=null,this.#S();return;case"message_start":{t.message?.role==="assistant"&&(this.#r=!0,this.#l={text:"",thinking:""});return}case"message_update":{if(!this.#r)return;let r=t.message,s=Array.isArray(r?.content)?r.content:[],i=s[s.length-1];this.#l={text:s.filter(o=>o?.type==="text").map(o=>o.text??"").join(""),thinking:s.filter(o=>o?.type==="thinking").map(o=>o.thinking??"").join(`
|
|
1576
|
+
`),tool:i?.type==="toolCall"?i.name:void 0};return}case"message_end":this.#r=!1;return;case"auto_retry_start":this.#s={text:`retrying after a transient error (attempt ${Number(t.attempt)||1}/${Number(t.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#s=null,t.success===!1&&this.#p(`retries exhausted: ${String(t.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#s={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#s=null;let r=t.result;typeof t.errorMessage=="string"&&t.errorMessage?this.#p(`compaction failed: ${t.errorMessage}`,"error"):r?.tokensBefore&&this.#p(`compacted: ~${Math.round(r.tokensBefore/1e3)}k \u2192 ~${Math.round((r.estimatedTokensAfter??0)/1e3)}k tokens`,"info"),this.#S();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.#i.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??LT),ownTimeout:s!==void 0})}else if(r==="notify"){let s=t.notifyType==="warning"?"warning":t.notifyType==="error"?"error":"info";this.#p(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.#u.set(s,t.statusText):this.#u.delete(s)}return}default:return}}#x(e){this.#f=e,this.#t=!1,this.#n=0,this.#r=!1,this.#l=null,this.#m=null,this.#s=null,this.#o=null,this.#u.clear(),this.#i=[],this.#h=null,this.#w=null,this.#g=null,this.#e=void 0,this.#E(e)}#E(e){for(let[,t]of this.#a)clearTimeout(t.timer),t.resolve({type:"response",success:!1,error:e});this.#a.clear()}},ay=n=>new Promise(e=>{setTimeout(e,n).unref?.()})});import{existsSync as ly,readFileSync as FT,realpathSync as qT}from"fs";import{join as on,dirname as py,resolve as UT}from"path";import{homedir as uy}from"os";function KT(n,e){let t=on(n,".pi");if(JT.some(s=>ly(on(t,s))))return!0;let r=on(e,".agents","skills");for(let s=n;;){let i=on(s,".agents","skills");if(i!==r&&ly(i))return!0;let o=py(s);if(o===s)return!1;s=o}}function HT(n,e){for(let t=e;;){if(n[t]===!0||n[t]===!1)return!0;let r=py(t);if(r===t)return!1;t=r}}function my(n,e){try{let t=e?.agentDir??on(uy(),".pi","agent"),r=dy(e?.home??process.env.HOME??uy()),s=dy(UT(n));if(!KT(s,r))return null;let i=fy(on(t,"settings.json")).defaultProjectTrust;return i==="always"||i==="never"||HT(fy(on(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 JT,dy,fy,hy=v(()=>{JT=["settings.json","extensions","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"],dy=n=>{try{return qT(n)}catch{return n}},fy=n=>{try{return JSON.parse(FT(n,"utf8"))}catch{return{}}}});import{statSync as WT,openSync as YT,readSync as VT,closeSync as zT,existsSync as yy}from"fs";import{join as qo}from"path";import{homedir as Lu}from"os";import{execFile as GT}from"child_process";async function QT(n){let e=qo(Lu(),".pi","agent","bin",process.platform==="win32"?"fd.exe":"fd");for(let t of["fd","fdfind",...yy(e)?[e]:[]]){let r=await new Promise(s=>{GT(t,["--base-directory",n,"--type","f","--follow","--hidden","--exclude",".git"],{maxBuffer:67108864},(i,o)=>s(i?null:o))});if(r!==null)return r.split(`
|
|
1577
|
+
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function ZT(n){return`--${n.replace(/^[/\\]/,"").replace(/[/\\:]/g,"-")}--`}function gy(n){return n.type==="message"?eO(n.message?.role):n.type==="custom_message"?n.display!==!1:!1}var XT,eO,zn,Mu=v(()=>{jr();El();Mi();sy();cy();hy();XT=qo(Lu(),".pi","agent","sessions");eO=n=>n==="user"||n==="assistant"||n==="toolResult"||n==="bashExecution";zn=class extends kt{displayName="Pi Mirror";detectsSelf(){return process.env.PI_CODING_AGENT==="true"}detectsInstalled(){return yy(qo(Lu(),".pi","agent"))}ensureHarnessSupport(){ry()}createDriver(e,t){let r=new Fo(e,t),s=my(e);return s&&r.notice(s,"warning"),r}walkFiles(e){return QT(e)}sessionsDir(e){return qo(XT,ZT(e))}listSessionFiles(e){return Li(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 gy(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:$e(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(f=>f.type==="text").map(f=>f.text??"").join(""),a=i.filter(f=>f.type==="thinking").map(f=>f.thinking??"").join(`
|
|
1578
|
+
`),c=i.filter(f=>f.type==="toolCall").map(f=>({id:f.id??"",name:f.name??"",input:f.arguments??{}}));if(o||a||c.length){let f=Date.parse(e.timestamp??""),p=!isNaN(f)&&f>=t;r.push({type:"assistant",text:o,thinking:a,tools:c,live:p})}let l=s.usage,d=l?(l.input??0)+(l.output??0)+(l.cacheRead??0)+(l.cacheWrite??0):0,u=l&&d>0&&s.stopReason!=="aborted"&&s.stopReason!=="error"?{in:l.input??0,out:l.output??0,cached:l.cacheRead??0,cacheCreate:l.cacheWrite??0}:void 0;return{events:r,usage:u,model:s.model,cost:l?.cost?.total}}return{events:r}}chainWorking(e){let t;for(let a of e)gy(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=YT(e,"r")}catch{return""}try{let s=65536;try{s=WT(e).size}catch{}let i=(u,f)=>{let p=Buffer.alloc(f),h=VT(t,p,0,f,u);return p.subarray(0,h).toString("utf8")},o=i(0,Math.min(65536,s)),a=s>65536?i(s-65536,65536):"",c=u=>{let f="";for(let p of u.split(`
|
|
1477
1579
|
`))if(p.includes('"session_info"'))try{let h=JSON.parse(p);h?.type==="session_info"&&typeof h.name=="string"&&h.name&&(f=h.name)}catch{}return f},l="";for(let u of o.split(`
|
|
1478
|
-
`))if(!(l||!u.includes('"type"')))try{let f=JSON.parse(u);f?.type==="message"&&f.message?.role==="user"&&(l=this.contentText(f.message.content).replace(/\s+/g," ").trim())}catch{}let d=c(a)||c(o)||l;return d?d.slice(0,200):""}finally{
|
|
1479
|
-
`):""}}});
|
|
1480
|
-
`)
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
`))
|
|
1484
|
-
|
|
1485
|
-
`)){if(!
|
|
1486
|
-
`)){if(
|
|
1487
|
-
`))
|
|
1488
|
-
|
|
1489
|
-
`)}function
|
|
1580
|
+
`))if(!(l||!u.includes('"type"')))try{let f=JSON.parse(u);f?.type==="message"&&f.message?.role==="user"&&(l=this.contentText(f.message.content).replace(/\s+/g," ").trim())}catch{}let d=c(a)||c(o)||l;return d?d.slice(0,200):""}finally{zT(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"?we(e):Array.isArray(e)?e.map(t=>typeof t?.text=="string"?we(t.text):t?.type==="image"&&t.data?$i(t.data,t.mimeType):"").filter(Boolean).join(`
|
|
1581
|
+
`):""}}});import{statSync as tO,readdirSync as nO,openSync as rO,readSync as sO,closeSync as iO,existsSync as oO}from"fs";import{basename as aO,join as Bu,resolve as cO}from"path";import{homedir as by}from"os";function uO(n){let e=n.trimStart();return lO.some(t=>e.startsWith(t))}function fs(n,e){return Array.isArray(n)?n.map(t=>typeof t?.text=="string"?e&&uO(t.text)?"":we(t.text):t?.type==="input_image"&&typeof t.image_url=="string"&&t.image_url.startsWith("data:")?``:"").filter(Boolean).join(`
|
|
1582
|
+
`):""}function dO(n){return typeof n=="string"?we(n):fs(n,!1)}function fO(n){let e=n??"";for(let t of[/tools\.shell_command\((\{[\s\S]*?\})\)/,/tools\.shell_command\((\{[\s\S]*\})\)/]){let r=t.exec(e);if(r)try{return JSON.parse(r[1])}catch{}}return{script:e}}function pO(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 vy(n,e){let t;try{t=rO(n,"r")}catch{return}try{let r=Buffer.alloc(e),s=sO(t,r,0,e,0);return{text:r.subarray(0,s).toString("utf8"),bytes:s}}finally{iO(t)}}function mO(n){let t=vy(n,65536);if(t===void 0)return;let r=t.text.indexOf(`
|
|
1583
|
+
`);if(r<0)return t.bytes>=65536?"":void 0;try{let s=JSON.parse(t.text.slice(0,r));return s?.type==="session_meta"&&typeof s.payload?.cwd=="string"?s.payload.cwd:""}catch{return""}}var lO,wy,Gn,Du=v(()=>{jr();Mi();lO=["<permissions instructions>","<apps_instructions>","<plugins_instructions>","<skills_instructions>","<recommended_plugins>","<environment_context>","<user_instructions>"];wy=n=>{let e=cO(n);return process.platform==="win32"?e.toLowerCase():e},Gn=class extends kt{constructor(t=Bu(by(),".codex","sessions")){super();this.root=t}displayName="Codex Mirror";#e=0;#t;#n=new Map;detectsSelf(){return!!process.env.CODEX_THREAD_ID}detectsInstalled(){return oO(Bu(by(),".codex"))}sessionsDir(t){return this.root}listSessionFiles(t){let r=wy(t),s=[];for(let i of this.#r()){let o;try{let c=tO(i);if(!c.isFile())continue;o=c.mtimeMs}catch{continue}let a=this.#n.get(i);if(a===void 0){if(a=mO(i),a===void 0)continue;this.#n.set(i,a)}wy(a)===r&&s.push({sessionId:aO(i,".jsonl"),file:i,mtime:o})}return s}#r(){let t=[],r=s=>{try{return nO(s).map(i=>Bu(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&&(t.ord=String(this.#e++),t.parent=this.#t,this.#t=t.ord),t.ord}parentOf(t){return t.parent}timestampOf(t){return t.timestamp}isSidechain(t){return!1}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=fs(i.content,!0).trim();a&&s.push({type:"user",text:a})}else if(i.role==="assistant"){let a=fs(i.content,!1);a&&s.push({type:"assistant",text:a,thinking:"",tools:[],live:o()})}return{events:s}}if(i.type==="reasoning"){let a=fs(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.type==="custom_tool_call"?fO(i.input):pO(i.arguments);return s.push({type:"assistant",text:"",thinking:"",tools:[{id:i.call_id??"",name:i.name??"",input:a}],live:o()}),{events:s}}if(i.type==="custom_tool_call_output"||i.type==="function_call_output"){let a=dO(i.output);return s.push({type:"tool_result",id:i.call_id??"",content:a,isError:!1,digest:$e(a)}),{events:s}}return{events:s}}if(t.type==="event_msg"){if(i.type==="token_count"){let a=i.info?.last_token_usage;if(!a)return{events:s};let c={in:Math.max(0,(a.input_tokens??0)-(a.cached_input_tokens??0)),out:a.output_tokens??0,cached:a.cached_input_tokens??0,cacheCreate:a.cache_write_input_tokens??0};return{events:s,usage:c}}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(){}readPreview(t){for(let r of(vy(t,256*1024)?.text??"").split(`
|
|
1584
|
+
`))if(r.includes('"user_message"'))try{let s=JSON.parse(r);if(s?.type==="event_msg"&&s.payload?.type==="user_message"&&typeof s.payload.message=="string"){let i=s.payload.message.replace(/\s+/g," ").trim();if(i)return i.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"?"":fs(t.payload.content,r==="user").replace(/\s+/g," ").trim()}}});var Uo,Sy=v(()=>{Uo=class{#e=new Map;accept(e,t){return this.#e.get(e)===t?!1:(this.#e.set(e,t),!0)}}});import{execFile as hO}from"child_process";import{promisify as gO}from"util";import{readFile as yO}from"fs/promises";import{resolve as ky,sep as bO}from"path";async function Je(n,e){let{stdout:t}=await wO("git",n,{cwd:e,maxBuffer:67108864});return t}async function an(){if(Jo)return Jo;try{Jo=(await Je(["rev-parse","--show-toplevel"],z)).trim()}catch{}return Jo}function vO(n,e){let t=e===" "?n:e;return t==="?"?"U":t}async function Fu(){let n=await an();if(!n)return{repo:!1,root:"",files:[]};try{let e=await Je(["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:vO(i[0],i[1])}))}try{let s=await Je(["diff","--numstat","HEAD"],n),i=new Map;for(let o of s.split(`
|
|
1585
|
+
`)){let a=/^(\d+)\t(\d+)\t(.+)$/.exec(o);a&&i.set(a[3],{add:+a[1],del:+a[2]})}for(let o of t){let a=i.get(o.path);a&&(o.add=a.add,o.del=a.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:Y(e)}}}async function qu(n){let e=await an();if(!e)return{ok:!1,error:"not a git repository"};try{if((await Je(["status","--porcelain","-z","--",n],e)).startsWith("??")){let s=ky(e,n);if(!s.startsWith(ky(e)+bO))return{ok:!1,error:"outside repository"};let i=await yO(s);return i.includes(0)?ju("Binary file (not shown)",!1):ju(i.toString("utf8"),!0)}let r;try{r=await Je(["diff","--no-color","--unified=999999","HEAD","--",n],e)}catch{r=await Je(["diff","--no-color","--unified=999999","--",n],e)}return ju(r,!1)}catch(t){return{ok:!1,error:Y(t)}}}var wO,xy,Jo,ju,ps=v(()=>{Lt();wO=gO(hO),xy=2e6;ju=(n,e)=>({ok:!0,text:n.slice(0,xy),untracked:e,truncated:n.length>xy})});function Ko(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 Uu=v(()=>{});var Ho,Wo,Ey=v(()=>{Ho=".typebulb/paste",Wo={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 SO,mkdirSync as kO,writeFileSync as xO,readFileSync as EO}from"fs";import{join as Yo}from"path";function Ay(){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 PO(n){return n.trim().toLowerCase().replace(/\.[a-z0-9]{1,4}$/,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}async function CO(n){let e=AbortSignal.timeout(AO);for(let[t,r]of OO){let s=at(t,r);if(typeof s!="string"){try{let i=await Nt(s,{messages:[{role:"user",content:`Reply with ONLY a short kebab-case filename (2-5 words, lowercase, no extension) describing this text:
|
|
1586
|
+
|
|
1587
|
+
${n.slice(0,TO)}`}],effort:0,webSearch:!1,signal:e});if(!i.ok)continue;let o=PO(await en(i,s.protocol));if(o)return o}catch{}if(e.aborted)return}}}async function Ty(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=Yo(n,Ho);try{kO(t,{recursive:!0})}catch(a){return{ok:!1,error:Y(a)}}let r,s,i;if(e.kind==="image"){if(r=`img-${Ay()}`,s=Object.keys(Wo).find(a=>Wo[a]===e.mime)??"png",i=Buffer.from(e.data,"base64"),!i.length)return{ok:!1,error:"empty image data"}}else r=await CO(e.data)??`paste-${Ay()}`,s="md",i=e.data;let o=`${r}.${s}`;for(let a=2;SO(Yo(t,o));a++)o=`${r}-${a}.${s}`;try{xO(Yo(t,o),i)}catch(a){return{ok:!1,error:Y(a)}}return{ok:!0,path:`${Ho}/${o}`}}function Oy(n,e){if(!/^[\w-]+(\.[\w-]+)*$/.test(e))return{ok:!1,error:"bad name"};let t=e.slice(e.lastIndexOf(".")+1).toLowerCase(),r=Wo[t];if(!r)return{ok:!1,error:"not an image"};try{return{ok:!0,mime:r,base64:EO(Yo(n,Ho,e)).toString("base64")}}catch{return{ok:!1,error:"not found"}}}var AO,TO,OO,Py=v(()=>{Bn();Vn();Lt();Ey();AO=4e3,TO=4e3,OO=[["openrouter","google/gemini-3.1-flash-lite-preview"],["gemini","gemini-3.1-flash-lite"]]});function RO(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 Cy,Ry=v(()=>{Cy=(n,e)=>RO(n,{key:e,desc:!0})});import{existsSync as _y,openSync as _O,readSync as NO,closeSync as IO,statSync as Xn,readdirSync as Ny,watchFile as $O,unwatchFile as Iy,mkdirSync as LO,writeFileSync as MO,readFileSync as Vo,unlinkSync as BO,rmSync as DO}from"fs";import{stat as jO}from"fs/promises";import{dirname as FO,join as cn,resolve as $y}from"path";function KO(n){if(!Number.isInteger(n))return!0;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function Qn(n){let e={cwd:z,sessionId:"",sessionStartMs:Date.now(),buffer:[],partial:"",offset:0,latest:{in:0,out:0,cached:0,cacheCreate:0},latestModel:null,everAttached:!1,entries:new Map},t=new Set,r,s=0;function i(){if(e.file){for(let g of t)if(g.file===e.file)return g;return}return r}function o(g){let k={d:n.createDriver(e.cwd,g),file:g,id:`new:${++s}`,startedAt:Date.now()};return t.add(k),e.file||(r=k),k}function a(){let g=[...t].filter(w=>w.file);if(!g.length)return[];let k=new Map(n.listSessionFiles(e.cwd).map(w=>[w.file,w.sessionId]));return g.map(w=>{let T=k.get(w.file);return{rec:w,sessionId:T??w.id,pending:T===void 0}})}let c=()=>a().filter(g=>g.pending&&g.rec.prompt!==void 0);async function l(g){t.delete(g),r===g&&(r=void 0);try{await g.d.dispose()}catch(k){console.error("[composer] dispose:",Y(k))}}function d(){let g=i(),k=new Set(c().map(w=>w.rec));for(let w of[...t])w!==g&&(k.has(w)||w.d.streaming||w.d.queue||w.d.error||l(w))}function u(){for(let g of t)g.d.sessionFile&&g.file!==g.d.sessionFile&&(g.file=g.d.sessionFile);if(r&&!e.file&&r.file){let g=n.listSessionFiles(e.cwd).find(k=>k.file===r.file);g&&x(g)}r&&!e.file&&r.prompt!==void 0&&e.sessionId!==r.id&&($(void 0,r.id),e.everAttached=!0)}let f=g=>cn(g,UO),p=(g,k)=>cn(f(g),`${k}.lock`);function h(g,k){try{let w=p(g,k);if(Date.now()-Xn(w).mtimeMs>=Ly)return!1;try{let T=parseInt(Vo(w,"utf8").trim(),10);if(T===process.pid||!KO(T))return!1}catch{}return!0}catch{return!1}}function m(g,k){if(k)try{LO(f(g),{recursive:!0}),MO(p(g,k),String(process.pid))}catch(w){console.error("[lock] claim failed:",Y(w))}}function b(g){try{DO(cn(g,".claude-bulb"),{recursive:!0,force:!0})}catch{}}function A(g){let k=f(g);if(!_y(k))return;let w;try{w=Ny(k)}catch{return}let T=Date.now();for(let I of w){if(!I.endsWith(".lock"))continue;let B=cn(k,I);try{let F=Xn(B);T-F.mtimeMs>JO&&BO(B)}catch{}}}function S(g){try{return Xn(g),!1}catch(k){return k.code==="ENOENT"}}function P(){let g=e;if(g.file&&!S(g.file)){m(g.cwd,g.sessionId);return}let k=_(g);k&&x(k)}function _(g){if(!g.everAttached)return C(g.cwd)??R(g.cwd,()=>!0)}function C(g){let k=f(g);if(!_y(k))return;let w;try{w=Ny(k)}catch{return}let T;for(let B of w)if(B.endsWith(".lock"))try{let F=Xn(cn(k,B));if(Date.now()-F.mtimeMs>=Ly||parseInt(Vo(cn(k,B),"utf8").trim(),10)!==process.pid)continue;(!T||F.mtimeMs>T.mtime)&&(T={sessionId:B.slice(0,-5),mtime:F.mtimeMs})}catch{}if(!T)return;let I=n.listSessionFiles(g).find(B=>B.sessionId===T.sessionId);if(!(!I||S(I.file)))return I}function R(g,k){return n.listSessionFiles(g).sort((w,T)=>T.mtime-w.mtime).find(w=>!h(g,w.sessionId)&&k(w))}function $(g,k){let w=e;if(w.file)try{Iy(w.file)}catch{}w.file=g,w.sessionId=k,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:k})}function x(g){let k=e;r=void 0,$(g.file,g.sessionId),k.everAttached=!0,m(k.cwd,g.sessionId),K();try{Iy(g.file)}catch{}$O(g.file,{interval:200},()=>K())}function D(){$(void 0,"")}function K(){let g=e;if(!g.file)return;let k;try{k=Xn(g.file).size}catch{return}if(k<=g.offset)return;let w;try{w=_O(g.file,"r")}catch{return}try{let W=k-g.offset,be=Buffer.alloc(W),oe=0;for(;oe<W;){let Dd=NO(w,be,oe,W-oe,g.offset+oe);if(!Dd)break;oe+=Dd}g.offset+=oe,g.partial+=be.subarray(0,oe).toString("utf8")}finally{IO(w)}let T,I;for(;(I=g.partial.indexOf(`
|
|
1588
|
+
`))>=0;){let W=g.partial.slice(0,I);if(g.partial=g.partial.slice(I+1),!W.trim())continue;let be=n.parseEntry(W);if(!be)continue;let oe=n.idOf(be);oe&&(g.entries.set(oe,be),!n.isSidechain(be)&&n.isLeafType(be)&&(T=oe))}if(!T)return;let B=[],F=g.entries.get(T),V=!1;for(;F;){if(B.push(F),n.idOf(F)===g.chainLastId){V=!0;break}let W=n.parentOf(F);F=W?g.entries.get(W):void 0}if(V)for(let W=B.length-2;W>=0;W--)N(B[W]);else{g.chainLastId!==void 0&&(g.buffer.push({type:"cleared"}),g.buffer.push({type:"session",sessionId:g.sessionId}),g.latest={in:0,out:0,cached:0,cacheCreate:0});let W=new Set(B.map(oe=>n.idOf(oe))),be=U(g.entries);for(let oe=B.length-1;oe>=0;oe--)N(B[oe]),y(n.idOf(B[oe]),be,W)}g.chainLastId=T}function U(g){let k=new Map;for(let w of g.values()){let T=n.parentOf(w);if(!T)continue;let I=k.get(T);I?I.push(w):k.set(T,[w])}return k}function y(g,k,w){if(!g)return;let T=k.get(g);if(!T)return;let I=T.filter(W=>!n.isSidechain(W));if(I.length<2)return;let B=I.filter(W=>!w.has(n.idOf(W)));if(!B.length)return;let F=[],V=0;for(let W of B){let be=E(W,k);F.push(...be.events),V+=be.count}V>0&&e.buffer.push({type:"fork",atId:g,count:V,events:F})}function E(g,k){let w=[],T=[g];for(;T.length;){let F=T.pop();if(n.isSidechain(F))continue;w.push(F);let V=k.get(n.idOf(F)??"");if(V)for(let W of V)T.push(W)}w.sort((F,V)=>(Date.parse(n.timestampOf(F)??"")||0)-(Date.parse(n.timestampOf(V)??"")||0));let I=[];for(let F of w)n.isRecoveryNoise(F)||I.push(...n.apply(F,e.sessionStartMs).events);return{count:I.reduce((F,V)=>F+(V.type==="user"||V.type==="assistant"?1:0),0),events:I}}function N(g){try{let{events:k,usage:w,model:T,cost:I}=n.apply(g,e.sessionStartMs);for(let B of k)e.buffer.push(B);k.some(B=>B.type==="assistant")&&i()?.d.clearCompletedDraft(),k.some(B=>B.type==="user")&&i()?.d.clearEcho(),T&&(e.latestModel=T),w&&(e.latest=w),(w||I)&&e.buffer.push({type:"usage",...e.latest,cost:I})}catch(k){console.error("[mirror] skipped malformed entry:",Y(k))}}async function L(){return{cwd:e.cwd,pid:process.pid,composer:!!n.createDriver,elsewhere:await M()}}async function M(){if(n.listSessionFiles(e.cwd).length)return;let g=await an();if(!g)return;let k=$y(g).toLowerCase();for(let w=$y(e.cwd);w.toLowerCase()!==k;){let T=FO(w);if(T===w)return;w=T;let I=n.listSessionFiles(w).length;if(I)return{dir:w,count:I}}}M().then(g=>{g&&console.log(`No sessions for ${e.cwd} \u2014 ${g.count} exist for ${g.dir}. Launched from a subfolder? Relaunch from the project root.`)}).catch(()=>{});let H=new Uo;async function G(g,k){H.accept(g,k)&&console.log(k)}function me(){let g=n.sessionAlive(e.sessionId,e.cwd);if(g!==void 0)return g;if(!e.file)return!1;try{return Date.now()-Xn(e.file).mtimeMs<1e4}catch{return!1}}function ee(){return n.chainWorking([...e.entries.values()])&&me()}function ie(){!n.createDriver||i()||e.latestModel||ee()||o(e.file)}async function ke(g){let k=e;P(),u(),ie(),d();let w=i();for(let B of t)B!==w&&B.d.dialog;let T=a().filter(B=>B.rec.d.streaming).map(B=>B.sessionId),I=n.createDriver?{streaming:!!w?.d.streaming,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:k.buffer.slice(g),cursor:k.buffer.length,working:!!w?.d.streaming||ee(),latestModel:k.latestModel,composer:I,busy:T}}async function Re(){P(),u();let g=i();if(g?.d.error&&!g.d.streaming&&(await l(g),g=void 0),!g){if(ee())return{ok:!1,error:"the agent is mid-turn in a terminal \u2014 watch only"};g=o(e.file)}let k=g;return{ok:!0,d:k.d,markSent:w=>{k.prompt===void 0&&(k.prompt=w)}}}async function ka(g,k){if(!n.createDriver)return{ok:!1,error:"not supported"};let w=String(g??"").trim();if(!w)return{ok:!1,error:"empty message"};let T=await Re();if(!T.ok)return T;let I=await T.d.send(w,k);return I.ok&&T.markSent(w),I}async function Pw(g,k){let w=i();return w?w.d.respondUi(String(g??""),k??{}):{ok:!1,error:"no dialog pending"}}async function Cw(g,k){if(!n.createDriver)return{ok:!1,error:"not supported"};if(!g||typeof g.type!="string")return{ok:!1,error:"bad command"};if(k?.spawn){let T=await Re();return T.ok?T.d.rpc(g):T}let w=i();return!w||w.d.error?{ok:!1,error:"not running"}:w.d.rpc(g)}async function Rw(){let g=i();if(g)try{await g.d.stop()}catch(k){console.error("[composer] stop:",Y(k))}return{ok:!0}}async function _w(){return n.createDriver?(u(),!e.file&&r&&r.prompt===void 0&&!r.d.streaming&&!r.d.error?{ok:!0}:(r?.d.error&&await l(r),r=void 0,D(),o(void 0),d(),{ok:!0})):{ok:!1,error:"not supported"}}async function Nw(){if(!n.createDriver)return[];let g=await Je(["ls-files","--cached","--others","--exclude-standard"],e.cwd).catch(()=>null),k=g!==null?g.split(`
|
|
1589
|
+
`).filter(Boolean):await n.walkFiles?.(e.cwd)??[];return(await Promise.all(k.map(async T=>{try{return{f:T,m:(await jO(cn(e.cwd,T))).mtimeMs}}catch{return{f:T,m:0}}}))).sort((T,I)=>I.m-T.m).map(T=>T.f)}function Iw(){for(let g of[...t])l(g)}async function $w(g){return n.createDriver?Ty(e.cwd,g):{ok:!1,error:"not supported"}}async function Lw(g){return Oy(e.cwd,String(g??""))}async function Mw(){let g=n.listSessionFiles(e.cwd).map(({sessionId:w,file:T,mtime:I})=>({sessionId:w,mtime:I,preview:n.readPreview(T)})),k=c().map(w=>({sessionId:w.sessionId,mtime:w.rec.startedAt,preview:w.rec.prompt??"",pending:!0}));return Cy([...g,...k],w=>w.mtime)}let Ld=new Map;function Bw(g,k){let w=Ld.get(g);if(w&&w.mtime===k)return w.turns;let T=[],I="";try{I=Vo(g,"utf8")}catch{return[]}for(let B of I.split(`
|
|
1590
|
+
`)){if(!B.trim())continue;let F=n.parseEntry(B);if(!F)continue;let V=n.searchText(F);V&&T.push({text:V,lower:V.toLowerCase()})}return Ld.set(g,{mtime:k,turns:T}),T}async function Dw(g){let k=g.toLowerCase(),w=[];for(let{sessionId:T,file:I,mtime:B}of n.listSessionFiles(e.cwd).sort((F,V)=>V.mtime-F.mtime)){let{hitCount:F,snippet:V}=Ko(Bw(I,B),k);if(F&&(w.push({sessionId:T,mtime:B,preview:n.readPreview(I),hitCount:F,snippet:V}),w.length>=HO))break}return w}let Md=800,Bd=new Map;function jw(g,k){let w=Bd.get(g);if(w&&w.mtime===k)return w.text;let T="";try{T=Vo(g,"utf8")}catch{return""}let I="";for(let F of T.split(`
|
|
1591
|
+
`)){if(!F.trim())continue;let V=n.parseEntry(F);if(V)for(let W of n.apply(V,e.sessionStartMs).events)W.type==="assistant"&&W.text.trim()&&(I=W.text.trim())}let B=I.length>Md?I.slice(0,Md).trimEnd()+"\u2026":I;return Bd.set(g,{mtime:k,text:B}),B}async function Fw(g){let k=n.listSessionFiles(e.cwd).find(w=>w.sessionId===g);return{text:k?jw(k.file,k.mtime):""}}async function qw(g){let k=e,w=n.listSessionFiles(k.cwd).find(T=>T.sessionId===g);if(!w){let T=c().find(I=>I.sessionId===g)?.rec;return T?((r!==T||k.sessionId!==T.id)&&(r=T,$(void 0,T.id),k.everAttached=!0,d()),{ok:!0}):{ok:!1,error:"session not found"}}return w.file===k.file?{ok:!0}:(x(w),u(),d(),{ok:!0})}return b(e.cwd),A(e.cwd),P(),{info:L,poll:ke,logEmbedStatus:G,listSessions:Mw,searchSessions:Dw,sessionPeek:Fw,attach:qw,composerSend:ka,composerStop:Rw,composerNew:_w,composerFiles:Nw,composerUiRespond:Pw,composerRpc:Cw,composerPaste:$w,composerPasteRead:Lw,shutdownComposer:Iw}}var qO,UO,Ly,JO,HO,zo=v(()=>{Lt();Sy();ps();Uu();Py();Ry();qO=".typebulb",UO=`${qO}/locks`,Ly=5e3,JO=6e4;HO=50});import{existsSync as Wu,mkdirSync as WO,readFileSync as My,writeFileSync as YO}from"fs";import{join as ln,isAbsolute as VO}from"path";async function Vu(n,e){let t=VO(n)?n:ln(z,n);return Wu(t)?(Eu(t,e),{ok:!0}):{ok:!1,error:"file not found"}}async function zu(n){let e=z,t=xu(n),r=ln(e,"typebulbs");WO(r,{recursive:!0});let s=Dl(t),i=`${s}.bulb.md`;for(let l=2;Wu(ln(r,i))&&My(ln(r,i),"utf8")!==t;l++)i=`${s}-${l}.bulb.md`;let o=ln(r,i);Wu(o)||YO(o,t);let a=ln("typebulbs",i),c=await Ki(a,{cwd:e,open:!1});return{ok:!0,file:a,pid:c.pid,url:c.url}}async function Gu(){return Q(z)}async function Xu(n){return await Yt(n),{ok:!0}}async function Qu(){let n=await as(z);return Ao(z).filter(e=>!e.serverOnly).map(e=>({...e,trusted:sn(e.path),batches:wu(e.path),lastRunAt:n(e.path)}))}async function Zu(n){let e=n.toLowerCase(),t=[];for(let r of Ao(z).filter(s=>!s.serverOnly).sort((s,i)=>i.mtime-s.mtime)){let s="";try{s=My(r.path,"utf8")}catch{continue}let i=[];for(let c of s.split(`
|
|
1592
|
+
`)){let l=c.replace(/\s+/g," ").trim();l&&i.push({text:l,lower:l.toLowerCase()})}let{hitCount:o,snippet:a}=Ko(i,e);o&&t.push({path:r.path,hitCount:o,snippet:a})}return t}async function ed(n,e,t){let r=z;e!=null&&Hn(n,e);let s=await Ki(n,{cwd:r,open:!1,trust:e,batch:t??void 0});return{ok:!0,file:s.file,pid:s.pid,url:s.url,trust:!!s.trust}}async function td(n){return{cap:await ku(n)}}async function nd(n,e){return Hn(n,e),{ok:!0}}async function rd(n,e){return We(n,e)}async function sd(){return ms&&Date.now()-ms.fetchedAt<=GO?ms.samples:(Ju??=XO().finally(()=>{Ju=null}),Ju)}async function XO(){try{let n=await fetch(`${zO}/api/scripts/u/samples?stubs`,{signal:AbortSignal.timeout(Dy)});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:Na(i.config)}));return ms={samples:s,fetchedAt:Date.now()},s}catch{return ms?.samples??[]}}async function id(n){return Yu.test(n)?Fy(By,"samples",n,!0):{ok:!1,error:"bad slug"}}async function ad(){let n=od();if(!n)return{bulbs:[]};let e=`${Go()}
|
|
1593
|
+
${n}`;return Mt?.key===e&&Date.now()-Mt.fetchedAt<=QO?{user:Mt.user,bulbs:Mt.bulbs}:(Ku??=ZO(e,n).finally(()=>{Ku=null}),Ku)}async function Hu(n,e,t){let r=await fetch(`${n}${e}`,{headers:t,signal:AbortSignal.timeout(Dy)});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 ZO(n,e){let t={Authorization:`Bearer ${e}`};try{let r=Go(),s;try{s=await Hu(r,"/api/me",t)}catch{let a=new URL(r);r=`${a.protocol}//api.${a.host}`,s=await Hu(r,"/api/me",t)}let o=(await Hu(r,"/api/scripts/list",t)).filter(a=>a.userSlug===s.slug&&!a.isTemplate).map(a=>({slug:a.slug,name:a.name,description:Na(a.config)}));return Mt={key:n,user:s.slug,bulbs:o,fetchedAt:Date.now()},{user:s.slug,bulbs:o}}catch{return Mt?.key===n?{user:Mt.user,bulbs:Mt.bulbs}:{bulbs:[]}}}async function cd(n,e,t=!1){return!Yu.test(e)||!Yu.test(n)?{ok:!1,error:"bad slug"}:Fy(Go(),n,e,t)}async function Fy(n,e,t,r){let s=No(e,t);try{let i=await Lo({origin:n,userSlug:e,slug:t,dest:ln(z,s)},{force:r,token:od(),timeoutMs:jy});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 ld(n,e=!1){let t=od();if(!t)return{ok:!1,error:"no TYPEBULB_TOKEN in .env"};try{let r=$o(n,z,Go()),s=await Bo(r,{token:t,force:e,timeoutMs:jy});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 zO,By,GO,Dy,jy,ms,Ju,Yu,QO,Mt,Ku,Go,od,Xo=v(()=>{Vn();Lt();Uu();le();zO="https://api.typebulb.com",By="https://typebulb.com",GO=3600*1e3,Dy=5e3,jy=15e3,ms=null,Ju=null;Yu=/^[a-z0-9][a-z0-9-]*$/,QO=300*1e3,Mt=null,Ku=null,Go=()=>bo("TYPEBULB_ORIGIN",z)||By,od=()=>bo("TYPEBULB_TOKEN",z)});import{readFileSync as fd,writeFileSync as Uy,mkdirSync as eP,appendFileSync as Jy,rmSync as qy}from"fs";import{join as ea,dirname as tP}from"path";import{createServer as nP}from"http";function Bt(n){try{return JSON.parse(fd(n,"utf8"))}catch{return null}}function Zo(n,e){eP(tP(n),{recursive:!0}),Uy(n,JSON.stringify(e,null,2)+`
|
|
1594
|
+
`)}function Hy(n,e,t){let r=ea(n,".gitignore"),s="";try{s=fd(r,"utf8")}catch{}let i=new Set(s.split(/\r?\n/).map(c=>c.trim())),o=e.filter(c=>!i.has(c));if(!o.length)return;let a=s&&!s.endsWith(`
|
|
1490
1595
|
`)?`
|
|
1491
|
-
`:"";try{
|
|
1596
|
+
`:"";try{Jy(r,a+t+`
|
|
1492
1597
|
`+o.join(`
|
|
1493
1598
|
`)+`
|
|
1494
|
-
`)}catch(c){console.error("[switcher] .gitignore update failed",Y(c))}}function
|
|
1599
|
+
`)}catch(c){console.error("[switcher] .gitignore update failed",Y(c))}}function aP(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?ys="live":s>oP&&(ys="uncached")}function Yy(n,e){let t={"content-type":"application/json",authorization:`Bearer ${e}`,"anthropic-version":n.headers["anthropic-version"]||"2023-06-01"},r=n.headers["anthropic-beta"];return typeof r=="string"&&(t["anthropic-beta"]=r),t}function cP(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 Vy(n){let e;try{e=JSON.parse(n)}catch{return n}gs=typeof e?.model=="string"?e.model:null,Xe&&(e.model=Xe),dn&&(e.provider=Wy(dn));let t=/haiku/i.test(gs||"");return bs!=null&&!t&&(e.reasoning={effort:ud[bs]}),delete e.thinking,e.output_config&&delete e.output_config.effort,cP(e),JSON.stringify(e)}function lP(){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 c=e++;return t.set(a.index,c),a.index=c,`event: ${a.type}
|
|
1495
1600
|
data: ${JSON.stringify(a)}
|
|
1496
1601
|
|
|
1497
1602
|
`}case"content_block_delta":case"content_block_stop":{let c=t.get(a.index);return c==null?null:(a.index=c,`event: ${a.type}
|
|
1498
1603
|
data: ${JSON.stringify(a)}
|
|
1499
1604
|
|
|
1500
|
-
`)}default:return i}};return i=>{
|
|
1605
|
+
`)}default:return i}};return i=>{n+=i;let o="",a;for(;(a=n.indexOf(`
|
|
1501
1606
|
|
|
1502
|
-
`))!==-1;){let c=
|
|
1607
|
+
`))!==-1;){let c=n.slice(0,a);if(n=n.slice(a+2),!c.trim())continue;let l=s(c);l!==null&&(o+=l)}return o}}function uP(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 hs(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 dP(n,e,t){if(!Xe){hs(e,400,"invalid_request_error",iP);return}let r=process.env.OPENROUTER_API_KEY;if(!r){hs(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(pd,{method:"POST",headers:Yy(n,r),body:Vy(t),signal:s.signal})}catch(u){hs(e,502,"api_error",`proxy upstream failed: ${Y(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"),c=i.body.getReader(),l=new TextDecoder,d=a?lP():null;try{for(;;){let{done:u,value:f}=await c.read();if(u)break;if(f)if(d){let p=l.decode(f,{stream:!0});aP(p);let h=d(p);h&&e.write(h)}else e.write(Buffer.from(f))}}catch{}finally{e.writableEnded||e.end()}}async function fP(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(!Xe||!r)return s();try{let i=await fetch(`${pd}/count_tokens`,{method:"POST",headers:Yy(n,r),body:Vy(t)});if(!i.ok)return s();let o=await i.text();e.writeHead(200,{"content-type":"application/json"}),e.end(o)}catch{s()}}function pP(n,e){let t=n.url||"/";if(n.method==="HEAD"){e.writeHead(200),e.end();return}if(n.method!=="POST"){hs(e,404,"not_found_error",t);return}uP(n).then(r=>{if(t.includes("count_tokens"))return fP(n,e,r);if(t.includes("/v1/messages"))return dP(n,e,r);hs(e,404,"not_found_error",t)})}function mP(){return Zn&&un?Promise.resolve(un):new Promise((n,e)=>{let t=nP(pP);t.on("error",e),t.listen(0,"127.0.0.1",()=>{Zn=t,un=t.address().port,console.log(`[switcher] wire proxy listening on ${Qo(un)}`),n(un)})})}function hP(){try{Zn?.close()}catch{}Zn=null,un=null}function gP(n,e){let t=ta(n),r=Bt(t),s=r||{};if((!s.env||typeof s.env!="object")&&(s.env={}),s.env.ANTHROPIC_BASE_URL===Qo(e)&&s.env.ANTHROPIC_AUTH_TOKEN)return;let i=na(n);if(!Bt(i)){let a={};for(let c of Ky)a[c]=c in s.env?s.env[c]:null;Zo(i,{managedBy:"agent-switcher",fileExisted:r!==null,snapshot:a,active:null})}s.env.ANTHROPIC_BASE_URL=Qo(e),s.env.ANTHROPIC_AUTH_TOKEN=sP,Zo(t,s),Hy(n,[".claude/settings.local.json",".claude/.cc-switcher.json"],"# agent switcher (local Claude Code model override)")}function yP(n,e,t){let r=na(n),s=Bt(r)||{managedBy:"agent-switcher",fileExisted:!1,snapshot:{}};s.active={model:e,provider:t},Zo(r,s)}function zy(n){let e=ta(n),t=na(n),r=Bt(t),s=Bt(e);if(s?.env){let i=r?.snapshot||{};for(let o of Ky){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{qy(e,{force:!0})}catch{}else Zo(e,s)}try{qy(t,{force:!0})}catch{}}async function bP(){let n=!!process.env.OPENROUTER_API_KEY,e=[];try{e=(await ot()).filter(r=>r.provider==="openrouter"&&!md(r.name)).map(r=>({id:r.name,label:r.friendlyName||r.name}))}catch(r){console.error("[switcher] model list failed",Y(r))}let t=e.length?void 0:mu()??void 0;return{hasKey:n,models:e,error:t}}async function wP(){if(Zn&&Xe)return{active:!0,managed:!0,model:Xe,port:un,provider:dn,routedModel:gs,caching:ys,reasoning:bs,externalBaseUrl:null};let n=Bt(ta(z))?.env||{};return{active:!1,managed:!1,model:null,port:null,provider:null,routedModel:null,caching:"unknown",reasoning:bs,externalBaseUrl:n.ANTHROPIC_BASE_URL||null}}async function Gy(n,e){let t=await mP();return Xe=n,dn=e,gP(z,t),t}async function vP({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(md(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 Gy(n,hd[n]??null),gs=null,ys="unknown",yP(z,n,dn)}catch(e){return{ok:!1,error:`failed to start the wire proxy: ${Y(e)}`}}return{ok:!0}}async function SP({level:n}){return n!=null&&(!Number.isInteger(n)||n<0||n>=ud.length)?{ok:!1,error:`reasoning level must be 0\u2013${ud.length-1} or null`}:(bs=n,{ok:!0,level:n})}async function kP(){return zy(z),Xe=null,dn=null,gs=null,ys="unknown",{ok:!0}}async function xP({key:n}){let e=(n||"").trim();if(!e)return{ok:!1,error:"empty key"};let t=z,r=ea(t,".env"),s="";try{s=fd(r,"utf8")}catch{}try{if(/^\s*OPENROUTER_API_KEY\s*=/m.test(s))Uy(r,s.replace(/^\s*OPENROUTER_API_KEY\s*=.*$/m,`OPENROUTER_API_KEY=${e}`));else{let i=s&&!s.endsWith(`
|
|
1503
1608
|
`)?`
|
|
1504
|
-
`:"";
|
|
1505
|
-
`)}}catch(i){return{ok:!1,error:Y(i)}}return process.env.OPENROUTER_API_KEY=e,
|
|
1506
|
-
`)}catch(o){return{ok:!1,error:`could not write ${
|
|
1609
|
+
`:"";Jy(r,i+`OPENROUTER_API_KEY=${e}
|
|
1610
|
+
`)}}catch(i){return{ok:!1,error:Y(i)}}return process.env.OPENROUTER_API_KEY=e,Hy(t,[".env"],"# secrets"),{ok:!0}}function EP(){if(!(!Zn&&!Xe)){try{zy(z)}catch{}hP()}}function AP(n,e){return Xy.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 TP(n){if(Xy.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 OP(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=dd(e?.cache_read_input_tokens)||dd(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 PP({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(md(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 c=new AbortController,l=setTimeout(()=>c.abort(),2e4);try{let d=JSON.stringify(a?{...i,provider:Wy(a)}:i),u=await fetch(pd,{method:"POST",signal:c.signal,headers:s,body:d}),f=await u.json().catch(()=>({}));return{r:u,j:f}}finally{clearTimeout(l)}};try{let{r:a,j:c}=await o();if(!a.ok){let A=c?.error?.message||c?.message||JSON.stringify(c).slice(0,300);return{ok:!0,callable:!1,status:a.status,ms:Date.now()-t,error:AP(a.status,A),restriction:TP(A)}}let l=typeof c?.provider=="string"?c.provider:void 0,d=c?.content?.find?.(A=>A.type==="text")?.text??c?.content?.[0]?.text??"ok",u=dd(c?.usage?.cache_creation_input_tokens),{r:f,j:p}=await o(l),{works:h,read:m,note:b}=OP(f.ok,p?.usage,l);return h===!0&&l&&(hd[n]=l,Xe===n&&(dn=l)),{ok:!0,callable:!0,status:a.status,ms:Date.now()-t,provider:l,sample:String(d).trim().slice(0,60),cache:{works:h,created:u,read:m,note:b}}}catch(a){let c=Y(a);return{ok:!0,callable:!1,ms:Date.now()-t,error:/abort/i.test(c)?"timed out (20s)":c}}}var rP,pd,sP,iP,Ky,oP,ud,ta,na,Qo,md,Zn,un,Xe,dn,gs,ys,bs,hd,dd,Wy,Xy,Qy=v(()=>{Vn();Lt();rP="https://openrouter.ai/api",pd=`${rP}/v1/messages`,sP="typebulb-proxy-managed",iP="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.",Ky=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],oP=5e3,ud=["low","medium","high"],ta=n=>ea(n,".claude","settings.local.json"),na=n=>ea(n,".claude",".cc-switcher.json"),Qo=n=>`http://127.0.0.1:${n}`;md=n=>/^anthropic\//i.test(n)||/claude/i.test(n),Zn=null,un=null,Xe=null,dn=null,gs=null,ys="unknown",bs=1,hd={},dd=n=>typeof n=="number"?n:0,Wy=n=>({order:[n],allow_fallbacks:!1});Xy=/data policy|no endpoints|no allowed providers|privacy|requires.*(training|logging|data)/i;(async function(){try{let e=Bt(na(z)),t=e?.active?.model;if(!t)return;let s=(Bt(ta(z))?.env||{}).ANTHROPIC_BASE_URL||"";if(!/127\.0\.0\.1|localhost/.test(s))return;let i=await Gy(t,e.active.provider??hd[t]??null);console.log(`[switcher] re-adopted override after restart: ${t} via ${Qo(i)}`)}catch(e){console.error("[switcher] boot reconcile failed",Y(e))}})()});var eb={};Ea(eb,{attach:()=>MP,blockToMarkdown:()=>Bi,breakout:()=>zu,capText:()=>we,cleanUserText:()=>xt,clearSwitchModel:()=>kP,composerPasteRead:()=>BP,displayName:()=>CP,downloadSample:()=>id,firstLineDigest:()=>$e,git:()=>Je,gitChangedFiles:()=>Fu,gitDiff:()=>qu,info:()=>RP,isHiddenTurn:()=>Fr,launchBulb:()=>ed,listBreakouts:()=>Gu,listBulbFiles:()=>Qu,listMyBulbs:()=>ad,listSamples:()=>sd,listSessions:()=>IP,listSwitchModels:()=>bP,logEmbedStatus:()=>NP,openFile:()=>Vu,poll:()=>_P,predictTrustOf:()=>td,probeModel:()=>PP,pullRemoteBulb:()=>cd,pushLocalBulb:()=>ld,readBulbLog:()=>rd,repoRoot:()=>an,saveOpenRouterKey:()=>xP,searchBulbs:()=>Zu,searchSessions:()=>$P,sessionPeek:()=>LP,setBulbTrust:()=>nd,setReasoning:()=>SP,setSwitchModel:()=>vP,shutdownSwitcher:()=>EP,stopBreakout:()=>Xu,switchState:()=>wP,toolResultDigest:()=>Pl});var Zy,CP,RP,_P,NP,IP,$P,LP,MP,BP,tb=v(()=>{zo();Di();Xo();ps();Qy();Di();jr();Zy=new Tn,CP=Zy.displayName,{info:RP,poll:_P,logEmbedStatus:NP,listSessions:IP,searchSessions:$P,sessionPeek:LP,attach:MP,composerPasteRead:BP}=Qn(Zy)});import{readFileSync as DP,writeFileSync as jP,mkdirSync as FP}from"fs";import{homedir as qP}from"os";import*as ra from"path";async function sb(){try{let n=await fetch(new URL("/api/tags",rb()).toString(),{signal:AbortSignal.timeout(UP)});return n.ok?((await n.json()).models??[]).map(t=>t.name).filter(t=>!!t):[]}catch{return[]}}function ib(n){let e;try{e=DP(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&&!gd(r)}}}catch{}return{json:void 0,unreadable:!0}}function gd(n){let e=n?.providers;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function JP(n){let e=gd(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 ob(){let{json:n,unreadable:e}=ib(nb());return e?{installed:[],configured:null}:{installed:await sb(),configured:JP(n)}}async function ab(){let n=await sb();return n.length?KP(nb(),n,rb()):{ok:!1,error:"Ollama is not running (or has no models installed)"}}function KP(n,e,t){let{json:r,unreadable:s}=ib(n);if(s)return{ok:!1,error:`could not parse ${n} \u2014 edit the ollama provider there yourself`};let i={...r??{},providers:{...gd(r)??{},ollama:{baseUrl:`${t}/v1`,api:"openai-completions",apiKey:"ollama",models:e.map(o=>({id:o}))}}};try{FP(ra.dirname(n),{recursive:!0}),jP(n,JSON.stringify(i,null,2)+`
|
|
1611
|
+
`)}catch(o){return{ok:!1,error:`could not write ${n}: ${Y(o)}`}}return{ok:!0,count:e.length}}var UP,nb,rb,cb=v(()=>{Lt();Vn();UP=1500,nb=()=>ra.join(qP(),".pi","agent","models.json"),rb=()=>jn(process.env.OLLAMA_HOST??"http://localhost:11434")});var ub={};Ea(ub,{attach:()=>QP,breakout:()=>zu,composerFiles:()=>nC,composerNew:()=>tC,composerPaste:()=>iC,composerPasteRead:()=>oC,composerRpc:()=>sC,composerSend:()=>ZP,composerStop:()=>eC,composerUiRespond:()=>rC,displayName:()=>HP,downloadSample:()=>id,git:()=>Je,gitChangedFiles:()=>Fu,gitDiff:()=>qu,info:()=>WP,launchBulb:()=>ed,listBreakouts:()=>Gu,listBulbFiles:()=>Qu,listMyBulbs:()=>ad,listSamples:()=>sd,listSessions:()=>zP,logEmbedStatus:()=>VP,ollamaOffer:()=>ob,ollamaSync:()=>ab,openFile:()=>Vu,poll:()=>YP,predictTrustOf:()=>td,pullRemoteBulb:()=>cd,pushLocalBulb:()=>ld,readBulbLog:()=>rd,repoRoot:()=>an,searchBulbs:()=>Zu,searchSessions:()=>GP,sessionPeek:()=>XP,setBulbTrust:()=>nd,shutdownComposer:()=>aC,stopBreakout:()=>Xu});var lb,HP,WP,YP,VP,zP,GP,XP,QP,ZP,eC,tC,nC,rC,sC,iC,oC,aC,db=v(()=>{zo();Mu();Xo();ps();cb();lb=new zn,HP=lb.displayName,{info:WP,poll:YP,logEmbedStatus:VP,listSessions:zP,searchSessions:GP,sessionPeek:XP,attach:QP,composerSend:ZP,composerStop:eC,composerNew:tC,composerFiles:nC,composerUiRespond:rC,composerRpc:sC,composerPaste:iC,composerPasteRead:oC,shutdownComposer:aC}=Qn(lb)});var pb={};Ea(pb,{attach:()=>hC,breakout:()=>zu,composerPasteRead:()=>gC,displayName:()=>cC,downloadSample:()=>id,git:()=>Je,gitChangedFiles:()=>Fu,gitDiff:()=>qu,info:()=>lC,launchBulb:()=>ed,listBreakouts:()=>Gu,listBulbFiles:()=>Qu,listMyBulbs:()=>ad,listSamples:()=>sd,listSessions:()=>fC,logEmbedStatus:()=>dC,openFile:()=>Vu,poll:()=>uC,predictTrustOf:()=>td,pullRemoteBulb:()=>cd,pushLocalBulb:()=>ld,readBulbLog:()=>rd,repoRoot:()=>an,searchBulbs:()=>Zu,searchSessions:()=>pC,sessionPeek:()=>mC,setBulbTrust:()=>nd,stopBreakout:()=>Xu});var fb,cC,lC,uC,dC,fC,pC,mC,hC,gC,mb=v(()=>{zo();Du();Xo();ps();fb=new Gn,cC=fb.displayName,{info:lC,poll:uC,logEmbedStatus:dC,listSessions:fC,searchSessions:pC,sessionPeek:mC,attach:hC,composerPasteRead:gC}=Qn(fb)});import*as Ow from"fs/promises";import*as dt from"path";Cs();le();function xl(n){if(!_e.includes(n))throw new Error(`Unknown block kind '${n}' (one of: ${_e.join(", ")})`);return n}function wh(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=xl(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}Di();Mu();Du();var sa={claude:{adapter:()=>new Tn,server:()=>Promise.resolve().then(()=>(tb(),eb))},pi:{adapter:()=>new zn,server:()=>Promise.resolve().then(()=>(db(),ub))},codex:{adapter:()=>new Gn,server:()=>Promise.resolve().then(()=>(mb(),pb))}};function hb(n){return n in sa}function er(){return Object.keys(sa)}function gb(){return Object.fromEntries(Object.entries(sa).map(([n,e])=>[n,e.adapter]))}function yb(n){return sa[n].server()}var ws=gb();function bb(){for(let n of Object.values(ws))try{n().ensureHarnessSupport()}catch{}}function fn(){for(let n of Object.keys(ws))try{if(ws[n]().detectsSelf())return n}catch{}}function wb(n){let e=er(),t=new Map(e.filter(i=>ws[i]).map(i=>[i,ws[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 bd=5e3;function yd(n){try{return n()}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}}function vb(n){let t={subcommand:"run",file:"",watch:!0,open:!(process.env.TERM_PROGRAM==="vscode"||fn()!==void 0),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=!0;else if(a==="--no-open")t.open=!1;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 c=n[++o];(!c||c.startsWith("-"))&&(console.error("Missing value for --mode (e.g. --mode staging)"),process.exit(1)),t.mode=c}else if(a==="--batch"){let c=n[++o];(!c||c.startsWith("-"))&&(console.error("Missing value for --batch (a batch name, e.g. --batch pilot)"),process.exit(1));let l=c.replace(/[\\/]+$/,"");(!l||/[\\/]/.test(l)||l==="."||l==="..")&&(console.error(`Invalid --batch value: ${c} (a single folder name \u2014 no path separators or dot segments)`),process.exit(1)),t.batch=l}else if(a==="--follow"||a==="-f")t.follow=!0;else if(a==="--clear")t.clear=!0;else if(a==="--run"){let c=n[++o];if(c==="latest")t.run="latest";else{let l=parseInt(c,10);(isNaN(l)||l<1)&&(console.error(`Invalid --run value: ${c} (a run number, or 'latest')`),process.exit(1)),t.run=l}}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 c=n[++o];c===void 0&&(console.error("Missing value for --match (a literal substring new log lines must contain)"),process.exit(1)),t.match=c}else if(a==="--timeout"){let c=parseInt(n[++o],10);(isNaN(c)||c<=0)&&(console.error(`Invalid --timeout value: ${n[o]} (seconds)`),process.exit(1)),t.timeoutSec=c}else if(a==="--wait"||a.startsWith("--wait="))if(a.startsWith("--wait=")){let c=parseInt(a.slice(7),10);(isNaN(c)||c<=0)&&(console.error(`Invalid --wait value: ${a.slice(7)} (milliseconds)`),process.exit(1)),t.sendWaitMs=c}else t.sendWaitMs=bd;else if(a==="--lines"||a==="-n"){let c=parseInt(n[++o],10);(isNaN(c)||c<0)&&(console.error(`Invalid --lines value: ${n[o]}`),process.exit(1)),t.lines=c}else if(a==="--port"||a==="-p"){let c=n[++o],l=parseInt(c,10);isNaN(l)&&(console.error(`Invalid port: ${c}`),process.exit(1)),t.port=l}else if(a==="--replace"||a.startsWith("--replace=")){let c=a.startsWith("--replace=")?a.slice(10):n[++o]??"",l=yd(()=>Kd(c));t.local&&(console.error(`--replace can only be used once (got '${t.local.name}' and '${l.name}')`),process.exit(1)),t.local=l}else if(a==="--args"||a.startsWith("--args=")){t.hasArgsFlag=!0;let c=a.startsWith("--args=")?a.slice(7):n[++o];c===void 0&&(console.error("Missing value for --args (a JSON array, or - to read it from stdin)"),process.exit(1)),t.argsJson=c}else if(!a.startsWith("-"))["call","send","get","put","slug"].includes(t.subcommand)?i.push(a):t.file=a;else{let c=t.subcommand==="call"?" (for a negative or dash-leading argument, use --args '<json-array>')":"";console.error(`Unknown option: ${a}${c}`),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=yd(()=>xl(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=yd(()=>wh(i.slice(1)))),t}function Sb(){console.log(`
|
|
1507
1612
|
typebulb - Local bulb runner for Typebulb
|
|
1508
1613
|
|
|
1509
1614
|
Usage:
|
|
@@ -1512,7 +1617,7 @@ Usage:
|
|
|
1512
1617
|
harness, brings up the agent mirror without opening a
|
|
1513
1618
|
browser, prints its URL and the authoring-skill path.
|
|
1514
1619
|
Always exits 0 (a status report).
|
|
1515
|
-
typebulb agent:{claude|pi}
|
|
1620
|
+
typebulb agent:{claude|codex|pi} Open a named harness's mirror in the foreground (a browser
|
|
1516
1621
|
view of your coding agent's sessions) \u2014 explicit / override.
|
|
1517
1622
|
typebulb call <file> <fn> [\u2026] Invoke one server.ts export headlessly: prints
|
|
1518
1623
|
its return as JSON to stdout, logs/errors to
|
|
@@ -1674,7 +1779,7 @@ Examples:
|
|
|
1674
1779
|
typebulb my-editor.bulb.md
|
|
1675
1780
|
typebulb --no-watch --port 8080 my-editor.bulb.md
|
|
1676
1781
|
typebulb .
|
|
1677
|
-
`)}
|
|
1782
|
+
`)}Ve();Kr();Cs();cs();Ve();import*as Ce from"path";import{spawn as JC,execSync as KC}from"child_process";import{createRequire as HC}from"module";import{existsSync as WC}from"fs";import*as pe from"fs/promises";import*as de from"path";var wd=[{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"}],vd=[{name:"dom"},{name:"dom.iterable"},{name:"dom.asynciterable"}];function Sd(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)}var yC=`
|
|
1678
1783
|
/**
|
|
1679
1784
|
* Get raw data chunk from the Data tab.
|
|
1680
1785
|
* @param index - Chunk index (0-based). Separate chunks with 2 blank lines.
|
|
@@ -1685,7 +1790,7 @@ Examples:
|
|
|
1685
1790
|
* @param index - Chunk index (0-based)
|
|
1686
1791
|
* @throws If chunk is not valid JSON/JSON-ish
|
|
1687
1792
|
*/
|
|
1688
|
-
json<T = unknown>(index: number): T
|
|
1793
|
+
json<T = unknown>(index: number): T;`,bC=`
|
|
1689
1794
|
/**
|
|
1690
1795
|
* Get the insight data produced by the inference layer.
|
|
1691
1796
|
*
|
|
@@ -1694,7 +1799,7 @@ Examples:
|
|
|
1694
1799
|
*
|
|
1695
1800
|
* @returns The parsed insight JSON, or undefined if no insight is available
|
|
1696
1801
|
*/
|
|
1697
|
-
insight<T = unknown>(): T | undefined;`,
|
|
1802
|
+
insight<T = unknown>(): T | undefined;`,kb=`options: {
|
|
1698
1803
|
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
1699
1804
|
system?: string;
|
|
1700
1805
|
/** Reasoning effort hint: 0=minimal, 1=low, 2=med, 3=high. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking budget, Anthropic adaptive thinking). 0 minimizes reasoning \u2014 a floor, not a guaranteed "off": some models still think a little at 0, and adaptive models already self-skip at 1 (low). Level 1 (low) is the sensible default for most work; reach for 0 only when you truly want minimal deliberation. Omit for the model's own default. */
|
|
@@ -1705,15 +1810,15 @@ Examples:
|
|
|
1705
1810
|
webSearch?: boolean;
|
|
1706
1811
|
/** Abort the request. On abort the promise rejects / the stream ends. */
|
|
1707
1812
|
signal?: AbortSignal;
|
|
1708
|
-
}`,
|
|
1813
|
+
}`,xb=`
|
|
1709
1814
|
/** A single streamed delta from \`tb.ai.stream()\`. Discriminated by \`kind\`. */
|
|
1710
1815
|
type AiChunk =
|
|
1711
1816
|
| { kind: "text"; text: string }
|
|
1712
1817
|
| { kind: "reasoning"; text: string };
|
|
1713
|
-
`,
|
|
1818
|
+
`,Eb=`
|
|
1714
1819
|
/** What backs \`tb.ai\`: the user's own keys, the quota-limited courtesy model, or nothing. */
|
|
1715
1820
|
type AiAccess = "own" | "courtesy" | "none";
|
|
1716
|
-
`,
|
|
1821
|
+
`,Ab=`
|
|
1717
1822
|
/**
|
|
1718
1823
|
* General-purpose AI call. \`tb.ai(opts)\` resolves with the full text; \`tb.ai.stream(opts)\`
|
|
1719
1824
|
* returns an async iterable of {@link AiChunk} deltas you consume with \`for await\`.
|
|
@@ -1722,7 +1827,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
1722
1827
|
* @throws On rate limit, network error, or provider error
|
|
1723
1828
|
*/
|
|
1724
1829
|
ai: {
|
|
1725
|
-
(${
|
|
1830
|
+
(${kb}): Promise<{ text: string }>;
|
|
1726
1831
|
/**
|
|
1727
1832
|
* Streaming counterpart of \`tb.ai()\`. Yields \`{ kind: "text" | "reasoning", text }\` deltas
|
|
1728
1833
|
* as they arrive; break the loop (or abort \`signal\`) to cancel and stop the upstream.
|
|
@@ -1736,8 +1841,8 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
1736
1841
|
* if (c.kind === "text") answer += c.text;
|
|
1737
1842
|
* }
|
|
1738
1843
|
*/
|
|
1739
|
-
stream(${
|
|
1740
|
-
};`,
|
|
1844
|
+
stream(${kb}): AsyncIterable<AiChunk>;
|
|
1845
|
+
};`,Tb=`
|
|
1741
1846
|
/**
|
|
1742
1847
|
* Returns AI models available to the current user.
|
|
1743
1848
|
* Models are filtered by the user's configured API keys.
|
|
@@ -1767,7 +1872,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
1767
1872
|
* \`tb.mode\` or the length of \`tb.models()\` \u2014 which hosts offer a courtesy
|
|
1768
1873
|
* model is the host's business and changes without your bulb changing.
|
|
1769
1874
|
*/
|
|
1770
|
-
aiAccess(): Promise<AiAccess>;`,
|
|
1875
|
+
aiAccess(): Promise<AiAccess>;`,wC="\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;",Ob=`
|
|
1771
1876
|
/**
|
|
1772
1877
|
* The mode this bulb is running in.
|
|
1773
1878
|
*
|
|
@@ -1777,7 +1882,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
1777
1882
|
* - \`'embedded'\` \u2014 Running as a bulb embedded inside another bulb (sandboxed,
|
|
1778
1883
|
* client-only: AI, filesystem, and server RPC are unavailable)
|
|
1779
1884
|
*/
|
|
1780
|
-
mode: 'local' | 'editor' | 'published' | 'embedded';`,
|
|
1885
|
+
mode: 'local' | 'editor' | 'published' | 'embedded';`,Pb=`
|
|
1781
1886
|
/**
|
|
1782
1887
|
* Local filesystem access (CLI only).
|
|
1783
1888
|
*
|
|
@@ -1794,7 +1899,7 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
1794
1899
|
readBytes(path: string): Promise<Uint8Array>;
|
|
1795
1900
|
/** Write text or raw bytes to a file. Creates parent directories if needed. */
|
|
1796
1901
|
write(path: string, content: string | Uint8Array): Promise<boolean>;
|
|
1797
|
-
};`,
|
|
1902
|
+
};`,Cb="\n /**\n * The bulb's folder \u2014 absolute path to `<bulb-dir>/<filename-stem>/`\n * (or its `batches/<name>/` folder when the run is scoped with `--batch`).\n *\n * For interop only (handing a path to `server.ts` or a spawned tool):\n * `tb.fs` already resolves relative paths against it, so bulb code writing\n * its own files never needs it. CLI only \u2014 throws in editor/published/embedded mode.\n */\n readonly dir: string;",vC=`
|
|
1798
1903
|
/**
|
|
1799
1904
|
* Async value inspector for tensor-like objects.
|
|
1800
1905
|
*
|
|
@@ -1861,47 +1966,47 @@ type AiAccess = "own" | "courtesy" | "none";
|
|
|
1861
1966
|
*
|
|
1862
1967
|
* @returns The full canonical URL
|
|
1863
1968
|
*/
|
|
1864
|
-
url(): Promise<string>;`,
|
|
1969
|
+
url(): Promise<string>;`,SC="\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 embedded 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;",kC="\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, embedded,\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;",xC="\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>>;",kd=`${xb}${Eb}
|
|
1865
1970
|
/**
|
|
1866
1971
|
* Typebulb utilities namespace.
|
|
1867
1972
|
* Type \`tb.\` to discover available helpers.
|
|
1868
1973
|
*/
|
|
1869
|
-
declare const tb: {${
|
|
1974
|
+
declare const tb: {${yC}${vC}${bC}${kC}${xC}${SC}${Ab}${Pb}${Cb}${Tb}${wC}${Ob}
|
|
1870
1975
|
};
|
|
1871
|
-
`,
|
|
1976
|
+
`,EC=`
|
|
1872
1977
|
/**
|
|
1873
1978
|
* Print to the CLI's stdout \u2014 the same channel as \`console.log\` here (the server's console IS
|
|
1874
1979
|
* the bulb's log). One log verb across blocks: page-side \`tb.log\` reaches this same stdout.
|
|
1875
1980
|
*/
|
|
1876
|
-
log(...args: any[]): void;`,
|
|
1981
|
+
log(...args: any[]): void;`,xd=`${xb}${Eb}
|
|
1877
1982
|
/**
|
|
1878
1983
|
* Typebulb utilities namespace (server-side).
|
|
1879
1984
|
* Type \`tb.\` to discover available helpers.
|
|
1880
1985
|
*/
|
|
1881
|
-
declare const tb: {${
|
|
1986
|
+
declare const tb: {${EC}${Ab}${Pb}${Cb}${Tb}${Ob}
|
|
1882
1987
|
};
|
|
1883
|
-
`;
|
|
1988
|
+
`;nt();import PC from"p-limit";nt();import{resolve as _b}from"resolve.exports";var lt={maxRelativeTypeRefs:500,maxBareDeps:8,maxBareDepth:3,prefetchConcurrency:4,negativeTtlMs:1e4},vs=["index.d.ts","index.d.mts"],Ed=/\.d\.(ts|mts|cts)$/i;function ia(n){return/\.d\.(ts|mts|cts)(?:[?#].*)?$/i.test(n)||/[?&]dts(?:[&#]|$)/i.test(n)}function Rb(n){return[`${n}.d.ts`,`${n}.d.mts`]}function Dt(n){if(!n||n==="./"||n==="/")return[...vs];let e=n.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),t=Rb(e),r=e.endsWith("/")?e:`${e}/`;return t.push(...Rb(`${r}index`)),t}async function tr(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(AC(a.status)&&s<e)continue;return a}catch{if(s<e)continue;return}finally{clearTimeout(o)}}}function AC(n){return n===408||n===429||n>=500&&n<600}var oa=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)||ia(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 j({name:e,version:t})),s=await tr(r);if(!s?.ok)return;let i;try{i=await s.json()}catch{return}if(i)return{pkg:i,baseDir:this.cdnClient.baseDir(new j({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=Gt(e.path);if(!o||o==="/"||o===".")return this.tryUntilSuccess([...vs],t);if(!Ed.test(o)){let a=await this.tryUntilSuccess(Dt(o),t);if(a)return a}return t(o)}let s=Dt(e.path),i=r?.subpath?[...s,...vs]:[...vs,...s];return this.tryUntilSuccess(i,t)}toResolutionResult(e){return{kind:Ed.test(e)?"types":"probe",path:e}}resolveExportsPath(e,t){let r=t||".",s=e;try{let i=this.extractPathFromResult(_b(s,r,{conditions:["types"]}));if(i)return i}catch{}try{return this.extractPathFromResult(_b(s,r,{browser:!0,conditions:["import","default","module","browser","node"]}))}catch{return}}async resolve(e){try{let t=j.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 j(i).format(),a=new j({...i,subpath:t.subpath}).format(),c=u=>this.fetchCandidateFrom(s,t.name,u);if(t.subpath){let u=Jl(t.subpath),f=this.resolveExportsPath(r,u);if(f){let h=await this.resolveFromSelected(this.toResolutionResult(f),c,{subpath:!0});if(h)return{...h,resolvedPkg:a}}let p=await this.tryUntilSuccess(Dt(u),c);if(p)return{...p,resolvedPkg:a}}let l=r.types??r.typings;if(l){let u=await this.resolveFromSelected({kind:"types",path:l},c);if(u)return{...u,resolvedPkg:o}}let d=this.resolveExportsPath(r,".");if(d){let u=await this.resolveFromSelected(this.toResolutionResult(d),c);if(u)return{...u,resolvedPkg:o}}return}catch{return}}async fetchCandidateFrom(e,t,r){let s=Gt(r),i=new URL(s,e).toString(),o=await this.tryUrls([i]);return o?{dts:o.dts,url:o.url,resolvedPkg:t}:void 0}};nt();import{gunzipSync as TC}from"fflate";var aa=class{async fetchAndExtract(e,t){let r=this.getTarballUrl(e,t),s=await tr(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=TC(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),c=a.indexOf(0),l=s.decode(a.slice(0,c>0?c:100)).trim(),d=o.slice(124,136),u=s.decode(d).trim().replace(/\0/g,""),f=parseInt(u,8)||0,p=String.fromCharCode(o[156]);if(i+=512,(p==="0"||p==="\0")&&(l.endsWith(".d.ts")||l.endsWith(".d.mts"))){let h=r.slice(i,i+f);t.set(this.normalizeTarPath(l),s.decode(h))}i+=Math.ceil(f/512)*512}}catch{}return t}};var ca=class{constructor(e,t,r=new aa){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=Xt.majorOf(r),o=e.filter(a=>Xt.majorOf(a)===i);if(o.length)return o.sort((a,c)=>Xt.cmp(c,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=Dt(e);return t!==e&&r.push(`${e}.d.ts`,`${e}/index.d.ts`),r}async fetchFromVersionedRoot(e,t){let r=new j(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,c]of i.entries()){let l=this.cdnClient.file(e,a);try{await this.cache.setCachedFile(l,c)}catch{}}let o=t.subpath?this.subpathCandidates(t.subpath):["index.d.ts"];for(let a of o){let c=i.get(a);if(c)return{dts:c,url:this.cdnClient.file(e,a),resolvedPkg:t.subpath?new j(t).format():t.name}}}async resolve(e){let t=j.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 la=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(`
|
|
1884
1989
|
`).filter(s=>{let i=s.trimStart();return!(i.startsWith("*")||i.startsWith("//")||i.startsWith("/*"))}).join(`
|
|
1885
|
-
`),
|
|
1886
|
-
`);await this.prefetchBareDeps(h,l,f,p,s);let m=c.format(),b=e===m?[e]:[e,m],A=b.some(
|
|
1887
|
-
`,"utf8"),await pe.writeFile(de.join(e,"code.tsx"),
|
|
1888
|
-
`,"utf8"),{dir:e}}function
|
|
1889
|
-
`))console.log(`${e} ${
|
|
1990
|
+
`),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://"))}};nt();var Nb="file:///node_modules",ua=class{constructor(){this.epoch=0}bumpEpoch(){this.epoch+=1}epochDir(){return`__tsepoch_${this.epoch}`}pathForMain(e){return`${Nb}/${this.epochDir()}/${e}/index.d.ts`}pathFor(e,t){let r=Gt(t);return`${Nb}/${this.epochDir()}/${e}/${r}`}};import{LRUCache as OC}from"lru-cache";function Ib(n){let e=new OC({ttl:lt.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 c=await tr(s,{init:{cache:"no-store"}});if(!c?.ok){c?.status===404&&(e.set(s,!0),await n.recordNegative(s));return}let l=await c.text(),d=c.url||s;return await n.clearNegative(s),await n.setCachedFile(d,l),{dts:l,url:d}})();return t.set(s,a),await a.finally(()=>t.delete(s))}catch{return}}}var Ss=class{constructor(e){this.inFlight=new Map,this.scanner=new la,this.cache=e.cache,this.cdnClient=e.cdnClient,this.versionResolver=e.versionResolver,this.packageService=e.packageService,this.fetchDts=Ib(e.cache),this.typescriptProvider=new oa(this.fetchDts,e.cdnClient),this.definitelyTypedProvider=new ca(e.cdnClient,e.cache),this.virtualFs=new ua}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 c=o.url??this.cdnClient.file(i?`${s}@${i}`:s,"index.d.ts");return{dts:o.content,url:c,resolvedPkg:r}}let a;try{a=await this.fetchViaProviders(r)}catch{return}if(!(!a?.dts||!a.url)&&new j(r).subpath===new j(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>lt.maxRelativeTypeRefs)))try{let a=new URL(t),c=new URL("./",a);o??(o=this.extractPackageRootUrl(a));let l=this.scanner.collectRelativeTypeRefs(e).slice(0,lt.maxRelativeTypeRefs);for(let d of l)await this.tryRelativeRef(d,c,o,r,s,i)}catch{}}async tryRelativeRef(e,t,r,s,i,o){try{let a=new URL(e,t),c=a.pathname+a.search,l=ia(c)?[c]:Dt(c);for(let d of l){let f=new URL(d,a).toString();if(o.has(f))return;let p=await this.fetchDts(f);if(p?.dts){let h=this.toVirtualPath(r,new URL(p.url),s);this.pushFileIfNew(i,h,p.dts),await this.expandRelativeRefs(p.dts,p.url,s,i,o,r);return}}}catch{}}isDifferentPackage(e,t){return e===t?!1:new j(e).name!==new j(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,lt.maxBareDeps).filter(l=>this.isDifferentPackage(l,t));if(!o.length)return;let a=new Set([t]),c=PC(lt.prefetchConcurrency);await Promise.all(o.map(l=>c(()=>this.prefetchBareDepsRecursive(l,r,s,lt.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 c=a.resolvedPkg||e,l=this.virtualFs.pathForMain(c);this.pushFileIfNew(t,l,a.dts),this.ambientlyDeclares(a.dts,e)?this.markFileAmbient(t,l):r.push({module:e,path:l}),a.url&&await this.expandRelativeRefs(a.dts,a.url,c,t);let d=this.scanner.collectBareModuleRefs(a.dts).slice(0,lt.maxBareDeps).filter(u=>!i.has(u));for(let u of d)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 j(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,c=new j(a||r),l=c.version?`${c.name}@${c.version}`:c.name,{mainPath:d,packageRootUrl:u}=this.computeEntryPath(o,l),f=[{path:d,content:i}],p=[];o&&await this.expandRelativeRefs(i,o,l,f,void 0,u);let h=f.map(S=>S.content).join(`
|
|
1991
|
+
`);await this.prefetchBareDeps(h,l,f,p,s);let m=c.format(),b=e===m?[e]:[e,m],A=b.some(S=>this.ambientlyDeclares(i,S));return A?this.markFileAmbient(f,d):p.push(...b.map(S=>({module:S,path:d}))),{pkg:e,mainPath:d,files:f,shims:p,ambient:A}}};Zl();nt();Nn();ts();Xl();_n();import*as nr from"path";var CC=nr.join(Qi,"pkg"),RC=nr.join(Qi,"files"),_C=nr.join(Qi,"negative.json"),fa=class{pkgMem=new Map;fileMem=new Map;negativeCache=new Qt(new In(_C));async getCachedDts(e){if(this.pkgMem.has(e))return this.pkgMem.get(e);await Z();let t=await rt($b(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 da(async()=>{await Z(),await Ae($b(e),JSON.stringify(s))})}async getCachedFile(e){if(this.fileMem.has(e))return this.fileMem.get(e);await Z();let t=await Xi(Lb(e));return this.fileMem.set(e,t),t}async setCachedFile(e,t){this.fileMem.set(e,t),await da(async()=>{await Z(),await Ae(Lb(e),t)})}isNegative(e){return this.negativeCache.isNegative(e)}async recordNegative(e){await da(async()=>{await Z(),await this.negativeCache.recordNegative(e)})}clearNegative(e){return da(()=>this.negativeCache.clearNegative(e))}};async function da(n){try{await n()}catch{}}function $b(n){return nr.join(CC,De(n)+".json")}function Lb(n){return nr.join(RC,De(n)+".txt")}Nn();var Ad;function NC(){return Ad||(Ad=new Ss({cache:new fa,cdnClient:dg,packageService:no,versionResolver:ug})),Ad}var Mb="file:///node_modules/";async function Bb(n){let e=Zi(n.emitKey,"typecheck");await Z(),await pe.rm(e,{recursive:!0,force:!0}),await pe.mkdir(e,{recursive:!0});let t=MC(n.jsxImportSource,n.dependencies),r=await NC().resolve(n.code,n.dependencies,t),s=n.local?.name,i=s?r.filter(d=>d.pkg!==s):r,o=new Set;for(let d of i)for(let u of d.files){let f=pa(u.path);if(!f||o.has(f))continue;o.add(f);let p=de.join(e,"node_modules",f);await pe.mkdir(de.dirname(p),{recursive:!0}),await pe.writeFile(p,u.content,"utf8")}let a={};for(let d of i)for(let u of d.shims){let f=pa(u.path);f&&(a[u.module]=[`./node_modules/${f}`])}for(let d of i){if(d.ambient)continue;let u=pa(d.mainPath);u&&(a[d.pkg]=[`./node_modules/${u}`])}let c=new Set;for(let d of i)for(let u of d.files){if(!u.ambient)continue;let f=pa(u.path);f&&c.add(`node_modules/${f}`)}if(n.local){delete a[n.local.name];let d=await BC(n.local,e);d?a[n.local.name]=[`./node_modules/${n.local.name}/${d}`]:console.warn(` local: '${n.local.name}' ships no type defs; check cannot type against it.`)}let l=IC(n.jsxImportSource,a,[...c]);return await pe.writeFile(de.join(e,"tsconfig.json"),JSON.stringify(l,null,2)+`
|
|
1992
|
+
`,"utf8"),await pe.writeFile(de.join(e,"code.tsx"),n.code,"utf8"),await pe.writeFile(de.join(e,"tb.d.ts"),kd,"utf8"),{dir:e}}var Td={target:"es2023",module:"esnext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0};function IC(n,e,t=[]){return{compilerOptions:{...Td,lib:$C([...wd,...vd]),jsx:"react-jsx",jsxImportSource:n??"react",paths:e},include:["code.tsx","tb.d.ts",...t]}}function $C(n){return Sd(n).map(e=>LC(e.name))}function LC(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 MC(n,e){let t=n??("react"in e?"react":void 0);return t?[`${t}/jsx-runtime`,`${t}/jsx-dev-runtime`]:[]}function pa(n){if(!n.startsWith(Mb))return;let e=n.slice(Mb.length),t=e.indexOf("/");if(!(t<0))return e.slice(t+1)}async function BC(n,e){if(!n.typesAbs)return;let t=de.dirname(n.typesAbs),r=de.join(e,"node_modules",n.name);for(let s of await DC(t)){let i=de.join(r,de.relative(t,s));await pe.mkdir(de.dirname(i),{recursive:!0}),await pe.copyFile(s,i)}return de.basename(n.typesAbs)}async function DC(n){let e=[];async function t(r){let s=await pe.readdir(r,{withFileTypes:!0});for(let i of s){let o=de.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 Pe from"fs/promises";import*as ut from"path";import{existsSync as jC}from"fs";Nn();eu();var FC="^22";async function Db(n){let e=Zi(n.emitKey,"typecheck-server");await Z(),await Pe.rm(e,{recursive:!0,force:!0}),await Pe.mkdir(e,{recursive:!0});let t=ut.join(n.bulbDir,".typebulb"),r=uo(n.server).filter(o=>o!==n.local?.name);await lo([`@types/node@${FC}`,...r],t,n.dependencies,{ignoreScripts:!0});let s=ut.join(t,"node_modules"),i=ut.join(e,"node_modules");return await UC(s,i),await Pe.writeFile(ut.join(e,"server.ts"),n.server,"utf8"),await Pe.writeFile(ut.join(e,"tb.d.ts"),xd,"utf8"),await Pe.writeFile(ut.join(e,"tsconfig.json"),JSON.stringify(qC(n.local),null,2)+`
|
|
1993
|
+
`,"utf8"),{dir:e}}function qC(n){let e={...Td,lib:["ES2023"],types:["node"]};if(n?.typesAbs){let t=i=>i.replace(/\\/g,"/"),r=t(ut.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 UC(n,e){if(!jC(n)){await Pe.mkdir(e,{recursive:!0});return}await Pe.rm(e,{recursive:!0,force:!0});let t=process.platform==="win32"?"junction":"dir";await Pe.symlink(n,e,t)}Yi();le();async function Fb(n,e){let{bulb:t,config:r,warnings:s,starts:i}=await Ue(n),o=Ce.basename(n),a=m=>i.get(m)??1;!t.code&&!t.server&&(console.error("Bulb has neither **code.tsx** nor **server.ts**; nothing to check."),process.exit(1));let c=!1,l=!1;for(let m of s)console.log(`structure ${m}`);s.length&&(c=!0);let d=Un(Ce.resolve(n)),u=d?An(t.name):"";d&&u&&u!==d.slug&&(console.log(`naming filename '${d.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.`),l=!0),t.code&&(c=jb(Hr(t.code,{target:"client",dependencies:r.dependencies??{},lineOffset:a("code.tsx")}),"client")||c),t.server&&(c=jb(Hr(t.server,{target:"server",lineOffset:a("server.ts")}),"server")||c);let f=GC([process.cwd(),Ce.dirname(n)]);if(!f){let m=Ce.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 ${m}`),process.exit(2)}let p=[];if(t.code){let{dir:m}=await Bb({code:t.code,dependencies:r.dependencies??{},jsxImportSource:r.ts?.jsxImportSource,emitKey:n,local:e});p.push({role:"client",dir:m})}if(t.server){let{dir:m}=await Db({server:t.server,bulbDir:Ce.dirname(n),emitKey:n,local:e?{name:e.name,typesAbs:e.typesAbs}:void 0,dependencies:r.dependencies});p.push({role:"server",dir:m})}for(let{role:m,dir:b}of p){let{stdout:A,exitCode:S}=await VC(f,b);for(let P of A.split(/\r?\n/))P.trim()&&console.log(`${m} ${YC(P,o,a)}`);S!==0&&(c=!0)}c&&process.exit(1);let h=[t.code&&"code.tsx",t.server&&"server.ts"].filter(Boolean).join(", ");console.error(l?`\u2713 type-checks (${h}) \u2014 see the naming warning above`:`\u2713 no issues (${h})`)}function jb(n,e){for(let t of n)for(let r of t.message.split(`
|
|
1994
|
+
`))console.log(`${e} ${r}`);return n.length>0}function YC(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 VC(n,e){return new Promise(t=>{let r=JC(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 zC=HC(import.meta.url);function GC(n){let e=r=>{try{let s=zC.resolve("typescript/package.json",{paths:r}),i=Ce.join(Ce.dirname(s),"lib","tsc.js");return WC(i)?i:void 0}catch{return}},t=e(n);if(t)return t;try{let r=KC("npm root -g",{encoding:"utf8"}).trim();return e([r])}catch{return}}Ve();_o();cs();async function qb(n,e){let{bulb:t}=await Ue(n),r=Kn(t);if(sn(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.)")}cs();import*as ks from"path";async function Ub(n,e){if(!n){e||(console.error("Usage: typebulb untrust <file.bulb.md>"),process.exit(1));let r=Ou();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=ks.resolve(n);t.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1));try{Hn(t,e)}catch(r){console.error(r.message),process.exit(1)}console.log(e?`Trusted ${ks.basename(t)} \u2014 runs with fs / AI / server.ts (no --trust needed).`:`Untrusted ${ks.basename(t)} \u2014 runs Restricted.`),console.log(` ${t}`)}Be();import*as Kb from"readline";Pu();function Od(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")}}async function Hb(n){let e=wb(process.cwd());if("ambiguous"in e){let t=await XC(n,e.ambiguous);return t?Jb(n,t):QC(n,e.ambiguous)}return Jb(n,e.name)}async function Jb(n,e){let t,r;try{t=await jh(e)}catch(d){r=d instanceof Error?d.message:String(d)}let{lit:s,litLink:i,brand:o}=Od(process.stdout.isTTY===!0),a=[" Read the authoring skill before writing a bulb:",` \u2022 ${s(ls())}`],c=t?[` Agent mirror (${e}) is live\u{1F4A1}`,` ${s("\u25CF")} ${i(t.url)}`," Embedded bulbs render live here."," Agents:",` Reusable app/tool \u2192 write a ${s(".bulb.md")}`," Show something inline \u2192 embed a bulb",...e==="codex"?[" verify it this turn \u2014 foreground-wait, bounded:",` \u2022 ${s('typebulb wait agent --match "[embed <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 ${s('typebulb wait agent --match "[embed <name>"')}`],...a," End this reply with the mirror link above"," \u2022 easy to miss the link mid-message"]:[` The mirror did not start (${r})`,` \u25CF Start it manually: ${s(`npx typebulb agent:${e}`)}`," Agents:",...a],l=[` ${o(`typebulb v${n}`)}`,...c,""];process.stdout.write(l.join(`
|
|
1890
1995
|
`)+`
|
|
1891
|
-
`)}async function
|
|
1996
|
+
`)}async function XC(n,e){if(!process.stdin.isTTY||!process.stdout.isTTY)return;let{lit:t,brand:r}=Od(!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(`
|
|
1892
1997
|
`)+`
|
|
1893
|
-
`);let i=
|
|
1998
|
+
`);let i=Kb.createInterface({input:process.stdin,output:process.stdout});try{let o=(await new Promise(c=>i.question(" Open which? [1]: ",c))).trim();if(o==="")return e[0];let a=Number(o);return Number.isInteger(a)&&a>=1&&a<=e.length?e[a-1]:e.find(c=>c===o.toLowerCase())}finally{i.close()}}function QC(n,e){let{lit:t,brand:r}=Od(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(`
|
|
1894
1999
|
`)+`
|
|
1895
|
-
`)}
|
|
1896
|
-
`+e)}function
|
|
2000
|
+
`)}it();nn();async function Wb(n){Te(n);let e=await ot();if(e.length>0){console.log(Rg(e,process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL));return}if(!hu()){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(Dn))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.")}le();function Yb(n){n?.trim()||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1));let e=An(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)}At();import*as zb from"path";import{valid as Vb,lt as ZC}from"semver";Be();Fi();function eR(n,e,t,r){if(/^\d+$/.test(e))return n.find(i=>i.pid===parseInt(e,10));let s=e==="agent"?n.filter(i=>i.agent!=null):n.filter(i=>i.agent===e);if(s.length){if(!t)return s[0];let i=s.filter(o=>o.cwd&&X(o.cwd)===X(t));return r&&i.find(o=>o.agent===r)||i[0]}return n.find(i=>X(i.file)===X(e))}var xs=n=>n.agent??zb.basename(n.file);function tR(n){return n===Me?"":n?(Vb(n)&&Vb(Me)?ZC(n,Me):!0)?` STALE runtime v${n} (this CLI is v${Me} \u2014 relaunch to update)`:` runtime v${n} (newer than this CLI's v${Me})`:" STALE runtime (predates the version stamp \u2014 relaunch to update)"}function Gb(n,e){for(let t of n)e(` ${t.url} pid ${t.pid} ${t.trust?"trusted":"restricted"}${t.batch?` --batch ${t.batch}`:""}${tR(t.version)} ${t.file}`)}function Pd(n,e){if(!n.length){console.log("No running bulb servers.");return}console.log("Running bulb servers:"),Gb(n,t=>console.log(t)),console.log(`
|
|
2001
|
+
`+e)}function Cd(n,e,t,r,s){let i=eR(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>\`):`),Gb(n,o=>console.error(o))):console.error("No bulb servers are running."),process.exit(1)}async function Xb(n,e){if(!n){e.clear&&(console.error("Specify which server to clear: typebulb logs --clear <file|pid>"),process.exit(1)),Pd(await Q(process.cwd()),"Run `typebulb logs <file|pid>` to print one server's console.");return}let t=Cd(await Q(),n,"logs",process.cwd(),fn());if(e.clear){Ih(t.pid),console.log(`Cleared log for ${xs(t)} (pid ${t.pid}).`);return}let r=We(t.pid),s=r.text;if(e.run!==void 0?(s=$h(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(`
|
|
1897
2002
|
`);i.length&&i[i.length-1]===""&&i.pop(),s=i.slice(-e.lines).join(`
|
|
1898
2003
|
`)}if(process.stdout.write(s),s&&!s.endsWith(`
|
|
1899
2004
|
`)&&process.stdout.write(`
|
|
1900
|
-
`),e.follow&&e.run===void 0){let i=
|
|
1901
|
-
`);m=
|
|
2005
|
+
`),e.follow&&e.run===void 0){let i=r.offset,o=setInterval(()=>{let c=We(t.pid,i);i=c.offset,c.text&&process.stdout.write(c.text)},500),a=()=>{clearInterval(o),process.exit(0)};process.on("SIGINT",a),process.on("SIGTERM",a),await new Promise(()=>{})}}var nR=n=>new Promise(e=>setTimeout(e,n));async function Qb(n,e){if(!n){Pd(await Q(process.cwd()),"Run `typebulb wait <file|pid>` to block until one logs a new line.");return}let t=Cd(await Q(),n,"wait",process.cwd(),fn()),r=t.agent!=null,i=process.env.TYPEBULB_WAIT_SHIM==="1",o=e.timeoutSec??1800,a=e.match??"",c=We(t.pid).offset,l=Il(t.pid,a)??(a?Il(t.pid):void 0),d=l!==void 0&&l<=c?l:a?0:c,u=Date.now()+o*1e3,f=r?1e4:1e3,p=2e3,h,m="",b=0;for(;;){let A=We(t.pid,d);if(d=A.offset,A.text){m+=A.text;let S=m.split(`
|
|
2006
|
+
`);m=S.pop()??"";for(let P of S)P.trim()&&(e.match&&!P.includes(e.match)||(console.log(P),h??=Date.now()+f,r&&(P.includes("] compile error")||P.includes("] runtime error"))&&(h=Math.min(h,Date.now()+p))))}if(h&&Date.now()>=h)break;if(!i&&!h&&Date.now()>=u){console.error(`timeout: no ${e.match?`line matching '${e.match}'`:"new output"} from ${xs(t)} within ${o}s`),b=2;break}if(!Ll(t.pid)){h||(console.error(`server ${xs(t)} (pid ${t.pid}) exited while waiting`),process.exit(3));break}await nR(400)}Ui(t.pid,d,a),process.exit(b)}async function Zb(n){if(!n){Pd(await Q(process.cwd()),"Run `typebulb stop <file|pid>` to stop one.");return}let e=Cd(await Q(),n,"stop",process.cwd(),fn());await Yt(e.pid),console.log(`Stopped ${xs(e)} (pid ${e.pid}, ${e.url}).`)}async function ew(n){let e=process.cwd(),t=n==="agent"?fn():void 0,r=n==="global"?await Q():n==="bulbs"?await Q(e):(await Q()).filter(i=>i.agent!=null&&i.cwd!=null&&X(i.cwd)===X(e)&&(!t||i.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}await Promise.all(r.map(i=>Yt(i.pid))),console.log(`Stopped ${r.length} ${s}${r.length===1?"":"s"}:`);for(let i of r)console.log(` ${i.url} pid ${i.pid} ${xs(i)}`)}Be();At();Jn();import*as ma from"path";import*as tw from"http";import{mkdir as rR,writeFile as sR}from"fs/promises";function iR(n,e){return new Promise((t,r)=>{let s=new URL(n),i=tw.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",c=>{a+=c}),o.on("end",()=>t({status:o.statusCode??0,text:a}))});i.setTimeout(0),i.on("error",r),i.end(e)})}var oR=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 nw(n,e,t=0){let r=e!==void 0&&e.startsWith("tb:");r&&t<=0&&(t=bd);let s=e!==void 0&&/^tb:(click|set)( |$)/.test(e),i=ma.resolve(n),o=On(await Q(),i)[0];if(!o){let p=(await as(process.cwd()))(i);console.error(p?`No running server for '${n}' \u2014 it last ran ${oR(p)}. 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 p=>{let h=[p>0?`reply=${p}`:"",s?"solo=1":""].filter(Boolean).join("&"),m=await iR(`${o.url}/__send${h?`?${h}`:""}`,e??"");(m.status<200||m.status>=300)&&(console.error(`send failed: HTTP ${m.status} from ${o.url}/__send`),process.exit(1));try{return JSON.parse(m.text)}catch{return{}}},c={};try{let p=Date.now()+t;do{if(c=await a(t>0?Math.max(p-Date.now(),1e3):0),(c.clients??0)>0||Date.now()>=p)break;await new Promise(h=>setTimeout(h,150))}while(!0)}catch(p){console.error(`send failed: ${p instanceof Error?p.message:String(p)}`),process.exit(1)}let l=c.clients??0,d=`${l} page${l===1?"":"s"}`;if(c.refused&&(console.error(`Actuation needs exactly one connected page; ${d} are open on ${o.url} \u2014 close the extras and retry.`),process.exit(1)),l===0){let p=c.droppedMsAgo,h=p!==void 0?` \u2014 a page disconnected ${Math.round(p/1e3)}s ago and hasn't reconnected; reload it, or open ${o.url}`:` \u2014 no page has ever connected; share ${o.url} and arm: typebulb wait ${n} --match "[page] connected"`;t>0?console.error(`No page connected after ${t/1e3}s${h}`):console.error(`Sent, but no page is connected${h}`),r&&process.exit(1);return}console.error(`Sent to ${d}.`);let u=c.results??[],f=c.errors??[];for(let p of f)console.error(`handler error: ${p}`);if(f.length&&process.exit(1),u.length>1&&(console.error(`${u.length} replies from ${d} \u2014 one reply owns stdout: at most one tb.onMessage handler, in one page, may return a value.`),process.exit(1)),u.length===1){if(e!==void 0&&/^tb:png( |$)/.test(e)){let h={};try{h=JSON.parse(u[0])}catch{}typeof h.png!="string"&&(console.error("tb:png replied with an unexpected shape \u2014 an older runtime? (`typebulb logs` lists server versions)"),process.exit(1));let m=Ah(i);await rR(ma.dirname(m),{recursive:!0}),await sR(m,Buffer.from(h.png,"base64"));let b=[h.via?`inside "${h.via}"`:"",h.backdrop?`backdrop ${h.backdrop}`:""].filter(Boolean);console.error(`canvas ${h.width}\xD7${h.height} \u2192 PNG${b.length?` (${b.join("; ")})`:""}`),console.log(m);return}let p;try{p=JSON.parse(u[0])}catch{p=void 0}console.log(typeof p=="string"?p:u[0])}else c.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)`))}Mo();$u();le();import*as rw from"fs/promises";async function sw(n,e){let t=await rw.readFile(n,"utf-8"),r=ue(t);r||(console.error(`Not a valid bulb: ${n}`),process.exit(1));let s=ae[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(`
|
|
1902
2007
|
`)?i:i+`
|
|
1903
|
-
`)}le();import*as
|
|
1904
|
-
`).trimEnd()}function
|
|
2008
|
+
`)}le();import*as Es from"fs/promises";async function aw(n,e){let t=await Es.readFile(n,"utf-8"),r=[];for(let{kind:i,source:o}of e){let a;try{a=o==="-"?await cR():await Es.readFile(o,"utf-8")}catch(c){ow(`Cannot read ${i}'s source: ${c instanceof Error?c.message:String(c)}`)}r.push({kind:i,content:cw(a),label:o==="-"?"stdin":o})}let s;try{s=aR(t,r)}catch(i){ow(`${n}: ${i instanceof Error?i.message:String(i)}`)}for(let i of s.upToDate)console.log(`${ae[i].path}: already up to date`);if(s.written.length){await Es.writeFile(n,s.text);for(let i of s.written)console.log(i.action==="removed"?`${ae[i.kind].path}: removed (${i.label} is empty)`:`${ae[i.kind].path}: ${i.action} from ${i.label} (${i.chars.toLocaleString()} chars)`)}}function aR(n,e){let t=ue(n);if(!t)throw new Error("not a valid bulb");let r=n,s=[],i=[];for(let{kind:o,content:a,label:c}of e){let l=ae[o].path,d=t.files.get(l);if(!a){if(d===void 0){i.push(o);continue}r=iw(rf(r,o),r,l),s.push({kind:o,action:"removed",chars:0,label:c});continue}if(d!==void 0&&cw(d)===a){i.push(o);continue}r=iw(rr(r,o,a),r,l),s.push({kind:o,action:d===void 0?"created":"replaced",chars:a.length,label:c})}return{text:r,written:s,upToDate:i}}function cw(n){return(n.charCodeAt(0)===65279?n.slice(1):n).replace(/\r\n/g,`
|
|
2009
|
+
`).trimEnd()}function iw(n,e,t){if(n===e)throw new Error(`the **${t}** block's fence is unterminated; refusing to rewrite inside it`);return n}function ow(n){console.error(n),process.exit(1)}async function cR(){let n=[];for await(let e of process.stdin)n.push(e);return Buffer.concat(n).toString("utf-8")}it();Ve();le();_o();import*as Ft from"fs/promises";import*as Sa from"path";import{EventEmitter as mw}from"events";import AR from"open";Bn();le();import{Hono as mR}from"hono";import{serve as hR}from"@hono/node-server";import{streamSSE as gR}from"hono/streaming";import*as Id from"fs/promises";Nn();ts();_n();import*as Rd from"fs/promises";import*as As from"path";var ha=class{async get(e){let t=De(e),r=As.join(es,t+".bin"),s=As.join(es,t+".json");try{let[i,o]=await Promise.all([Rd.readFile(r),Rd.readFile(s,"utf8")]),a=JSON.parse(o);return{body:i,contentType:a.contentType,cacheControl:a.cacheControl}}catch{return}}async set(e,t){await Z();let r=De(e),s=As.join(es,r+".bin"),i=As.join(es,r+".json"),o={url:e,contentType:t.contentType,cacheControl:t.cacheControl};await Promise.all([Ae(s,t.body),Ae(i,JSON.stringify(o))])}};var lw=`
|
|
1905
2010
|
const CSS = '\\n' +
|
|
1906
2011
|
/* The agent mirror's token set, verbatim (agents/core/client/styles.css) \u2014 one system across CLI
|
|
1907
2012
|
chrome: app chrome sits on --panel, content wells paint --veil, grays ride one neutral tint.
|
|
@@ -2205,18 +2310,18 @@ export function runInference(ctx) {
|
|
|
2205
2310
|
showConfirm();
|
|
2206
2311
|
document.body.appendChild(host);
|
|
2207
2312
|
}
|
|
2208
|
-
`;
|
|
2209
|
-
${f}`:"";return y.text(`Forbidden: this capability requires --trust.${M}`,403)}await E()},C=async(y,E)=>{let N=y.req.header("sec-fetch-site");if(N){if(N!=="same-origin")return y.text(`Forbidden: ${N} request`,403)}else{let L=y.req.header("origin");if(L&&!
|
|
2210
|
-
`+ee.slice(-4e3)),new
|
|
2313
|
+
`;Be();nn();So();Bn();import{stream as lR}from"hono/streaming";var uR="X-TB-Stream";function Ts(n){return n instanceof ve?{message:n.message,code:n.code,retryable:n.retryable}:{message:n instanceof Error?n.message:"Unknown error",code:"unknown",retryable:!1}}function ga(n,e){return n.header("Content-Type","application/x-ndjson; charset=utf-8"),n.header("Cache-Control","no-cache"),n.header(uR,"1"),lR(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:Ts(s)}))}finally{try{await r.return?.()}catch{}}})}var ya={log:(...n)=>console.log(...n)};function ba(n,e){let t=n?.[e]??(Object.hasOwn(ya,e)?ya[e]:void 0);return typeof t=="function"?t:void 0}function wa(n){return n.constructor?.name==="AsyncGeneratorFunction"}gu();var dR=/^\/(v\d+\/|stable\/|node\/|gh\/|@[^/]+\/[^@/]+@|[^@/]+@)/,fR=/[?&]target=/,pR=/^\/(?:@[^/]+\/)?[^/@]+\/[^/]+/;function uw(n,e=""){return dR.test(n)?!0:pR.test(n)&&fR.test(e)}var yR="127.0.0.1",bR=new Set(["localhost","127.0.0.1","::1"]),wR=0;function vR(n){if(n)try{return new URL(n.includes("://")?n:`http://${n}`).hostname}catch{return}}function SR(n){let e=vR(n);return!!e&&bR.has(e)}function kR(n,e){if(!e)return!1;try{return new URL(n).host===e}catch{return!1}}function _d(n){return n instanceof Error?n.message:"Unknown error"}async function fw(n){let{getHtml:e,basePath:t,fsBase:r,port:s,reloadEmitter:i,messageEmitter:o,getServerExports:a,getBulbBlocks:c,saveInferenceResult:l,localOverride:d,trusted:u=!1,trustHint:f,staticAssets:p,bulbAssets:h,sourceFile:m}=n,b=`${process.pid}-${++wR}-${Date.now()}`,A=r??t,S=new mR;S.use("*",async(y,E)=>{if(!SR(y.req.header("host")))return y.text("Forbidden: untrusted Host",403);await E()}),S.use("*",async(y,E)=>{await E(),y.res.headers.set("Cross-Origin-Opener-Policy","same-origin"),y.res.headers.set("Cross-Origin-Embedder-Policy","credentialless")});let P=[["/__fs/*","the filesystem"],["/__api/*","server-side code (server.ts)"],["/__ai","AI (your API keys)"],["/__infer","AI (your API keys)"],["/__infer-save","the filesystem"]],_=async(y,E)=>{if(!u){let N=new URL(y.req.url).pathname,L=P.find(([H])=>H.endsWith("/*")?N.startsWith(H.slice(0,-2)):N===H)?.[1]??"server-side code (server.ts)";Mh(process.pid,L);let M=f?`
|
|
2314
|
+
${f}`:"";return y.text(`Forbidden: this capability requires --trust.${M}`,403)}await E()},C=async(y,E)=>{let N=y.req.header("sec-fetch-site");if(N){if(N!=="same-origin")return y.text(`Forbidden: ${N} request`,403)}else{let L=y.req.header("origin");if(L&&!kR(L,y.req.header("host")))return y.text("Forbidden: cross-origin request",403)}await E()};for(let[y]of P)S.use(y,_),S.use(y,C);S.use("/__log",C),S.post("/__log",async y=>{try{let{args:E}=await y.req.json();console.log(...E||[])}catch{}return y.json({ok:!0})});let R=0;if(o){let y=0,E=new Map;S.use("/__send",C),S.post("/__send",async N=>{let L="";try{L=await N.req.text()}catch{}let M=Number(N.req.query("reply"))||0,H=o.listenerCount("message"),G=H===0&&R?Date.now()-R:void 0;if(N.req.query("solo")!==void 0&&H!==1)return N.json({clients:H,droppedMsAgo:G,refused:H>1});if(M<=0||H===0)return o.emit("message",{payload:L}),N.json({clients:H,droppedMsAgo:G});let me=++y,ee=await new Promise(ie=>{let ke={expected:H,received:0,results:[],errors:[],finish:ka=>{clearTimeout(Re),E.delete(me),ie({results:ke.results,errors:ke.errors,timedOut:ka})}},Re=setTimeout(()=>ke.finish(!0),M);E.set(me,ke),o.emit("message",{id:me,payload:L})});return N.json({clients:H,...ee})}),S.use("/__send-reply",C),S.post("/__send-reply",async N=>{try{let{id:L,results:M,errors:H}=await N.req.json(),G=E.get(L);G&&(G.results.push(...M??[]),G.errors.push(...H??[]),++G.received>=G.expected&&G.finish(!1))}catch{}return N.json({ok:!0})})}S.get("/",y=>y.html(e())),S.post("/__fs/read",async y=>{try{let{path:E}=await y.req.json(),N=await is(E,A,t);return new Response(new Uint8Array(N),{headers:{"Content-Type":"application/octet-stream"}})}catch(E){let N=_d(E);return y.json({error:N},400)}}),S.post("/__fs/write",async y=>{try{let E=y.req.query("path");return E?(await xo(E,new Uint8Array(await y.req.arrayBuffer()),A,t),y.json({success:!0})):y.json({error:"Missing path"},400)}catch(E){let N=_d(E);return y.json({error:N},400)}}),S.post("/__api/:name",async y=>{try{let E=y.req.param("name"),N=ba(a?.(),E);if(!N)return y.json({error:`API function '${E}' not found`},404);let{args:L}=await y.req.json();if(wa(N))return ga(y,N(...L||[]));let M=await N(...L||[]);return y.json({result:M})}catch(E){let N=_d(E);return y.json({error:N},500)}}),S.post("/__ai",async y=>{try{let{messages:E,system:N,effort:L,provider:M,model:H,webSearch:G,stream:me}=await y.req.json();if(!E||!Array.isArray(E)||E.length===0)return y.json({message:"messages array is required",code:"unknown",retryable:!1},400);let ee=at(M,H);if(typeof ee=="string")return y.json({message:ee,code:"unknown",retryable:!1},400);let ie=await Nt(ee,{messages:E,system:N,effort:L,webSearch:G,signal:y.req.raw.signal});if(!ie.ok){let Re=await Mn(ie,ee.protocol);return y.json(Re,ie.status)}if(me)return ga(y,tn(ie,ee.protocol));let ke=await en(ie,ee.protocol);return ke||console.warn("[tb.ai] Empty response from provider"),y.json({text:ke})}catch(E){return y.json(Ts(E),500)}}),S.post("/__infer",async y=>{try{let{data:E}=await y.req.json().catch(()=>({})),N=c?.();if(!N?.infer.trim())return y.json({message:"This bulb has no infer.md block.",code:"unknown",retryable:!1},400);let L=at();if(typeof L=="string")return y.json({message:L,code:"unknown",retryable:!1},400);let M=Array.isArray(E)?E.map(String):[],H=uu(N,M),G=await Nt(L,{messages:[{role:"user",content:H}],signal:y.req.raw.signal});if(!G.ok){let ee=await Mn(G,L.protocol);return y.json(ee,G.status)}let me=(async function*(){let ee="";for await(let Re of tn(G,L.protocol))Re.kind!=="text"||!Re.text||(ee+=Re.text,yield{kind:"delta",text:Re.text});let ie=du(ee);if(ie.parsed===null)throw console.warn(`[tb.infer] output not valid JSON after sanitize; raw output (last 4000 chars):
|
|
2315
|
+
`+ee.slice(-4e3)),new ve("LLM output is not valid JSON","parse_error",!0);ie.fixesApplied.length&&console.warn("[tb.infer] sanitized output, fixes applied:",ie.fixesApplied.join(", "));let ke={insight:ie.parsed,insightJson:ie.json,data:M};yield{kind:"complete",...ke,fixesApplied:ie.fixesApplied,hash:fu(ke)}})();return ga(y,me)}catch(E){return y.json(Ts(E),500)}});let $=async y=>{let{hash:E}=await y.req.json().catch(()=>({}));return typeof E=="string"?pu(E):null};S.post("/__infer-save",async y=>{try{if(!l)return y.json({message:"Save is not available for this server.",code:"unknown",retryable:!1},400);let E=await $(y);return E?(await l(E.data,E.insightJson),y.json({ok:!0})):y.json({message:"No decodable #tb= fragment to save.",code:"unknown",retryable:!1},400)}catch(E){return y.json(Ts(E),500)}}),S.get("/__infer-info",y=>{let E=c?.(),N=sr(E?.config??"").inference,L=_i(E?.data??""),M=at();return typeof M=="string"?y.json({error:M,inference:N,data:L}):y.json({provider:M.protocol,model:M.model,inference:N,data:L})}),S.use("/__infer-decode",C),S.post("/__infer-decode",async y=>y.json(await $(y)??{error:"invalid fragment"})),S.get("/__infer-ui.js",y=>y.body(lw,200,{"Content-Type":"text/javascript; charset=utf-8"})),S.get("/__models",async y=>{try{let E=await ot();return y.json(E)}catch{return y.json([],200)}}),S.get("/__ai-access",async y=>{try{return y.json(await vo())}catch{return y.json("none",200)}}),m&&S.get("/__source/*",async y=>{let E=await Id.readFile(m,"utf-8").catch(()=>{});return E===void 0?y.text("Not Found",404):new Response(E,{headers:{"Content-Type":"text/plain; charset=utf-8"}})});let x=["esm.sh","unpkg.com","cdn.jsdelivr.net","cdnjs.cloudflare.com"],D=new ha;S.get("/proxy/*",async y=>{let E=new URL(y.req.url),L=(E.pathname+E.search).slice(7),M=L.lastIndexOf("https://");return M===-1?y.text("Invalid proxy URL",400):K(y,L.slice(M))}),d&&dw(S,`/local/${d.name}/`,d.serveDir),p&&dw(S,p.mount,p.dir),h&&S.get("/assets/*",async y=>{let{pathname:E}=new URL(y.req.url),N=E.slice(8),L;try{L=decodeURIComponent(N)}catch{return y.text("Not Found",404)}let M=cf(L);if(M)return y.text(`${M} is not an asset type: a bulb's code and markup live in the bulb; assets are media and data`,403);try{for(let G of h.dirs){let me=await pw(L,G,{"Cache-Control":"no-cache"});if(me)return me}}catch{return y.text("Not Found",404)}let H=h.remoteBase;return H?y.redirect(H+N,302):y.text("Not Found",404)});async function K(y,E){let N;try{N=new URL(E)}catch{return y.text("Invalid URL",400)}if(N.protocol!=="https:")return y.text("HTTPS only",400);if(!x.includes(N.hostname))return y.text("Host not allowed",403);let L=await D.get(E);if(L)return new Response(L.body,{status:200,headers:Nd(L.contentType,L.cacheControl)});try{let M=await fetch(E,{headers:{Accept:y.req.header("Accept")||"*/*"},redirect:"follow"});if(!M.ok)return y.text(`Upstream ${M.status}`,M.status);let H=M.headers.get("Content-Type")||void 0,G=M.headers.get("Cache-Control")||void 0;if(M.body){let[me,ee]=M.body.tee();return(async()=>{try{let ie=await new Response(ee).arrayBuffer();await D.set(E,{body:Buffer.from(ie),contentType:H,cacheControl:G})}catch{}})(),new Response(me,{status:M.status,headers:Nd(H,G)})}return new Response(null,{status:M.status,headers:Nd(H,G)})}catch(M){return y.text(`Proxy fetch failed: ${M instanceof Error?M.message:M}`,502)}}(i||o)&&S.get("/__reload",y=>gR(y,async E=>{let N=()=>{E.writeSSE({event:"reload",data:""})},L=M=>{E.writeSSE({event:"message",data:JSON.stringify(M)})};for(i?.on("reload",N),o?.on("message",L),o&&o.listenerCount("message")===1&&console.log("[page] connected"),E.onAbort(()=>{i?.removeListener("reload",N),o?.removeListener("message",L),R=Date.now()}),await E.writeSSE({event:"hello",data:b});!E.aborted;)await E.sleep(3e4)})),S.notFound(async y=>{if(y.req.method!=="GET")return y.text("Not Found",404);let E=new URL(y.req.url);return uw(E.pathname,E.search)?K(y,"https://esm.sh"+E.pathname+E.search):y.text("Not Found",404)});let U=hR({fetch:S.fetch,port:s,hostname:yR});return U.listening||await new Promise((y,E)=>{let N=L=>E(L);U.once("error",N),U.once("listening",()=>{U.removeListener("error",N),y()})}),{port:s,close:()=>U.close()}}function Nd(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 dw(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 pw(decodeURIComponent(s.slice(e.length)),t)??r.text("Not Found",404)}catch{return r.text("Not Found",404)}})}async function pw(n,e,t={}){let r=ko(n,e),s=await Id.readFile(r).catch(()=>{});if(s)return new Response(s,{headers:{"Content-Type":af(r),...t}})}Be();Jn();async function va(n){let{port:e,portNote:t,makeServerOptions:r,makeEntry:s,displayName:i,stopLog:o}=n,a=await fw(r(e)).catch(async u=>{if(u?.code!=="EADDRINUSE")throw u;return Su(e)}),c=`http://localhost:${e}`;await Lh(s(e,c)),console.log(`
|
|
2211
2316
|
${i}`),console.log(` ${c}`),t&&console.log(` ${t}`);let l=[],d=async()=>{console.log(`
|
|
2212
|
-
Shutting down...`),a.close();for(let u of l)try{await u()}catch{}o(),await
|
|
2317
|
+
Shutting down...`),a.close();for(let u of l)try{await u()}catch{}o(),await Ur(process.pid),process.exit(0)};return process.on("SIGINT",d),process.on("SIGTERM",d),{port:e,url:c,onCleanup(u){l.push(u)}}}Jn();import xR from"chokidar";var ER={persistent:!0,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}};function jt(n){let{target:e,onChange:t,events:r="change",debounceMs:s=150}=n,i,o=xR.watch(e,ER);o.on("error",c=>console.warn(`watch: ${c instanceof Error?c.message:c} \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()}}Be();async function hw(n,e,t,r){let s=process.cwd(),i=Ji(process.pid),o=e.watch?new mw:void 0,a=new mw;a.setMaxListeners(0);let c=Te(e.mode),l=await Bl(n);l.length&&console.log(`Replacing the running server for this bulb (pid ${l.map(x=>x.pid).join(", ")})`);let{port:d,note:u}=await Ro({explicit:e.port,target:{kind:"bulb",file:n},cwd:process.cwd()}),f=1;console.log($l(f)),e.batch&&await qn(n,e.batch),console.log(`Loading ${Sa.basename(n)}...`);let{html:p,bulb:h,serverExports:m}=await bu(n,e.watch,e.trust,r,e.batch);_t(c,n,h.server);let b=[...e.batch?[$t(n,e.batch)]:[],$t(n)],A=Un(Sa.resolve(n)),S=e.trust?void 0:Kn(h),{port:P,url:_,onCleanup:C}=await va({port:d,portNote:u,displayName:h.name,stopLog:i,makeServerOptions:x=>({getHtml:()=>p,basePath:s,fsBase:It(n,e.batch),port:x,reloadEmitter:o,messageEmitter:a,getServerExports:()=>m,getBulbBlocks:()=>({infer:h.infer,insight:h.insight,code:h.code,config:h.config,data:h.data}),saveInferenceResult:async(D,K)=>{let U=await Ft.readFile(n,"utf-8");U=rr(U,"data",D.join(ah)),U=rr(U,"insight",K),await Ft.writeFile(n,U)},localOverride:r?{name:r.name,serveDir:r.serveDir}:void 0,bulbAssets:{dirs:b,remoteBase:A&&Is(A.userSlug,A.slug)},sourceFile:n,trusted:e.trust,trustHint:t}),makeEntry:(x,D)=>({pid:process.pid,port:x,url:D,file:n,cwd:process.cwd(),startedAt:Date.now(),trust:e.trust,batch:e.batch,mode:e.mode,predicted:S})});e.trust?console.log(" trust: granted (filesystem, AI, server.ts enabled)"):console.log(S?` trust: restricted \u2014 this bulb appears to use ${S}; re-run with --trust to enable it:
|
|
2213
2318
|
${t}
|
|
2214
2319
|
`:` trust: restricted \u2014 re-run with --trust to enable filesystem / AI / server.ts
|
|
2215
2320
|
`),e.watch&&console.log(` Watching for changes...
|
|
2216
|
-
`);let R,$;if(e.watch&&o){let x=0,D=Promise.resolve();if(R
|
|
2217
|
-
`),o.emit("reload")}})}for(let K of b)await
|
|
2218
|
-
`),o.emit("reload")}}))}R&&C(R),$&&C($),C(()=>
|
|
2219
|
-
`):await
|
|
2321
|
+
`);let R,$;if(e.watch&&o){let x=0,D=Promise.resolve();if(R=jt({target:n,onChange:()=>{let K=++x;D=D.then(async()=>{if(K===x)try{console.log("Recompiling...");let U=await bu(n,!0,e.trust,r,e.batch);p=U.html,m=U.serverExports,h=U.bulb,f++,console.log($l(f)),o.emit("reload")}catch(U){console.error("Compile error:",U)}})}}),r){let{name:K,serveDir:U}=r;$=jt({target:U,events:"all",onChange:()=>{console.log(`Local package '${K}' changed. Browser reloading...
|
|
2322
|
+
`),o.emit("reload")}})}for(let K of b)await Ft.stat(K).then(U=>U.isDirectory()).catch(()=>!1)&&C(jt({target:K,events:"all",onChange:()=>{console.log(`Assets changed. Browser reloading...
|
|
2323
|
+
`),o.emit("reload")}}))}R&&C(R),$&&C($),C(()=>Ft.rm(yu(n),{force:!0})),e.open&&(l.some(x=>x.port===P)?console.log(` Reusing the open browser tab.
|
|
2324
|
+
`):await AR(_))}it();import{readFileSync as yw,copyFileSync as OR,existsSync as PR}from"fs";import*as fe from"path";import{fileURLToPath as CR}from"url";import{EventEmitter as RR}from"events";import bw from"open";Jn();Be();oo();var $d=n=>`/agents/${n}/client.js`,TR=`
|
|
2220
2325
|
(() => {
|
|
2221
2326
|
const api = async (name, ...args) => {
|
|
2222
2327
|
const resp = await fetch('/__api/' + name, {
|
|
@@ -2245,21 +2350,21 @@ Shutting down...`),a.close();for(let u of l)try{await u()}catch{}o(),await Dn(pr
|
|
|
2245
2350
|
})
|
|
2246
2351
|
});
|
|
2247
2352
|
if (window.__TYPEBULB_WATCH__) {
|
|
2248
|
-
${
|
|
2353
|
+
${io}
|
|
2249
2354
|
}
|
|
2250
2355
|
})();
|
|
2251
|
-
`;function
|
|
2356
|
+
`;function gw(n){let{name:e,agent:t,styles:r,mountHtml:s,watch:i,theme:o}=n,a=$d(t);return`<!DOCTYPE html>
|
|
2252
2357
|
<html>
|
|
2253
2358
|
<head>
|
|
2254
2359
|
<meta charset="utf-8">
|
|
2255
2360
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
2256
|
-
<title>${
|
|
2257
|
-
${
|
|
2361
|
+
<title>${ro(e)} - typebulb</title>
|
|
2362
|
+
${so(e,o)}
|
|
2258
2363
|
<style>
|
|
2259
|
-
${
|
|
2364
|
+
${Dr}
|
|
2260
2365
|
</style>
|
|
2261
2366
|
<style>
|
|
2262
|
-
${
|
|
2367
|
+
${r}
|
|
2263
2368
|
</style>
|
|
2264
2369
|
</head>
|
|
2265
2370
|
<body>
|
|
@@ -2268,17 +2373,17 @@ ${s}
|
|
|
2268
2373
|
${i?"<script>window.__TYPEBULB_WATCH__ = true;</script>":""}
|
|
2269
2374
|
|
|
2270
2375
|
<script>
|
|
2271
|
-
${
|
|
2376
|
+
${TR}
|
|
2272
2377
|
</script>
|
|
2273
2378
|
|
|
2274
2379
|
<script type="module" src="${a}"></script>
|
|
2275
2380
|
</body>
|
|
2276
|
-
</html>`}async function
|
|
2277
|
-
${
|
|
2278
|
-
`);let _=fe.join(u,t,"client"),C=fe.join(u,"core","client");async function R(){await(await import("esbuild")).build({entryPoints:[fe.join(_,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:fe.join(d,"client.js")});for(let D of["styles.css","index.html","typebulb.png","typebulb-inv.png"])
|
|
2279
|
-
`),i.emit("reload")}catch(K){console.error("Mirror rebuild failed:",K instanceof Error?K.message:K)}finally{D=!1}}}})}
|
|
2280
|
-
`);let c=0,l=Promise.resolve()
|
|
2281
|
-
`)}catch(p){
|
|
2282
|
-
`),
|
|
2283
|
-
`),process.exit(1)}function
|
|
2284
|
-
${e}`),process.exit(1))}async function
|
|
2381
|
+
</html>`}async function ww(n){let e=process.cwd(),t=n.agentTarget;hb(t)||(console.error(`Unknown agent '${t}'. Known: ${er().join(", ")}.`),process.exit(1));let r=await Ml(e,t);if(r){console.log(`Mirror '${t}' is already running for this project:
|
|
2382
|
+
${r.url}`),n.open&&await bw(r.url);return}let s=Ji(process.pid),i=n.watch?new RR:void 0,o=Te(n.mode),a=await yb(t),c=a.displayName||`${t} mirror`;_t(o,fe.join(e,"mirror"));let l=fe.dirname(CR(import.meta.url)),d=fe.join(l,"agents",t),u=fe.join(l,"..","cli","agents"),f=fe.join(d,"styles.css"),p=fe.join(d,"index.html"),h=()=>gw({name:c,agent:t,styles:yw(f,"utf8"),mountHtml:yw(p,"utf8"),watch:n.watch}),{port:m,note:b}=await Ro({explicit:n.port,target:{kind:"mirror",agent:t},cwd:e}),{port:A,url:S,onCleanup:P}=await va({port:m,portNote:b,displayName:c,stopLog:s,makeServerOptions:x=>({getHtml:h,basePath:e,port:x,reloadEmitter:i,getServerExports:()=>a,trusted:!0,staticAssets:{mount:`${fe.posix.dirname($d(t))}/`,dir:d}}),makeEntry:(x,D)=>({pid:process.pid,port:x,url:D,file:`agent:${t}`,cwd:e,startedAt:Date.now(),trust:!0,agent:t})});n.watch&&console.log(` Watching for changes...
|
|
2383
|
+
`);let _=fe.join(u,t,"client"),C=fe.join(u,"core","client");async function R(){await(await import("esbuild")).build({entryPoints:[fe.join(_,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:fe.join(d,"client.js")});for(let D of["styles.css","index.html","typebulb.png","typebulb-inv.png"])OR(fe.join(C,D),fe.join(d,D))}let $;if(n.watch&&i){let x=PR(_),D=!1;$=jt({target:x?u:d,events:"all",onChange:async()=>{if(!D){D=!0;try{x&&await R(),console.log(`Mirror rebuilt. Browser reloading...
|
|
2384
|
+
`),i.emit("reload")}catch(K){console.error("Mirror rebuild failed:",K instanceof Error?K.message:K)}finally{D=!1}}}})}n.open&&await bw(S),P(()=>a.shutdownSwitcher?.()),P(()=>a.shutdownComposer?.()),$&&P($)}it();Ve();import*as vw from"path";async function Sw(n,e,t,r,s){let i=Te(t),o=!1;s&&await qn(n,s);let a=async()=>{let{bulb:c,config:l}=await Ue(n);o||(_t(i,n,c.server),o=!0),await os(c.server,n,r,l.dependencies,s)};if(console.log(`Running ${vw.basename(n)}...`),await a(),e){console.log(`Watching for changes...
|
|
2385
|
+
`);let c=0,l=Promise.resolve();jt({target:n,onChange:()=>{let d=++c;l=l.then(async()=>{if(d===c)try{console.log("Re-running..."),await a()}catch(u){console.error("Error:",u)}})}})}}it();Ve();import{Console as _R}from"node:console";Be();async function Ew(n,e,t,r,s){MR();try{let p=On(await Q(),n)[0];p&&(Ui(p.pid,We(p.pid).offset),console.error(`note: 'call' boots a fresh server.ts instance; the running server (${p.url}) is not contacted \u2014 state shared with it must live on disk.`))}catch{}let i=Te(t),{bulb:o,config:a}=await Ue(n);o.server||Os("This bulb has no **server.ts** block; nothing to call."),_t(i,n,o.server),s&&await qn(n,s);let c;try{c=await os(o.server,n,r,a.dependencies,s)}catch(p){Os(p instanceof Error?p.message:String(p))}let l=ba(c,e.fn);if(!l){let p=[...Object.keys(c).filter(h=>typeof c[h]=="function"),...Object.keys(ya)];Os(`Function '${e.fn}' not found. Available: ${p.length?p.join(", "):"(none)"}.`)}let d=await NR(e);if(wa(l)){try{for await(let p of l(...d))await xw(JSON.stringify(p,Aw)+`
|
|
2386
|
+
`)}catch(p){Os(p instanceof Error?p.stack??p.message:String(p))}return kw(0)}let u;try{u=await l(...d)}catch(p){Os(p instanceof Error?p.stack??p.message:String(p))}let f=LR(u);f!==void 0&&await xw(f+`
|
|
2387
|
+
`),kw(0)}function kw(n){process.exitCode=n,setTimeout(()=>process.exit(n),2e3).unref?.()}async function NR(n){if(n.hasArgsFlag){let e=n.argsJson??"";return e==="-"&&(e=await BR()),$R(e)}return IR(n.positional)}function IR(n){return n.map(e=>{try{return JSON.parse(e)}catch{return e}})}function $R(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 LR(n){if(n!==void 0)return JSON.stringify(n,Aw,2)}function Aw(n,e){return typeof e=="bigint"?e.toString():e}function Os(n){process.stderr.write(n+`
|
|
2388
|
+
`),process.exit(1)}function MR(){let n=new _R(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 xw(n){return new Promise((e,t)=>{process.stdout.write(n,r=>r?t(r):e())})}async function BR(){let n=[];for await(let e of process.stdin)n.push(e);return Buffer.concat(n).toString("utf-8")}Fi();for(let n of[process.stdout,process.stderr])n.on("error",e=>{if(e?.code!=="EPIPE")throw e});function Tw(n,e){n||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
|
|
2389
|
+
${e}`),process.exit(1))}async function DR(){let n=vb(process.argv.slice(2));if(n.version&&(console.log(`typebulb ${Me}`),process.exit(0)),n.help&&(Sb(),process.exit(0)),bb(),n.subcommand==="logs"){await Xb(n.file||void 0,{follow:n.follow,clear:n.clear,run:n.run,lines:n.lines});return}if(n.subcommand==="wait"){await Qb(n.file||void 0,{match:n.match,timeoutSec:n.timeoutSec});return}if(n.subcommand==="stop"){n.stopScope?await ew(n.stopScope):await Zb(n.file||void 0);return}if(n.subcommand==="send"){await nw(n.file,n.sendMessage,n.sendWaitMs??0);return}if(n.subcommand==="models"){await Wb(n.mode);return}if(n.subcommand==="slug"){Yb(n.slugName);return}if(n.subcommand==="pull"){await Qg(n.file||void 0,{force:n.force,mode:n.mode});return}if(n.subcommand==="push"){await ey(n.file||void 0,{force:n.force,mode:n.mode});return}if(n.subcommand==="agent"){await(n.agentTarget?ww(n):Hb(Me));return}if(n.subcommand==="trust"||n.subcommand==="untrust"){await Ub(n.file||void 0,n.subcommand==="trust");return}let e;if(!n.file||n.file==="."){let c=await $g(process.cwd());c||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=c}else e=dt.resolve(n.file);if(await Ow.access(e).then(()=>!0,()=>!1)||(er().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}`+(dt.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 sw(e,n.blockKind);return}if(n.subcommand==="put"){await aw(e,n.blockPairs);return}let r=n.file&&n.file!=="."?n.file:dt.relative(process.cwd(),e)||dt.basename(e),s=`npx typebulb --trust ${r.includes(" ")?`"${r}"`:r}`;if(n.subcommand==="predict"){await qb(e,s);return}let i=!n.noTrust&&sn(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 Ue(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 Hd(n.local)}catch(c){console.error(c instanceof Error?c.message:String(c)),process.exit(1)}console.error(`replace: ${a.name} \u2192 ${dt.relative(process.cwd(),a.dir)||"."}`)}if(n.subcommand==="check"){await Fb(e,a);return}if(n.subcommand==="call"){Tw(n.trust,s),await Ew(e,{fn:n.fn,positional:n.callArgs,argsJson:n.argsJson,hasArgsFlag:n.hasArgsFlag},n.mode,a,n.batch);return}if(o&&o.bulb.server&&(Hi(o.bulb)||n.server)){Tw(n.trust,s),await Sw(e,n.watch,n.mode,a,n.batch);return}await hw(e,n,s,a)}DR().catch(n=>{console.error("Error:",n.message),process.exit(1)});
|