@builder.io/dev-tools 1.59.1-beta.202605221744.c721c12 → 1.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +21 -21
- package/cli/index.cjs.map +3 -3
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +3 -3
- package/server/index.mjs +3 -3
- package/types/tsconfig.tsbuildinfo +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xxe=Object.create;var ey=Object.defineProperty;var Fxe=Object.getOwnPropertyDescriptor;var kxe=Object.getOwnPropertyNames;var Rxe=Object.getPrototypeOf,Txe=Object.prototype.hasOwnProperty;var L=(t,e)=>()=>(t&&(e=t(t=0)),e);var N=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ty=(t,e)=>{for(var r in e)ey(t,r,{get:e[r],enumerable:!0})},WJ=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kxe(e))!Txe.call(t,i)&&i!==r&&ey(t,i,{get:()=>e[i],enumerable:!(n=Fxe(e,i))||n.enumerable});return t};var X=(t,e,r)=>(r=t!=null?xxe(Rxe(t)):{},WJ(e||!t||!t.__esModule?ey(r,"default",{value:t,enumerable:!0}):r,t)),Vr=t=>WJ(ey({},"__esModule",{value:!0}),t);var h=L(()=>{(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"
|
|
1
|
+
var xxe=Object.create;var ey=Object.defineProperty;var Fxe=Object.getOwnPropertyDescriptor;var kxe=Object.getOwnPropertyNames;var Rxe=Object.getPrototypeOf,Txe=Object.prototype.hasOwnProperty;var L=(t,e)=>()=>(t&&(e=t(t=0)),e);var N=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ty=(t,e)=>{for(var r in e)ey(t,r,{get:e[r],enumerable:!0})},WJ=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kxe(e))!Txe.call(t,i)&&i!==r&&ey(t,i,{get:()=>e[i],enumerable:!(n=Fxe(e,i))||n.enumerable});return t};var X=(t,e,r)=>(r=t!=null?xxe(Rxe(t)):{},WJ(e||!t||!t.__esModule?ey(r,"default",{value:t,enumerable:!0}):r,t)),Vr=t=>WJ(ey({},"__esModule",{value:!0}),t);var h=L(()=>{(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"0f992041a448bae90d66afd44fc4649cc25ce1bf"}}catch{}})()});function Xc(t){let e=t[t.length-1];return e&&typeof e=="object"&&!(e instanceof Error)&&!Array.isArray(e)&&"loggerOptions"in e?{callArgs:t.slice(0,-1),options:e.loggerOptions}:{callArgs:t,options:{}}}function Nxe(t,e){return`[${t.toUpperCase()}]`+e.map(r=>{if(r instanceof Error)return r.stack??r.message;if(typeof r=="object"&&r!==null)try{return JSON.stringify(r)}catch{return String(r)}return String(r)}).join(" ")}function XJ(){let t=process.env.FUSION_ENVIRONMENT;return t==="cloud"||t==="cloud-v2"}function ry(t,e,r,n){let i={severity:e,message:Nxe(r,n),timestamp:new Date().toISOString()};r&&(i.context=r),t.write(JSON.stringify(i)+`
|
|
2
2
|
`)}function Mxe(t,e,r){return{debug(...n){if(!e())return;let{callArgs:i,options:s}=Xc(n);ry(s.stderr?process.stderr:process.stdout,"DEBUG",r,i)},info(...n){if(t>Zc.info)return;let{callArgs:i,options:s}=Xc(n);s.debug&&!e()||ry(s.stderr?process.stderr:process.stdout,"INFO",r,i)},warn(...n){if(t>Zc.warn)return;let{callArgs:i,options:s}=Xc(n);s.debug&&!e()||ry(process.stderr,"WARNING",r,i)},error(...n){if(t>Zc.error)return;let{callArgs:i,options:s}=Xc(n);s.debug&&!e()||ry(process.stderr,"ERROR",r,i)}}}function Pp(t){return t?`[${t}]`:""}function Pxe(t,e,r){return{debug(...n){if(!e())return;let{callArgs:i,options:s}=Xc(n);s.stderr?console.error(Pp(r),...i):console.debug(Pp(r),...i)},info(...n){if(Zc.info<t)return;let{callArgs:i,options:s}=Xc(n);s.debug&&!e()||(s.stderr?console.error(Pp(r),...i):console.log(Pp(r),...i))},warn(...n){if(Zc.warn<t)return;let{callArgs:i,options:s}=Xc(n);s.debug&&!e()||console.warn(Pp(r),...i)},error(...n){if(Zc.error<t)return;let{callArgs:i,options:s}=Xc(n);s.debug&&!e()||console.error(Pp(r),...i)}}}function ej(t){ZJ=t}function ve(t,e){let r=typeof e?.debug=="function"?e.debug:e?.debug!==void 0?()=>e.debug:()=>ZJ||!!process.env.DEBUG,n=e?.level??process.env.LOG_LEVEL?.toLowerCase();return XJ()?Mxe(zJ(n??"info"),r,t):Pxe(zJ(n??"info"),r,t)}function zJ(t){return Zc[t]??Zc.info}function tj(){if(!XJ())return;let t=process.stderr.write.bind(process.stderr);process.stderr.write=function(e,r,n){let i=typeof r=="function"?r:n,s=typeof r=="string"?r:void 0,o=typeof e=="string"?e:Buffer.from(e).toString("utf8"),a=o.trim();if(a.startsWith("{"))try{if(typeof JSON.parse(a).severity=="string")return s?t(e,s,i):t(e,i)}catch{}let A={severity:"ERROR",message:a||o,timestamp:new Date().toISOString(),stream:"stderr"},c=JSON.stringify(A)+`
|
|
3
3
|
`;return i?t(c,i):t(c)}}function rj(t="process",e=r=>process.exit(r)){let r=ve(t),n=i=>Promise.resolve(e(i)).catch(()=>{}).finally(()=>process.exit(i));process.on("uncaughtException",i=>{r.error("Uncaught exception:",i),n(1)}),process.on("unhandledRejection",i=>{r.error("Unhandled rejection:",i instanceof Error?i:String(i)),n(1)})}var Zc,ZJ,Qt=L(()=>{"use strict";h();Zc={debug:0,info:1,warn:2,error:3};ZJ=!1});var ij=N((fDt,nj)=>{h();function KF(t){return t==null?[]:Array.isArray(t)?t:[t]}function Lxe(t,e,r,n){var i,s=t[e],o=~n.string.indexOf(e)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~n.boolean.indexOf(e)?r==="false"?!1:r==="true"||(t._.push((i=+r,i*0===0?i:r)),!!r):(i=+r,i*0===0?i:r);t[e]=s==null?o:Array.isArray(s)?s.concat(o):[s,o]}nj.exports=function(t,e){t=t||[],e=e||{};var r,n,i,s,o,a={_:[]},A=0,c=0,u=0,l=t.length;let d=e.alias!==void 0,g=e.unknown!==void 0,p=e.default!==void 0;if(e.alias=e.alias||{},e.string=KF(e.string),e.boolean=KF(e.boolean),d)for(r in e.alias)for(n=e.alias[r]=KF(e.alias[r]),A=0;A<n.length;A++)(e.alias[n[A]]=n.concat(r)).splice(A,1);for(A=e.boolean.length;A-- >0;)for(n=e.alias[e.boolean[A]]||[],c=n.length;c-- >0;)e.boolean.push(n[c]);for(A=e.string.length;A-- >0;)for(n=e.alias[e.string[A]]||[],c=n.length;c-- >0;)e.string.push(n[c]);if(p){for(r in e.default)if(s=typeof e.default[r],n=e.alias[r]=e.alias[r]||[],e[s]!==void 0)for(e[s].push(r),A=0;A<n.length;A++)e[s].push(n[A])}let f=g?Object.keys(e.alias):[];for(A=0;A<l;A++){if(i=t[A],i==="--"){a._=a._.concat(t.slice(++A));break}for(c=0;c<i.length&&i.charCodeAt(c)===45;c++);if(c===0)a._.push(i);else if(i.substring(c,c+3)==="no-"){if(s=i.substring(c+3),g&&!~f.indexOf(s))return e.unknown(i);a[s]=!1}else{for(u=c+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(s=i.substring(c,u),o=i.substring(++u)||A+1===l||(""+t[A+1]).charCodeAt(0)===45||t[++A],n=c===2?[s]:s,u=0;u<n.length;u++){if(s=n[u],g&&!~f.indexOf(s))return e.unknown("-".repeat(c)+s);Lxe(a,s,u+1<n.length||o,e)}}}if(p)for(r in e.default)a[r]===void 0&&(a[r]=e.default[r]);if(d)for(r in a)for(n=e.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a}});function _xe(){if(fm!==void 0)return fm;try{return fm=require("prettier"),fm}catch{return fm=null,null}}function Uxe(t){let e=[],r=Pl.default.dirname(t);for(;r!==Pl.default.dirname(r);){let n=Pl.default.join(r,".prettierignore");HF.default.existsSync(n)&&e.push(n);let i=Pl.default.join(r,".git");if(HF.default.existsSync(i))break;r=Pl.default.dirname(r)}return e}function Gxe(t){if(t)try{let r=(0,sj.createRequire)(t)("prettier");if(r)return r}catch{}return _xe()}async function OA(t,e,r,n){try{let i=Pl.default.resolve(t,n??"file.tsx"),s=Gxe(i);if(!s)return e;if(n){let A=Uxe(i);if((await s.getFileInfo(i,{ignorePath:A.length>0?A:void 0})).ignored)return e}let o=await s.resolveConfig(i);return await s.format(e,{...o,filepath:n,parser:r})}catch{return e}}var sj,Pl,HF,fm,JF=L(()=>{"use strict";h();sj=require("node:module"),Pl=X(require("node:path"),1),HF=X(require("node:fs"),1)});var jF,Lp,ny,iy,oj,Ll,YF,qF,_l,aj,_p=L(()=>{"use strict";h();jF="preview-url",Lp="framework",ny="platform",iy="node",oj="/~builder-connect",Ll="/~builder-connected",YF="/~builder-dev-tools",qF="/~builder-dev-tools.js",_l="/~builder-dev-tools-close",aj="/mappings"});var sy=N((BDt,Aj)=>{"use strict";h();var $F={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Oxe={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},Kxe={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?$F.up():"");return t&&(e+=$F.left),e}};Aj.exports={cursor:$F,scroll:Oxe,erase:Kxe,beep:"\x07"}});var Ir=N((QDt,VF)=>{h();var ay=process||{},cj=ay.argv||[],oy=ay.env||{},Hxe=!(oy.NO_COLOR||cj.includes("--no-color"))&&(!!oy.FORCE_COLOR||cj.includes("--color")||ay.platform==="win32"||(ay.stdout||{}).isTTY&&oy.TERM!=="dumb"||!!oy.CI),Jxe=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+jxe(i,e,r,s)+e:t+i+e},jxe=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},uj=(t=Hxe)=>{let e=t?Jxe:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};VF.exports=uj();VF.exports.createColors=uj});function Yxe({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}function Bj(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(qxe,"")}function yj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function hm(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Bj(t),t.length===0))return 0;t=t.replace(zxe()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(Vxe.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function eFe(){let t=new Map;for(let[e,r]of Object.entries(Nr)){for(let[n,i]of Object.entries(r))Nr[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Nr[n],t.set(i[0],i[1]);Object.defineProperty(Nr,e,{value:r,enumerable:!1})}return Object.defineProperty(Nr,"codes",{value:t,enumerable:!1}),Nr.color.close="\x1B[39m",Nr.bgColor.close="\x1B[49m",Nr.color.ansi=lj(),Nr.color.ansi256=gj(),Nr.color.ansi16m=pj(),Nr.bgColor.ansi=lj(WF),Nr.bgColor.ansi256=gj(WF),Nr.bgColor.ansi16m=pj(WF),Object.defineProperties(Nr,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>Nr.rgbToAnsi256(...Nr.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Nr.ansi256ToAnsi(Nr.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Nr.ansi256ToAnsi(Nr.hexToAnsi256(e)),enumerable:!1}}),Nr}function hj(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
4
4
|
`).split(`
|
|
@@ -75,7 +75,7 @@ ${Fj}${n.trimStart()}`),r=3+(0,Ul.stripVTControlCharacters)(n.trimStart()).lengt
|
|
|
75
75
|
`),p(),i()};return{start:I,stop:B,message:(E="")=>{a=m(E??a)}}}});function jt(t,e=""){return t.ts.createSourceFile("module.tsx",typeof e=="string"?e:"",t.ts.ScriptTarget.Latest,void 0)}function hy(t,e=""){let r=jt(t,e?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${e}`);return r.statements[0]}function Ln(t,e,r){if(e){let n=t.ts.createPrinter({newLine:t.ts.NewLineKind.LineFeed,removeComments:r});return t.ts.isSourceFile(e)?n.printFile(e).trim()+`
|
|
76
76
|
`:n.printNode(t.ts.EmitHint.Unspecified,e,t.ts.createSourceFile("module.tsx","",t.ts.ScriptTarget.Latest)).trim()+`
|
|
77
77
|
`}return""}var Jr=L(()=>{"use strict";h()});var _j=N((UDt,Lj)=>{"use strict";h();Lj.exports=function(){if(process.env.npm_config_user_agent)return wFe(process.env.npm_config_user_agent)};function wFe(t){let e=t.split(" ")[0],r=e.lastIndexOf("/"),n=e.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:e.substring(r+1)}}});function js(t){return t.endsWith(".mapper.tsx")||t.endsWith(".mapper.jsx")||t.endsWith(".mapper.ts")||t.endsWith(".mapper.js")||t.endsWith(".mapper.mjs")}function Yt(t,e,r){e=Oo(e),r=Oo(r),e=t.dirname(e);let n=t.basename(r,t.extname(r));r=t.dirname(r);let i;return n==="index"?i=t.relative(e,r):i=t.relative(e,t.join(r,n)),i=Oo(t.normalize(i)),i.startsWith(".")||(i="./"+i),i}function Oo(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}function Ol(t,e){let r=t.extname(e),n=t.basename(e,r).split(/[\/\\]/),i=n[n.length-1];return Uj(i==="index"?t.basename(t.dirname(e)):i)}function Uj(t){return Er(t).replace(/ /g,"")}function Ys(t,e){let r=t.extname(e),n=Oo(t.basename(e,r)).split("/").pop();return Er(n==="index"?t.basename(t.dirname(e)):n)}function Br(t,e){let r=Oo(t.relative(t.getAppRootDir(),e));r=r.split("/").filter(i=>i!=="."&&i!==".."&&i!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=t.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(i=>i.name.includes("next"))?"@/"+r:"~/"+r}function ir(t,e){let r=e,n=[];for(let i=0;i<2;i++){let s=t.basename(r);if(!s||s==="components")break;n.unshift(s),r=t.dirname(r)}return n.join("/")}function Er(t){for(t=t.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();t.includes(" ");)t=t.replace(/ /g," ");return t.split(" ").map(e=>e.length>2?e[0].toUpperCase()+e.slice(1):e).join("").trim()}function ts(t){return t.sort((e,r)=>e.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function hr(t,e,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${e}`);return n&&(e=n),e=t.normalize(e),(await t.hash(e+"#"+r)).substring(0,8)}async function Oj(t){return(await t.hash(t.getAppRootDir())).substring(0,8)}function Cm(t){return typeof t=="number"}function Kp(t){return typeof t=="boolean"}function Pi(t){return typeof t=="string"}function Hp(t){return typeof t=="string"?/^[A-Z][A-Za-z0-9]*$/.test(t):!1}function bs(t){return JSON.parse(JSON.stringify(t))}function my(t,e,r){for(let n of e)if(t.dirname(r).includes(n))return!0;return!1}function Kj(){try{let t=(0,Gj.default)();if(t?.name)return t.name}catch{}return"npm"}function bFe(){return process.platform.startsWith("win")}function st(){return process.pkg?"@builder.io/agent":bFe()?'"@builder.io/dev-tools"':"builder.io"}function Ak(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_")}var Gj,St=L(()=>{"use strict";h();Gj=X(_j(),1)});function Li(t){let e=t.join(t.getAppRootDir(),"tsconfig.json");return t.exists(e)}async function rs(t,e){async function r(i,s){if(s>10)return;let o=await t.readdir(i);for(let a of o){if(SFe.includes(a))continue;let A=t.join(i,a),c=await t.stat(A);if(c){if(c.isFile()&&a.startsWith("builder-registry."))return A;if(c.isDirectory()){let u=await r(A,s+1);if(u)return u}}}}let n=await r(t.getAppRootDir(),0);if(!n){let s=`builder-registry.${await Li(t)?"ts":"js"}`;return t.join(e,s)}return n}async function Ko(t,e){let r=t.resolve("/");for(let n=0;n<20;n++){let i=t.join(e,"package.json"),s=await t.readFile(i);if(s)return JSON.parse(s);if(e===r)break;e=t.dirname(e)}return null}async function Hj(t,e){for(let r=0;r<20;r++){let n=t.dirname(e),i=t.join(n,"node_modules");if(await t.exists(i))return i;if(e===t.getAppRootDir())break;e=t.dirname(e)}return t.join(t.getAppRootDir(),"node_modules")}async function Im(t,e,r){let n=await t.readdir(e);return n.includes(r)?t.join(e,r):(await Promise.all(n.map(async s=>{if(s.startsWith(".")||s==="node_modules")return;let o=t.join(e,s);if((await t.stat(o)).isDirectory()){let A=await Im(t,o,r);if(A)return A}}))).find(s=>typeof s=="string")}var SFe,Bi=L(()=>{"use strict";h();SFe=["node_modules","dist","build","public"]});async function Dn(t,e,r){if(!Array.isArray(e)||e.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${e}`);let n=await Hj(t,e[0]),i=t.join(n,"typescript","lib"),s=new Map,o={fileExists:a=>{if(a=t.normalize(a),a.includes("node_modules")){let A=Em.get(a);if(!A){try{t.statSync(a).isFile()?A={exists:!0,content:t.readFileSync(a)}:A={exists:!1}}catch{A={exists:!1}}Em.set(a,A)}return A.exists}if(!s.has(a))if(t.existsSync(a)){let c=t.statSync(a);s.set(a,c.isFile())}else s.set(a,!1);return s.get(a)},getCanonicalFileName:a=>t.normalize(a),getCurrentDirectory:()=>t.cwd(),getDefaultLibFileName:()=>t.join(i,"lib.d.ts"),getDefaultLibLocation:()=>i,getNewLine:()=>`
|
|
78
|
-
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=Em.get(a);if(c)return jt(t,c.content)}let A;try{A=t.readFileSync(a)}catch{console.error(`Could not read: ${a}`),A==null}if(A==null){let c=t.basename(a),u=t.extname(c).toLowerCase();if(a.startsWith(i)&&u===".ts"&&(A=jj.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new Iy(c)}return a.includes("node_modules")&&(A?Em.set(a,{exists:!0,content:A}):Em.set(a,{exists:!1})),jt(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return vFe(t,o,e,r)}catch(a){if(a instanceof Iy){await xFe(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function vFe(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},s=t.ts.findConfigFile(t.dirname(r[0]),o=>t.existsSync(o));if(s){let o=Jj.get(s);if(!o){let a=t.ts.readConfigFile(s,A=>{let c=t.readFileSync(A);return typeof c=="string"?c:void 0});a.error?t.Sentry?.captureException(new Error("Error reading tsconfig for createTsProgram"),{extra:{error:a.error,tsConfigPath:s}}):(o=t.ts.parseJsonConfigFileContent(a.config,t.ts.sys||{useCaseSensitiveFileNames:!1,readDirectory:(c,u)=>t.readdirSync(c),fileExists:c=>t.existsSync(c),readFile:c=>t.readFileSync(c)||void 0},t.dirname(s),void 0,s).options,Jj.set(s,o))}o&&(i.options=bs(o))}return i.options.noEmit=!0,i.options.isolatedModules=!1,i.options.strict=!1,i.options.jsx=t.ts.JsxEmit.Preserve,i.options.allowJs=!0,Object.assign(i.options,n),t.ts.createProgram(i)}async function Jp(t,e,r){r||(r=await Dn(t,[e]));let n=r.getSourceFile(e);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${e}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}async function xFe(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;Cy.has(e)||Cy.set(e,fetch(r).then(n=>n.text()).then(n=>{jj.set(e,n)})),await Cy.get(e),Cy.delete(e)}async function Yj(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:ck(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function ck(t,e){let r={diagnostics:[],code:e.code,output:null};try{let n=t.ts.transpileModule(e.code,{compilerOptions:e.compilerOptions,fileName:e.filePath??"module.tsx",reportDiagnostics:!0});n.diagnostics?.forEach(i=>{r.diagnostics.push({messageText:String(i.messageText)})}),r.output=n.outputText}catch(n){console.error("transpileModule",n),r.diagnostics.push({messageText:String(n)})}return r}var Iy,jj,Cy,Em,Jj,qs=L(()=>{"use strict";h();Jr();St();Bi();Iy=class{libName;constructor(e){this.libName=e}};jj=new Map,Cy=new Map,Em=new Map,Jj=new Map});var FFe,dt,Wr=L(()=>{"use strict";h();FFe="1.59.1
|
|
78
|
+
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=Em.get(a);if(c)return jt(t,c.content)}let A;try{A=t.readFileSync(a)}catch{console.error(`Could not read: ${a}`),A==null}if(A==null){let c=t.basename(a),u=t.extname(c).toLowerCase();if(a.startsWith(i)&&u===".ts"&&(A=jj.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new Iy(c)}return a.includes("node_modules")&&(A?Em.set(a,{exists:!0,content:A}):Em.set(a,{exists:!1})),jt(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return vFe(t,o,e,r)}catch(a){if(a instanceof Iy){await xFe(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function vFe(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},s=t.ts.findConfigFile(t.dirname(r[0]),o=>t.existsSync(o));if(s){let o=Jj.get(s);if(!o){let a=t.ts.readConfigFile(s,A=>{let c=t.readFileSync(A);return typeof c=="string"?c:void 0});a.error?t.Sentry?.captureException(new Error("Error reading tsconfig for createTsProgram"),{extra:{error:a.error,tsConfigPath:s}}):(o=t.ts.parseJsonConfigFileContent(a.config,t.ts.sys||{useCaseSensitiveFileNames:!1,readDirectory:(c,u)=>t.readdirSync(c),fileExists:c=>t.existsSync(c),readFile:c=>t.readFileSync(c)||void 0},t.dirname(s),void 0,s).options,Jj.set(s,o))}o&&(i.options=bs(o))}return i.options.noEmit=!0,i.options.isolatedModules=!1,i.options.strict=!1,i.options.jsx=t.ts.JsxEmit.Preserve,i.options.allowJs=!0,Object.assign(i.options,n),t.ts.createProgram(i)}async function Jp(t,e,r){r||(r=await Dn(t,[e]));let n=r.getSourceFile(e);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${e}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}async function xFe(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;Cy.has(e)||Cy.set(e,fetch(r).then(n=>n.text()).then(n=>{jj.set(e,n)})),await Cy.get(e),Cy.delete(e)}async function Yj(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:ck(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function ck(t,e){let r={diagnostics:[],code:e.code,output:null};try{let n=t.ts.transpileModule(e.code,{compilerOptions:e.compilerOptions,fileName:e.filePath??"module.tsx",reportDiagnostics:!0});n.diagnostics?.forEach(i=>{r.diagnostics.push({messageText:String(i.messageText)})}),r.output=n.outputText}catch(n){console.error("transpileModule",n),r.diagnostics.push({messageText:String(n)})}return r}var Iy,jj,Cy,Em,Jj,qs=L(()=>{"use strict";h();Jr();St();Bi();Iy=class{libName;constructor(e){this.libName=e}};jj=new Map,Cy=new Map,Em=new Map,Jj=new Map});var FFe,dt,Wr=L(()=>{"use strict";h();FFe="1.59.1",dt=process.env.OVERRIDE_VERSION??FFe});async function Kl(t){let e=[],r=await Ko(t,t.getRepoRootDir());if(r){let n=await $j(r,t);e.push(...n)}return e}async function $j(t,e){let r=[];if(t&&typeof t=="object"){let n=new Set(Object.keys({...t.dependencies,...t.devDependencies}));for(let i of kFe)if(n.has(i)&&!r.some(s=>s.name===i)){let s={name:i};qj.has(i)&&(s.version=await qj.get(i)(e)),r.push(s)}}return r}function uk(t){let e=parseInt(t);return Number.isNaN(e)?void 0:e}var qj,kFe,Hl=L(()=>{"use strict";h();Bi();St();qj=new Map([["next",async t=>{if(!t.spawnSync)return;let e=Kj(),r=e==="npm"?"npx":e,{stdout:n}=t.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let i=n.match(/(Next.js v)([\d.]+)/g);if(!i)return;let s=i[0].split("Next.js v")[1],[o,a,A]=s.split(".");return{major:uk(o),minor:uk(a),patch:uk(A)}}]]),kFe=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"]});async function $s(t){let e=Vj(t),r=await t.readFile(e);return typeof r=="string"?JSON.parse(r):{}}async function Vs(t,e){e=typeof e=="object"&&e!=null?e:{};let r=Vj(t);await t.writeFile(r,JSON.stringify(e??{},null,2))}function Vj(t){let e=t.getAppRootDir();return t.join(e,"node_modules",".builder","builder-cache.json")}var Jl=L(()=>{"use strict";h()});async function Ra(t,e,r){let n={envKey:r,envValue:null,file:""};for(let i of e){let s=t.join(t.getAppRootDir(),i),o=await RFe(t,s);if(o){let a=o[r];if(typeof a=="string"&&a.length>0&&a!=="YOUR_API_KEY")return n.envValue=a,n.file=s,n}}return n.file=t.join(t.getAppRootDir(),e[e.length-1]),n}async function RFe(t,e){let r=await t.readFile(e);return typeof r=="string"?Wj(r):null}function Wj(t){let e={},r=t.replace(/\r\n?/gm,`
|
|
79
79
|
`),n;for(;(n=TFe.exec(r))!=null;){let i=n[1],s=n[2]||"";s=s.trim();let o=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),o==='"'&&(s=s.replace(/\\n/g,`
|
|
80
80
|
`),s=s.replace(/\\r/g,"\r")),e[i]=s}return e}async function Ta(t,e,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",s=await t.readFile(e);try{if(s)if(s.includes(r))if(s.includes(n))t.debug(`"${r}" with "${n}" already set in ${e}`);else return t.debug(`Replace "${r}" in ${e}`),s=s.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await t.writeFile(e,s),"update";else return t.debug(`Append "${r}" to ${e}`),s+=`
|
|
81
81
|
|
|
@@ -1276,7 +1276,7 @@ Restarting server after Builder Devtools update...
|
|
|
1276
1276
|
<h3>How's Devtools working for you?</h3>
|
|
1277
1277
|
<p>We'd love your feedback!</p>
|
|
1278
1278
|
</div>
|
|
1279
|
-
\`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",()=>{e.classList.remove("menu-toggle-tooltip-show")})},1e3)};function ui(t){t.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(Ur(),"builder")}),t.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let c=t.querySelector(".nav-cmp-list .section-content");c.scrollTop=0,oe(t,"nav-cmp-list"),ai(t)}),t.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),oe(t,"nav-settings")}),t.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(je(),"builder")}),t.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ci(t){let e=t.getElementById("enable-edit");e.addEventListener("change",r=>{r.stopPropagation(),Ht(e.checked)}),e.checked=it(),Ht(e.checked)}var Dt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,si(e),ui(e),oi(e),ri(e),ti(e),ci(e),this.setAttribute("aria-hidden","true"),e.getElementById("version").textContent="v1.59.1-beta.202605221744.c721c12"}highlightOpener(){let e=this.shadowRoot.querySelector(".menu-toggle");e.classList.add("menu-toggle-highlight"),e.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight")},20)},20)}};var lo=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media(max-width:840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media(max-width:590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
|
|
1279
|
+
\`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",()=>{e.classList.remove("menu-toggle-tooltip-show")})},1e3)};function ui(t){t.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(Ur(),"builder")}),t.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let c=t.querySelector(".nav-cmp-list .section-content");c.scrollTop=0,oe(t,"nav-cmp-list"),ai(t)}),t.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),oe(t,"nav-settings")}),t.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(je(),"builder")}),t.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ci(t){let e=t.getElementById("enable-edit");e.addEventListener("change",r=>{r.stopPropagation(),Ht(e.checked)}),e.checked=it(),Ht(e.checked)}var Dt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,si(e),ui(e),oi(e),ri(e),ti(e),ci(e),this.setAttribute("aria-hidden","true"),e.getElementById("version").textContent="v1.59.1"}highlightOpener(){let e=this.shadowRoot.querySelector(".menu-toggle");e.classList.add("menu-toggle-highlight"),e.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight")},20)},20)}};var lo=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media(max-width:840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media(max-width:590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
|
|
1280
1280
|
</style>\`,Nt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=lo+\`<main>
|
|
1281
1281
|
<aside>
|
|
1282
1282
|
<div class="logo"></div>
|
|
@@ -1315,7 +1315,7 @@ Restarting server after Builder Devtools update...
|
|
|
1315
1315
|
</nav>
|
|
1316
1316
|
</section>
|
|
1317
1317
|
</main>
|
|
1318
|
-
\`,po();let r=new URL(Fr,ot);r.searchParams.set(Br,location.href);let n=e.querySelectorAll(".next-step");for(let i of n)i.setAttribute("href",r.href);ye("overview step viewed")}},po=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var li=async()=>{(await jr()).isValid||fo()},fo=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Nt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var mo=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",at),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",Dt);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.59.1
|
|
1318
|
+
\`,po();let r=new URL(Fr,ot);r.searchParams.set(Br,location.href);let n=e.querySelectorAll(".next-step");for(let i of n)i.setAttribute("href",r.href);ye("overview step viewed")}},po=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var li=async()=>{(await jr()).isValid||fo()},fo=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Nt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var mo=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",at),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",Dt);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.59.1"),document.body.appendChild(t));let e=document.querySelector("builder-dev-tools-edit");e||(e=document.createElement("builder-dev-tools-edit"),document.body.appendChild(e));let r=document.getElementById("builder-dev-tools-style");r||(r=document.createElement("style"),r.id="builder-dev-tools-style",r.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(r)),li(),Jn()}catch(t){console.error("Builder Devtools:",t)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.59.1"),mo());})();`)}async function Ere(t){return Bre(t,`<!doctype html>
|
|
1319
1319
|
<html lang="en" dir="ltr">
|
|
1320
1320
|
<head>
|
|
1321
1321
|
<meta charset="utf-8" />
|
|
@@ -1735,9 +1735,9 @@ file '${d}'`:f}).join(`
|
|
|
1735
1735
|
${B}`))}),I.on("close",y=>{Ng.debug(`ffmpeg stdout:${E}`),y===0?d():g(new Error(`ffmpeg exited with code ${y}
|
|
1736
1736
|
Stderr: ${B}`))})})}async#o(e,r,n,i,s,o,a){return new Promise((A,c)=>{let u=r.toLowerCase().endsWith(".webp"),l=["-i",e];o&&l.push("-loglevel","debug");let d=n,g=i;if(s&&(d>s||g>s)){let I=s/Math.max(d,g);d=Math.round(d*I),g=Math.round(g*I),d=d%2===0?d:d+1,g=g%2===0?g:g+1}let p=`scale=${d}:${g}:force_original_aspect_ratio=decrease,pad=${d}:${g}:(ow-iw)/2:(oh-ih)/2:color=black`;l.push("-vf",p),u&&l.push("-vcodec","libwebp","-lossless","0","-compression_level","3","-q:v","80","-preset","picture"),l.push("-y",r);let f=(0,A0.spawn)("ffmpeg",l,{signal:a}),m="",C="";o&&f.stdout.on("data",I=>{C+=I.toString()}),f.stderr.on("data",I=>{m+=I.toString(),C+=I.toString()}),f.on("error",I=>{c(new Error(`Failed to spawn ffmpeg: ${I.message}
|
|
1737
1737
|
${m}`))}),f.on("close",I=>{Ng.debug(`ffmpeg stdout:${C}`),I===0?A():c(new Error(`ffmpeg exited with code ${I}
|
|
1738
|
-
Stderr: ${m}`))})})}async#i(){if(this.tmpDir)try{await lI.promises.rm(this.tmpDir,{recursive:!0,force:!0}),this.tmpDir=null}catch(e){Ng.warn(`Failed to cleanup temporary directory: ${e}`)}}async cleanup(){await this.#i()}}});async function Lse(t,e,r,n){try{if(!(await fetch(`${W9e}?imageId=${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:t,imageContentType:e}),signal:n})).ok)return null;let s=`assets/TEMP/${r}`;return`${z9e}/${encodeURIComponent(s)}`}catch{return null}}var W9e,z9e,_se=L(()=>{"use strict";h();W9e="https://builder.io/api/v1/stage-image",z9e="https://cdn.builder.io/api/v1/image"});var Fn,l0,gI,X9e,zL,XL,ZL,pI,Use=L(()=>{"use strict";h();Fn=require("node:fs"),l0=require("node:path");_se();Qt();gI=ve("TimelineCollector"),X9e={mcp__chrome__navigate_page:{labelFn:t=>`Navigating to ${t?.url||t?.path||"page"}`,category:"navigation"},mcp__chrome__take_screenshot:{labelFn:()=>"Checking page state",category:"observation"},mcp__chrome__click:{labelFn:t=>`Clicking '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__fill:{labelFn:t=>`Typing in '${t?.selector||t?.ref||"field"}'`,category:"interaction"},mcp__chrome__type:{labelFn:t=>`Typing '${(t?.text||"").substring(0,30)}'`,category:"interaction"},mcp__chrome__press_key:{labelFn:t=>`Pressing ${t?.key||"key"}`,category:"interaction"},mcp__chrome__evaluate_script:{labelFn:()=>"Running script on page",category:"interaction"},mcp__chrome__hover:{labelFn:t=>`Hovering over '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__scroll:{labelFn:()=>"Scrolling page",category:"interaction"},mcp__chrome__select_option:{labelFn:t=>`Selecting '${t?.value||"option"}' in '${t?.selector||"dropdown"}'`,category:"interaction"}},zL=500,XL=5e3,ZL=2e3,pI=class{#n;#c;#s;#t;#o=[];#i=[];#e=null;#a=null;#B=0;#m=0;#
|
|
1738
|
+
Stderr: ${m}`))})})}async#i(){if(this.tmpDir)try{await lI.promises.rm(this.tmpDir,{recursive:!0,force:!0}),this.tmpDir=null}catch(e){Ng.warn(`Failed to cleanup temporary directory: ${e}`)}}async cleanup(){await this.#i()}}});async function Lse(t,e,r,n){try{if(!(await fetch(`${W9e}?imageId=${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:t,imageContentType:e}),signal:n})).ok)return null;let s=`assets/TEMP/${r}`;return`${z9e}/${encodeURIComponent(s)}`}catch{return null}}var W9e,z9e,_se=L(()=>{"use strict";h();W9e="https://builder.io/api/v1/stage-image",z9e="https://cdn.builder.io/api/v1/image"});var Fn,l0,gI,X9e,zL,XL,ZL,pI,Use=L(()=>{"use strict";h();Fn=require("node:fs"),l0=require("node:path");_se();Qt();gI=ve("TimelineCollector"),X9e={mcp__chrome__navigate_page:{labelFn:t=>`Navigating to ${t?.url||t?.path||"page"}`,category:"navigation"},mcp__chrome__take_screenshot:{labelFn:()=>"Checking page state",category:"observation"},mcp__chrome__click:{labelFn:t=>`Clicking '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__fill:{labelFn:t=>`Typing in '${t?.selector||t?.ref||"field"}'`,category:"interaction"},mcp__chrome__type:{labelFn:t=>`Typing '${(t?.text||"").substring(0,30)}'`,category:"interaction"},mcp__chrome__press_key:{labelFn:t=>`Pressing ${t?.key||"key"}`,category:"interaction"},mcp__chrome__evaluate_script:{labelFn:()=>"Running script on page",category:"interaction"},mcp__chrome__hover:{labelFn:t=>`Hovering over '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__scroll:{labelFn:()=>"Scrolling page",category:"interaction"},mcp__chrome__select_option:{labelFn:t=>`Selecting '${t?.value||"option"}' in '${t?.selector||"dropdown"}'`,category:"interaction"}},zL=500,XL=5e3,ZL=2e3,pI=class{#n;#c;#s;#t;#o=[];#i=[];#e=null;#a=null;#B=0;#m=0;#M=Date.now();#F="";#b="";#S=!1;#A=[];#p=null;#r=[];#g;constructor(e,r){this.#n=e,this.#c=r.framesDir,this.#s=r.debug??!1,this.#t=r.enableCdnUpload??!0,this.#g=(0,l0.join)(r.framesDir,`${e}-state.jsonl`)}setReplayUploader(e){this.#e=e}reset(){this.#o=[],this.#i=[],this.#a=null,this.#B=0,this.#m=0,this.#M=Date.now(),this.#F="",this.#b="",this.#A=[],this.#p=null,this.#r=[];try{(0,Fn.existsSync)(this.#g)&&(0,Fn.unlinkSync)(this.#g)}catch{}}onToolCall(e,r){let n=X9e[e];if(n){let i={};try{i=JSON.parse(r||"{}")}catch{}let s=n.labelFn(i);this.#F=s,this.#T({label:s,category:n.category,toolName:e,timestamp:Date.now()})}}onToolResult(e){if(e.tool_name!=="mcp__chrome__take_screenshot"||!Array.isArray(e.content))return;let r=e.content.find(n=>n.type==="image"&&n.source.type==="base64");r&&(this.#a=r)}onRecordFrame(e){let r=this.#a;if(!r)return;let n=e.title||"Untitled",i=e.category||"milestone";this.#F=n,this.#k(r,n,i,!0,void 0,e.description)}onThinking(e){!e||e.length===0||(this.#b=e.substring(0,300),this.#T({label:"AI thinking",category:"observation",thinking:e.substring(0,2e3),timestamp:Date.now()}))}getLastCapturedImage(){return this.#a}getExplicitFrames(){return this.#i.filter(e=>e.explicit).map(e=>({image:e.image,title:e.title}))}getExplicitImages(){return this.#i.filter(e=>e.explicit).map(e=>e.image)}getAllImages(){return this.#i.map(e=>e.image)}getLegacyMetadataFrames(){return this.#i.filter(e=>e.explicit).map(e=>({hasImage:!0,title:e.title}))}getExplicitFrameDurations(){let e=this.#i.filter(n=>n.explicit);if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,s=Math.min(XL,Math.max(zL,i));r.push((s/1e3).toFixed(2))}else r.push((ZL/1e3).toFixed(2));return r}getProgressSnapshot(){let e=this.#i[this.#i.length-1];return{eventCount:this.#o.length,frameCount:this.#i.length,lastLabel:this.#F,lastFrameFileName:e?.fileName,lastThinking:this.#b||void 0}}getEventCount(){return this.#o.length}getFrameCount(){return this.#i.length}getLastLabel(){return this.#F}hasExplicitFrames(){return this.#i.some(e=>e.explicit)}hasAnyFrames(){return this.#i.length>0}mergeChildTimeline(e,r,n){let i,s;for(let c of e.#o)(i===void 0||c.timestamp<i)&&(i=c.timestamp),(s===void 0||c.timestamp>s)&&(s=c.timestamp);let o=this.#T({label:`[${r}] Start`,category:"milestone",timestamp:i??Date.now()}),a=new Map;for(let c of e.#o){let u=this.#T({label:`[${r}] ${c.label}`,category:c.category,description:c.description,toolName:c.toolName,durationMs:c.durationMs,thinking:c.thinking,frameIndex:c.frameIndex!=null?c.frameIndex+this.#m:void 0,timestamp:c.timestamp});a.set(c.id,u.id)}for(let c of e.#i){let u=`${this.#n}-${r}-${String(this.#m).padStart(5,"0")}.${this.#J(c.image)}`,l={image:c.image,title:`[${r}] ${c.title}`,category:c.category,eventId:a.get(c.eventId)??o.id,explicit:c.explicit,timestamp:c.timestamp,fileName:u,imageUrl:c.imageUrl};c.uploadPromise&&(l.uploadPromise=c.uploadPromise.then(()=>{l.imageUrl=c.imageUrl})),this.#i.push(l),this.#m++,this.#R(c.image,u).catch(()=>{})}let A=this.#T({label:`[${r}] End${n?.summary?` \u2014 ${n.summary}`:""}`,category:"milestone",timestamp:s??Date.now()});return n?.sessionId&&this.#A.push({label:r,sessionId:n.sessionId,startEventId:o.id,endEventId:A.id,testCaseIds:n.testCaseIds,replayId:n.replayId}),this.mergeChildStateFile(e.getStateFilePath()),{startEventId:o.id,endEventId:A.id}}mergeTestPlan(e){if(!this.#p)this.#p={mode:e.mode,test_cases:[...e.test_cases]};else{let r=new Set(this.#p.test_cases.map(n=>n.id));for(let n of e.test_cases)r.has(n.id)||this.#p.test_cases.push(n)}}getMergedTestPlan(){return this.#p}mergeTestCaseResults(e){for(let r of e){let n=r.test_case_id;if(!n){this.#r.push(r);continue}let i=this.#r.findIndex(A=>A.test_case_id===n);if(i===-1){this.#r.push(r);continue}let s=this.#r[i],o=Number(s.timestamp??s.ts??0);Number(r.timestamp??r.ts??Date.now())>=o&&(this.#r[i]=r)}}getMergedTestCaseResults(){return this.#r}getStateFilePath(){return this.#g}onTestOutcome(e,r,n){this.#H({kind:"test_outcome",status:r,reason:n,...e})}mergeChildStateFile(e){try{if(!(0,Fn.existsSync)(e))return;this.#W(),(0,Fn.appendFileSync)(this.#g,(0,Fn.readFileSync)(e,"utf8"))}catch(r){this.#s&&gI.warn(`Failed to merge child state: ${e}`,r)}}readState(){try{if(!(0,Fn.existsSync)(this.#g))return[];let e=(0,Fn.readFileSync)(this.#g,"utf8"),r=[];for(let n of e.split(`
|
|
1739
1739
|
`))if(n)try{r.push(JSON.parse(n))}catch{}return r}catch{return[]}}#H(e){try{this.#W(),(0,Fn.appendFileSync)(this.#g,JSON.stringify({ts:Date.now(),agentId:this.#n,...e})+`
|
|
1740
|
-
`)}catch(r){this.#s&&gI.warn("Failed to append state entry",r)}}#W(){this.#S||((0,Fn.mkdirSync)(this.#c,{recursive:!0}),this.#S=!0)}getHighlightFrames(){if(this.#i.length===0)return[];let e=new Set;e.add(0),e.add(this.#i.length-1);for(let s=0;s<this.#i.length;s++)this.#i[s].explicit&&e.add(s);let r=new Set(this.#o.filter(s=>s.category==="navigation"&&s.frameIndex!=null).map(s=>s.frameIndex));for(let s=0;s<this.#i.length;s++)s>0&&r.has(s-1)&&e.add(s),r.has(s)&&e.add(s);for(let s of this.#o)s.frameIndex!=null&&(s.category==="milestone"||s.category==="assertion"||s.category==="error")&&e.add(s.frameIndex);let n=[...e].sort((s,o)=>s-o);n=n.filter((s,o)=>o===0||this.#i[s].title!==this.#i[n[o-1]].title);let i=15;if(n.length>i){let s=n[0],o=n[n.length-1],a=n.slice(1,-1),A=a.length/(i-2),c=[s];for(let u=0;u<i-2;u++)c.push(a[Math.round(u*A)]);c.push(o),n=c}return n.map(s=>this.#i[s])}getHighlightImages(){return this.getHighlightFrames().map(e=>e.image)}getHighlightMetadataFrames(){return this.getHighlightFrames().map(e=>({hasImage:!0,title:e.title}))}getHighlightFrameDurations(){let e=this.getHighlightFrames();if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,s=Math.min(XL,Math.max(zL,i));r.push((s/1e3).toFixed(2))}else r.push((ZL/1e3).toFixed(2));return r}async cleanupSessionFiles(){let e=this.#c;try{let n=(await Fn.promises.readdir(e)).filter(s=>s.startsWith(this.#n)),i=0;for(let s of n)try{await Fn.promises.unlink((0,l0.join)(e,s)),i++}catch{}i>0&&gI.info(`Cleaned up ${i} local files for session ${this.#n}`)}catch{}}async finalize(){let e=this.#i.map(s=>s.uploadPromise).filter(Boolean);if(e.length>0){let s=new Promise(o=>setTimeout(o,3e4));await Promise.race([Promise.allSettled(e),s])}let r=Date.now(),n=this.#i.map((s,o)=>{let a=ZL;if(o<this.#i.length-1){let A=this.#i[o+1].timestamp-s.timestamp;a=Math.min(XL,Math.max(zL,A))}return{index:o,timestamp:s.timestamp,title:s.title,category:s.category,eventId:s.eventId,explicit:s.explicit,displayDurationMs:a,fileName:s.fileName,image_url:s.imageUrl,cursorX:s.cursorX,cursorY:s.cursorY,viewportWidth:s.viewportWidth,viewportHeight:s.viewportHeight}}),i={version:1,sessionId:this.#n,startTime:this.#P,endTime:r,totalFrames:n.length,events:this.#o,frames:n,...this.#A.length>0&&{phases:this.#A}};return this.#t&&this.#i.length>0&&this.#i.every(s=>!!s.imageUrl)&&this.cleanupSessionFiles().catch(()=>{}),i}#T(e){let r={id:this.#B++,...e};return this.#o.push(r),r}#k(e,r,n,i,s,o,a){let A=this.#T({label:r,category:n,frameIndex:this.#m,durationMs:s,description:o,timestamp:Date.now()}),c=this.#J(e),u=`${this.#n}-frame-${String(this.#m).padStart(5,"0")}.${c}`,l={image:e,title:r,category:n,eventId:A.id,explicit:i,timestamp:Date.now(),fileName:u,cursorX:a?.x,cursorY:a?.y,viewportWidth:a?.viewportWidth,viewportHeight:a?.viewportHeight};if(this.#i.push(l),this.#m++,this.#R(e,u).catch(()=>{}),this.#t&&e.source.type==="base64"){let d=`${this.#n}-frame-${String(this.#m-1).padStart(5,"0")}`;l.uploadPromise=Lse(e.source.data,e.source.media_type,d).then(g=>{g&&(l.imageUrl=g),this.#e&&this.#e.recordCheckpoint(l.timestamp,l.title,l.imageUrl)})}}async#R(e,r){try{this.#S||(await Fn.promises.mkdir(this.#c,{recursive:!0}),this.#S=!0);let n=(0,l0.join)(this.#c,r);if(e.source.type==="base64"){let i=Buffer.from(e.source.data,"base64");await Fn.promises.writeFile(n,new Uint8Array(i)),this.#s&&gI.info(`Saved frame: ${r}`)}}catch(n){this.#s&&gI.warn(`Failed to save frame: ${r}`,n)}}#J(e){if(e.source.type!=="base64")return"webp";switch(e.source.media_type){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";default:return"webp"}}}});function Bn(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}var g0=L(()=>{"use strict";h()});function lc(t){return Array.isArray?Array.isArray(t):qse(t)==="[object Array]"}function e6e(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-Z9e?"-0":e}function t6e(t){return t==null?"":e6e(t)}function lA(t){return typeof t=="string"}function jse(t){return typeof t=="number"}function r6e(t){return t===!0||t===!1||n6e(t)&&qse(t)=="[object Boolean]"}function Yse(t){return typeof t=="object"}function n6e(t){return Yse(t)&&t!==null}function _s(t){return t!=null}function e_(t){return!t.trim().length}function qse(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function $se(t){let e=null,r=null,n=null,i=1,s=null;if(lA(t)||lc(t))n=t,e=Ose(t),r=r_(t);else{if(!Gse.call(t,"name"))throw new Error(a6e("name"));let o=t.name;if(n=o,Gse.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(A6e(o));e=Ose(o),r=r_(o),s=t.getFn}return{path:e,id:r,weight:i,src:n,getFn:s}}function Ose(t){return lc(t)?t:t.split(".")}function r_(t){return lc(t)?t.join("."):t}function c6e(t,e){let r=[],n=!1,i=(s,o,a)=>{if(_s(s))if(!o[a])r.push(s);else{let A=o[a],c=s[A];if(!_s(c))return;if(a===o.length-1&&(lA(c)||jse(c)||r6e(c)))r.push(t6e(c));else if(lc(c)){n=!0;for(let u=0,l=c.length;u<l;u+=1)i(c[u],o,a+1)}else o.length&&i(c,o,a+1)}};return i(t,lA(e)?e.split("."):e,0),n?r:r[0]}function f6e(t=1,e=3){let r=new Map,n=Math.pow(10,e);return{get(i){let s=i.match(d6e).length;if(r.has(s))return r.get(s);let o=1/Math.pow(s,.5*t),a=parseFloat(Math.round(o*n)/n);return r.set(s,a),a},clear(){r.clear()}}}function Vse(t,e,{getFn:r=ot.getFn,fieldNormWeight:n=ot.fieldNormWeight}={}){let i=new dI({getFn:r,fieldNormWeight:n});return i.setKeys(t.map($se)),i.setSources(e),i.create(),i}function h6e(t,{getFn:e=ot.getFn,fieldNormWeight:r=ot.fieldNormWeight}={}){let{keys:n,records:i}=t,s=new dI({getFn:e,fieldNormWeight:r});return s.setKeys(n),s.setIndexRecords(i),s}function p0(t,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:i=ot.distance,ignoreLocation:s=ot.ignoreLocation}={}){let o=e/t.length;if(s)return o;let a=Math.abs(n-r);return i?o+a/i:a?1:o}function m6e(t=[],e=ot.minMatchCharLength){let r=[],n=-1,i=-1,s=0;for(let o=t.length;s<o;s+=1){let a=t[s];a&&n===-1?n=s:!a&&n!==-1&&(i=s-1,i-n+1>=e&&r.push([n,i]),n=-1)}return t[s-1]&&s-n>=e&&r.push([n,s-1]),r}function C6e(t,e,r,{location:n=ot.location,distance:i=ot.distance,threshold:s=ot.threshold,findAllMatches:o=ot.findAllMatches,minMatchCharLength:a=ot.minMatchCharLength,includeMatches:A=ot.includeMatches,ignoreLocation:c=ot.ignoreLocation}={}){if(e.length>Mg)throw new Error(o6e(Mg));let u=e.length,l=t.length,d=Math.max(0,Math.min(n,l)),g=s,p=d,f=a>1||A,m=f?Array(l):[],C;for(;(C=t.indexOf(e,p))>-1;){let b=p0(e,{currentLocation:C,expectedLocation:d,distance:i,ignoreLocation:c});if(g=Math.min(b,g),p=C+u,f){let D=0;for(;D<u;)m[C+D]=1,D+=1}}p=-1;let I=[],B=1,E=u+l,y=1<<u-1;for(let b=0;b<u;b+=1){let D=0,F=E;for(;D<F;)p0(e,{errors:b,currentLocation:d+F,expectedLocation:d,distance:i,ignoreLocation:c})<=g?D=F:E=F,F=Math.floor((E-D)/2+D);E=F;let S=Math.max(1,d-F+1),x=o?l:Math.min(d+F,l)+u,U=Array(x+2);U[x+1]=(1<<b)-1;for(let H=x;H>=S;H-=1){let P=H-1,G=r[t.charAt(P)];if(f&&(m[P]=+!!G),U[H]=(U[H+1]<<1|1)&G,b&&(U[H]|=(I[H+1]|I[H])<<1|1|I[H+1]),U[H]&y&&(B=p0(e,{errors:b,currentLocation:P,expectedLocation:d,distance:i,ignoreLocation:c}),B<=g)){if(g=B,p=P,p<=d)break;S=Math.max(1,2*d-p)}}if(p0(e,{errors:b+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:c})>g)break;I=U}let Q={isMatch:p>=0,score:Math.max(.001,B)};if(f){let b=m6e(m,a);b.length?A&&(Q.indices=b):Q.isMatch=!1}return Q}function I6e(t){let e={};for(let r=0,n=t.length;r<n;r+=1){let i=t.charAt(r);e[i]=(e[i]||0)|1<<n-r-1}return e}function Kse(t,e){let r=t.match(e);return r?r[1]:null}function y6e(t,e={}){return t.split(B6e).map(r=>{let n=r.trim().split(E6e).filter(s=>s&&!!s.trim()),i=[];for(let s=0,o=n.length;s<o;s+=1){let a=n[s],A=!1,c=-1;for(;!A&&++c<Hse;){let u=c_[c],l=u.isMultiMatch(a);l&&(i.push(new u(l,e)),A=!0)}if(!A)for(c=-1;++c<Hse;){let u=c_[c],l=u.isSingleMatch(a);if(l){i.push(new u(l,e));break}}}return i})}function D6e(...t){l_.push(...t)}function g_(t,e){for(let r=0,n=l_.length;r<n;r+=1){let i=l_[r];if(i.condition(t,e))return new i(t,e)}return new f0(t,e)}function Wse(t,e,{auto:r=!0}={}){let n=i=>{let s=Object.keys(i),o=w6e(i);if(!o&&s.length>1&&!d_(i))return n(Jse(i));if(b6e(i)){let A=o?i[p_.PATH]:s[0],c=o?i[p_.PATTERN]:i[A];if(!lA(c))throw new Error(s6e(A));let u={keyId:r_(A),pattern:c};return r&&(u.searcher=g_(c,e)),u}let a={children:[],operator:s[0]};return s.forEach(A=>{let c=i[A];lc(c)&&c.forEach(u=>{a.children.push(n(u))})}),a};return d_(t)||(t=Jse(t)),n(t)}function S6e(t,{ignoreFieldNorm:e=ot.ignoreFieldNorm}){t.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:s,score:o})=>{let a=i?i.weight:null;n*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(e?1:s))}),r.score=n})}function v6e(t,e){let r=t.matches;e.matches=[],_s(r)&&r.forEach(n=>{if(!_s(n.indices)||!n.indices.length)return;let{indices:i,value:s}=n,o={indices:i,value:s};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),e.matches.push(o)})}function x6e(t,e){e.score=t.score}function F6e(t,e,{includeMatches:r=ot.includeMatches,includeScore:n=ot.includeScore}={}){let i=[];return r&&i.push(v6e),n&&i.push(x6e),t.map(s=>{let{idx:o}=s,a={item:e[o],refIndex:o};return i.length&&i.forEach(A=>{A(s,a)}),a})}var Z9e,i6e,s6e,o6e,a6e,A6e,Gse,t_,u6e,l6e,g6e,p6e,ot,d6e,dI,Mg,d0,f0,gA,n_,i_,s_,o_,a_,A_,h0,m0,c_,Hse,E6e,B6e,Q6e,u_,l_,C0,p_,d_,w6e,b6e,Jse,gc,zse=L(()=>{h();Z9e=1/0;i6e="Incorrect 'index' type",s6e=t=>`Invalid value for key ${t}`,o6e=t=>`Pattern length exceeds max of ${t}.`,a6e=t=>`Missing ${t} property in key`,A6e=t=>`Property 'weight' in key '${t}' must be a positive integer`,Gse=Object.prototype.hasOwnProperty,t_=class{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let i=$se(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};u6e={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},l6e={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},g6e={location:0,threshold:.6,distance:100},p6e={useExtendedSearch:!1,getFn:c6e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},ot={...l6e,...u6e,...g6e,...p6e},d6e=/[^ ]+/g;dI=class{constructor({getFn:e=ot.getFn,fieldNormWeight:r=ot.fieldNormWeight}={}){this.norm=f6e(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,lA(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){let r=this.size();lA(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!_s(e)||e_(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((i,s)=>{let o=i.getFn?i.getFn(e):this.getFn(e,i.path);if(_s(o)){if(lc(o)){let a=[],A=[{nestedArrIndex:-1,value:o}];for(;A.length;){let{nestedArrIndex:c,value:u}=A.pop();if(_s(u))if(lA(u)&&!e_(u)){let l={v:u,i:c,n:this.norm.get(u)};a.push(l)}else lc(u)&&u.forEach((l,d)=>{A.push({nestedArrIndex:d,value:l})})}n.$[s]=a}else if(lA(o)&&!e_(o)){let a={v:o,n:this.norm.get(o)};n.$[s]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};Mg=32;d0=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t),f0=class{constructor(e,{location:r=ot.location,threshold:n=ot.threshold,distance:i=ot.distance,includeMatches:s=ot.includeMatches,findAllMatches:o=ot.findAllMatches,minMatchCharLength:a=ot.minMatchCharLength,isCaseSensitive:A=ot.isCaseSensitive,ignoreDiacritics:c=ot.ignoreDiacritics,ignoreLocation:u=ot.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:s,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:A,ignoreDiacritics:c,ignoreLocation:u},e=A?e:e.toLowerCase(),e=c?d0(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let l=(g,p)=>{this.chunks.push({pattern:g,alphabet:I6e(g),startIndex:p})},d=this.pattern.length;if(d>Mg){let g=0,p=d%Mg,f=d-p;for(;g<f;)l(this.pattern.substr(g,Mg),g),g+=Mg;if(p){let m=d-Mg;l(this.pattern.substr(m),m)}}else l(this.pattern,0)}searchIn(e){let{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=r?e:e.toLowerCase(),e=n?d0(e):e,this.pattern===e){let f={isMatch:!0,score:0};return i&&(f.indices=[[0,e.length-1]]),f}let{location:s,distance:o,threshold:a,findAllMatches:A,minMatchCharLength:c,ignoreLocation:u}=this.options,l=[],d=0,g=!1;this.chunks.forEach(({pattern:f,alphabet:m,startIndex:C})=>{let{isMatch:I,score:B,indices:E}=C6e(e,f,m,{location:s+C,distance:o,threshold:a,findAllMatches:A,minMatchCharLength:c,includeMatches:i,ignoreLocation:u});I&&(g=!0),d+=B,I&&E&&(l=[...l,...E])});let p={isMatch:g,score:g?d/this.chunks.length:1};return g&&i&&(p.indices=l),p}},gA=class{constructor(e){this.pattern=e}static isMultiMatch(e){return Kse(e,this.multiRegex)}static isSingleMatch(e){return Kse(e,this.singleRegex)}search(){}};n_=class extends gA{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},i_=class extends gA{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}},s_=class extends gA{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},o_=class extends gA{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}},a_=class extends gA{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},A_=class extends gA{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}},h0=class extends gA{constructor(e,{location:r=ot.location,threshold:n=ot.threshold,distance:i=ot.distance,includeMatches:s=ot.includeMatches,findAllMatches:o=ot.findAllMatches,minMatchCharLength:a=ot.minMatchCharLength,isCaseSensitive:A=ot.isCaseSensitive,ignoreDiacritics:c=ot.ignoreDiacritics,ignoreLocation:u=ot.ignoreLocation}={}){super(e),this._bitapSearch=new f0(e,{location:r,threshold:n,distance:i,includeMatches:s,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:A,ignoreDiacritics:c,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},m0=class extends gA{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n,i=[],s=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+s,i.push([n,r-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}},c_=[n_,m0,s_,o_,A_,a_,i_,h0],Hse=c_.length,E6e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,B6e="|";Q6e=new Set([h0.type,m0.type]),u_=class{constructor(e,{isCaseSensitive:r=ot.isCaseSensitive,ignoreDiacritics:n=ot.ignoreDiacritics,includeMatches:i=ot.includeMatches,minMatchCharLength:s=ot.minMatchCharLength,ignoreLocation:o=ot.ignoreLocation,findAllMatches:a=ot.findAllMatches,location:A=ot.location,threshold:c=ot.threshold,distance:u=ot.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:s,findAllMatches:a,ignoreLocation:o,location:A,threshold:c,distance:u},e=r?e:e.toLowerCase(),e=n?d0(e):e,this.pattern=e,this.query=y6e(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){let r=this.query;if(!r)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:s}=this.options;e=i?e:e.toLowerCase(),e=s?d0(e):e;let o=0,a=[],A=0;for(let c=0,u=r.length;c<u;c+=1){let l=r[c];a.length=0,o=0;for(let d=0,g=l.length;d<g;d+=1){let p=l[d],{isMatch:f,indices:m,score:C}=p.search(e);if(f){if(o+=1,A+=C,n){let I=p.constructor.type;Q6e.has(I)?a=[...a,...m]:a.push(m)}}else{A=0,o=0,a.length=0;break}}if(o){let d={isMatch:!0,score:A/o};return n&&(d.indices=a),d}}return{isMatch:!1,score:1}}},l_=[];C0={AND:"$and",OR:"$or"},p_={PATH:"$path",PATTERN:"$val"},d_=t=>!!(t[C0.AND]||t[C0.OR]),w6e=t=>!!t[p_.PATH],b6e=t=>!lc(t)&&Yse(t)&&!d_(t),Jse=t=>({[C0.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});gc=class{constructor(e,r={},n){this.options={...ot,...r},this.options.useExtendedSearch,this._keyStore=new t_(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof dI))throw new Error(i6e);this._myIndex=r||Vse(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){_s(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let r=[];for(let n=0,i=this._docs.length;n<i;n+=1){let s=this._docs[n];e(s,n)&&(this.removeAt(n),n-=1,i-=1,r.push(s))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){let{includeMatches:n,includeScore:i,shouldSort:s,sortFn:o,ignoreFieldNorm:a}=this.options,A=lA(e)?lA(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return S6e(A,{ignoreFieldNorm:a}),s&&A.sort(o),jse(r)&&r>-1&&(A=A.slice(0,r)),F6e(A,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){let r=g_(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:s,i:o,n:a})=>{if(!_s(s))return;let{isMatch:A,score:c,indices:u}=r.searchIn(s);A&&i.push({item:s,idx:o,matches:[{score:c,value:s,norm:a,indices:u}]})}),i}_searchLogical(e){let r=Wse(e,this.options),n=(a,A,c)=>{if(!a.children){let{keyId:l,searcher:d}=a,g=this._findMatches({key:this._keyStore.get(l),value:this._myIndex.getValueForItemAtKeyId(A,l),searcher:d});return g&&g.length?[{idx:c,item:A,matches:g}]:[]}let u=[];for(let l=0,d=a.children.length;l<d;l+=1){let g=a.children[l],p=n(g,A,c);if(p.length)u.push(...p);else if(a.operator===C0.AND)return[]}return u},i=this._myIndex.records,s={},o=[];return i.forEach(({$:a,i:A})=>{if(_s(a)){let c=n(r,a,A);c.length&&(s[A]||(s[A]={idx:A,item:a,matches:[]},o.push(s[A])),c.forEach(({matches:u})=>{s[A].matches.push(...u)}))}}),o}_searchObjectList(e){let r=g_(e,this.options),{keys:n,records:i}=this._myIndex,s=[];return i.forEach(({$:o,i:a})=>{if(!_s(o))return;let A=[];n.forEach((c,u)=>{A.push(...this._findMatches({key:c,value:o[u],searcher:r}))}),A.length&&s.push({idx:a,item:o,matches:A})}),s}_findMatches({key:e,value:r,searcher:n}){if(!_s(r))return[];let i=[];if(lc(r))r.forEach(({v:s,i:o,n:a})=>{if(!_s(s))return;let{isMatch:A,score:c,indices:u}=n.searchIn(s);A&&i.push({score:c,key:e,value:s,idx:o,norm:a,indices:u})});else{let{v:s,n:o}=r,{isMatch:a,score:A,indices:c}=n.searchIn(s);a&&i.push({score:A,key:e,value:s,norm:o,indices:c})}return i}};gc.version="7.1.0";gc.createIndex=Vse;gc.parseIndex=h6e;gc.config=ot;gc.parseQuery=Wse;D6e(u_)});function R6e(t){if(t.startsWith(".")){let e=t.slice(1),r=e.lastIndexOf(".");return r<0?t:"."+e.slice(0,r)}return t.replace(/\.[^.]+$/,"")}function T6e(t){return t.map(e=>{let r=e.lastIndexOf("/"),n=r>=0?e.slice(r+1):e,i=R6e(n),s=r>=0?e.slice(0,r):"";return{fullPath:e,basename:n,filenameWithoutExt:i,dirname:s}})}function Xse(t){let e=T6e(t);return new gc(e,{includeScore:!0,includeMatches:!0,threshold:.3,ignoreLocation:!0,minMatchCharLength:1,keys:k6e})}function Zse(t){let{fullPath:e,basename:r}=t.item,n=e.length-r.length,i=["fullPath","filenameWithoutExt","basename","dirname"];for(let s of i){let o=t.matches?.find(c=>c.key===s);if(!o?.indices?.length)continue;let a=s==="basename"||s==="filenameWithoutExt"?n:0,A=[];for(let[c,u]of o.indices)for(let l=c;l<=u;l++)A.push(l+a);return A}return[]}var k6e,eoe=L(()=>{"use strict";h();zse();k6e=[{name:"filenameWithoutExt",weight:3},{name:"basename",weight:2},{name:"fullPath",weight:.5},{name:"dirname",weight:.3}]});function M6e(t){return(0,toe.createHash)("sha256").update(t).digest("hex").slice(0,16)}function P6e(t){return t.join(roe.default.homedir(),".builder","history")}function noe(t,e){return t.join(P6e(t),`${M6e(e)}.json`)}async function f_(t,e){let r=noe(t,e);try{let n=await t.readFile(r);return n?JSON.parse(n):[]}catch{return[]}}async function ioe(t,e,r){let n=noe(t,e);await t.writeFile(n,JSON.stringify(r,null,2))}async function soe(t,e,r,n){let i=await f_(t,e),s=i.findIndex(a=>a.sessionId===r),o=Date.now();s!==-1?i[s].lastActiveAt=o:i.unshift({sessionId:r,title:n,createdAt:o,lastActiveAt:o}),await ioe(t,e,i.slice(0,N6e))}async function h_(t,e,r){let n=await f_(t,e),i=n.find(s=>s.sessionId===r);i&&(i.lastActiveAt=Date.now(),await ioe(t,e,n))}async function I0(t,e){return f_(t,e)}function ooe(t){let r=t.replace(/<[^>]*>/g,"").trim().split(`
|
|
1740
|
+
`)}catch(r){this.#s&&gI.warn("Failed to append state entry",r)}}#W(){this.#S||((0,Fn.mkdirSync)(this.#c,{recursive:!0}),this.#S=!0)}getHighlightFrames(){if(this.#i.length===0)return[];let e=new Set;e.add(0),e.add(this.#i.length-1);for(let s=0;s<this.#i.length;s++)this.#i[s].explicit&&e.add(s);let r=new Set(this.#o.filter(s=>s.category==="navigation"&&s.frameIndex!=null).map(s=>s.frameIndex));for(let s=0;s<this.#i.length;s++)s>0&&r.has(s-1)&&e.add(s),r.has(s)&&e.add(s);for(let s of this.#o)s.frameIndex!=null&&(s.category==="milestone"||s.category==="assertion"||s.category==="error")&&e.add(s.frameIndex);let n=[...e].sort((s,o)=>s-o);n=n.filter((s,o)=>o===0||this.#i[s].title!==this.#i[n[o-1]].title);let i=15;if(n.length>i){let s=n[0],o=n[n.length-1],a=n.slice(1,-1),A=a.length/(i-2),c=[s];for(let u=0;u<i-2;u++)c.push(a[Math.round(u*A)]);c.push(o),n=c}return n.map(s=>this.#i[s])}getHighlightImages(){return this.getHighlightFrames().map(e=>e.image)}getHighlightMetadataFrames(){return this.getHighlightFrames().map(e=>({hasImage:!0,title:e.title}))}getHighlightFrameDurations(){let e=this.getHighlightFrames();if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,s=Math.min(XL,Math.max(zL,i));r.push((s/1e3).toFixed(2))}else r.push((ZL/1e3).toFixed(2));return r}async cleanupSessionFiles(){let e=this.#c;try{let n=(await Fn.promises.readdir(e)).filter(s=>s.startsWith(this.#n)),i=0;for(let s of n)try{await Fn.promises.unlink((0,l0.join)(e,s)),i++}catch{}i>0&&gI.info(`Cleaned up ${i} local files for session ${this.#n}`)}catch{}}async finalize(){let e=this.#i.map(s=>s.uploadPromise).filter(Boolean);if(e.length>0){let s=new Promise(o=>setTimeout(o,3e4));await Promise.race([Promise.allSettled(e),s])}let r=Date.now(),n=this.#i.map((s,o)=>{let a=ZL;if(o<this.#i.length-1){let A=this.#i[o+1].timestamp-s.timestamp;a=Math.min(XL,Math.max(zL,A))}return{index:o,timestamp:s.timestamp,title:s.title,category:s.category,eventId:s.eventId,explicit:s.explicit,displayDurationMs:a,fileName:s.fileName,image_url:s.imageUrl,cursorX:s.cursorX,cursorY:s.cursorY,viewportWidth:s.viewportWidth,viewportHeight:s.viewportHeight}}),i={version:1,sessionId:this.#n,startTime:this.#M,endTime:r,totalFrames:n.length,events:this.#o,frames:n,...this.#A.length>0&&{phases:this.#A}};return this.#t&&this.#i.length>0&&this.#i.every(s=>!!s.imageUrl)&&this.cleanupSessionFiles().catch(()=>{}),i}#T(e){let r={id:this.#B++,...e};return this.#o.push(r),r}#k(e,r,n,i,s,o,a){let A=this.#T({label:r,category:n,frameIndex:this.#m,durationMs:s,description:o,timestamp:Date.now()}),c=this.#J(e),u=`${this.#n}-frame-${String(this.#m).padStart(5,"0")}.${c}`,l={image:e,title:r,category:n,eventId:A.id,explicit:i,timestamp:Date.now(),fileName:u,cursorX:a?.x,cursorY:a?.y,viewportWidth:a?.viewportWidth,viewportHeight:a?.viewportHeight};if(this.#i.push(l),this.#m++,this.#R(e,u).catch(()=>{}),this.#t&&e.source.type==="base64"){let d=`${this.#n}-frame-${String(this.#m-1).padStart(5,"0")}`;l.uploadPromise=Lse(e.source.data,e.source.media_type,d).then(g=>{g&&(l.imageUrl=g),this.#e&&this.#e.recordCheckpoint(l.timestamp,l.title,l.imageUrl)})}}async#R(e,r){try{this.#S||(await Fn.promises.mkdir(this.#c,{recursive:!0}),this.#S=!0);let n=(0,l0.join)(this.#c,r);if(e.source.type==="base64"){let i=Buffer.from(e.source.data,"base64");await Fn.promises.writeFile(n,new Uint8Array(i)),this.#s&&gI.info(`Saved frame: ${r}`)}}catch(n){this.#s&&gI.warn(`Failed to save frame: ${r}`,n)}}#J(e){if(e.source.type!=="base64")return"webp";switch(e.source.media_type){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";default:return"webp"}}}});function Bn(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}var g0=L(()=>{"use strict";h()});function lc(t){return Array.isArray?Array.isArray(t):qse(t)==="[object Array]"}function e6e(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-Z9e?"-0":e}function t6e(t){return t==null?"":e6e(t)}function lA(t){return typeof t=="string"}function jse(t){return typeof t=="number"}function r6e(t){return t===!0||t===!1||n6e(t)&&qse(t)=="[object Boolean]"}function Yse(t){return typeof t=="object"}function n6e(t){return Yse(t)&&t!==null}function _s(t){return t!=null}function e_(t){return!t.trim().length}function qse(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function $se(t){let e=null,r=null,n=null,i=1,s=null;if(lA(t)||lc(t))n=t,e=Ose(t),r=r_(t);else{if(!Gse.call(t,"name"))throw new Error(a6e("name"));let o=t.name;if(n=o,Gse.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(A6e(o));e=Ose(o),r=r_(o),s=t.getFn}return{path:e,id:r,weight:i,src:n,getFn:s}}function Ose(t){return lc(t)?t:t.split(".")}function r_(t){return lc(t)?t.join("."):t}function c6e(t,e){let r=[],n=!1,i=(s,o,a)=>{if(_s(s))if(!o[a])r.push(s);else{let A=o[a],c=s[A];if(!_s(c))return;if(a===o.length-1&&(lA(c)||jse(c)||r6e(c)))r.push(t6e(c));else if(lc(c)){n=!0;for(let u=0,l=c.length;u<l;u+=1)i(c[u],o,a+1)}else o.length&&i(c,o,a+1)}};return i(t,lA(e)?e.split("."):e,0),n?r:r[0]}function f6e(t=1,e=3){let r=new Map,n=Math.pow(10,e);return{get(i){let s=i.match(d6e).length;if(r.has(s))return r.get(s);let o=1/Math.pow(s,.5*t),a=parseFloat(Math.round(o*n)/n);return r.set(s,a),a},clear(){r.clear()}}}function Vse(t,e,{getFn:r=ot.getFn,fieldNormWeight:n=ot.fieldNormWeight}={}){let i=new dI({getFn:r,fieldNormWeight:n});return i.setKeys(t.map($se)),i.setSources(e),i.create(),i}function h6e(t,{getFn:e=ot.getFn,fieldNormWeight:r=ot.fieldNormWeight}={}){let{keys:n,records:i}=t,s=new dI({getFn:e,fieldNormWeight:r});return s.setKeys(n),s.setIndexRecords(i),s}function p0(t,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:i=ot.distance,ignoreLocation:s=ot.ignoreLocation}={}){let o=e/t.length;if(s)return o;let a=Math.abs(n-r);return i?o+a/i:a?1:o}function m6e(t=[],e=ot.minMatchCharLength){let r=[],n=-1,i=-1,s=0;for(let o=t.length;s<o;s+=1){let a=t[s];a&&n===-1?n=s:!a&&n!==-1&&(i=s-1,i-n+1>=e&&r.push([n,i]),n=-1)}return t[s-1]&&s-n>=e&&r.push([n,s-1]),r}function C6e(t,e,r,{location:n=ot.location,distance:i=ot.distance,threshold:s=ot.threshold,findAllMatches:o=ot.findAllMatches,minMatchCharLength:a=ot.minMatchCharLength,includeMatches:A=ot.includeMatches,ignoreLocation:c=ot.ignoreLocation}={}){if(e.length>Mg)throw new Error(o6e(Mg));let u=e.length,l=t.length,d=Math.max(0,Math.min(n,l)),g=s,p=d,f=a>1||A,m=f?Array(l):[],C;for(;(C=t.indexOf(e,p))>-1;){let b=p0(e,{currentLocation:C,expectedLocation:d,distance:i,ignoreLocation:c});if(g=Math.min(b,g),p=C+u,f){let D=0;for(;D<u;)m[C+D]=1,D+=1}}p=-1;let I=[],B=1,E=u+l,y=1<<u-1;for(let b=0;b<u;b+=1){let D=0,F=E;for(;D<F;)p0(e,{errors:b,currentLocation:d+F,expectedLocation:d,distance:i,ignoreLocation:c})<=g?D=F:E=F,F=Math.floor((E-D)/2+D);E=F;let S=Math.max(1,d-F+1),x=o?l:Math.min(d+F,l)+u,U=Array(x+2);U[x+1]=(1<<b)-1;for(let H=x;H>=S;H-=1){let P=H-1,G=r[t.charAt(P)];if(f&&(m[P]=+!!G),U[H]=(U[H+1]<<1|1)&G,b&&(U[H]|=(I[H+1]|I[H])<<1|1|I[H+1]),U[H]&y&&(B=p0(e,{errors:b,currentLocation:P,expectedLocation:d,distance:i,ignoreLocation:c}),B<=g)){if(g=B,p=P,p<=d)break;S=Math.max(1,2*d-p)}}if(p0(e,{errors:b+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:c})>g)break;I=U}let Q={isMatch:p>=0,score:Math.max(.001,B)};if(f){let b=m6e(m,a);b.length?A&&(Q.indices=b):Q.isMatch=!1}return Q}function I6e(t){let e={};for(let r=0,n=t.length;r<n;r+=1){let i=t.charAt(r);e[i]=(e[i]||0)|1<<n-r-1}return e}function Kse(t,e){let r=t.match(e);return r?r[1]:null}function y6e(t,e={}){return t.split(B6e).map(r=>{let n=r.trim().split(E6e).filter(s=>s&&!!s.trim()),i=[];for(let s=0,o=n.length;s<o;s+=1){let a=n[s],A=!1,c=-1;for(;!A&&++c<Hse;){let u=c_[c],l=u.isMultiMatch(a);l&&(i.push(new u(l,e)),A=!0)}if(!A)for(c=-1;++c<Hse;){let u=c_[c],l=u.isSingleMatch(a);if(l){i.push(new u(l,e));break}}}return i})}function D6e(...t){l_.push(...t)}function g_(t,e){for(let r=0,n=l_.length;r<n;r+=1){let i=l_[r];if(i.condition(t,e))return new i(t,e)}return new f0(t,e)}function Wse(t,e,{auto:r=!0}={}){let n=i=>{let s=Object.keys(i),o=w6e(i);if(!o&&s.length>1&&!d_(i))return n(Jse(i));if(b6e(i)){let A=o?i[p_.PATH]:s[0],c=o?i[p_.PATTERN]:i[A];if(!lA(c))throw new Error(s6e(A));let u={keyId:r_(A),pattern:c};return r&&(u.searcher=g_(c,e)),u}let a={children:[],operator:s[0]};return s.forEach(A=>{let c=i[A];lc(c)&&c.forEach(u=>{a.children.push(n(u))})}),a};return d_(t)||(t=Jse(t)),n(t)}function S6e(t,{ignoreFieldNorm:e=ot.ignoreFieldNorm}){t.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:s,score:o})=>{let a=i?i.weight:null;n*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(e?1:s))}),r.score=n})}function v6e(t,e){let r=t.matches;e.matches=[],_s(r)&&r.forEach(n=>{if(!_s(n.indices)||!n.indices.length)return;let{indices:i,value:s}=n,o={indices:i,value:s};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),e.matches.push(o)})}function x6e(t,e){e.score=t.score}function F6e(t,e,{includeMatches:r=ot.includeMatches,includeScore:n=ot.includeScore}={}){let i=[];return r&&i.push(v6e),n&&i.push(x6e),t.map(s=>{let{idx:o}=s,a={item:e[o],refIndex:o};return i.length&&i.forEach(A=>{A(s,a)}),a})}var Z9e,i6e,s6e,o6e,a6e,A6e,Gse,t_,u6e,l6e,g6e,p6e,ot,d6e,dI,Mg,d0,f0,gA,n_,i_,s_,o_,a_,A_,h0,m0,c_,Hse,E6e,B6e,Q6e,u_,l_,C0,p_,d_,w6e,b6e,Jse,gc,zse=L(()=>{h();Z9e=1/0;i6e="Incorrect 'index' type",s6e=t=>`Invalid value for key ${t}`,o6e=t=>`Pattern length exceeds max of ${t}.`,a6e=t=>`Missing ${t} property in key`,A6e=t=>`Property 'weight' in key '${t}' must be a positive integer`,Gse=Object.prototype.hasOwnProperty,t_=class{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let i=$se(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};u6e={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},l6e={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},g6e={location:0,threshold:.6,distance:100},p6e={useExtendedSearch:!1,getFn:c6e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},ot={...l6e,...u6e,...g6e,...p6e},d6e=/[^ ]+/g;dI=class{constructor({getFn:e=ot.getFn,fieldNormWeight:r=ot.fieldNormWeight}={}){this.norm=f6e(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,lA(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){let r=this.size();lA(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!_s(e)||e_(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((i,s)=>{let o=i.getFn?i.getFn(e):this.getFn(e,i.path);if(_s(o)){if(lc(o)){let a=[],A=[{nestedArrIndex:-1,value:o}];for(;A.length;){let{nestedArrIndex:c,value:u}=A.pop();if(_s(u))if(lA(u)&&!e_(u)){let l={v:u,i:c,n:this.norm.get(u)};a.push(l)}else lc(u)&&u.forEach((l,d)=>{A.push({nestedArrIndex:d,value:l})})}n.$[s]=a}else if(lA(o)&&!e_(o)){let a={v:o,n:this.norm.get(o)};n.$[s]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};Mg=32;d0=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t),f0=class{constructor(e,{location:r=ot.location,threshold:n=ot.threshold,distance:i=ot.distance,includeMatches:s=ot.includeMatches,findAllMatches:o=ot.findAllMatches,minMatchCharLength:a=ot.minMatchCharLength,isCaseSensitive:A=ot.isCaseSensitive,ignoreDiacritics:c=ot.ignoreDiacritics,ignoreLocation:u=ot.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:s,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:A,ignoreDiacritics:c,ignoreLocation:u},e=A?e:e.toLowerCase(),e=c?d0(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let l=(g,p)=>{this.chunks.push({pattern:g,alphabet:I6e(g),startIndex:p})},d=this.pattern.length;if(d>Mg){let g=0,p=d%Mg,f=d-p;for(;g<f;)l(this.pattern.substr(g,Mg),g),g+=Mg;if(p){let m=d-Mg;l(this.pattern.substr(m),m)}}else l(this.pattern,0)}searchIn(e){let{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=r?e:e.toLowerCase(),e=n?d0(e):e,this.pattern===e){let f={isMatch:!0,score:0};return i&&(f.indices=[[0,e.length-1]]),f}let{location:s,distance:o,threshold:a,findAllMatches:A,minMatchCharLength:c,ignoreLocation:u}=this.options,l=[],d=0,g=!1;this.chunks.forEach(({pattern:f,alphabet:m,startIndex:C})=>{let{isMatch:I,score:B,indices:E}=C6e(e,f,m,{location:s+C,distance:o,threshold:a,findAllMatches:A,minMatchCharLength:c,includeMatches:i,ignoreLocation:u});I&&(g=!0),d+=B,I&&E&&(l=[...l,...E])});let p={isMatch:g,score:g?d/this.chunks.length:1};return g&&i&&(p.indices=l),p}},gA=class{constructor(e){this.pattern=e}static isMultiMatch(e){return Kse(e,this.multiRegex)}static isSingleMatch(e){return Kse(e,this.singleRegex)}search(){}};n_=class extends gA{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},i_=class extends gA{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}},s_=class extends gA{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},o_=class extends gA{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}},a_=class extends gA{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},A_=class extends gA{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}},h0=class extends gA{constructor(e,{location:r=ot.location,threshold:n=ot.threshold,distance:i=ot.distance,includeMatches:s=ot.includeMatches,findAllMatches:o=ot.findAllMatches,minMatchCharLength:a=ot.minMatchCharLength,isCaseSensitive:A=ot.isCaseSensitive,ignoreDiacritics:c=ot.ignoreDiacritics,ignoreLocation:u=ot.ignoreLocation}={}){super(e),this._bitapSearch=new f0(e,{location:r,threshold:n,distance:i,includeMatches:s,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:A,ignoreDiacritics:c,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},m0=class extends gA{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n,i=[],s=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+s,i.push([n,r-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}},c_=[n_,m0,s_,o_,A_,a_,i_,h0],Hse=c_.length,E6e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,B6e="|";Q6e=new Set([h0.type,m0.type]),u_=class{constructor(e,{isCaseSensitive:r=ot.isCaseSensitive,ignoreDiacritics:n=ot.ignoreDiacritics,includeMatches:i=ot.includeMatches,minMatchCharLength:s=ot.minMatchCharLength,ignoreLocation:o=ot.ignoreLocation,findAllMatches:a=ot.findAllMatches,location:A=ot.location,threshold:c=ot.threshold,distance:u=ot.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:s,findAllMatches:a,ignoreLocation:o,location:A,threshold:c,distance:u},e=r?e:e.toLowerCase(),e=n?d0(e):e,this.pattern=e,this.query=y6e(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){let r=this.query;if(!r)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:s}=this.options;e=i?e:e.toLowerCase(),e=s?d0(e):e;let o=0,a=[],A=0;for(let c=0,u=r.length;c<u;c+=1){let l=r[c];a.length=0,o=0;for(let d=0,g=l.length;d<g;d+=1){let p=l[d],{isMatch:f,indices:m,score:C}=p.search(e);if(f){if(o+=1,A+=C,n){let I=p.constructor.type;Q6e.has(I)?a=[...a,...m]:a.push(m)}}else{A=0,o=0,a.length=0;break}}if(o){let d={isMatch:!0,score:A/o};return n&&(d.indices=a),d}}return{isMatch:!1,score:1}}},l_=[];C0={AND:"$and",OR:"$or"},p_={PATH:"$path",PATTERN:"$val"},d_=t=>!!(t[C0.AND]||t[C0.OR]),w6e=t=>!!t[p_.PATH],b6e=t=>!lc(t)&&Yse(t)&&!d_(t),Jse=t=>({[C0.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});gc=class{constructor(e,r={},n){this.options={...ot,...r},this.options.useExtendedSearch,this._keyStore=new t_(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof dI))throw new Error(i6e);this._myIndex=r||Vse(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){_s(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let r=[];for(let n=0,i=this._docs.length;n<i;n+=1){let s=this._docs[n];e(s,n)&&(this.removeAt(n),n-=1,i-=1,r.push(s))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){let{includeMatches:n,includeScore:i,shouldSort:s,sortFn:o,ignoreFieldNorm:a}=this.options,A=lA(e)?lA(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return S6e(A,{ignoreFieldNorm:a}),s&&A.sort(o),jse(r)&&r>-1&&(A=A.slice(0,r)),F6e(A,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){let r=g_(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:s,i:o,n:a})=>{if(!_s(s))return;let{isMatch:A,score:c,indices:u}=r.searchIn(s);A&&i.push({item:s,idx:o,matches:[{score:c,value:s,norm:a,indices:u}]})}),i}_searchLogical(e){let r=Wse(e,this.options),n=(a,A,c)=>{if(!a.children){let{keyId:l,searcher:d}=a,g=this._findMatches({key:this._keyStore.get(l),value:this._myIndex.getValueForItemAtKeyId(A,l),searcher:d});return g&&g.length?[{idx:c,item:A,matches:g}]:[]}let u=[];for(let l=0,d=a.children.length;l<d;l+=1){let g=a.children[l],p=n(g,A,c);if(p.length)u.push(...p);else if(a.operator===C0.AND)return[]}return u},i=this._myIndex.records,s={},o=[];return i.forEach(({$:a,i:A})=>{if(_s(a)){let c=n(r,a,A);c.length&&(s[A]||(s[A]={idx:A,item:a,matches:[]},o.push(s[A])),c.forEach(({matches:u})=>{s[A].matches.push(...u)}))}}),o}_searchObjectList(e){let r=g_(e,this.options),{keys:n,records:i}=this._myIndex,s=[];return i.forEach(({$:o,i:a})=>{if(!_s(o))return;let A=[];n.forEach((c,u)=>{A.push(...this._findMatches({key:c,value:o[u],searcher:r}))}),A.length&&s.push({idx:a,item:o,matches:A})}),s}_findMatches({key:e,value:r,searcher:n}){if(!_s(r))return[];let i=[];if(lc(r))r.forEach(({v:s,i:o,n:a})=>{if(!_s(s))return;let{isMatch:A,score:c,indices:u}=n.searchIn(s);A&&i.push({score:c,key:e,value:s,idx:o,norm:a,indices:u})});else{let{v:s,n:o}=r,{isMatch:a,score:A,indices:c}=n.searchIn(s);a&&i.push({score:A,key:e,value:s,norm:o,indices:c})}return i}};gc.version="7.1.0";gc.createIndex=Vse;gc.parseIndex=h6e;gc.config=ot;gc.parseQuery=Wse;D6e(u_)});function R6e(t){if(t.startsWith(".")){let e=t.slice(1),r=e.lastIndexOf(".");return r<0?t:"."+e.slice(0,r)}return t.replace(/\.[^.]+$/,"")}function T6e(t){return t.map(e=>{let r=e.lastIndexOf("/"),n=r>=0?e.slice(r+1):e,i=R6e(n),s=r>=0?e.slice(0,r):"";return{fullPath:e,basename:n,filenameWithoutExt:i,dirname:s}})}function Xse(t){let e=T6e(t);return new gc(e,{includeScore:!0,includeMatches:!0,threshold:.3,ignoreLocation:!0,minMatchCharLength:1,keys:k6e})}function Zse(t){let{fullPath:e,basename:r}=t.item,n=e.length-r.length,i=["fullPath","filenameWithoutExt","basename","dirname"];for(let s of i){let o=t.matches?.find(c=>c.key===s);if(!o?.indices?.length)continue;let a=s==="basename"||s==="filenameWithoutExt"?n:0,A=[];for(let[c,u]of o.indices)for(let l=c;l<=u;l++)A.push(l+a);return A}return[]}var k6e,eoe=L(()=>{"use strict";h();zse();k6e=[{name:"filenameWithoutExt",weight:3},{name:"basename",weight:2},{name:"fullPath",weight:.5},{name:"dirname",weight:.3}]});function M6e(t){return(0,toe.createHash)("sha256").update(t).digest("hex").slice(0,16)}function P6e(t){return t.join(roe.default.homedir(),".builder","history")}function noe(t,e){return t.join(P6e(t),`${M6e(e)}.json`)}async function f_(t,e){let r=noe(t,e);try{let n=await t.readFile(r);return n?JSON.parse(n):[]}catch{return[]}}async function ioe(t,e,r){let n=noe(t,e);await t.writeFile(n,JSON.stringify(r,null,2))}async function soe(t,e,r,n){let i=await f_(t,e),s=i.findIndex(a=>a.sessionId===r),o=Date.now();s!==-1?i[s].lastActiveAt=o:i.unshift({sessionId:r,title:n,createdAt:o,lastActiveAt:o}),await ioe(t,e,i.slice(0,N6e))}async function h_(t,e,r){let n=await f_(t,e),i=n.find(s=>s.sessionId===r);i&&(i.lastActiveAt=Date.now(),await ioe(t,e,n))}async function I0(t,e){return f_(t,e)}function ooe(t){let r=t.replace(/<[^>]*>/g,"").trim().split(`
|
|
1741
1741
|
`)[0].trim();return r.length>80?r.slice(0,77)+"...":r}var toe,roe,N6e,m_=L(()=>{"use strict";h();toe=require("node:crypto"),roe=X(require("node:os"),1),N6e=50});function aoe(t,e){t||(t="http://localhost:3000");let r=L6e(e);return`
|
|
1742
1742
|
|
|
1743
1743
|
<browser_automation_instructions>
|
|
@@ -1788,7 +1788,7 @@ ${r}
|
|
|
1788
1788
|
Before scheduling browser tests, check whether the modified files are inside \`${t}\`. If all changes are outside this path, skip browser testing entirely.
|
|
1789
1789
|
`:""}var Aoe=L(()=>{"use strict";h()});function _6e(t){let e=t.trim().replace(/\.git$/,"");return e.startsWith("git@")&&(e=e.replace(/^git@/,"").replace(/:([^/])/,"/$1")),e=e.replace(/^https?:\/\//,"").replace(/^[^@]+@/,""),e.toLowerCase()}async function E0(t){if(!t)return;let e=_6e(t),n=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("").slice(0,8)}var C_=L(()=>{"use strict";h()});var I_,coe=L(()=>{"use strict";h();C_();I_="code"});function If(t,e=I_){if(typeof t!="string"||!t.trim())return{};let r=t.trim();if(!r.includes(":"))return{[e]:r};let n={};for(let i of r.split(",")){let s=i.indexOf(":");if(s===-1)continue;let o;try{o=decodeURIComponent(i.substring(0,s))}catch{continue}let a=i.substring(s+1).trim();o&&a&&(n[o]=a)}return n}function uo(t){return!t||Object.keys(t).length===0?"":Object.keys(t).sort().filter(r=>t[r]).map(r=>`${encodeURIComponent(r)}:${t[r]}`).join(",")}function Mu(t,e,r=I_){return If(t,r)[e]}var E_=L(()=>{"use strict";h();oo();coe()});async function B0({sys:t,credentials:e,projectId:r,branchName:n,repoPath:i,aiBranch:s,featureBranch:o,workspace:a,isConnectedToProvider:A,debug:c,forcedFullBackup:u,canAbortMerge:l,folderName:d,repoUrl:g}){let p=performance.now();async function f(P){return ca("git",P,{cwd:i,sys:t})}async function m(){return(await f(["branch","--show-current"])).trim()}async function C(P,G){try{return await f(["merge-base","--is-ancestor",P,G]),!0}catch{return!1}}async function I(){try{return await f(["rev-parse","-q","--verify","MERGE_HEAD"]),!0}catch{return!1}}async function B(P){if(P!=null)try{let G=await f(["--no-pager","show","-s","--format='%an%n%ad%n%B'",P]);return of(G.trim(),1e3)}catch{return}}async function E(){try{return(await f(["rev-parse","HEAD"])).trim()}catch{return null}}async function y(P,G){try{let W=(await f(["rev-list",P,`--max-count=${G}`])).trim();return W?W.split(`
|
|
1790
1790
|
`):[]}catch{return[]}}let Q=u;if(!a)throw new Error("Workspace is required for backup upload");if(await I())if(l)Dr.debug("There is an merge conflict, when attempting to backup, let's try to abort the merge"),await f(["merge","--abort"]);else throw new Error("Merge conflict detected, please resolve the conflict before continuing");await pc(i,t)||(Dr.debug("Uncommitted changes detected, staging and committing before backup"),await f(["add","-A","."]),await f(["commit","--quiet","--no-verify","-m","commit pending changes"]));let D=(d?a.folders.find(P=>(P.name??P.path)===d):a.folders.find(P=>P.enableGit))?.originalRepoUrl??g;if(!D)throw new Error("Original repo URL is required for backup upload");let F=u?"offline-full":A?void 0:"offline",S=await E();if(!S){let P=null;try{let G=await f(["rev-list","--all","--count"]);P=parseInt(G.trim(),10)}catch{}if(P===0){Dr.info("Repository has no commits (empty repo) \u2014 nothing to back up");let G={projectId:r,branchName:n,size:0,partial:!0,initialBranch:o,initialCommitHash:void 0,lastCommitHash:"",gitBranchName:s,empty:!0,status:"completed",version:"v2",repoUrl:D,forced:F,...d&&{folderName:d}};return{success:!0,empty:!0,lastCommitHash:"",partial:!0,repoUrl:D,backupRef:void 0,backupEntry:G}}throw new Error(P===null?"Failed to get current commit hash (git rev-list failed)":`Failed to get current commit hash (rev-list --all --count returned ${P})`)}let x=await m();if(!Q&&x!==s)throw new Error(`Current branch "${x}" is not the ai branch "${s}"`);let U=await U6e({sys:t,repoPath:i,featureBranch:o,debug:c,workspace:a,isConnectedToProvider:A,forcedFullBackup:u,credentials:e,projectId:r,folderName:d}),j=await y(U.initialBranch,10),H=await y(s,10);try{if(U.partial&&(U.initialCommitHash===S||await C(S,U.initialBranch))){Dr.debug(`No commits to backup. ${S}`);let Z={projectId:r,branchName:n,size:0,partial:U.partial,initialBranch:U.initialBranch,initialCommitHash:U.initialCommitHash,lastCommitHash:S,gitBranchName:s,empty:!0,status:"completed",version:"v2",repoUrl:D,forced:F,...d&&{folderName:d},metadata:{initialCommitMeta:await B(U.initialCommitHash),lastCommitMeta:await B(S),rangeInRemote:j,rangeInLocal:H}};return{success:!0,empty:!0,lastCommitHash:S,partial:U.partial,repoUrl:D,backupRef:fI({version:"v2",originalRepoUrl:D,commitHash:S}),backupEntry:Z}}Dr.debug("Creating git bundle...");let P=Date.now(),G=Math.random().toString(36).substring(2,8),$=`backup-${P}-${G}.bundle`,W="/tmp",K=t.join(W,$);Pu.default.mkdirSync(W,{recursive:!0}),await f(["bundle","create","--quiet",K,...U.partial?[`${U.initialCommitHash}..${s}`]:["--branches","--tags"]]),Dr.debug("Computing MD5 hash of bundle file...");let{contentMd5:J,size:O}=await K6e(K);Dr.debug("Verify bundle file integrity"),await f(["bundle","verify","--quiet",K]),Dr.debug(`Requesting signed upload URL for size: ${O} bytes`);let te=await G6e(e,{projectId:r,branchName:n,size:O,partial:U.partial,contentMd5:J,...d&&{folderName:d},...g&&{repoUrl:g}},c);if(!te)return Dr.info("Project/branch was removed, it's okay to skip backup"),{success:!1,reason:"project_removed"};let{signedUrl:ge}=te;Dr.debug(`Uploading to URL: ${ge}`),await O6e(K,ge,O,J),Dr.debug("Uploaded successfully");let Ce={projectId:r,branchName:n,size:O,partial:U.partial,initialBranch:U.initialBranch,initialCommitHash:U.initialCommitHash,lastCommitHash:S,gitBranchName:s,empty:!1,status:"completed",contentMd5:J,version:"v2",repoUrl:D,forced:F,...d&&{folderName:d},metadata:{initialCommitMeta:await B(U.initialCommitHash),lastCommitMeta:await B(S),rangeInRemote:j,rangeInLocal:H}};try{Pu.default.unlinkSync(K)}catch(ce){t.Sentry?.captureException(ce,{level:"warning",tags:{operation:"codegen-backup"}})}return Dr.debug("Everything is done"),{success:!0,empty:!1,lastCommitHash:S,partial:U.partial,repoUrl:D,backupRef:fI({version:"v2",originalRepoUrl:D,commitHash:S}),backupEntry:Ce}}catch(P){let G=performance.now()-p,$=P instanceof Error?P.message:String(P);try{await loe(e,{elapsedTime:G,error:$,backups:[]},c)}catch(W){Dr.error("Failed to record backup failure",W)}throw P}}async function U6e({sys:t,repoPath:e,featureBranch:r,debug:n,workspace:i,isConnectedToProvider:s,forcedFullBackup:o,credentials:a,projectId:A,folderName:c}){async function u(Q){return ca("git",Q,{cwd:e,sys:t})}async function l(Q){try{return(await u(["rev-parse",Q||"HEAD"])).trim()}catch{return null}}async function d(Q){try{return await u(["remote","get-url",Q]),!0}catch{return!1}}async function g(){try{let b=(await u(["remote","show","origin"])).match(/HEAD branch: (.+)/);if(b){let D=b[1].trim();if(D)return D}return null}catch(Q){let b=new Error("failed to get default remote branch",{cause:Q});throw t.Sentry?.captureException(b,{tags:{operation:"codegen-backup"}}),b}}async function p(Q){let b;try{b=(await u(["remote","get-url","origin"])).trim()}catch{}b!==Q&&(b?await u(["remote","set-url","origin",Q]):await u(["remote","add","origin",Q]))}let f=async()=>{if(i?.folders.length){let b=c?i.folders.find(D=>(D.name??D.path)===c):i.folders.find(D=>D.enableGit);if(!b?.repoName)throw new Error("Git workspace not found");return!qC.includes(b.repoName)}return!!await d("origin")};async function m(){let Q=!1;try{if(i?.folders?.length){let b=c?i.folders.find(D=>(D.name??D.path)===c):i.folders.find(D=>D.enableGit);if(b?.repoName&&A){let D=await Ef(a,A,n);if(D.success){let F=D.gitConfigs?.[b.repoName];F?.url?(Dr.info(`Refreshing origin remote URL to ${F.url}`),await p(F.url)):(Dr.warn("Config URL was not returned for repo",b.repoName),Q=!0)}else Dr.warn("Failed to fetch git configs",D.error instanceof Error?D.error.message:String(D.error)),Q=!0}}}catch(b){Dr.warn("Failed to refresh remote origin URL",b instanceof Error?b.message:String(b)),Q=!0}return Q}if(o){let Q=await l(r);return{initialBranch:r,initialCommitHash:Q??void 0,partial:!1,forcedFullBackup:o}}let C=await f();if(C){if(!s){Dr.info("Performing offline backup. Not attempting to fetch origin remote.");let Q=await l(r);if(!Q)throw new Error("Failed to get initial commit hash");return{initialBranch:r,initialCommitHash:Q,partial:C,forcedFullBackup:o}}}else{Dr.debug("No origin remote found. Partial backups are not supported.");let Q=await l(r);if(!Q)throw new Error("Failed to get initial commit hash");return{initialBranch:r,initialCommitHash:Q,partial:!1,forcedFullBackup:o}}Dr.debug("Re-fetching all branches");let I=await m();await u(["fetch","origin"]);let B=await g();if(!B)throw new Error("Failed to get default remote branch");if(B==="(unknown)"){Dr.info("Origin default branch is (unknown); performing full backup.");let Q=await l(r);if(!Q)throw new Error("Failed to get initial commit hash");return{initialBranch:r,initialCommitHash:Q,partial:!1,forcedFullBackup:o,tokenRefreshFailed:I}}let E=`refs/remotes/origin/${B}`,y=await l(E);if(!y)throw new Error("Failed to get initial commit hash");return{initialBranch:E,initialCommitHash:y,partial:C,forcedFullBackup:o,tokenRefreshFailed:I}}async function G6e(t,e,r){let n=new URL(`${Te}/projects/git-backup-upload-url`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Re(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e),signal:AbortSignal.timeout(1e4)},r);if(i.status===404||i.status===410)return null;if(!i.ok)throw new Error(`Failed to get upload URL: ${i.statusText}`);return await i.json()}async function loe(t,e,r){let n=new URL(`${Te}/projects/git-backup-record`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Re(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},signal:AbortSignal.timeout(1e4),body:JSON.stringify(e)},r);if(i.status===404||i.status===410)return{success:!0};if(!i.ok)throw new Error(`Failed to record backup: ${i.statusText}`);return await i.json()}async function y0(t,e,r,n){if(e.length===0)return;let i=e.map(a=>`${a.folderName||"code"} (${(a.size/1024/1024).toFixed(1)}MB, ${a.partial?"partial":"full"}${a.forced?", forced":""})`).join(", ");Dr.info(`Recording ${e.length} folder(s): ${i}`);let s=Date.now();if(!(await loe(t,{backups:e,elapsedTime:r},n)).success)throw new Error("Commit(s) not found on remote when recording backup batch");Dr.info(`Recorded in ${Date.now()-s}ms \u2014 ${e.length} folder(s) committed`)}async function B_(t,e){try{if(e.check.backup.empty)return{success:!0,bundlePath:void 0,bundleSize:0,partial:e.check.backup.partial,gitBranchName:e.check.backup.gitBranchName,lastCommitHash:e.check.backup.lastCommitHash};if(!e.downloadUrl)throw new Error("No download URL found");let{signedUrl:r,partial:n}=e.downloadUrl,i=Date.now(),s=Math.random().toString(36).substring(2,8),o=`download-${i}-${s}.bundle`,a="/tmp",A=t.join(a,o);Pu.default.mkdirSync(a,{recursive:!0});let c=await fetch(r);if(!c.ok){let d=await c.text();throw new Error(`Failed to download bundle: ${c.statusText}: ${d}`)}let u=await c.arrayBuffer();Pu.default.writeFileSync(A,new Uint8Array(u));let l=await t.stat(A);return Dr.info(`Downloaded bundle: ${l.size} bytes`),{success:!0,bundlePath:A,bundleSize:l.size,partial:n,gitBranchName:e.check.backup.gitBranchName,lastCommitHash:e.check.backup.lastCommitHash}}catch(r){let n=new Error("Failed to download backup",{cause:r});return t.Sentry?.captureException(n,{tags:{operation:"codegen-backup"}}),{success:!1,error:n}}}async function O6e(t,e,r,n){let i=Pu.default.createReadStream(t),s=await fetch(e,{method:"PUT",body:i,headers:{"Content-Type":"application/octet-stream","Content-Length":r.toString(),"Content-MD5":n},duplex:"half"}),o=await s.text();if(!s.ok)throw new Error(`Failed to upload bundle: ${s.statusText}: ${o}`);return Dr.info(`Uploaded bundle: ${o}`),s}async function K6e(t){let e=await Pu.default.promises.stat(t);if(!e.isFile())throw new Error("Bundle file does not exist");let r=(0,uoe.createHash)("md5"),n=Pu.default.createReadStream(t);return await new Promise((s,o)=>{n.on("error",o),n.on("data",a=>r.update(a)),n.on("end",s)}),{contentMd5:r.digest("base64"),size:e.size}}async function y_(t,e,r,n){try{let i=JSON.stringify(r),s=new URL(`${Te}/projects/set-runtime-status`);e.builderPublicKey&&s.searchParams.set("apiKey",e.builderPublicKey),e.userId&&s.searchParams.set("userId",e.userId);let o={"Content-Type":"application/json"};e.builderPrivateKey&&(o.Authorization=`Bearer ${e.builderPrivateKey}`);let a=await Re(s,{method:"POST",body:i,keepalive:!0,headers:o,signal:AbortSignal.timeout(1e4)},n);return a.ok?await a.json():!1}catch(i){return t.Sentry?.captureException(i,{level:"warning",tags:{operation:"codegen-backup"}}),!1}}async function Q0(t,e,r,n){let i=uo(r.commits);if(!i)return;let s=Object.keys(r.commits).length;Dr.info(`Syncing snapshot (${s} folder(s)): ${i}`),await y_(t,e,{projectId:r.projectId,branchName:r.branchName,lastCommitHash:i,clearSecondaryVolumeId:!1},n)}function fI(t){if(!(t.originalRepoUrl==null||t.commitHash==null))return`${t.version??"v1"}::${t.originalRepoUrl}::${t.commitHash}`}var Pu,uoe,Dr,D0=L(()=>{"use strict";h();Pu=X(require("node:fs"),1);vr();Qr();oo();uoe=require("node:crypto");ua();Qt();ZC();E_();Dr=ve("Backup")});function dc(t){try{if((0,Bf.existsSync)(t)){let e=(0,Bf.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return null}function lo(t){try{if((0,Bf.existsSync)(t))return(0,Bf.readFileSync)(t,"utf-8")}catch{}return null}function yf(t){let e=t.filter(r=>!r.includes("/"));return e.some(r=>r==="pnpm-lock.yaml")?{manager:"pnpm",setupCommand:"pnpm install"}:e.some(r=>r==="yarn.lock")?{manager:"yarn",setupCommand:"yarn"}:e.some(r=>r==="bun.lockb")?{manager:"bun",setupCommand:"bun install"}:e.some(r=>r==="package-lock.json")?{manager:"npm",setupCommand:"npm install"}:null}function goe(t,e){return t.some(r=>r===e)}function hI(t,e){return t.filter(n=>!n.includes("/")).some(e)}function Qf(t,e){return t.some(r=>r.startsWith(`${e}/`))}var Bf,mI=L(()=>{"use strict";h();Bf=require("node:fs")});async function doe(t,e){try{let r=yf(e);if(!r||!hI(e,A=>/^next\.config\.(js|ts|mjs)$/.test(A))||!Qf(e,"app"))return null;let s=(0,poe.join)(t,"package.json"),o=dc(s);if(!o?.scripts?.dev)return null;let a=o.scripts.dev;return a.includes("next dev")?{id:"nextjs",setupCommand:r.setupCommand,devCommand:a,setupDependencies:[{tool:"node",version:"22",key:"node",type:"mise"}],autoDetectDevServer:!0}:null}catch{return null}}var poe,foe=L(()=>{"use strict";h();poe=require("node:path");mI()});async function hoe(t,e){try{let r=yf(e);if(!r)return null;let n=hI(e,d=>d==="vue.config.js"||d==="vue.config.ts"),i=hI(e,d=>/^vite\.config\.(js|ts|mjs)$/.test(d));if(!n&&!i)return null;if(i&&!n){let d=e.filter(g=>/^vite\.config\.(js|ts|mjs)$/.test(g));if(d.length>0){let g=(0,Q_.join)(t,d[0]),p=lo(g);if(!p||!p.includes("@vitejs/plugin-vue")&&!p.includes("vite-plugin-vue"))return null}}if(!Qf(e,"src"))return null;let o=(0,Q_.join)(t,"package.json"),a=dc(o);if(!a||!(a.dependencies?.vue||a.devDependencies?.vue)||!a.scripts?.dev)return null;let c=a.scripts.dev,u=c.includes("vite"),l=c.includes("vue-cli-service");return!u&&!l?null:{id:"vue-vite",setupCommand:r.setupCommand,devCommand:c,setupDependencies:[{tool:"node",version:"22",key:"node",type:"mise"}],autoDetectDevServer:!0}}catch{return null}}var Q_,moe=L(()=>{"use strict";h();Q_=require("node:path");mI()});async function Coe(t,e){try{let r=yf(e);if(!r||!goe(e,"svelte.config.js")||!Qf(e,"src"))return null;let s=(0,D_.join)(t,"package.json"),o=dc(s);if(!o||!(o.dependencies?.svelte||o.devDependencies?.svelte))return null;let A=o.dependencies?.["@sveltejs/kit"]||o.devDependencies?.["@sveltejs/kit"],c=o.dependencies?.["@sveltejs/vite-plugin-svelte"]||o.devDependencies?.["@sveltejs/vite-plugin-svelte"];if(!A&&!c||!o.scripts?.dev)return null;let u=o.scripts.dev,l=u.includes("vite"),d=u.includes("svelte-kit");if(!l&&!d)return null;if(l&&!A){let g=e.filter(p=>/^vite\.config\.(js|ts|mjs)$/.test(p));if(g.length>0){let p=(0,D_.join)(t,g[0]),f=lo(p);if(!f||!f.includes("@sveltejs/vite-plugin-svelte"))return null}}return{id:"svelte-vite",setupCommand:r.setupCommand,devCommand:u,setupDependencies:[{tool:"node",version:"22",key:"node",type:"mise"}],autoDetectDevServer:!0}}catch{return null}}var D_,Ioe=L(()=>{"use strict";h();D_=require("node:path");mI()});function H6e(t){let e=[".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".cs",".php",".swift",".kt",".scala",".vue",".svelte",".astro",".qwik"],r=["package.json","Cargo.toml","go.mod","pyproject.toml","requirements.txt","Gemfile","pom.xml","build.gradle","next.config.js","next.config.ts","next.config.mjs","nuxt.config.js","nuxt.config.ts","gatsby-config.js","gatsby-config.ts","svelte.config.js","vite.config.js","vite.config.ts","webpack.config.js","webpack.config.ts","rollup.config.js","astro.config.mjs","remix.config.js","angular.json","stencil.config.ts","stencil.config.js","web-dev-server.config.js","web-dev-server.config.mjs","custom-elements.json","hugo.toml","hugo.yaml","config.toml","config.yaml","_config.yml","jekyll-config.yml","docusaurus.config.js","mkdocs.yml","nest-cli.json","tsconfig.json","jsconfig.json","ios/Podfile","android/build.gradle","pubspec.yaml"],n=["src/","app/","pages/","components/","public/","static/","assets/","lib/","pkg/","cmd/","internal/","views/","templates/","content/","layouts/","archetypes/"];return!(t.some(a=>e.some(A=>a.toLowerCase().endsWith(A)))||t.some(a=>{let A=a.replace(/\\/g,"/"),c=A.split("/").pop()||"";return r.includes(c)||r.includes(A)})||t.some(a=>{let A=a.replace(/\\/g,"/");return n.some(c=>A.includes(c))}))}function pA(t){if(!t)return!1;let e=t.trim();if(e==="")return!1;let r=[">","<",">=","<=","^","~","=","*"];for(let n of r)if(e.includes(n))return!1;return!(e.includes(" ")||/\.x$/i.test(e)||/\.\*$/.test(e)||e.toLowerCase()==="latest")}async function J6e(t,e){try{let r=e.filter(A=>A.endsWith("package.json")),n=dc((0,An.join)(t,"package.json"));if(e.some(A=>A.includes("pnpm-workspace.yaml")))return{isMonorepo:!0,type:"pnpm-workspaces",possibleRoots:await dA(e)};if(n?.workspaces){let A=await dA(e);return e.some(l=>l.includes("yarn.lock"))?{isMonorepo:!0,type:"yarn-workspaces",possibleRoots:A}:e.some(l=>l.includes("bun.lock")||l.includes("bun.lockb"))?{isMonorepo:!0,type:"bun-workspaces",possibleRoots:A}:{isMonorepo:!0,type:"npm-workspaces",possibleRoots:A}}if(e.some(A=>A.includes("lerna.json")))return{isMonorepo:!0,type:"lerna",possibleRoots:await dA(e)};if(e.some(A=>A.includes("nx.json")))return{isMonorepo:!0,type:"nx",possibleRoots:await dA(e)};if(e.some(A=>A.includes("turbo.json")))return{isMonorepo:!0,type:"turborepo",possibleRoots:await dA(e)};if(e.some(A=>A.includes("rush.json")))return{isMonorepo:!0,type:"rush",possibleRoots:await dA(e)};if(e.some(A=>A.includes(".moon/workspace.yml")||A.includes(".moon/workspace.yaml")))return{isMonorepo:!0,type:"moon",possibleRoots:await dA(e)};if(lo((0,An.join)(t,"Cargo.toml"))?.includes("[workspace]"))return{isMonorepo:!0,type:"cargo-workspaces",possibleRoots:await dA(e)};if(e.some(A=>A.endsWith("go.work")))return{isMonorepo:!0,type:"go-workspaces",possibleRoots:await dA(e)};let o=await dA(e);return o.length>=3?{isMonorepo:!0,type:"other",possibleRoots:o}:r.length>3?{isMonorepo:!0,type:"other",possibleRoots:o}:e.filter(A=>A.endsWith("Cargo.toml")).length>3?{isMonorepo:!0,type:"other",possibleRoots:o}:{isMonorepo:!1,possibleRoots:o.length>0?o:void 0}}catch{return{isMonorepo:!1}}}async function j6e(t,e){try{let r=[],n=e.filter(l=>l.endsWith("package.json")),i={};for(let l of n){let d=(0,An.join)(t,l),g=dc(d);g&&(Object.assign(i,g.dependencies||{}),Object.assign(i,g.devDependencies||{}))}let s={React:{deps:["react","react-dom"],files:["jsx","tsx"]},"Next.js":{deps:["next"],files:["pages/","app/"],configFiles:["next.config.js","next.config.mjs","next.config.ts"]},Vue:{deps:["vue"],files:["vue"]},Nuxt:{deps:["nuxt"],configFiles:["nuxt.config.js","nuxt.config.ts"]},Angular:{deps:["@angular/core"],configFiles:["angular.json"]},Svelte:{deps:["svelte"],files:["svelte"]},SvelteKit:{deps:["@sveltejs/kit"],configFiles:["svelte.config.js"]},Qwik:{deps:["@builder.io/qwik"],files:["qwik"]},Solid:{deps:["solid-js"]},Stencil:{deps:["@stencil/core"],configFiles:["stencil.config.ts","stencil.config.js"]},Lit:{deps:["lit","lit-element","lit-html"]},Polymer:{deps:["@polymer/polymer"]},"FAST (Microsoft)":{deps:["@microsoft/fast-element"]},Haunted:{deps:["haunted"]},Hybrids:{deps:["hybrids"]},Express:{deps:["express"]},Fastify:{deps:["fastify"]},NestJS:{deps:["@nestjs/core"],configFiles:["nest-cli.json"]},Remix:{deps:["@remix-run/react"],configFiles:["remix.config.js"]},Gatsby:{deps:["gatsby"],configFiles:["gatsby-config.js"]},Astro:{deps:["astro"],configFiles:["astro.config.mjs"]}};for(let[l,d]of Object.entries(s)){let g=[],p="low",f=d.deps.some(m=>i?.[m]);f&&(g.push(`dependency: ${d.deps.find(m=>i?.[m])}`),p="high"),d.configFiles&&d.configFiles.some(C=>e.some(I=>I.includes(C)))&&(g.push(`config: ${d.configFiles.find(C=>e.some(I=>I.includes(C)))}`),p="high"),d.files&&!f&&d.files.some(C=>e.some(I=>I.includes(C)))&&(g.push(`files: ${d.files.find(C=>e.some(I=>I.includes(C)))}`),p=p==="high"?"high":"medium"),g.length>0&&r.push({name:l,confidence:p,indicators:g})}let o={Django:{files:["manage.py","settings.py"],imports:["django"]},Flask:{files:["app.py"],imports:["flask"]},FastAPI:{files:[],imports:["fastapi"]}};for(let[l,d]of Object.entries(o)){let g=[],p="low";if(d.files.some(m=>e.some(C=>C.includes(m)))&&(g.push(`file: ${d.files.find(m=>e.some(C=>C.includes(m)))}`),p="high"),d.imports){let m=e.filter(I=>I.includes("requirements.txt")),C=e.filter(I=>I.includes("pyproject.toml"));for(let I of m){let B=lo((0,An.join)(t,I));if(B&&d.imports.some(y=>B.includes(y))){g.push("requirements.txt"),p="high";break}}for(let I of C){let B=lo((0,An.join)(t,I));if(B&&d.imports.some(y=>B.includes(y))){g.push("pyproject.toml"),p="high";break}}}g.length>0&&r.push({name:l,confidence:p,indicators:g})}let a=e.filter(l=>l.endsWith("Cargo.toml")),A=[{name:"Actix",dep:"actix-web"},{name:"Rocket",dep:"rocket"},{name:"Axum",dep:"axum"},{name:"Warp",dep:"warp"}];for(let l of a){let d=lo((0,An.join)(t,l));if(d)for(let{name:g,dep:p}of A)d.includes(p)&&!r.some(f=>f.name===g)&&r.push({name:g,confidence:"high",indicators:[`Cargo.toml: ${p}`]})}let c=e.filter(l=>l.endsWith("go.mod")),u=[{name:"Gin",dep:"github.com/gin-gonic/gin"},{name:"Echo",dep:"github.com/labstack/echo"},{name:"Fiber",dep:"github.com/gofiber/fiber"}];for(let l of c){let d=lo((0,An.join)(t,l));if(d)for(let{name:g,dep:p}of u)d.includes(p)&&!r.some(f=>f.name===g)&&r.push({name:g,confidence:"high",indicators:[`go.mod: ${p}`]})}return r}catch{return[]}}async function Y6e(t,e){let r=[];try{let n=(0,An.join)(t,".npmrc");if((0,Ur.existsSync)(n)){r.push({tool:".npmrc"});let p=(0,Ur.readFileSync)(n,"utf-8");(p.includes("@")||p.includes("registry"))&&r.push({tool:"private-packages"})}e.some(p=>p.includes(".env")||p.includes(".env.example")||p.includes(".env.template"))&&r.push({tool:"env-file"});let s=(0,An.join)(t,".nvmrc"),o=(0,An.join)(t,".node-version");if((0,Ur.existsSync)(s)){let p=(0,Ur.readFileSync)(s,"utf-8").trim();pA(p)?r.push({tool:"node",version:p}):r.push({tool:"node"})}else if((0,Ur.existsSync)(o)){let p=(0,Ur.readFileSync)(o,"utf-8").trim();pA(p)?r.push({tool:"node",version:p}):r.push({tool:"node"})}else{let p=(0,An.join)(t,"package.json");if((0,Ur.existsSync)(p))try{let f=JSON.parse((0,Ur.readFileSync)(p,"utf-8"));if(f.engines?.node){let m=f.engines.node;pA(m)?r.push({tool:"node",version:m}):r.push({tool:"node"})}}catch{}}let a=(0,An.join)(t,"rust-toolchain"),A=(0,An.join)(t,"rust-toolchain.toml");if((0,Ur.existsSync)(a)){let p=(0,Ur.readFileSync)(a,"utf-8").trim();pA(p)?r.push({tool:"rust",version:p}):r.push({tool:"rust"})}else if((0,Ur.existsSync)(A)){let m=(0,Ur.readFileSync)(A,"utf-8").match(/channel\s*=\s*"(.+?)"/)?.[1];pA(m)?r.push({tool:"rust",version:m}):r.push({tool:"rust"})}let c=(0,An.join)(t,".python-version");if((0,Ur.existsSync)(c)){let p=(0,Ur.readFileSync)(c,"utf-8").trim();pA(p)?r.push({tool:"python",version:p}):r.push({tool:"python"})}else{let p=(0,An.join)(t,"pyproject.toml");if((0,Ur.existsSync)(p)){let m=(0,Ur.readFileSync)(p,"utf-8").match(/requires-python\s*=\s*"(.+?)"/);if(m){let C=m[1];pA(C)?r.push({tool:"python",version:C}):r.push({tool:"python"})}}}let u=(0,An.join)(t,".go-version");if((0,Ur.existsSync)(u)){let p=(0,Ur.readFileSync)(u,"utf-8").trim();pA(p)?r.push({tool:"go",version:p}):r.push({tool:"go"})}else{let p=(0,An.join)(t,"go.mod");if((0,Ur.existsSync)(p)){let m=(0,Ur.readFileSync)(p,"utf-8").match(/go\s+(\d+\.\d+)/);if(m){let C=m[1];pA(C)?r.push({tool:"go",version:C}):r.push({tool:"go"})}}}let l=(0,An.join)(t,".ruby-version");if((0,Ur.existsSync)(l)){let p=(0,Ur.readFileSync)(l,"utf-8").trim();pA(p)?r.push({tool:"ruby",version:p}):r.push({tool:"ruby"})}e.some(p=>p.includes("docker-compose.yml")||p.includes("docker-compose.yaml")||p.includes("compose.yml")||p.includes("compose.yaml"))&&r.push({tool:"docker-compose"});let g=[{type:"postgresql",indicators:["postgresql","postgres","psql"]},{type:"mysql",indicators:["mysql"]},{type:"mongodb",indicators:["mongodb","mongo"]},{type:"redis",indicators:["redis"]},{type:"sqlite",indicators:["sqlite"]}];for(let{type:p,indicators:f}of g)e.some(C=>f.some(I=>C.toLowerCase().includes(I)))&&r.push({tool:p});return r}catch{return[]}}async function q6e(t){try{let e=[];return t.some(r=>r.includes("package-lock.json"))&&e.push("npm"),t.some(r=>r.includes("yarn.lock"))&&e.push("yarn"),t.some(r=>r.includes("pnpm-lock.yaml"))&&e.push("pnpm"),t.some(r=>r.includes("bun.lockb"))&&e.push("bun"),t.some(r=>r.includes("Cargo.lock"))&&e.push("cargo"),t.some(r=>r.includes("go.sum"))&&e.push("go"),t.some(r=>r.includes("Gemfile.lock"))&&e.push("bundler"),t.some(r=>r.includes("requirements.txt")||r.includes("pyproject.toml"))&&e.push("pip/poetry"),e}catch{return[]}}async function $6e(t){try{let e=[],r=[{name:"Webpack",indicators:["webpack.config.js","webpack.config.ts"]},{name:"Vite",indicators:["vite.config.js","vite.config.ts"]},{name:"esbuild",indicators:["esbuild.config.js"]},{name:"Rollup",indicators:["rollup.config.js"]},{name:"Parcel",indicators:[".parcelrc"]},{name:"Turbopack",indicators:["turbo.json"]},{name:"Make",indicators:["Makefile"]},{name:"CMake",indicators:["CMakeLists.txt"]},{name:"Gradle",indicators:["build.gradle","build.gradle.kts"]},{name:"Maven",indicators:["pom.xml"]}];for(let{name:n,indicators:i}of r)i.some(o=>t.some(a=>a.includes(o)))&&e.push(n);return e}catch{return[]}}function V6e(t,e){let r=[],n=t.split(`
|
|
1791
|
-
`);for(let i of n){let s=i.trim();if(!s||s.startsWith("#"))continue;let o=s.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(o){let a=o[1],A=o[2].trim();(A.startsWith('"')&&A.endsWith('"')||A.startsWith("'")&&A.endsWith("'"))&&(A=A.slice(1,-1)),r.push({key:a,placeholderValue:A||void 0,source:e,type:"env"})}}return r}function W6e(t,e){let r=[],n=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,i,s=new Set;for(;(i=n.exec(t))!==null;){let o=i[1];s.has(o)||(s.add(o),r.push({key:o,source:e,type:"npmrc"}))}return r}async function z6e(t,e){try{let r=[],n=new Set,i=[".env.example",".env.template",".env.sample",".env.local.example",".env.development.example",".env.production.example",".env.test.example",".env.staging.example",".env",".env.local",".env.development",".env.production",".env.test",".env.staging"],s=[],o=new Set,a=[];for(let A of e){let c=A.replace(/\\/g,"/");(c===".npmrc"||c.endsWith("/.npmrc"))&&a.push(A)}for(let A of a){let c=(0,An.join)(t,A),u=lo(c);if(u){let l=W6e(u,A);for(let d of l)n.has(d.key)||(n.add(d.key),r.push(d))}}for(let A of i)for(let c of e){let u=c.replace(/\\/g,"/");(u===A||u.endsWith(`/${A}`))&&!o.has(c)&&(o.add(c),s.push(c))}for(let A of s){let c=(0,An.join)(t,A),u=lo(c);if(u){let l=V6e(u,A);for(let d of l)n.has(d.key)||(n.add(d.key),r.push(d))}}return r}catch{return[]}}async function X6e(t,e){try{let r=await doe(t,e);if(r)return r;let n=await hoe(t,e);if(n)return n;let i=await Coe(t,e);return i||null}catch{return null}}async function dA(t){try{let e=new Set,r=["__tests__","__test__","__examples__","__example__","__fixtures__","__mocks__","test","tests","testing","spec","specs","example","examples","sample","samples","demo","demos","fixture","fixtures","mock","mocks",".test",".spec"],n=["package.json","tsconfig.json","jsconfig.json","pyproject.toml","setup.py","setup.cfg","Pipfile","requirements.txt","poetry.lock","go.mod","Cargo.toml","Gemfile","Rakefile","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","composer.json","mix.exs","Package.swift","pubspec.yaml","stack.yaml","cabal.project","build.sbt","project.clj","deps.edn","CMakeLists.txt","Makefile","Dockerfile",".storybook"],i=a=>a.split("/").some(c=>r.some(u=>c===u||c.startsWith(u+".")));for(let a of t){let A=a.replace(/\\/g,"/"),c=A.split("/").pop()||"";if(n.includes(c)){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}if(c.endsWith(".csproj")||c.endsWith(".fsproj")||c.endsWith(".vbproj")||c.endsWith(".sln")){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}}let s=Array.from(e).sort(),o=s.filter(a=>a!==".");return o.length>0?o:s}catch{return[]}}async function Eoe(t,e){let r=[];try{let n=await Lu({sys:t,basePath:e,globPattern:"**/*",dot:!0}),i=H6e(n),s=await J6e(e,n),o=await j6e(e,n),a=await Y6e(e,n),A=await q6e(n),c=await $6e(n),u=await z6e(e,n),l=await X6e(e,n),d={languages:[],isEmpty:i,isMonorepo:s.isMonorepo,monorepoType:s.type,frameworks:o,setupRequirements:a,packageManagers:A,buildTools:c,environmentVariables:u.length>0?u:void 0,possibleMonorepoRoots:s.possibleRoots,guessedSettings:l||void 0};return r.length>0&&(d.errors=r),d}catch(n){return{languages:[],isEmpty:!1,isMonorepo:!1,frameworks:[],setupRequirements:[],packageManagers:[],buildTools:[],errors:[`Fatal error: ${n instanceof Error?n.message:String(n)}`]}}}var Ur,An,Boe=L(()=>{"use strict";h();Pg();mI();foe();moe();Ioe();Ur=require("node:fs"),An=require("node:path")});var Qoe,go,w0,yoe,b0,Doe=L(()=>{"use strict";h();Qoe=require("node:child_process"),go=X(require("node:path"),1),w0=X(require("node:fs"),1);sa();Qt();yoe=ve("TsServer"),b0=class t{#n=null;#c=0;#s=new Map;#t="";#o;#i=!1;#e=null;#a=new Set;#B=!1;#m=null;static REQUEST_TIMEOUT=3e4;constructor(e){this.#o=e}async start(){return this.#m?this.#m:(this.#m=this.#
|
|
1791
|
+
`);for(let i of n){let s=i.trim();if(!s||s.startsWith("#"))continue;let o=s.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(o){let a=o[1],A=o[2].trim();(A.startsWith('"')&&A.endsWith('"')||A.startsWith("'")&&A.endsWith("'"))&&(A=A.slice(1,-1)),r.push({key:a,placeholderValue:A||void 0,source:e,type:"env"})}}return r}function W6e(t,e){let r=[],n=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,i,s=new Set;for(;(i=n.exec(t))!==null;){let o=i[1];s.has(o)||(s.add(o),r.push({key:o,source:e,type:"npmrc"}))}return r}async function z6e(t,e){try{let r=[],n=new Set,i=[".env.example",".env.template",".env.sample",".env.local.example",".env.development.example",".env.production.example",".env.test.example",".env.staging.example",".env",".env.local",".env.development",".env.production",".env.test",".env.staging"],s=[],o=new Set,a=[];for(let A of e){let c=A.replace(/\\/g,"/");(c===".npmrc"||c.endsWith("/.npmrc"))&&a.push(A)}for(let A of a){let c=(0,An.join)(t,A),u=lo(c);if(u){let l=W6e(u,A);for(let d of l)n.has(d.key)||(n.add(d.key),r.push(d))}}for(let A of i)for(let c of e){let u=c.replace(/\\/g,"/");(u===A||u.endsWith(`/${A}`))&&!o.has(c)&&(o.add(c),s.push(c))}for(let A of s){let c=(0,An.join)(t,A),u=lo(c);if(u){let l=V6e(u,A);for(let d of l)n.has(d.key)||(n.add(d.key),r.push(d))}}return r}catch{return[]}}async function X6e(t,e){try{let r=await doe(t,e);if(r)return r;let n=await hoe(t,e);if(n)return n;let i=await Coe(t,e);return i||null}catch{return null}}async function dA(t){try{let e=new Set,r=["__tests__","__test__","__examples__","__example__","__fixtures__","__mocks__","test","tests","testing","spec","specs","example","examples","sample","samples","demo","demos","fixture","fixtures","mock","mocks",".test",".spec"],n=["package.json","tsconfig.json","jsconfig.json","pyproject.toml","setup.py","setup.cfg","Pipfile","requirements.txt","poetry.lock","go.mod","Cargo.toml","Gemfile","Rakefile","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","composer.json","mix.exs","Package.swift","pubspec.yaml","stack.yaml","cabal.project","build.sbt","project.clj","deps.edn","CMakeLists.txt","Makefile","Dockerfile",".storybook"],i=a=>a.split("/").some(c=>r.some(u=>c===u||c.startsWith(u+".")));for(let a of t){let A=a.replace(/\\/g,"/"),c=A.split("/").pop()||"";if(n.includes(c)){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}if(c.endsWith(".csproj")||c.endsWith(".fsproj")||c.endsWith(".vbproj")||c.endsWith(".sln")){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}}let s=Array.from(e).sort(),o=s.filter(a=>a!==".");return o.length>0?o:s}catch{return[]}}async function Eoe(t,e){let r=[];try{let n=await Lu({sys:t,basePath:e,globPattern:"**/*",dot:!0}),i=H6e(n),s=await J6e(e,n),o=await j6e(e,n),a=await Y6e(e,n),A=await q6e(n),c=await $6e(n),u=await z6e(e,n),l=await X6e(e,n),d={languages:[],isEmpty:i,isMonorepo:s.isMonorepo,monorepoType:s.type,frameworks:o,setupRequirements:a,packageManagers:A,buildTools:c,environmentVariables:u.length>0?u:void 0,possibleMonorepoRoots:s.possibleRoots,guessedSettings:l||void 0};return r.length>0&&(d.errors=r),d}catch(n){return{languages:[],isEmpty:!1,isMonorepo:!1,frameworks:[],setupRequirements:[],packageManagers:[],buildTools:[],errors:[`Fatal error: ${n instanceof Error?n.message:String(n)}`]}}}var Ur,An,Boe=L(()=>{"use strict";h();Pg();mI();foe();moe();Ioe();Ur=require("node:fs"),An=require("node:path")});var Qoe,go,w0,yoe,b0,Doe=L(()=>{"use strict";h();Qoe=require("node:child_process"),go=X(require("node:path"),1),w0=X(require("node:fs"),1);sa();Qt();yoe=ve("TsServer"),b0=class t{#n=null;#c=0;#s=new Map;#t="";#o;#i=!1;#e=null;#a=new Set;#B=!1;#m=null;static REQUEST_TIMEOUT=3e4;constructor(e){this.#o=e}async start(){return this.#m?this.#m:(this.#m=this.#M(),this.#m)}async#M(){if(this.#n||this.#i)return;let e=this.#F();if(!e)throw new Error("Could not find tsserver. Ensure TypeScript is installed in the project.");this.#n=(0,Qoe.spawn)("node",[e,"--useInferredProjectConfig"],{cwd:this.#o,stdio:["pipe","pipe","pipe"],env:{...process.env,TSS_LOG:void 0}}),vw.track(this.#n),this.#n.stdout.on("data",r=>{this.#b(r.toString("utf-8"))}),this.#n.stderr.on("data",r=>{yoe.debug("stderr",r.toString("utf-8"),{loggerOptions:{stderr:!0}})}),this.#n.on("exit",r=>{this.#n=null,this.#B=!1;for(let[,n]of this.#s)clearTimeout(n.timer),n.reject(new Error(`tsserver exited with code ${r}`));this.#s.clear()}),this.#n.on("error",r=>{yoe.error("Process error:",r.message)}),this.#B=!0,await this.#A("configure",{hostInfo:"fusion-editor",preferences:{providePrefixAndSuffixTextForRename:!0,allowRenameOfImportPath:!0,includeCompletionsForModuleExports:!0,includeCompletionsWithSnippetText:!0,includeAutomaticOptionalChainCompletions:!0,includeCompletionsWithInsertText:!0,includeCompletionsWithClassMemberSnippets:!0,includeCompletionsWithObjectLiteralMethodSnippets:!0,importModuleSpecifierPreference:"shortest",importModuleSpecifierEnding:"minimal",includeInlayParameterNameHints:"all",includeInlayParameterNameHintsWhenArgumentMatchesName:!1,includeInlayFunctionParameterTypeHints:!0,includeInlayVariableTypeHints:!0,includeInlayVariableTypeHintsWhenTypeMatchesName:!1,includeInlayPropertyDeclarationTypeHints:!0,includeInlayFunctionLikeReturnTypeHints:!0,includeInlayEnumMemberValueHints:!0}})}#F(){let e=go.default.join(this.#o,"node_modules","typescript","lib","tsserver.js");if(w0.default.existsSync(e))return e;let r=go.default.join(this.#o,"..","node_modules","typescript","lib","tsserver.js");if(w0.default.existsSync(r))return r;try{let n=require.resolve("typescript/lib/tsserver.js",{paths:[this.#o]});if(w0.default.existsSync(n))return n}catch{}return null}#b(e){for(this.#t+=e;;){let r=this.#t.match(/^Content-Length:\s*(\d+)\r?\n\r?\n/);if(r){let s=parseInt(r[1],10),o=r[0].length,a=o+s;if(this.#t.length>=a){let A=this.#t.substring(o,a);this.#t=this.#t.substring(a),this.#S(A);continue}break}let n=this.#t.indexOf(`
|
|
1792
1792
|
`);if(n===-1)break;let i=this.#t.substring(0,n).trim();this.#t=this.#t.substring(n+1),i.startsWith("{")&&this.#S(i)}}#S(e){let r;try{r=JSON.parse(e)}catch{return}if(r.type==="response"){let n=r,i=this.#s.get(n.request_seq);i&&(clearTimeout(i.timer),this.#s.delete(n.request_seq),i.resolve({success:n.success,body:n.body,message:n.message}))}else if(r.type==="event"){let n=r;this.#e?.(n)}}async#A(e,r){if(!this.#n||!this.#B)throw new Error("tsserver is not running");let n=++this.#c,i={seq:n,type:"request",command:e,arguments:r};return new Promise((s,o)=>{let a=setTimeout(()=>{this.#s.delete(n),o(new Error(`tsserver request "${e}" timed out`))},t.REQUEST_TIMEOUT);this.#s.set(n,{resolve:s,reject:o,timer:a});let A=JSON.stringify(i)+`
|
|
1793
1793
|
`;this.#n.stdin.write(A)})}setEventHandler(e){this.#e=e}async openFile(e,r,n){await this.start();let i=go.default.isAbsolute(e)?e:go.default.resolve(this.#o,e);if(this.#a.has(i)){await this.changeFile(e,r);return}await this.#A("open",{file:i,fileContent:r,scriptKindName:this.#r(i),projectRootPath:n||this.#o}),this.#a.add(i)}async changeFile(e,r){if(!this.#B)return;let n=go.default.isAbsolute(e)?e:go.default.resolve(this.#o,e);if(!this.#a.has(n)){await this.openFile(e,r);return}await this.#A("open",{file:n,fileContent:r,scriptKindName:this.#r(n),projectRootPath:this.#o})}async closeFile(e){if(!this.#B)return;let r=go.default.isAbsolute(e)?e:go.default.resolve(this.#o,e);this.#a.has(r)&&(await this.#A("close",{file:r}),this.#a.delete(r))}async getCompletions(e,r,n,i){let s=this.#p(e);return this.#A("completionInfo",{file:s,line:r,offset:n,includeExternalModuleExports:i?.includeExternalModuleExports??!0,includeInsertTextCompletions:!0,triggerCharacter:i?.triggerCharacter,triggerKind:i?.triggerCharacter?2:1})}async getCompletionDetails(e,r,n,i){let s=this.#p(e);return this.#A("completionEntryDetails",{file:s,line:r,offset:n,entryNames:i})}async getDefinition(e,r,n){let i=this.#p(e);return this.#A("definition",{file:i,line:r,offset:n})}async getTypeDefinition(e,r,n){let i=this.#p(e);return this.#A("typeDefinition",{file:i,line:r,offset:n})}async getQuickInfo(e,r,n){let i=this.#p(e);return this.#A("quickinfo",{file:i,line:r,offset:n})}async getReferences(e,r,n){let i=this.#p(e);return this.#A("references",{file:i,line:r,offset:n})}async getSignatureHelp(e,r,n){let i=this.#p(e);return this.#A("signatureHelp",{file:i,line:r,offset:n})}async requestDiagnostics(e){let r=e.map(n=>this.#p(n));await this.#A("geterr",{files:r,delay:0}).catch(()=>{})}async getRenameLocations(e,r,n){let i=this.#p(e);return this.#A("rename",{file:i,line:r,offset:n,findInComments:!1,findInStrings:!1})}async getNavTree(e){let r=this.#p(e);return this.#A("navtree",{file:r})}async organizeImports(e){let r=this.#p(e);return this.#A("organizeImports",{scope:{type:"file",args:{file:r}}})}async getInlayHints(e){let r=this.#p(e);return this.#A("provideInlayHints",{file:r,start:0,length:2147483647})}async getCodeFixes(e,r,n,i,s,o){let a=this.#p(e);return this.#A("getCodeFixes",{file:a,startLine:r,startOffset:n,endLine:i,endOffset:s,errorCodes:o})}async getApplicableRefactors(e,r,n,i,s){let o=this.#p(e);return this.#A("getApplicableRefactors",{file:o,startLine:r,startOffset:n,endLine:i,endOffset:s})}async getEditsForRefactor(e,r,n,i,s,o,a){let A=this.#p(e);return this.#A("getEditsForRefactor",{file:A,startLine:r,startOffset:n,endLine:i,endOffset:s,refactor:o,action:a})}async getImplementation(e,r,n){let i=this.#p(e);return this.#A("implementation",{file:i,line:r,offset:n})}async getSelectionRange(e,r){let n=this.#p(e);return this.#A("selectionRange",{file:n,locations:r})}async getLinkedEditingRange(e,r,n){let i=this.#p(e);return this.#A("linkedEditingRange",{file:i,line:r,offset:n})}async getFormatRange(e,r,n,i,s){let o=this.#p(e);return this.#A("format",{file:o,line:r,offset:n,endLine:i,endOffset:s})}getCwd(){return this.#o}isRunning(){return this.#B&&this.#n!==null}dispose(){if(this.#i=!0,this.#B=!1,this.#n){try{this.#n.kill("SIGTERM")}catch{}vw.untrack(this.#n),this.#n=null}for(let[,e]of this.#s)clearTimeout(e.timer),e.reject(new Error("tsserver disposed"));this.#s.clear(),this.#a.clear(),this.#e=null}#p(e){return go.default.isAbsolute(e)?e:go.default.resolve(this.#o,e)}#r(e){switch(go.default.extname(e).toLowerCase()){case".tsx":return"TSX";case".ts":return"TS";case".jsx":return"JSX";case".js":case".mjs":case".cjs":return"JS";default:return"TS"}}}});function _u(t){if(!t)return;let e=t.toLowerCase();if(e!=="inherit")return Z6e[e]??t}var Z6e,S0=L(()=>{"use strict";h();Z6e={"sonnet-4":"acs4",sonnet:"acs",opus:"aco",haiku:"ach",gpt5:"opa5","gpt5-5":"opa55","gpt5-codex":"opa5c.acs4",codex:"opa5c.acs4","gpt5-codex-mini":"opa5c-mini","gpt5-mini":"opa5-mini","gpt5-nano":"opa5-nano",gemini:"g.acs","gemini-flash":"gf.ach"}});function woe(t){let e;if(typeof t=="string"){let r=t.trim();if(r.startsWith("{"))try{e=JSON.parse(r)}catch{return}}else t&&typeof t=="object"&&(e=t);if(e&&typeof e.schedule=="string"&&eqe.has(e.schedule)&&typeof e.coalesce=="string"&&tqe.has(e.coalesce))return{schedule:e.schedule,coalesce:e.coalesce}}function rqe(t){return t==="next-turn"||t==="until-idle"?t:woe(t)}function boe(t,e){try{if(!t||!t.trim())return null;let r=Jd(t);if(!r.frontmatter||Object.keys(r.frontmatter).length===0)return{name:CI.default.basename(e,CI.default.extname(e)),systemPrompt:r.body||t.trim(),filePath:e};let n=r.body;if(!n)return null;let i=r.frontmatter.name||CI.default.basename(e,CI.default.extname(e)),s;r.frontmatter.tools&&(Array.isArray(r.frontmatter.tools)?s=r.frontmatter.tools.map(y=>y.trim()):typeof r.frontmatter.tools=="string"&&(s=r.frontmatter.tools.split(",").map(y=>y.trim())));let o=r.frontmatter.model?_u(r.frontmatter.model):void 0,a=!!r.frontmatter.includeMemories,A=!!r.frontmatter.needDevServer,c=!!r.frontmatter.needValidation,u=!!r.frontmatter.resetAfterRun,l=["low","medium","high","minimal"],d=r.frontmatter.reasoning&&l.includes(r.frontmatter.reasoning)?r.frontmatter.reasoning:void 0,g=r.frontmatter.maxTimeoutMs,p=typeof g=="number"?g:typeof g=="string"?Number(g):void 0,f=p&&Number.isFinite(p)&&p>0?p:void 0,m=r.frontmatter.maxCompletions,C=typeof m=="number"?m:typeof m=="string"?Number(m):void 0,I=C&&Number.isFinite(C)&&C>0?Math.floor(C):void 0,B=woe(r.frontmatter.queueBehavior),E=B?void 0:rqe(r.frontmatter.queueMode);return{name:i,description:r.frontmatter.description,systemPrompt:n,tools:s,model:o,filePath:e,includeMemories:a,needDevServer:A,needValidation:c,resetAfterRun:u,maxTimeoutMs:f,maxCompletions:I,reasoning:d,queueBehavior:B,queueMode:E}}catch{return null}}var CI,eqe,tqe,Soe=L(()=>{"use strict";h();CI=X(require("node:path"),1);KD();S0();eqe=new Set(["next-turn","until-idle","interrupt","interrupt-clear","interrupt-replace"]),tqe=new Set(["merge","replace-latest","preserve-order"])});async function w_(t,e,r,n="",i,s){let o=[];try{if(!await t.exists(e))return o;let a=await t.readdir(e);for(let A of a){let c=t.join(e,A);if(i&&s){let l=t.relative(s,c);if(!l.startsWith("..")&&!l.startsWith("/")&&i(l))continue}let u=await t.stat(c).catch(()=>null);if(u)if(u.isDirectory()){let l=n?`${n}/${A}`:A,d=await w_(t,c,r,l,i,s);o.push(...d)}else(A.endsWith(".mdc")||A.endsWith(".md")||A.endsWith(".yml")||A.endsWith(".yaml"))&&o.push(c)}}catch{}return o}async function xoe(t,e,r){try{if(!(await t.stat(e).catch(()=>null))?.isFile())return null;let i=await t.readFile(e);if(!i)return null;let s=t.relative(r,e);return boe(i,s)}catch(n){return t.Sentry?.captureException(n),null}}async function koe({sys:t,projectDir:e,currentDir:r,rootDir:n,homeDir:i}){let s=[],o=[".claude/agents",".builder/agents",".cursor/agents",".agents/agents"],a=await v0(e,t),A=i??(0,Foe.homedir)();if(A)try{for(let u of nqe){let l=t.resolve(A,u);if(await t.exists(l)){let d=await w_(t,l,l);for(let g of d){let p=await xoe(t,g,e);p&&s.push({...p,scope:"user"})}}}}catch(u){voe.debug("Error reading user-level agents:",u)}let c=new Set;for(let u of Array.isArray(r)?r:[r]){let l=u,d;do{try{for(let g of o){let p=t.resolve(l,g);if(!c.has(p)&&(c.add(p),await t.exists(p))){let f=await w_(t,p,p,"",a,e);for(let m of f){let C=await xoe(t,m,e);C&&s.push({...C,scope:"project"})}}}}catch(g){voe.debug(`Error reading ${l}:`,g)}if(d=l,l=t.dirname(l),l===d)break}while(d!==n)}return s}var Foe,voe,nqe,Roe=L(()=>{"use strict";h();Foe=require("node:os");Soe();Pg();Qt();voe=ve("AgentDiscovery");nqe=[".builder/agents",".agents/agents"]});function iqe(t){try{return JSON.stringify(t)}catch{return String(t)}}function Toe(t){let{filePath:e,forceWorkspace:r=!1,workspace:n,workingDirectory:i,sys:s,canCollapseWorkspace:o}=t;if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${iqe(e)}`);let a=e;if(a.startsWith("~")){let p=ni(a);if(p!==a&&s.isAbsolute(p))return{resolvedPath:s.normalize(s.resolve(p))}}if(s.isAbsolute(a))return{resolvedPath:s.normalize(s.resolve(a))};if(a.startsWith("./")&&(a=a.substring(2)),!n?.folders?.length)return{resolvedPath:s.resolve(i,a)};if(n.folders.length===1&&n.folders[0].name==="."||o){let p=n.folders[0],f=s.resolve(i,p.path);return{resolvedPath:s.resolve(f,a),workspaceFolder:p}}let c=a.indexOf("/");if(c===-1){if(r){let p=n.folders[0],f=s.resolve(i,p.path);return{resolvedPath:s.resolve(f,a),workspaceFolder:p}}return{resolvedPath:s.resolve(i,a)}}let u=a.substring(0,c),l=a.substring(c+1),d=n.folders.find(p=>p.name?p.name===u:s.basename(p.path)===u);if(!d){if(!r)return{resolvedPath:s.resolve(i,a)};d=n.folders[0];let p=s.resolve(i,d.path);return{resolvedPath:s.resolve(p,a),workspaceFolder:d}}let g=s.resolve(i,d.path);return{resolvedPath:s.resolve(g,l),workspaceFolder:d}}function Noe(t){let{absolutePath:e,workspace:r,workingDirectory:n,sys:i,canCollapseWorkspace:s}=t;if(!r?.folders?.length)return;let o=Bn(i.resolve(e));if(r.folders.length===1&&r.folders[0].name==="."){let A=r.folders[0],c=Bn(i.resolve(n,A.path));if(o.startsWith(c)){let u=o.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}if(s&&r.folders.length===1){let A=r.folders[0],c=Bn(i.resolve(n,A.path));if(o.startsWith(c)){let u=o.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}for(let A of r.folders){let c=Bn(i.resolve(n,A.path));if(o.startsWith(c)){let u=o.substring(c.length);u.startsWith("/")&&(u=u.substring(1));let l=A.name||i.basename(A.path);if(l==="."&&r.folders.length>1)continue;return u?`${l}/${u}`:l}}if(s&&r.folders.length>0){let A=r.folders[0],c=Bn(i.resolve(n,A.path));if(o.startsWith(c)){let u=o.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}}function Uu(t){let{resolvedPath:e,workingDirectory:r,workspace:n,sys:i,extraAllowedRoots:s}=t,o=i.normalize(e),a=i.normalize(r),A=a.includes("\\")?"\\":"/",c=l=>o.startsWith(l+A)||o===l;if(c(a))return!0;if(n?.folders)for(let l of n.folders){let d=i.normalize(i.resolve(r,l.path));if(c(d))return!0}let u=s??cie();for(let l of u){let d=i.normalize(i.resolve(l));if(c(d))return!0}return!1}var Moe=L(()=>{"use strict";h();g0();tI()});function Gu(t){return!!t._zod}function ji(t,e){return Gu(t)?x0.safeParse(t,e):t.safeParse(e)}function Df(t){if(!t)return;let e;if(Gu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Poe(t){if(Gu(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var sqe,x0,II=L(()=>{h();sqe=X(require("zod/v3"),1),x0=X(require("zod/v4-mini"),1)});var T,Ou,k0,Ku,R0,ii,Loe,_oe,iJt,oqe,aqe,S_,Us,EI,Uoe,si,po,fo,oi,T0,Goe,BI,Ooe,Koe,v_,Lg,We,x_,Hoe,Hu,sJt,fc,Aqe,N0,cqe,yI,wf,Joe,uqe,lqe,gqe,pqe,dqe,fqe,F_,hqe,k_,M0,joe,P0,mqe,Cqe,L0,Iqe,QI,DI,Eqe,wI,hc,Bqe,bI,_0,U0,G0,oJt,O0,K0,H0,Yoe,qoe,$oe,R_,Voe,SI,bf,Woe,yqe,T_,N_,M_,P_,L_,Qqe,__,U_,G_,Dqe,wqe,bqe,Sqe,vqe,xqe,Fqe,kqe,Rqe,O_,Tqe,Nqe,K_,H_,J_,Mqe,Pqe,Lqe,j_,_qe,Y_,q_,Uqe,Gqe,zoe,$_,V_,Ju,aJt,Oqe,vI,W_,Xoe,xI,Kqe,z_,Hqe,Jqe,jqe,Yqe,qqe,$qe,Vqe,F0,Wqe,zqe,X_,_g,FI,Xqe,Zqe,e5e,t5e,r5e,n5e,i5e,s5e,o5e,a5e,A5e,c5e,u5e,l5e,g5e,Z_,p5e,d5e,ju,f5e,h5e,m5e,C5e,eU,I5e,E5e,tU,B5e,AJt,cJt,uJt,lJt,gJt,pJt,He,b_,la=L(()=>{h();T=X(require("zod/v4"),1),Ou="2025-11-25",k0=[Ou,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ku="io.modelcontextprotocol/related-task",R0="2.0",ii=T.custom(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Loe=T.union([T.string(),T.number().int()]),_oe=T.string(),iJt=T.looseObject({ttl:T.union([T.number(),T.null()]).optional(),pollInterval:T.number().optional()}),oqe=T.object({ttl:T.number().optional()}),aqe=T.object({taskId:T.string()}),S_=T.looseObject({progressToken:Loe.optional(),[Ku]:aqe.optional()}),Us=T.object({_meta:S_.optional()}),EI=Us.extend({task:oqe.optional()}),Uoe=t=>EI.safeParse(t).success,si=T.object({method:T.string(),params:Us.loose().optional()}),po=T.object({_meta:S_.optional()}),fo=T.object({method:T.string(),params:po.loose().optional()}),oi=T.looseObject({_meta:S_.optional()}),T0=T.union([T.string(),T.number().int()]),Goe=T.object({jsonrpc:T.literal(R0),id:T0,...si.shape}).strict(),BI=t=>Goe.safeParse(t).success,Ooe=T.object({jsonrpc:T.literal(R0),...fo.shape}).strict(),Koe=t=>Ooe.safeParse(t).success,v_=T.object({jsonrpc:T.literal(R0),id:T0,result:oi}).strict(),Lg=t=>v_.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(We||(We={}));x_=T.object({jsonrpc:T.literal(R0),id:T0.optional(),error:T.object({code:T.number().int(),message:T.string(),data:T.unknown().optional()})}).strict(),Hoe=t=>x_.safeParse(t).success,Hu=T.union([Goe,Ooe,v_,x_]),sJt=T.union([v_,x_]),fc=oi.strict(),Aqe=po.extend({requestId:T0.optional(),reason:T.string().optional()}),N0=fo.extend({method:T.literal("notifications/cancelled"),params:Aqe}),cqe=T.object({src:T.string(),mimeType:T.string().optional(),sizes:T.array(T.string()).optional(),theme:T.enum(["light","dark"]).optional()}),yI=T.object({icons:T.array(cqe).optional()}),wf=T.object({name:T.string(),title:T.string().optional()}),Joe=wf.extend({...wf.shape,...yI.shape,version:T.string(),websiteUrl:T.string().optional(),description:T.string().optional()}),uqe=T.intersection(T.object({applyDefaults:T.boolean().optional()}),T.record(T.string(),T.unknown())),lqe=T.preprocess(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,T.intersection(T.object({form:uqe.optional(),url:ii.optional()}),T.record(T.string(),T.unknown()).optional())),gqe=T.looseObject({list:ii.optional(),cancel:ii.optional(),requests:T.looseObject({sampling:T.looseObject({createMessage:ii.optional()}).optional(),elicitation:T.looseObject({create:ii.optional()}).optional()}).optional()}),pqe=T.looseObject({list:ii.optional(),cancel:ii.optional(),requests:T.looseObject({tools:T.looseObject({call:ii.optional()}).optional()}).optional()}),dqe=T.object({experimental:T.record(T.string(),ii).optional(),sampling:T.object({context:ii.optional(),tools:ii.optional()}).optional(),elicitation:lqe.optional(),roots:T.object({listChanged:T.boolean().optional()}).optional(),tasks:gqe.optional()}),fqe=Us.extend({protocolVersion:T.string(),capabilities:dqe,clientInfo:Joe}),F_=si.extend({method:T.literal("initialize"),params:fqe}),hqe=T.object({experimental:T.record(T.string(),ii).optional(),logging:ii.optional(),completions:ii.optional(),prompts:T.object({listChanged:T.boolean().optional()}).optional(),resources:T.object({subscribe:T.boolean().optional(),listChanged:T.boolean().optional()}).optional(),tools:T.object({listChanged:T.boolean().optional()}).optional(),tasks:pqe.optional()}),k_=oi.extend({protocolVersion:T.string(),capabilities:hqe,serverInfo:Joe,instructions:T.string().optional()}),M0=fo.extend({method:T.literal("notifications/initialized"),params:po.optional()}),joe=t=>M0.safeParse(t).success,P0=si.extend({method:T.literal("ping"),params:Us.optional()}),mqe=T.object({progress:T.number(),total:T.optional(T.number()),message:T.optional(T.string())}),Cqe=T.object({...po.shape,...mqe.shape,progressToken:Loe}),L0=fo.extend({method:T.literal("notifications/progress"),params:Cqe}),Iqe=Us.extend({cursor:_oe.optional()}),QI=si.extend({params:Iqe.optional()}),DI=oi.extend({nextCursor:_oe.optional()}),Eqe=T.enum(["working","input_required","completed","failed","cancelled"]),wI=T.object({taskId:T.string(),status:Eqe,ttl:T.union([T.number(),T.null()]),createdAt:T.string(),lastUpdatedAt:T.string(),pollInterval:T.optional(T.number()),statusMessage:T.optional(T.string())}),hc=oi.extend({task:wI}),Bqe=po.merge(wI),bI=fo.extend({method:T.literal("notifications/tasks/status"),params:Bqe}),_0=si.extend({method:T.literal("tasks/get"),params:Us.extend({taskId:T.string()})}),U0=oi.merge(wI),G0=si.extend({method:T.literal("tasks/result"),params:Us.extend({taskId:T.string()})}),oJt=oi.loose(),O0=QI.extend({method:T.literal("tasks/list")}),K0=DI.extend({tasks:T.array(wI)}),H0=si.extend({method:T.literal("tasks/cancel"),params:Us.extend({taskId:T.string()})}),Yoe=oi.merge(wI),qoe=T.object({uri:T.string(),mimeType:T.optional(T.string()),_meta:T.record(T.string(),T.unknown()).optional()}),$oe=qoe.extend({text:T.string()}),R_=T.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Voe=qoe.extend({blob:R_}),SI=T.enum(["user","assistant"]),bf=T.object({audience:T.array(SI).optional(),priority:T.number().min(0).max(1).optional(),lastModified:T.iso.datetime({offset:!0}).optional()}),Woe=T.object({...wf.shape,...yI.shape,uri:T.string(),description:T.optional(T.string()),mimeType:T.optional(T.string()),annotations:bf.optional(),_meta:T.optional(T.looseObject({}))}),yqe=T.object({...wf.shape,...yI.shape,uriTemplate:T.string(),description:T.optional(T.string()),mimeType:T.optional(T.string()),annotations:bf.optional(),_meta:T.optional(T.looseObject({}))}),T_=QI.extend({method:T.literal("resources/list")}),N_=DI.extend({resources:T.array(Woe)}),M_=QI.extend({method:T.literal("resources/templates/list")}),P_=DI.extend({resourceTemplates:T.array(yqe)}),L_=Us.extend({uri:T.string()}),Qqe=L_,__=si.extend({method:T.literal("resources/read"),params:Qqe}),U_=oi.extend({contents:T.array(T.union([$oe,Voe]))}),G_=fo.extend({method:T.literal("notifications/resources/list_changed"),params:po.optional()}),Dqe=L_,wqe=si.extend({method:T.literal("resources/subscribe"),params:Dqe}),bqe=L_,Sqe=si.extend({method:T.literal("resources/unsubscribe"),params:bqe}),vqe=po.extend({uri:T.string()}),xqe=fo.extend({method:T.literal("notifications/resources/updated"),params:vqe}),Fqe=T.object({name:T.string(),description:T.optional(T.string()),required:T.optional(T.boolean())}),kqe=T.object({...wf.shape,...yI.shape,description:T.optional(T.string()),arguments:T.optional(T.array(Fqe)),_meta:T.optional(T.looseObject({}))}),Rqe=QI.extend({method:T.literal("prompts/list")}),O_=DI.extend({prompts:T.array(kqe)}),Tqe=Us.extend({name:T.string(),arguments:T.record(T.string(),T.string()).optional()}),Nqe=si.extend({method:T.literal("prompts/get"),params:Tqe}),K_=T.object({type:T.literal("text"),text:T.string(),annotations:bf.optional(),_meta:T.record(T.string(),T.unknown()).optional()}),H_=T.object({type:T.literal("image"),data:R_,mimeType:T.string(),annotations:bf.optional(),_meta:T.record(T.string(),T.unknown()).optional()}),J_=T.object({type:T.literal("audio"),data:R_,mimeType:T.string(),annotations:bf.optional(),_meta:T.record(T.string(),T.unknown()).optional()}),Mqe=T.object({type:T.literal("tool_use"),name:T.string(),id:T.string(),input:T.record(T.string(),T.unknown()),_meta:T.record(T.string(),T.unknown()).optional()}),Pqe=T.object({type:T.literal("resource"),resource:T.union([$oe,Voe]),annotations:bf.optional(),_meta:T.record(T.string(),T.unknown()).optional()}),Lqe=Woe.extend({type:T.literal("resource_link")}),j_=T.union([K_,H_,J_,Lqe,Pqe]),_qe=T.object({role:SI,content:j_}),Y_=oi.extend({description:T.string().optional(),messages:T.array(_qe)}),q_=fo.extend({method:T.literal("notifications/prompts/list_changed"),params:po.optional()}),Uqe=T.object({title:T.string().optional(),readOnlyHint:T.boolean().optional(),destructiveHint:T.boolean().optional(),idempotentHint:T.boolean().optional(),openWorldHint:T.boolean().optional()}),Gqe=T.object({taskSupport:T.enum(["required","optional","forbidden"]).optional()}),zoe=T.object({...wf.shape,...yI.shape,description:T.string().optional(),inputSchema:T.object({type:T.literal("object"),properties:T.record(T.string(),ii).optional(),required:T.array(T.string()).optional()}).catchall(T.unknown()),outputSchema:T.object({type:T.literal("object"),properties:T.record(T.string(),ii).optional(),required:T.array(T.string()).optional()}).catchall(T.unknown()).optional(),annotations:Uqe.optional(),execution:Gqe.optional(),_meta:T.record(T.string(),T.unknown()).optional()}),$_=QI.extend({method:T.literal("tools/list")}),V_=DI.extend({tools:T.array(zoe)}),Ju=oi.extend({content:T.array(j_).default([]),structuredContent:T.record(T.string(),T.unknown()).optional(),isError:T.boolean().optional()}),aJt=Ju.or(oi.extend({toolResult:T.unknown()})),Oqe=EI.extend({name:T.string(),arguments:T.record(T.string(),T.unknown()).optional()}),vI=si.extend({method:T.literal("tools/call"),params:Oqe}),W_=fo.extend({method:T.literal("notifications/tools/list_changed"),params:po.optional()}),Xoe=T.object({autoRefresh:T.boolean().default(!0),debounceMs:T.number().int().nonnegative().default(300)}),xI=T.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Kqe=Us.extend({level:xI}),z_=si.extend({method:T.literal("logging/setLevel"),params:Kqe}),Hqe=po.extend({level:xI,logger:T.string().optional(),data:T.unknown()}),Jqe=fo.extend({method:T.literal("notifications/message"),params:Hqe}),jqe=T.object({name:T.string().optional()}),Yqe=T.object({hints:T.array(jqe).optional(),costPriority:T.number().min(0).max(1).optional(),speedPriority:T.number().min(0).max(1).optional(),intelligencePriority:T.number().min(0).max(1).optional()}),qqe=T.object({mode:T.enum(["auto","required","none"]).optional()}),$qe=T.object({type:T.literal("tool_result"),toolUseId:T.string().describe("The unique identifier for the corresponding tool call."),content:T.array(j_).default([]),structuredContent:T.object({}).loose().optional(),isError:T.boolean().optional(),_meta:T.record(T.string(),T.unknown()).optional()}),Vqe=T.discriminatedUnion("type",[K_,H_,J_]),F0=T.discriminatedUnion("type",[K_,H_,J_,Mqe,$qe]),Wqe=T.object({role:SI,content:T.union([F0,T.array(F0)]),_meta:T.record(T.string(),T.unknown()).optional()}),zqe=EI.extend({messages:T.array(Wqe),modelPreferences:Yqe.optional(),systemPrompt:T.string().optional(),includeContext:T.enum(["none","thisServer","allServers"]).optional(),temperature:T.number().optional(),maxTokens:T.number().int(),stopSequences:T.array(T.string()).optional(),metadata:ii.optional(),tools:T.array(zoe).optional(),toolChoice:qqe.optional()}),X_=si.extend({method:T.literal("sampling/createMessage"),params:zqe}),_g=oi.extend({model:T.string(),stopReason:T.optional(T.enum(["endTurn","stopSequence","maxTokens"]).or(T.string())),role:SI,content:Vqe}),FI=oi.extend({model:T.string(),stopReason:T.optional(T.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(T.string())),role:SI,content:T.union([F0,T.array(F0)])}),Xqe=T.object({type:T.literal("boolean"),title:T.string().optional(),description:T.string().optional(),default:T.boolean().optional()}),Zqe=T.object({type:T.literal("string"),title:T.string().optional(),description:T.string().optional(),minLength:T.number().optional(),maxLength:T.number().optional(),format:T.enum(["email","uri","date","date-time"]).optional(),default:T.string().optional()}),e5e=T.object({type:T.enum(["number","integer"]),title:T.string().optional(),description:T.string().optional(),minimum:T.number().optional(),maximum:T.number().optional(),default:T.number().optional()}),t5e=T.object({type:T.literal("string"),title:T.string().optional(),description:T.string().optional(),enum:T.array(T.string()),default:T.string().optional()}),r5e=T.object({type:T.literal("string"),title:T.string().optional(),description:T.string().optional(),oneOf:T.array(T.object({const:T.string(),title:T.string()})),default:T.string().optional()}),n5e=T.object({type:T.literal("string"),title:T.string().optional(),description:T.string().optional(),enum:T.array(T.string()),enumNames:T.array(T.string()).optional(),default:T.string().optional()}),i5e=T.union([t5e,r5e]),s5e=T.object({type:T.literal("array"),title:T.string().optional(),description:T.string().optional(),minItems:T.number().optional(),maxItems:T.number().optional(),items:T.object({type:T.literal("string"),enum:T.array(T.string())}),default:T.array(T.string()).optional()}),o5e=T.object({type:T.literal("array"),title:T.string().optional(),description:T.string().optional(),minItems:T.number().optional(),maxItems:T.number().optional(),items:T.object({anyOf:T.array(T.object({const:T.string(),title:T.string()}))}),default:T.array(T.string()).optional()}),a5e=T.union([s5e,o5e]),A5e=T.union([n5e,i5e,a5e]),c5e=T.union([A5e,Xqe,Zqe,e5e]),u5e=EI.extend({mode:T.literal("form").optional(),message:T.string(),requestedSchema:T.object({type:T.literal("object"),properties:T.record(T.string(),c5e),required:T.array(T.string()).optional()})}),l5e=EI.extend({mode:T.literal("url"),message:T.string(),elicitationId:T.string(),url:T.string().url()}),g5e=T.union([u5e,l5e]),Z_=si.extend({method:T.literal("elicitation/create"),params:g5e}),p5e=po.extend({elicitationId:T.string()}),d5e=fo.extend({method:T.literal("notifications/elicitation/complete"),params:p5e}),ju=oi.extend({action:T.enum(["accept","decline","cancel"]),content:T.preprocess(t=>t===null?void 0:t,T.record(T.string(),T.union([T.string(),T.number(),T.boolean(),T.array(T.string())])).optional())}),f5e=T.object({type:T.literal("ref/resource"),uri:T.string()}),h5e=T.object({type:T.literal("ref/prompt"),name:T.string()}),m5e=Us.extend({ref:T.union([h5e,f5e]),argument:T.object({name:T.string(),value:T.string()}),context:T.object({arguments:T.record(T.string(),T.string()).optional()}).optional()}),C5e=si.extend({method:T.literal("completion/complete"),params:m5e}),eU=oi.extend({completion:T.looseObject({values:T.array(T.string()).max(100),total:T.optional(T.number().int()),hasMore:T.optional(T.boolean())})}),I5e=T.object({uri:T.string().startsWith("file://"),name:T.string().optional(),_meta:T.record(T.string(),T.unknown()).optional()}),E5e=si.extend({method:T.literal("roots/list"),params:Us.optional()}),tU=oi.extend({roots:T.array(I5e)}),B5e=fo.extend({method:T.literal("notifications/roots/list_changed"),params:po.optional()}),AJt=T.union([P0,F_,C5e,z_,Nqe,Rqe,T_,M_,__,wqe,Sqe,vI,$_,_0,G0,O0,H0]),cJt=T.union([N0,L0,M0,B5e,bI]),uJt=T.union([fc,_g,FI,ju,tU,U0,K0,hc]),lJt=T.union([P0,X_,Z_,E5e,_0,G0,O0,H0]),gJt=T.union([N0,L0,Jqe,xqe,G_,W_,q_,bI,d5e]),pJt=T.union([fc,k_,eU,Y_,O_,N_,P_,U_,Ju,V_,U0,K0,hc]),He=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===We.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new b_(i.elicitations,r)}return new t(e,r,n)}},b_=class extends He{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(We.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}});function Yu(t){return t==="completed"||t==="failed"||t==="cancelled"}var Zoe=L(()=>{h()});var J0=L(()=>{h()});var rU=L(()=>{h();J0()});var qu=L(()=>{h()});var j0=L(()=>{h()});var ho=L(()=>{h();j0()});var Q5e,nU=L(()=>{h();Q5e=require("zod/v3");qu();yn()});var iU=L(()=>{h();qu()});var sU=L(()=>{h()});var Y0=L(()=>{h();yn()});var oU=L(()=>{h();yn()});var aU=L(()=>{h();qu()});var AU=L(()=>{h();yn()});var cU=L(()=>{h();yn();ho()});var uU=L(()=>{h()});var lU=L(()=>{h();yn()});var gU=L(()=>{h()});var ujt,q0=L(()=>{h();qu();ujt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});var b5e,$0=L(()=>{h();b5e=require("zod/v3");yn();q0();Y0();ho()});var pU=L(()=>{h();yn();$0();ho()});var dU=L(()=>{h()});var fU=L(()=>{h();ho()});var hU=L(()=>{h()});var V0=L(()=>{h();yn()});var mU=L(()=>{h();yn();V0()});var CU=L(()=>{h();qu()});var IU=L(()=>{h();yn()});var EU=L(()=>{h();yn();ho()});var BU=L(()=>{h();yn()});var yU=L(()=>{h();yn()});var QU=L(()=>{h();qu();yn()});var DU=L(()=>{h();yn()});var wU=L(()=>{h();ho()});var bU=L(()=>{h();ho()});var SU=L(()=>{h();yn()});var v5e,vU=L(()=>{h();v5e=require("zod/v3");ho();nU();iU();sU();Y0();oU();aU();AU();cU();uU();lU();gU();pU();dU();fU();hU();mU();CU();IU();EU();BU();yU();$0();QU();q0();DU();wU();V0();bU();SU()});var yn=L(()=>{h();J0();vU();j0();ho()});var eae=L(()=>{h()});var xU=L(()=>{h();yn();rU();ho()});var tae=L(()=>{h();J0();rU();qu();j0();yn();eae();ho();nU();iU();sU();Y0();oU();aU();AU();cU();uU();lU();gU();pU();dU();fU();hU();mU();CU();IU();EU();BU();yU();SU();$0();QU();q0();DU();wU();V0();bU();vU();xU();xU()});function FU(t){let r=Df(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Poe(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function kU(t,e){let r=ji(t,e);if(!r.success)throw r.error;return r.data}var F5e,rae=L(()=>{h();F5e=X(require("zod/v4-mini"),1);II();tae()});function nae(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function W0(t,e){let r={...t};for(let n in e){let i=n,s=e[i];if(s===void 0)continue;let o=r[i];nae(o)&&nae(s)?r[i]={...o,...s}:r[i]=s}return r}var k5e,Sf,RU=L(()=>{h();II();la();Zoe();rae();k5e=6e4,Sf=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(N0,r=>{this._oncancel(r)}),this.setNotificationHandler(L0,r=>{this._onprogress(r)}),this.setRequestHandler(P0,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(_0,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new He(We.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(G0,async(r,n)=>{let i=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let A=a.message,c=A.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),a.type==="response")u(A);else{let l=A,d=new He(l.error.code,l.error.message,l.error.data);u(d)}else{let l=a.type==="response"?"Response":"Error";this._onerror(new Error(`${l} handler missing for request ${c}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(s,n.sessionId);if(!o)throw new He(We.InvalidParams,`Task not found: ${s}`);if(!Yu(o.status))return await this._waitForTaskUpdate(s,n.signal),await i();if(Yu(o.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Ku]:{taskId:s}}}}return await i()};return await i()}),this.setRequestHandler(O0,async(r,n)=>{try{let{tasks:i,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new He(We.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(H0,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new He(We.InvalidParams,`Task not found: ${r.params.taskId}`);if(Yu(i.status))throw new He(We.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new He(We.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(i){throw i instanceof He?i:new He(We.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),He.fromError(We.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let i=this._transport?.onmessage;this._transport.onmessage=(s,o)=>{i?.(s,o),Lg(s)||Hoe(s)?this._onresponse(s):BI(s)?this._onrequest(s,o):Koe(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=He.fromError(We.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,s=e.params?._meta?.[Ku]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:We.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(l=>this._onerror(new Error(`Failed to enqueue error response: ${l}`))):i?.send(u).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let a=Uoe(e.params)?e.params.task:void 0,A=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,c={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(o.signal.aborted)return;let l={relatedRequestId:e.id};s&&(l.relatedTask={taskId:s}),await this.notification(u,l)},sendRequest:async(u,l,d)=>{if(o.signal.aborted)throw new He(We.ConnectionClosed,"Request was cancelled");let g={...d,relatedRequestId:e.id};s&&!g.relatedTask&&(g.relatedTask={taskId:s});let p=g.relatedTask?.taskId??s;return p&&A&&await A.updateTaskStatus(p,"input_required"),await this.request(u,l,g)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:A,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async u=>{if(o.signal.aborted)return;let l={result:u,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:l,timestamp:Date.now()},i?.sessionId):await i?.send(l)},async u=>{if(o.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:We.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},i?.sessionId):await i?.send(l)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(A){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(A);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Lg(e))n(e);else{let o=new He(e.error.code,e.error.message,e.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Lg(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let a=o.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Lg(e))i(e);else{let o=He.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(o){yield{type:"error",error:o instanceof He?o:new He(We.InternalError,String(o))}}return}let s;try{let o=await this.request(e,hc,n);if(o.task)s=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new He(We.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Yu(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new He(We.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new He(We.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let A=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(c=>setTimeout(c,A)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof He?o:new He(We.InternalError,String(o))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o,task:a,relatedTask:A}=n??{};return new Promise((c,u)=>{let l=I=>{u(I)};if(!this._transport){l(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(I){l(I);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),a&&(g.params={...g.params,task:a}),A&&(g.params={...g.params,_meta:{...g.params?._meta||{},[Ku]:A}});let p=I=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(I)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o}).catch(E=>this._onerror(new Error(`Failed to send cancellation: ${E}`)));let B=I instanceof He?I:new He(We.RequestTimeout,String(I));u(B)};this._responseHandlers.set(d,I=>{if(!n?.signal?.aborted){if(I instanceof Error)return u(I);try{let B=ji(r,I.result);B.success?c(B.data):u(B.error)}catch(B){u(B)}}}),n?.signal?.addEventListener("abort",()=>{p(n?.signal?.reason)});let f=n?.timeout??k5e,m=()=>p(He.fromError(We.RequestTimeout,"Request timed out",{timeout:f}));this._setupTimeout(d,f,n?.maxTotalTimeout,m,n?.resetTimeoutOnProgress??!1);let C=A?.taskId;if(C){let I=B=>{let E=this._responseHandlers.get(d);E?E(B):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,I),this._enqueueTaskMessage(C,{type:"request",message:g,timestamp:Date.now()}).catch(B=>{this._cleanupTimeout(d),u(B)})}else this._transport.send(g,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:o}).catch(I=>{this._cleanupTimeout(d),u(I)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},U0,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},K0,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Yoe,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Ku]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Ku]:r.relatedTask}}}),this._transport?.send(a,r).catch(A=>this._onerror(A))});return}let o={...e,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Ku]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(e,r){let n=FU(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>{let o=kU(e,i);return Promise.resolve(r(o,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=FU(e);this._notificationHandlers.set(n,i=>{let s=kU(e,i);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&BI(i.message)){let s=i.message.id,o=this._requestResolvers.get(s);o?(o(new He(We.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,s)=>{if(r.aborted){s(new He(We.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),s(new He(We.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let s=await n.getTask(i,r);if(!s)throw new He(We.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(i,s,o)=>{await n.storeTaskResult(i,s,o,r);let a=await n.getTask(i,r);if(a){let A=bI.parse({method:"notifications/tasks/status",params:a});await this.notification(A),Yu(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,s,o)=>{let a=await n.getTask(i,r);if(!a)throw new He(We.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Yu(a.status))throw new He(We.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,s,o,r);let A=await n.getTask(i,r);if(A){let c=bI.parse({method:"notifications/tasks/status",params:A});await this.notification(c),Yu(A.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}}});var NI=N(zt=>{"use strict";h();Object.defineProperty(zt,"__esModule",{value:!0});zt.regexpCode=zt.getEsmExportName=zt.getProperty=zt.safeStringify=zt.stringify=zt.strConcat=zt.addCodeArg=zt.str=zt._=zt.nil=zt._Code=zt.Name=zt.IDENTIFIER=zt._CodeOrName=void 0;var RI=class{};zt._CodeOrName=RI;zt.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ug=class extends RI{constructor(e){if(super(),!zt.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};zt.Name=Ug;var mo=class extends RI{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ug&&(r[n.str]=(r[n.str]||0)+1),r),{})}};zt._Code=mo;zt.nil=new mo("");function iae(t,...e){let r=[t[0]],n=0;for(;n<e.length;)NU(r,e[n]),r.push(t[++n]);return new mo(r)}zt._=iae;var TU=new mo("+");function sae(t,...e){let r=[TI(t[0])],n=0;for(;n<e.length;)r.push(TU),NU(r,e[n]),r.push(TU,TI(t[++n]));return R5e(r),new mo(r)}zt.str=sae;function NU(t,e){e instanceof mo?t.push(...e._items):e instanceof Ug?t.push(e):t.push(M5e(e))}zt.addCodeArg=NU;function R5e(t){let e=1;for(;e<t.length-1;){if(t[e]===TU){let r=T5e(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function T5e(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ug||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ug))return`"${t}${e.slice(1)}`}function N5e(t,e){return e.emptyStr()?t:t.emptyStr()?e:sae`${t}${e}`}zt.strConcat=N5e;function M5e(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:TI(Array.isArray(t)?t.join(","):t)}function P5e(t){return new mo(TI(t))}zt.stringify=P5e;function TI(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}zt.safeStringify=TI;function L5e(t){return typeof t=="string"&&zt.IDENTIFIER.test(t)?new mo(`.${t}`):iae`[${t}]`}zt.getProperty=L5e;function _5e(t){if(typeof t=="string"&&zt.IDENTIFIER.test(t))return new mo(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}zt.getEsmExportName=_5e;function U5e(t){return new mo(t.toString())}zt.regexpCode=U5e});var LU=N(fs=>{"use strict";h();Object.defineProperty(fs,"__esModule",{value:!0});fs.ValueScope=fs.ValueScopeName=fs.Scope=fs.varKinds=fs.UsedValueState=void 0;var ds=NI(),MU=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},z0;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(z0||(fs.UsedValueState=z0={}));fs.varKinds={const:new ds.Name("const"),let:new ds.Name("let"),var:new ds.Name("var")};var X0=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ds.Name?e:this.name(e)}name(e){return new ds.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};fs.Scope=X0;var Z0=class extends ds.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,ds._)`.${new ds.Name(r)}[${n}]`}};fs.ValueScopeName=Z0;var G5e=(0,ds._)`\n`,PU=class extends X0{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?G5e:ds.nil}}get(){return this._scope}name(e){return new Z0(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let A=this._scope[s]||(this._scope[s]=[]),c=A.length;return A[c]=r.ref,i.setValue(r,{property:s,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ds._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=ds.nil;for(let o in e){let a=e[o];if(!a)continue;let A=n[o]=n[o]||new Map;a.forEach(c=>{if(A.has(c))return;A.set(c,z0.Started);let u=r(c);if(u){let l=this.opts.es5?fs.varKinds.var:fs.varKinds.const;s=(0,ds._)`${s}${l} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))s=(0,ds._)`${s}${u}${this.opts._n}`;else throw new MU(c);A.set(c,z0.Completed)})}return s}};fs.ValueScope=PU});var bt=N(xt=>{"use strict";h();Object.defineProperty(xt,"__esModule",{value:!0});xt.or=xt.and=xt.not=xt.CodeGen=xt.operators=xt.varKinds=xt.ValueScopeName=xt.ValueScope=xt.Scope=xt.Name=xt.regexpCode=xt.stringify=xt.getProperty=xt.nil=xt.strConcat=xt.str=xt._=void 0;var Jt=NI(),ga=LU(),$u=NI();Object.defineProperty(xt,"_",{enumerable:!0,get:function(){return $u._}});Object.defineProperty(xt,"str",{enumerable:!0,get:function(){return $u.str}});Object.defineProperty(xt,"strConcat",{enumerable:!0,get:function(){return $u.strConcat}});Object.defineProperty(xt,"nil",{enumerable:!0,get:function(){return $u.nil}});Object.defineProperty(xt,"getProperty",{enumerable:!0,get:function(){return $u.getProperty}});Object.defineProperty(xt,"stringify",{enumerable:!0,get:function(){return $u.stringify}});Object.defineProperty(xt,"regexpCode",{enumerable:!0,get:function(){return $u.regexpCode}});Object.defineProperty(xt,"Name",{enumerable:!0,get:function(){return $u.Name}});var nb=LU();Object.defineProperty(xt,"Scope",{enumerable:!0,get:function(){return nb.Scope}});Object.defineProperty(xt,"ValueScope",{enumerable:!0,get:function(){return nb.ValueScope}});Object.defineProperty(xt,"ValueScopeName",{enumerable:!0,get:function(){return nb.ValueScopeName}});Object.defineProperty(xt,"varKinds",{enumerable:!0,get:function(){return nb.varKinds}});xt.operators={GT:new Jt._Code(">"),GTE:new Jt._Code(">="),LT:new Jt._Code("<"),LTE:new Jt._Code("<="),EQ:new Jt._Code("==="),NEQ:new Jt._Code("!=="),NOT:new Jt._Code("!"),OR:new Jt._Code("||"),AND:new Jt._Code("&&"),ADD:new Jt._Code("+")};var Cc=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},_U=class extends Cc{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ga.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=xf(this.rhs,e,r)),this}get names(){return this.rhs instanceof Jt._CodeOrName?this.rhs.names:{}}},eb=class extends Cc{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Jt.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=xf(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Jt.Name?{}:{...this.lhs.names};return rb(e,this.rhs)}},UU=class extends eb{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},GU=class extends Cc{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},OU=class extends Cc{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},KU=class extends Cc{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},HU=class extends Cc{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=xf(this.code,e,r),this}get names(){return this.code instanceof Jt._CodeOrName?this.code.names:{}}},MI=class extends Cc{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(O5e(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Kg(e,r.names),{})}},Ic=class extends MI{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},JU=class extends MI{},vf=class extends Ic{};vf.kind="else";var Gg=class t extends Ic{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new vf(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(oae(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=xf(this.condition,e,r),this}get names(){let e=super.names;return rb(e,this.condition),this.else&&Kg(e,this.else.names),e}};Gg.kind="if";var Og=class extends Ic{};Og.kind="for";var jU=class extends Og{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=xf(this.iteration,e,r),this}get names(){return Kg(super.names,this.iteration.names)}},YU=class extends Og{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ga.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=rb(super.names,this.from);return rb(e,this.to)}},tb=class extends Og{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=xf(this.iterable,e,r),this}get names(){return Kg(super.names,this.iterable.names)}},PI=class extends Ic{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};PI.kind="func";var LI=class extends MI{render(e){return"return "+super.render(e)}};LI.kind="return";var qU=class extends Ic{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Kg(e,this.catch.names),this.finally&&Kg(e,this.finally.names),e}},_I=class extends Ic{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};_I.kind="catch";var UI=class extends Ic{render(e){return"finally"+super.render(e)}};UI.kind="finally";var $U=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
1794
1794
|
`:""},this._extScope=e,this._scope=new ga.Scope({parent:e}),this._nodes=[new JU]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new _U(e,s,n)),s}const(e,r,n){return this._def(ga.varKinds.const,e,r,n)}let(e,r,n){return this._def(ga.varKinds.let,e,r,n)}var(e,r,n){return this._def(ga.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new eb(e,r,n))}add(e,r){return this._leafNode(new UU(e,xt.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Jt.nil&&this._leafNode(new HU(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Jt.addCodeArg)(r,i));return r.push("}"),new Jt._Code(r)}if(e,r,n){if(this._blockNode(new Gg(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Gg(e))}else(){return this._elseNode(new vf)}endIf(){return this._endBlockNode(Gg,vf)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new jU(e),r)}forRange(e,r,n,i,s=this.opts.es5?ga.varKinds.var:ga.varKinds.let){let o=this._scope.toName(e);return this._for(new YU(s,o,r,n),()=>i(o))}forOf(e,r,n,i=ga.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Jt.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Jt._)`${o}.length`,a=>{this.var(s,(0,Jt._)`${o}[${a}]`),n(s)})}return this._for(new tb("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?ga.varKinds.var:ga.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Jt._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new tb("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(Og)}label(e){return this._leafNode(new GU(e))}break(e){return this._leafNode(new OU(e))}return(e){let r=new LI;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(LI)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new qU;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new _I(s),r(s)}return n&&(this._currNode=i.finally=new UI,this.code(n)),this._endBlockNode(_I,UI)}throw(e){return this._leafNode(new KU(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Jt.nil,n,i){return this._blockNode(new PI(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(PI)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Gg))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};xt.CodeGen=$U;function Kg(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function rb(t,e){return e instanceof Jt._CodeOrName?Kg(t,e.names):t}function xf(t,e,r){if(t instanceof Jt.Name)return n(t);if(!i(t))return t;return new Jt._Code(t._items.reduce((s,o)=>(o instanceof Jt.Name&&(o=n(o)),o instanceof Jt._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof Jt._Code&&s._items.some(o=>o instanceof Jt.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function O5e(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function oae(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Jt._)`!${VU(t)}`}xt.not=oae;var K5e=aae(xt.operators.AND);function H5e(...t){return t.reduce(K5e)}xt.and=H5e;var J5e=aae(xt.operators.OR);function j5e(...t){return t.reduce(J5e)}xt.or=j5e;function aae(t){return(e,r)=>e===Jt.nil?r:r===Jt.nil?e:(0,Jt._)`${VU(e)} ${t} ${VU(r)}`}function VU(t){return t instanceof Jt.Name?t:(0,Jt._)`(${t})`}});var qt=N(Nt=>{"use strict";h();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.checkStrictMode=Nt.getErrorPath=Nt.Type=Nt.useFunc=Nt.setEvaluated=Nt.evaluatedPropsToName=Nt.mergeEvaluated=Nt.eachItem=Nt.unescapeJsonPointer=Nt.escapeJsonPointer=Nt.escapeFragment=Nt.unescapeFragment=Nt.schemaRefOrVal=Nt.schemaHasRulesButRef=Nt.schemaHasRules=Nt.checkUnknownRules=Nt.alwaysValidSchema=Nt.toHash=void 0;var mr=bt(),Y5e=NI();function q5e(t){let e={};for(let r of t)e[r]=!0;return e}Nt.toHash=q5e;function $5e(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(uae(t,e),!lae(e,t.self.RULES.all))}Nt.alwaysValidSchema=$5e;function uae(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||dae(t,`unknown keyword: "${s}"`)}Nt.checkUnknownRules=uae;function lae(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Nt.schemaHasRules=lae;function V5e(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Nt.schemaHasRulesButRef=V5e;function W5e({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,mr._)`${r}`}return(0,mr._)`${t}${e}${(0,mr.getProperty)(n)}`}Nt.schemaRefOrVal=W5e;function z5e(t){return gae(decodeURIComponent(t))}Nt.unescapeFragment=z5e;function X5e(t){return encodeURIComponent(zU(t))}Nt.escapeFragment=X5e;function zU(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Nt.escapeJsonPointer=zU;function gae(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Nt.unescapeJsonPointer=gae;function Z5e(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Nt.eachItem=Z5e;function Aae({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let A=o===void 0?s:o instanceof mr.Name?(s instanceof mr.Name?t(i,s,o):e(i,s,o),o):s instanceof mr.Name?(e(i,o,s),s):r(s,o);return a===mr.Name&&!(A instanceof mr.Name)?n(i,A):A}}Nt.mergeEvaluated={props:Aae({mergeNames:(t,e,r)=>t.if((0,mr._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,mr._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,mr._)`${r} || {}`).code((0,mr._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,mr._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,mr._)`${r} || {}`),XU(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:pae}),items:Aae({mergeNames:(t,e,r)=>t.if((0,mr._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,mr._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,mr._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,mr._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function pae(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,mr._)`{}`);return e!==void 0&&XU(t,r,e),r}Nt.evaluatedPropsToName=pae;function XU(t,e,r){Object.keys(r).forEach(n=>t.assign((0,mr._)`${e}${(0,mr.getProperty)(n)}`,!0))}Nt.setEvaluated=XU;var cae={};function e$e(t,e){return t.scopeValue("func",{ref:e,code:cae[e.code]||(cae[e.code]=new Y5e._Code(e.code))})}Nt.useFunc=e$e;var WU;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(WU||(Nt.Type=WU={}));function t$e(t,e,r){if(t instanceof mr.Name){let n=e===WU.Num;return r?n?(0,mr._)`"[" + ${t} + "]"`:(0,mr._)`"['" + ${t} + "']"`:n?(0,mr._)`"/" + ${t}`:(0,mr._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,mr.getProperty)(t).toString():"/"+zU(t)}Nt.getErrorPath=t$e;function dae(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Nt.checkStrictMode=dae});var Ec=N(ZU=>{"use strict";h();Object.defineProperty(ZU,"__esModule",{value:!0});var ki=bt(),r$e={data:new ki.Name("data"),valCxt:new ki.Name("valCxt"),instancePath:new ki.Name("instancePath"),parentData:new ki.Name("parentData"),parentDataProperty:new ki.Name("parentDataProperty"),rootData:new ki.Name("rootData"),dynamicAnchors:new ki.Name("dynamicAnchors"),vErrors:new ki.Name("vErrors"),errors:new ki.Name("errors"),this:new ki.Name("this"),self:new ki.Name("self"),scope:new ki.Name("scope"),json:new ki.Name("json"),jsonPos:new ki.Name("jsonPos"),jsonLen:new ki.Name("jsonLen"),jsonPart:new ki.Name("jsonPart")};ZU.default=r$e});var GI=N(Ri=>{"use strict";h();Object.defineProperty(Ri,"__esModule",{value:!0});Ri.extendErrors=Ri.resetErrorsCount=Ri.reportExtraError=Ri.reportError=Ri.keyword$DataError=Ri.keywordError=void 0;var $t=bt(),ib=qt(),Yi=Ec();Ri.keywordError={message:({keyword:t})=>(0,$t.str)`must pass "${t}" keyword validation`};Ri.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,$t.str)`"${t}" keyword must be ${e} ($data)`:(0,$t.str)`"${t}" keyword is invalid ($data)`};function n$e(t,e=Ri.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,A=mae(t,e,r);n??(o||a)?fae(s,A):hae(i,(0,$t._)`[${A}]`)}Ri.reportError=n$e;function i$e(t,e=Ri.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=mae(t,e,r);fae(i,a),s||o||hae(n,Yi.default.vErrors)}Ri.reportExtraError=i$e;function s$e(t,e){t.assign(Yi.default.errors,e),t.if((0,$t._)`${Yi.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,$t._)`${Yi.default.vErrors}.length`,e),()=>t.assign(Yi.default.vErrors,null)))}Ri.resetErrorsCount=s$e;function o$e({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Yi.default.errors,a=>{t.const(o,(0,$t._)`${Yi.default.vErrors}[${a}]`),t.if((0,$t._)`${o}.instancePath === undefined`,()=>t.assign((0,$t._)`${o}.instancePath`,(0,$t.strConcat)(Yi.default.instancePath,s.errorPath))),t.assign((0,$t._)`${o}.schemaPath`,(0,$t.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,$t._)`${o}.schema`,r),t.assign((0,$t._)`${o}.data`,n))})}Ri.extendErrors=o$e;function fae(t,e){let r=t.const("err",e);t.if((0,$t._)`${Yi.default.vErrors} === null`,()=>t.assign(Yi.default.vErrors,(0,$t._)`[${r}]`),(0,$t._)`${Yi.default.vErrors}.push(${r})`),t.code((0,$t._)`${Yi.default.errors}++`)}function hae(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,$t._)`new ${t.ValidationError}(${e})`):(r.assign((0,$t._)`${n}.errors`,e),r.return(!1))}var Hg={keyword:new $t.Name("keyword"),schemaPath:new $t.Name("schemaPath"),params:new $t.Name("params"),propertyName:new $t.Name("propertyName"),message:new $t.Name("message"),schema:new $t.Name("schema"),parentSchema:new $t.Name("parentSchema")};function mae(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,$t._)`{}`:a$e(t,e,r)}function a$e(t,e,r={}){let{gen:n,it:i}=t,s=[A$e(i,r),c$e(t,r)];return u$e(t,e,s),n.object(...s)}function A$e({errorPath:t},{instancePath:e}){let r=e?(0,$t.str)`${t}${(0,ib.getErrorPath)(e,ib.Type.Str)}`:t;return[Yi.default.instancePath,(0,$t.strConcat)(Yi.default.instancePath,r)]}function c$e({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,$t.str)`${e}/${t}`;return r&&(i=(0,$t.str)`${i}${(0,ib.getErrorPath)(r,ib.Type.Str)}`),[Hg.schemaPath,i]}function u$e(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:A,propertyName:c,topSchemaRef:u,schemaPath:l}=a;n.push([Hg.keyword,i],[Hg.params,typeof e=="function"?e(t):e||(0,$t._)`{}`]),A.messages&&n.push([Hg.message,typeof r=="function"?r(t):r]),A.verbose&&n.push([Hg.schema,o],[Hg.parentSchema,(0,$t._)`${u}${l}`],[Yi.default.data,s]),c&&n.push([Hg.propertyName,c])}});var Iae=N(Ff=>{"use strict";h();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.boolOrEmptySchema=Ff.topBoolOrEmptySchema=void 0;var l$e=GI(),g$e=bt(),p$e=Ec(),d$e={message:"boolean schema is false"};function f$e(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Cae(t,!1):typeof r=="object"&&r.$async===!0?e.return(p$e.default.data):(e.assign((0,g$e._)`${n}.errors`,null),e.return(!0))}Ff.topBoolOrEmptySchema=f$e;function h$e(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Cae(t)):r.var(e,!0)}Ff.boolOrEmptySchema=h$e;function Cae(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,l$e.reportError)(i,d$e,void 0,e)}});var e2=N(kf=>{"use strict";h();Object.defineProperty(kf,"__esModule",{value:!0});kf.getRules=kf.isJSONType=void 0;var m$e=["string","number","integer","boolean","null","object","array"],C$e=new Set(m$e);function I$e(t){return typeof t=="string"&&C$e.has(t)}kf.isJSONType=I$e;function E$e(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}kf.getRules=E$e});var t2=N(Vu=>{"use strict";h();Object.defineProperty(Vu,"__esModule",{value:!0});Vu.shouldUseRule=Vu.shouldUseGroup=Vu.schemaHasRulesForType=void 0;function B$e({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Eae(t,n)}Vu.schemaHasRulesForType=B$e;function Eae(t,e){return e.rules.some(r=>Bae(t,r))}Vu.shouldUseGroup=Eae;function Bae(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Vu.shouldUseRule=Bae});var OI=N(Ti=>{"use strict";h();Object.defineProperty(Ti,"__esModule",{value:!0});Ti.reportTypeError=Ti.checkDataTypes=Ti.checkDataType=Ti.coerceAndCheckDataType=Ti.getJSONTypes=Ti.getSchemaTypes=Ti.DataType=void 0;var y$e=e2(),Q$e=t2(),D$e=GI(),Et=bt(),yae=qt(),Rf;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Rf||(Ti.DataType=Rf={}));function w$e(t){let e=Qae(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ti.getSchemaTypes=w$e;function Qae(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(y$e.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ti.getJSONTypes=Qae;function b$e(t,e){let{gen:r,data:n,opts:i}=t,s=S$e(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,Q$e.schemaHasRulesForType)(t,e[0]));if(o){let a=n2(e,n,i.strictNumbers,Rf.Wrong);r.if(a,()=>{s.length?v$e(t,e,s):i2(t)})}return o}Ti.coerceAndCheckDataType=b$e;var Dae=new Set(["string","number","integer","boolean","null"]);function S$e(t,e){return e?t.filter(r=>Dae.has(r)||e==="array"&&r==="array"):[]}function v$e(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,Et._)`typeof ${i}`),a=n.let("coerced",(0,Et._)`undefined`);s.coerceTypes==="array"&&n.if((0,Et._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Et._)`${i}[0]`).assign(o,(0,Et._)`typeof ${i}`).if(n2(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,Et._)`${a} !== undefined`);for(let c of r)(Dae.has(c)||c==="array"&&s.coerceTypes==="array")&&A(c);n.else(),i2(t),n.endIf(),n.if((0,Et._)`${a} !== undefined`,()=>{n.assign(i,a),x$e(t,a)});function A(c){switch(c){case"string":n.elseIf((0,Et._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,Et._)`"" + ${i}`).elseIf((0,Et._)`${i} === null`).assign(a,(0,Et._)`""`);return;case"number":n.elseIf((0,Et._)`${o} == "boolean" || ${i} === null
|
|
@@ -1825,11 +1825,11 @@ ${r}
|
|
|
1825
1825
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1826
1826
|
`):void 0})}let f=p.substring(4).split(" ")[0],m=oet(f);p.startsWith("--- ")?(s=m,i=m,a=0,A=0,c=[],u=[],o=null,l=f==="/dev/null",d=!1):p.startsWith("+++ ")&&(d=f==="/dev/null",f==="/dev/null"?i=s:i=m);continue}else{if(p.startsWith("@@"))continue;p.startsWith("+")?(a++,c.push(p.substring(1)),o===null&&(o="update")):p.startsWith("-")?(A++,u.push(p.substring(1)),o===null&&(o="update")):(p.startsWith(" ")||p==="")&&(c.push(p.substring(1)),u.push(p.substring(1)))}}if(i&&o){let g;l?g="create":d?g="delete":g="update";let p=g==="delete"&&s?s:i;r.push({filePath:p,addedLines:a,removedLines:A,action:g,content:c.length>0?c.join(`
|
|
1827
1827
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1828
|
-
`):void 0})}return r}var Qle=L(()=>{"use strict";h()});var il,Dle=L(()=>{"use strict";h();il=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var Aet,ih,wle,cet,uet,get,Wb,pO=L(()=>{"use strict";h();Dle();Aet=()=>{if(typeof globalThis<"u"&&globalThis.crypto)return globalThis.crypto;if(typeof require<"u")try{let t=require("crypto");if(t.webcrypto)return t.webcrypto}catch{}throw new Error("Web Crypto API is not available. Requires Node.js 15+ or a browser environment.")},ih=Aet(),wle=async()=>{let t=await ih.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await ih.subtle.exportKey("jwk",t);return JSON.stringify(e)},cet=async()=>ih.getRandomValues(new Uint8Array(16)),uet=async(t,e,r)=>{let n=await ih.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},get=async(t,e,r)=>{let n=await ih.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},Wb=async t=>{try{il("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);il("validateEncryptionKey: Parsed JWK");let r=await ih.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);il("validateEncryptionKey: Imported crypto key");let n="test",i=await cet();il("validateEncryptionKey: Generated test IV",i);let s=await uet(r,i,n);il("validateEncryptionKey: Encrypted test data",s);let o=new Uint8Array(s);il("validateEncryptionKey: Encrypted test data array",o);let a=await get(r,i,o);return il("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});function ble(t){return t.length<=dO?t:t.slice(0,dO)+`... [+${t.length-dO} chars]`}var pet,dO,zb,Sle=L(()=>{"use strict";h();_r();vr();Qr();pet=5e3,dO=8e3,zb=class{#n;#c;#s;#t=[];#o;#i=!1;#e=Promise.resolve();constructor(e){this.#n=e.credentials,this.#c=e.replayId,this.#s=e.debug??!1;let r=setInterval(()=>{this.#B()},pet);r.unref?.(),this.#o=r}recordText(e,r=Date.now()){this.#i||this.#a({ts:r,type:"text",content:ble(e)})}recordReasoning(e,r=Date.now()){this.#i||this.#a({ts:r,type:"thinking",content:ble(e)})}recordCheckpoint(e=Date.now(),r="",n){this.#i||this.#a({ts:e,type:"checkpoint",label:r,imageUrl:n})}#a(e){e.type!=="checkpoint"&&!e.content||this.#t.push(e)}async#B(){if(this.#t.length===0)return;let e=this.#t;return this.#t=[],this.#e=this.#e.catch(()=>{}).then(()=>this.#m(e)),this.#e}async#m(e){try{let r=new URL(`${Te}/codegen/replay/${encodeURIComponent(this.#c)}/actions`);this.#n.builderPublicKey&&r.searchParams.set("apiKey",this.#n.builderPublicKey),this.#n.userId&&r.searchParams.set("userId",this.#n.userId);let n={"content-type":"application/json"};this.#n.builderPrivateKey&&(n.authorization=`Bearer ${this.#n.builderPrivateKey}`),await Re(r,{method:"POST",body:JSON.stringify({actions:e}),headers:n,keepalive:!0},this.#s)}catch{}}async flush(){await this.#B(),await this.#e.catch(()=>{})}async close(){this.#i||(this.#i=!0,this.#o&&clearInterval(this.#o),await this.flush())}}});var fO,vle,det,xle=L(()=>{h();fO=(t,e,r)=>{let n=t instanceof RegExp?vle(t,r):t,i=e instanceof RegExp?vle(e,r):e,s=n!==null&&i!=null&&det(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},vle=(t,e)=>{let r=e.match(t);return r?r[0]:null},det=(t,e,r)=>{let n,i,s,o,a,A=r.indexOf(t),c=r.indexOf(e,A+1),u=A;if(A>=0&&c>0){if(t===e)return[A,c];for(n=[],s=r.length;u>=0&&!a;){if(u===A)n.push(u),A=r.indexOf(t,u+1);else if(n.length===1){let l=n.pop();l!==void 0&&(a=[l,c])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&o!==void 0&&(a=[s,o])}return a}});function hO(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function bet(t){return t.replace(Eet,Fle).replace(Bet,kle).replace(yet,mO).replace(Qet,Rle).replace(Det,Tle)}function vet(t){return t.replace(fet,"\\").replace(het,"{").replace(met,"}").replace(Cet,",").replace(Iet,".")}function Nle(t){if(!t)return[""];let e=[],r=fO("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=Nle(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Mle(t,e={}){if(!t)return[];let{max:r=wet}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),bE(bet(t),r,!0).map(vet)}function xet(t){return"{"+t+"}"}function Fet(t){return/^-?0\d/.test(t)}function ket(t,e){return t<=e}function Ret(t,e){return t>=e}function bE(t,e,r){let n=[],i=fO("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?bE(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let A=s+"{"+i.body+"}"+o[a];n.push(A)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),A=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||A,u=i.body.indexOf(",")>=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+mO+i.post,bE(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=Nle(i.body),l.length===1&&l[0]!==void 0&&(l=bE(l[0],e,!1).map(xet),l.length===1))return o.map(g=>i.pre+l[0]+g);let d;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=hO(l[0]),p=hO(l[1]),f=Math.max(l[0].length,l[1].length),m=l.length===3&&l[2]!==void 0?Math.abs(hO(l[2])):1,C=ket;p<g&&(m*=-1,C=Ret);let B=l.some(Fet);d=[];for(let E=g;C(E,p);E+=m){let y;if(A)y=String.fromCharCode(E),y==="\\"&&(y="");else if(y=String(E),B){let Q=f-y.length;if(Q>0){let b=new Array(Q+1).join("0");E<0?y="-"+b+y.slice(1):y=b+y}}d.push(y)}}else{d=[];for(let g=0;g<l.length;g++)d.push.apply(d,bE(l[g],e,!1))}for(let g=0;g<d.length;g++)for(let p=0;p<o.length&&n.length<e;p++){let f=s+d[g]+o[p];(!r||c||f)&&n.push(f)}}return n}var Fle,kle,mO,Rle,Tle,fet,het,met,Cet,Iet,Eet,Bet,yet,Qet,Det,wet,Ple=L(()=>{h();xle();Fle="\0SLASH"+Math.random()+"\0",kle="\0OPEN"+Math.random()+"\0",mO="\0CLOSE"+Math.random()+"\0",Rle="\0COMMA"+Math.random()+"\0",Tle="\0PERIOD"+Math.random()+"\0",fet=new RegExp(Fle,"g"),het=new RegExp(kle,"g"),met=new RegExp(mO,"g"),Cet=new RegExp(Rle,"g"),Iet=new RegExp(Tle,"g"),Eet=/\\\\/g,Bet=/\\{/g,yet=/\\}/g,Qet=/\\,/g,Det=/\\\./g,wet=1e5});var SE,Lle=L(()=>{h();SE=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var Tet,vE,Net,_le,Ule,Gle=L(()=>{h();Tet={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},vE=t=>t.replace(/[[\]\\-]/g,"\\$&"),Net=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_le=t=>t.join(""),Ule=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;s<t.length;){let f=t.charAt(s);if((f==="!"||f==="^")&&s===r+1){c=!0,s++;continue}if(f==="]"&&o&&!A){u=s+1;break}if(o=!0,f==="\\"&&!A){A=!0,s++;continue}if(f==="["&&!A){for(let[m,[C,I,B]]of Object.entries(Tet))if(t.startsWith(m,s)){if(l)return["$.",!1,t.length-r,!0];s+=m.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(vE(l)+"-"+vE(f)):f===l&&n.push(vE(f)),l="",s++;continue}if(t.startsWith("-]",s+1)){n.push(vE(f+"-")),s+=2;continue}if(t.startsWith("-",s+1)){l=f,s+=2;continue}n.push(vE(f)),s++}if(u<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let f=n[0].length===2?n[0].slice(-1):n[0];return[Net(f),!1,u-r,!1]}let d="["+(c?"^":"")+_le(n)+"]",g="["+(c?"":"^")+_le(i)+"]";return[n.length&&i.length?"("+d+"|"+g+")":n.length?d:g,a,u-r,!0]}});var sl,Xb=L(()=>{h();sl=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")});var Is,Met,CO,Ole,Pet,Let,_et,Kle,Uet,Zb,Get,Oet,Ket,Het,IO,Hle,Jle,Jet,tp,EO=L(()=>{h();Gle();Xb();Met=new Set(["!","?","+","*","@"]),CO=t=>Met.has(t),Ole=t=>CO(t.type),Pet=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Let=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),_et=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Kle=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Uet="(?!(?:^|/)\\.\\.?(?:$|/))",Zb="(?!\\.)",Get=new Set(["[","."]),Oet=new Set(["..","."]),Ket=new Set("().*{}+?[]^$\\!"),Het=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),IO="[^/]",Hle=IO+"*?",Jle=IO+"+?",Jet=0,tp=class{type;#n;#c;#s=!1;#t=[];#o;#i;#e;#a=!1;#B;#m;#P=!1;id=++Jet;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#c=!0),this.#o=r,this.#n=this.#o?this.#o.#n:this,this.#B=this.#n===this?n:this.#n.#B,this.#e=this.#n===this?[]:this.#n.#e,e==="!"&&!this.#n.#a&&this.#e.push(this),this.#i=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#c!==void 0)return this.#c;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#c=!0;return this.#c}toString(){return this.#m!==void 0?this.#m:this.type?this.#m=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#m=this.#t.map(e=>String(e)).join("")}#F(){if(this!==this.#n)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let e;for(;e=this.#e.pop();){if(e.type!=="!")continue;let r=e,n=r.#o;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof Is&&r.#o===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#a&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#o?.isStart())return!1;if(this.#i===0)return!0;let e=this.#o;for(let r=0;r<this.#i;r++){let n=e.#t[r];if(!(n instanceof Is&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#t.length:0;return this.#i===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new Is(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#b(e,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,m="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,m+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),m+=C;continue}else if(C==="["){A=!0,c=f,u=!1,m+=C;continue}if(!i.noext&&CO(C)&&e.charAt(f)==="("&&s<=o){r.push(m),m="";let B=new Is(C,r);f=Is.#b(e,B,f,i,s+1),r.push(B);continue}m+=C}return r.push(m),f}let l=n+1,d=new Is(null,r),g=[],p="";for(;l<e.length;){let f=e.charAt(l++);if(a||f==="\\"){a=!a,p+=f;continue}if(A){l===c+1?(f==="^"||f==="!")&&(u=!0):f==="]"&&!(l===c+2&&u)&&(A=!1),p+=f;continue}else if(f==="["){A=!0,c=l,u=!1,p+=f;continue}if(!i.noext&&CO(f)&&e.charAt(l)==="("&&(s<=o||r&&r.#p(f))){let C=r&&r.#p(f)?0:1;d.push(p),p="";let I=new Is(f,d);d.push(I),l=Is.#b(e,I,l,i,s+C);continue}if(f==="|"){d.push(p),p="",g.push(d),d=new Is(null,r);continue}if(f===")")return p===""&&r.#t.length===0&&(r.#P=!0),d.push(p),p="",r.push(...g,d),l;p+=f}return r.type=null,r.#c=void 0,r.#t=[e.substring(n-1)],l}#S(e){return this.#A(e,Let)}#A(e,r=Pet){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#p(n.type,r)}#p(e,r=_et){return!!r.get(this.type)?.includes(e)}#r(e,r){let n=e.#t[0],i=new Is(null,n,this.options);i.#t.push(""),n.push(i),this.#g(e,r)}#g(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#o=this);this.#m=void 0}#H(e){return!!Kle.get(this.type)?.has(e)}#W(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#H(r.type)}#T(e){let r=Kle.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#o=this);this.type=i,this.#m=void 0,this.#P=!1}static fromGlob(e,r={}){let n=new Is(null,void 0,r);return Is.#b(e,n,0,r,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#c||this.#B.nocase&&!this.#B.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#B.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#B}toRegExpSource(e){let r=e??!!this.#B.dot;if(this.#n===this&&(this.#k(),this.#F()),!Ole(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[p,f,m,C]=typeof g=="string"?Is.#J(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||m,this.#s=this.#s||C,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Oet.has(this.#t[0]))){let p=Get,f=r&&p.has(c.charAt(0))||c.startsWith("\\.")&&p.has(c.charAt(2))||c.startsWith("\\.\\.")&&p.has(c.charAt(4)),m=!r&&!e&&p.has(c.charAt(0));u=f?Uet:m?Zb:""}let l="";return this.isEnd()&&this.#n.#a&&this.#o?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,sl(c),this.#c=!!this.#c,this.#s]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#R(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,sl(this.toString()),!1,!1]}let o=!n||e||r||!Zb?"":this.#R(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#P)a=(this.isStart()&&!r?Zb:"")+Jle;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Zb:"")+Hle+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+A}return[a,sl(s),this.#c=!!this.#c,this.#s]}#k(){if(Ole(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#k(),this.#A(i)?(r=!1,this.#g(i,n)):this.#S(i)?(r=!1,this.#r(i,n)):this.#W(i)&&(r=!1,this.#T(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#k();this.#m=void 0}#R(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#s=this.#s||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#J(e,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,s+=(Ket.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?Jle:Hle,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[u,l,d,g]=Ule(e,A);if(d){s+=u,o=o||l,A+=d-1,r=r||g;continue}}if(c==="?"){s+=IO,r=!0;continue}s+=Het(c)}return[s,sl(e),!!r,o]}};Is=tp});var BO,yO=L(()=>{h();BO=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var li,jet,Yet,qet,$et,Vet,Wet,zet,Xet,Zet,ett,ttt,rtt,ntt,itt,stt,ott,att,Att,qle,$le,Vle,jle,ctt,Ni,utt,ltt,gtt,ptt,dtt,yo,ftt,Wle,htt,mtt,Yle,Ctt,sh,zle=L(()=>{h();Ple();Lle();EO();yO();Xb();EO();yO();Xb();li=(t,e,r={})=>(SE(e),!r.nocomment&&e.charAt(0)==="#"?!1:new sh(e,r).match(t)),jet=/^\*+([^+@!?\*\[\(]*)$/,Yet=t=>e=>!e.startsWith(".")&&e.endsWith(t),qet=t=>e=>e.endsWith(t),$et=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Vet=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Wet=/^\*+\.\*+$/,zet=t=>!t.startsWith(".")&&t.includes("."),Xet=t=>t!=="."&&t!==".."&&t.includes("."),Zet=/^\.\*+$/,ett=t=>t!=="."&&t!==".."&&t.startsWith("."),ttt=/^\*+$/,rtt=t=>t.length!==0&&!t.startsWith("."),ntt=t=>t.length!==0&&t!=="."&&t!=="..",itt=/^\?+([^+@!?\*\[\(]*)?$/,stt=([t,e=""])=>{let r=qle([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},ott=([t,e=""])=>{let r=$le([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},att=([t,e=""])=>{let r=$le([t]);return e?n=>r(n)&&n.endsWith(e):r},Att=([t,e=""])=>{let r=qle([t]);return e?n=>r(n)&&n.endsWith(e):r},qle=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},$le=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},Vle=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jle={win32:{sep:"\\"},posix:{sep:"/"}},ctt=Vle==="win32"?jle.win32.sep:jle.posix.sep;li.sep=ctt;Ni=Symbol("globstar **");li.GLOBSTAR=Ni;utt="[^/]",ltt=utt+"*?",gtt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ptt="(?:(?!(?:\\/|^)\\.).)*?",dtt=(t,e={})=>r=>li(r,t,e);li.filter=dtt;yo=(t,e={})=>Object.assign({},t,e),ftt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return li;let e=li;return Object.assign((n,i,s={})=>e(n,i,yo(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,yo(t,s))}static defaults(i){return e.defaults(yo(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,yo(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,yo(t,s))}},unescape:(n,i={})=>e.unescape(n,yo(t,i)),escape:(n,i={})=>e.escape(n,yo(t,i)),filter:(n,i={})=>e.filter(n,yo(t,i)),defaults:n=>e.defaults(yo(t,n)),makeRe:(n,i={})=>e.makeRe(n,yo(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,yo(t,i)),match:(n,i,s={})=>e.match(n,i,yo(t,s)),sep:e.sep,GLOBSTAR:Ni})};li.defaults=ftt;Wle=(t,e={})=>(SE(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Mle(t,{max:e.braceExpandMax}));li.braceExpand=Wle;htt=(t,e={})=>new sh(t,e).makeRe();li.makeRe=htt;mtt=(t,e,r={})=>{let n=new sh(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};li.match=mtt;Yle=/[?*]|[+@!]\(.*?\)|\[|\]/,Ctt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){SE(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||Vle,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=s[0]===""&&s[1]===""&&(s[2]==="?"||!Yle.test(s[2]))&&!Yle.test(s[3]),c=/^[a-z]:/i.test(s[0]);if(A)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(c)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],A=n[i+2],c=n[i+3];if(a!==".."||!A||A==="."||A===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let A=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...A),n.length===0&&n.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),A=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),l=A?3:a?0:void 0,d=u?3:c?0:void 0;if(typeof l=="number"&&typeof d=="number"){let[g,p]=[e[l],r[d]];g.toLowerCase()===p.toLowerCase()&&(r[d]=g,s=d,i=l)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(Ni)?this.#n(e,r,n,i,s):this.#s(e,r,n,i,s)}#n(e,r,n,i,s){let o=r.indexOf(Ni,s),a=r.lastIndexOf(Ni),[A,c,u]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#s(I,A,n,0,0))return!1;i+=A.length,s+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#s(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#s(e,u,n,I,0)))return!1;l=u.length+1}}if(!c.length){let I=!!l;for(let B=i;B<e.length-l;B++){let E=String(e[B]);if(I=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||I}let d=[[[],0]],g=d[0],p=0,f=[0];for(let I of c)I===Ni?(f.push(p),g=[[],0],d.push(g)):(g[0].push(I),p++);let m=d.length-1,C=e.length-l;for(let I of d)I[1]=C-(f[m--]+I[0].length);return!!this.#c(e,d,i,0,n,0,!!l)}#c(e,r,n,i,s,o,a){let A=r[i];if(!A){for(let l=n;l<e.length;l++){a=!0;let d=e[l];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return a}let[c,u]=A;for(;n<=u;){if(this.#s(e.slice(0,n+c.length),c,s,n,0)&&o<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,s,o+1,a);if(g!==!1)return g}let d=e[n];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;n++}return s||null}#s(e,r,n,i,s){let o,a,A,c;for(o=i,a=s,c=e.length,A=r.length;o<c&&a<A;o++,a++){this.debug("matchOne loop");let u=r[a],l=e[o];if(this.debug(r,u,l),u===!1||u===Ni)return!1;let d;if(typeof u=="string"?(d=l===u,this.debug("string match",u,l,d)):(d=u.test(l),this.debug("pattern match",u,l,d)),!d)return!1}if(o===c&&a===A)return!0;if(o===c)return n;if(a===A)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Wle(this.pattern,this.options)}parse(e){SE(e);let r=this.options;if(e==="**")return Ni;if(e==="")return"";let n,i=null;(n=e.match(ttt))?i=r.dot?ntt:rtt:(n=e.match(jet))?i=(r.nocase?r.dot?Vet:$et:r.dot?qet:Yet)(n[1]):(n=e.match(itt))?i=(r.nocase?r.dot?ott:stt:r.dot?att:Att)(n):(n=e.match(Wet))?i=r.dot?Xet:zet:(n=e.match(Zet))&&(i=ett);let s=tp.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?ltt:r.dot?gtt:ptt,i=new Set(r.nocase?["i"]:[]),s=e.map(A=>{let c=A.map(l=>{if(l instanceof RegExp)for(let d of l.flags.split(""))i.add(d);return typeof l=="string"?Ctt(l):l===Ni?Ni:l._src});c.forEach((l,d)=>{let g=c[d+1],p=c[d-1];l!==Ni||p===Ni||(p===void 0?g!==void 0&&g!==Ni?c[d+1]="(?:\\/|"+n+"\\/)?"+g:c[d]=n:g===void 0?c[d-1]=p+"(?:\\/|\\/"+n+")?":g!==Ni&&(c[d-1]=p+"(?:\\/|\\/"+n+"\\/)"+g,c[d+1]=Ni))});let u=c.filter(l=>l!==Ni);if(this.partial&&u.length>=1){let l=[];for(let d=1;d<=u.length;d++)l.push(u.slice(0,d).join("/"));return"(?:"+l.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<s.length;a++){let A=s[a],c=i;if(n.matchBase&&A.length===1&&(c=[o]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return li.defaults(e).Minimatch}};li.AST=tp;li.Minimatch=sh;li.escape=BO;li.unescape=sl});async function Itt(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${Te}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let s={"Content-Type":"application/json"};t.builderPrivateKey&&(s.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Re(i,{method:"GET",headers:s,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function Ett(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Xle(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function Btt(t,e){let r=new Map;for(let i of t){let s=i.category||"general";r.has(s)||r.set(s,[]),r.get(s).push(i)}if(r.size===0)return;await eS.default.mkdir(e,{recursive:!0});let n=[];for(let[i,s]of r){let o=`${Ett(i)}.md`,a=Zle.default.join(e,o),A=s.filter(g=>g.glob),c=s.filter(g=>!g.glob),u=new Map;for(let g of A){let p=g.glob;u.has(p)||u.set(p,[]),u.get(p).push(g)}let l=[...u.keys()].sort((g,p)=>Xle(g).localeCompare(Xle(p))),d=[];if(d.push(`# ${i}`),d.push(""),l.length>0){d.push("## File-specific"),d.push("");for(let g of l){let p=u.get(g);d.push(`### \`${g}\``),d.push("");for(let f of p)d.push(`- **When**: ${f.when}`),d.push(` ${f.memory}`),d.push("")}}if(c.length>0){d.push("## General"),d.push("");for(let g of c)d.push(`- **When**: ${g.when}`),d.push(` ${g.memory}`),d.push("")}n.push(eS.default.writeFile(a,d.join(`
|
|
1829
|
-
`),"utf-8"))}await Promise.all(n)}function ytt(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let s=t[i];s==="{"?r++:s==="}"&&r>0?r--:s===","&&r===0&&(e.push(t.slice(n,i)),n=i+1)}return e.push(t.slice(n)),e.map(i=>i.trim()).filter(Boolean)}function ege(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?ytt(n.glob).some(s=>{try{return li(r,s.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function tge(t,e,r,n){try{return await Itt(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function tS(t,e,r){try{await eS.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await Btt(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var eS,Zle,QO=L(()=>{"use strict";h();eS=X(require("node:fs/promises"),1),Zle=X(require("node:path"),1);zle();vr();Qr()});function Qtt(){if(xE!==void 0)return xE;try{return xE=require("prettier"),xE}catch{return xE=null,null}}function Qo(t){try{return JSON.stringify(t)}catch{return String(t)}}var ol,wO,rS,nge,sS,nS,ige,xE,rge,Dtt,wtt,btt,Stt,Ia,DO,oh=L(()=>{"use strict";h();Pg();kse();_r();ks();vr();Qr();ol=X(require("node:fs"),1),wO=require("node:crypto");VL();WL();Pse();Use();g0();X1();$C();eoe();rS=X(require("node:os"),1);m_();Di();Qt();Aoe();D0();Boe();Doe();oo();C_();nge=X(require("chokidar"),1);E_();RO();Roe();MO();er();sS=X(require("node:events"),1);eI();nS=require("node:crypto");Fg();Moe();nL();tI();XC();Bu();yle();ua();Qle();ige=require("node:fs/promises");pO();ZC();AI();ac();Sle();QO();sa();Uw();GD();S0();rge=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-user","credits-limit-other","invalid-last-message"],Dtt=["initial-with-url","initial-without-url","success"],wtt=1800*1e3,btt=2147483647,Stt=t=>{let e=Number(process.env.AGENT_TIMEOUT_OVERRIDE_MS),r=Number.isFinite(e)&&e>0?e:t&&Number.isFinite(t)&&t>0?t:wtt;return Math.min(r,btt)},Ia=class t{#n;#c;#s;#t=[];#o;#i;#e;#a;#B;#m;#
|
|
1830
|
-
${UD(e,{skipCommandSecurity:this.#u?.skipCommandSecurity})}`,tag:"reminder:environment-variables"}))}queueSystemReminder(e){let r=e.tag?this.#j.findIndex(n=>n.tag===e.tag):-1;return r!==-1?e.text?(this.#j[r]=e,{operation:"update"}):(this.#j.splice(r,1),{operation:"delete"}):e.text?(this.#j.push(e),{operation:"add"}):{operation:"noop"}}setDefaultAutoPush(e){this.#T=e}async setPrivacyMode(e){if(e&&e.enabled){if(!e.encryptKey&&!this.#Ee)this.#Ee=await wle();else if(e.encryptKey){if(!await Wb(e.encryptKey))throw new Error("Invalid encryption key: key failed validation");this.#Ee=e.encryptKey}}else this.#Ee=void 0;this.#
|
|
1828
|
+
`):void 0})}return r}var Qle=L(()=>{"use strict";h()});var il,Dle=L(()=>{"use strict";h();il=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var Aet,ih,wle,cet,uet,get,Wb,pO=L(()=>{"use strict";h();Dle();Aet=()=>{if(typeof globalThis<"u"&&globalThis.crypto)return globalThis.crypto;if(typeof require<"u")try{let t=require("crypto");if(t.webcrypto)return t.webcrypto}catch{}throw new Error("Web Crypto API is not available. Requires Node.js 15+ or a browser environment.")},ih=Aet(),wle=async()=>{let t=await ih.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await ih.subtle.exportKey("jwk",t);return JSON.stringify(e)},cet=async()=>ih.getRandomValues(new Uint8Array(16)),uet=async(t,e,r)=>{let n=await ih.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},get=async(t,e,r)=>{let n=await ih.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},Wb=async t=>{try{il("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);il("validateEncryptionKey: Parsed JWK");let r=await ih.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);il("validateEncryptionKey: Imported crypto key");let n="test",i=await cet();il("validateEncryptionKey: Generated test IV",i);let s=await uet(r,i,n);il("validateEncryptionKey: Encrypted test data",s);let o=new Uint8Array(s);il("validateEncryptionKey: Encrypted test data array",o);let a=await get(r,i,o);return il("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});function ble(t){return t.length<=dO?t:t.slice(0,dO)+`... [+${t.length-dO} chars]`}var pet,dO,zb,Sle=L(()=>{"use strict";h();_r();vr();Qr();pet=5e3,dO=8e3,zb=class{#n;#c;#s;#t=[];#o;#i=!1;#e=Promise.resolve();constructor(e){this.#n=e.credentials,this.#c=e.replayId,this.#s=e.debug??!1;let r=setInterval(()=>{this.#B()},pet);r.unref?.(),this.#o=r}recordText(e,r=Date.now()){this.#i||this.#a({ts:r,type:"text",content:ble(e)})}recordReasoning(e,r=Date.now()){this.#i||this.#a({ts:r,type:"thinking",content:ble(e)})}recordCheckpoint(e=Date.now(),r="",n){this.#i||this.#a({ts:e,type:"checkpoint",label:r,imageUrl:n})}#a(e){e.type!=="checkpoint"&&!e.content||this.#t.push(e)}async#B(){if(this.#t.length===0)return;let e=this.#t;return this.#t=[],this.#e=this.#e.catch(()=>{}).then(()=>this.#m(e)),this.#e}async#m(e){try{let r=new URL(`${Te}/codegen/replay/${encodeURIComponent(this.#c)}/actions`);this.#n.builderPublicKey&&r.searchParams.set("apiKey",this.#n.builderPublicKey),this.#n.userId&&r.searchParams.set("userId",this.#n.userId);let n={"content-type":"application/json"};this.#n.builderPrivateKey&&(n.authorization=`Bearer ${this.#n.builderPrivateKey}`),await Re(r,{method:"POST",body:JSON.stringify({actions:e}),headers:n,keepalive:!0},this.#s)}catch{}}async flush(){await this.#B(),await this.#e.catch(()=>{})}async close(){this.#i||(this.#i=!0,this.#o&&clearInterval(this.#o),await this.flush())}}});var fO,vle,det,xle=L(()=>{h();fO=(t,e,r)=>{let n=t instanceof RegExp?vle(t,r):t,i=e instanceof RegExp?vle(e,r):e,s=n!==null&&i!=null&&det(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},vle=(t,e)=>{let r=e.match(t);return r?r[0]:null},det=(t,e,r)=>{let n,i,s,o,a,A=r.indexOf(t),c=r.indexOf(e,A+1),u=A;if(A>=0&&c>0){if(t===e)return[A,c];for(n=[],s=r.length;u>=0&&!a;){if(u===A)n.push(u),A=r.indexOf(t,u+1);else if(n.length===1){let l=n.pop();l!==void 0&&(a=[l,c])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&o!==void 0&&(a=[s,o])}return a}});function hO(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function bet(t){return t.replace(Eet,Fle).replace(Bet,kle).replace(yet,mO).replace(Qet,Rle).replace(Det,Tle)}function vet(t){return t.replace(fet,"\\").replace(het,"{").replace(met,"}").replace(Cet,",").replace(Iet,".")}function Nle(t){if(!t)return[""];let e=[],r=fO("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=Nle(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Mle(t,e={}){if(!t)return[];let{max:r=wet}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),bE(bet(t),r,!0).map(vet)}function xet(t){return"{"+t+"}"}function Fet(t){return/^-?0\d/.test(t)}function ket(t,e){return t<=e}function Ret(t,e){return t>=e}function bE(t,e,r){let n=[],i=fO("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?bE(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let A=s+"{"+i.body+"}"+o[a];n.push(A)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),A=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||A,u=i.body.indexOf(",")>=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+mO+i.post,bE(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=Nle(i.body),l.length===1&&l[0]!==void 0&&(l=bE(l[0],e,!1).map(xet),l.length===1))return o.map(g=>i.pre+l[0]+g);let d;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=hO(l[0]),p=hO(l[1]),f=Math.max(l[0].length,l[1].length),m=l.length===3&&l[2]!==void 0?Math.abs(hO(l[2])):1,C=ket;p<g&&(m*=-1,C=Ret);let B=l.some(Fet);d=[];for(let E=g;C(E,p);E+=m){let y;if(A)y=String.fromCharCode(E),y==="\\"&&(y="");else if(y=String(E),B){let Q=f-y.length;if(Q>0){let b=new Array(Q+1).join("0");E<0?y="-"+b+y.slice(1):y=b+y}}d.push(y)}}else{d=[];for(let g=0;g<l.length;g++)d.push.apply(d,bE(l[g],e,!1))}for(let g=0;g<d.length;g++)for(let p=0;p<o.length&&n.length<e;p++){let f=s+d[g]+o[p];(!r||c||f)&&n.push(f)}}return n}var Fle,kle,mO,Rle,Tle,fet,het,met,Cet,Iet,Eet,Bet,yet,Qet,Det,wet,Ple=L(()=>{h();xle();Fle="\0SLASH"+Math.random()+"\0",kle="\0OPEN"+Math.random()+"\0",mO="\0CLOSE"+Math.random()+"\0",Rle="\0COMMA"+Math.random()+"\0",Tle="\0PERIOD"+Math.random()+"\0",fet=new RegExp(Fle,"g"),het=new RegExp(kle,"g"),met=new RegExp(mO,"g"),Cet=new RegExp(Rle,"g"),Iet=new RegExp(Tle,"g"),Eet=/\\\\/g,Bet=/\\{/g,yet=/\\}/g,Qet=/\\,/g,Det=/\\\./g,wet=1e5});var SE,Lle=L(()=>{h();SE=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var Tet,vE,Net,_le,Ule,Gle=L(()=>{h();Tet={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},vE=t=>t.replace(/[[\]\\-]/g,"\\$&"),Net=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_le=t=>t.join(""),Ule=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;s<t.length;){let f=t.charAt(s);if((f==="!"||f==="^")&&s===r+1){c=!0,s++;continue}if(f==="]"&&o&&!A){u=s+1;break}if(o=!0,f==="\\"&&!A){A=!0,s++;continue}if(f==="["&&!A){for(let[m,[C,I,B]]of Object.entries(Tet))if(t.startsWith(m,s)){if(l)return["$.",!1,t.length-r,!0];s+=m.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(vE(l)+"-"+vE(f)):f===l&&n.push(vE(f)),l="",s++;continue}if(t.startsWith("-]",s+1)){n.push(vE(f+"-")),s+=2;continue}if(t.startsWith("-",s+1)){l=f,s+=2;continue}n.push(vE(f)),s++}if(u<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let f=n[0].length===2?n[0].slice(-1):n[0];return[Net(f),!1,u-r,!1]}let d="["+(c?"^":"")+_le(n)+"]",g="["+(c?"":"^")+_le(i)+"]";return[n.length&&i.length?"("+d+"|"+g+")":n.length?d:g,a,u-r,!0]}});var sl,Xb=L(()=>{h();sl=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")});var Is,Met,CO,Ole,Pet,Let,_et,Kle,Uet,Zb,Get,Oet,Ket,Het,IO,Hle,Jle,Jet,tp,EO=L(()=>{h();Gle();Xb();Met=new Set(["!","?","+","*","@"]),CO=t=>Met.has(t),Ole=t=>CO(t.type),Pet=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Let=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),_et=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Kle=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Uet="(?!(?:^|/)\\.\\.?(?:$|/))",Zb="(?!\\.)",Get=new Set(["[","."]),Oet=new Set(["..","."]),Ket=new Set("().*{}+?[]^$\\!"),Het=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),IO="[^/]",Hle=IO+"*?",Jle=IO+"+?",Jet=0,tp=class{type;#n;#c;#s=!1;#t=[];#o;#i;#e;#a=!1;#B;#m;#M=!1;id=++Jet;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#c=!0),this.#o=r,this.#n=this.#o?this.#o.#n:this,this.#B=this.#n===this?n:this.#n.#B,this.#e=this.#n===this?[]:this.#n.#e,e==="!"&&!this.#n.#a&&this.#e.push(this),this.#i=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#c!==void 0)return this.#c;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#c=!0;return this.#c}toString(){return this.#m!==void 0?this.#m:this.type?this.#m=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#m=this.#t.map(e=>String(e)).join("")}#F(){if(this!==this.#n)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let e;for(;e=this.#e.pop();){if(e.type!=="!")continue;let r=e,n=r.#o;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof Is&&r.#o===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#a&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#o?.isStart())return!1;if(this.#i===0)return!0;let e=this.#o;for(let r=0;r<this.#i;r++){let n=e.#t[r];if(!(n instanceof Is&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#t.length:0;return this.#i===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new Is(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#b(e,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,m="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,m+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),m+=C;continue}else if(C==="["){A=!0,c=f,u=!1,m+=C;continue}if(!i.noext&&CO(C)&&e.charAt(f)==="("&&s<=o){r.push(m),m="";let B=new Is(C,r);f=Is.#b(e,B,f,i,s+1),r.push(B);continue}m+=C}return r.push(m),f}let l=n+1,d=new Is(null,r),g=[],p="";for(;l<e.length;){let f=e.charAt(l++);if(a||f==="\\"){a=!a,p+=f;continue}if(A){l===c+1?(f==="^"||f==="!")&&(u=!0):f==="]"&&!(l===c+2&&u)&&(A=!1),p+=f;continue}else if(f==="["){A=!0,c=l,u=!1,p+=f;continue}if(!i.noext&&CO(f)&&e.charAt(l)==="("&&(s<=o||r&&r.#p(f))){let C=r&&r.#p(f)?0:1;d.push(p),p="";let I=new Is(f,d);d.push(I),l=Is.#b(e,I,l,i,s+C);continue}if(f==="|"){d.push(p),p="",g.push(d),d=new Is(null,r);continue}if(f===")")return p===""&&r.#t.length===0&&(r.#M=!0),d.push(p),p="",r.push(...g,d),l;p+=f}return r.type=null,r.#c=void 0,r.#t=[e.substring(n-1)],l}#S(e){return this.#A(e,Let)}#A(e,r=Pet){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#p(n.type,r)}#p(e,r=_et){return!!r.get(this.type)?.includes(e)}#r(e,r){let n=e.#t[0],i=new Is(null,n,this.options);i.#t.push(""),n.push(i),this.#g(e,r)}#g(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#o=this);this.#m=void 0}#H(e){return!!Kle.get(this.type)?.has(e)}#W(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#H(r.type)}#T(e){let r=Kle.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#o=this);this.type=i,this.#m=void 0,this.#M=!1}static fromGlob(e,r={}){let n=new Is(null,void 0,r);return Is.#b(e,n,0,r,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#c||this.#B.nocase&&!this.#B.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#B.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#B}toRegExpSource(e){let r=e??!!this.#B.dot;if(this.#n===this&&(this.#k(),this.#F()),!Ole(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[p,f,m,C]=typeof g=="string"?Is.#J(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||m,this.#s=this.#s||C,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Oet.has(this.#t[0]))){let p=Get,f=r&&p.has(c.charAt(0))||c.startsWith("\\.")&&p.has(c.charAt(2))||c.startsWith("\\.\\.")&&p.has(c.charAt(4)),m=!r&&!e&&p.has(c.charAt(0));u=f?Uet:m?Zb:""}let l="";return this.isEnd()&&this.#n.#a&&this.#o?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,sl(c),this.#c=!!this.#c,this.#s]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#R(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,sl(this.toString()),!1,!1]}let o=!n||e||r||!Zb?"":this.#R(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#M)a=(this.isStart()&&!r?Zb:"")+Jle;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Zb:"")+Hle+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+A}return[a,sl(s),this.#c=!!this.#c,this.#s]}#k(){if(Ole(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#k(),this.#A(i)?(r=!1,this.#g(i,n)):this.#S(i)?(r=!1,this.#r(i,n)):this.#W(i)&&(r=!1,this.#T(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#k();this.#m=void 0}#R(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#s=this.#s||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#J(e,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,s+=(Ket.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?Jle:Hle,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[u,l,d,g]=Ule(e,A);if(d){s+=u,o=o||l,A+=d-1,r=r||g;continue}}if(c==="?"){s+=IO,r=!0;continue}s+=Het(c)}return[s,sl(e),!!r,o]}};Is=tp});var BO,yO=L(()=>{h();BO=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var li,jet,Yet,qet,$et,Vet,Wet,zet,Xet,Zet,ett,ttt,rtt,ntt,itt,stt,ott,att,Att,qle,$le,Vle,jle,ctt,Ni,utt,ltt,gtt,ptt,dtt,yo,ftt,Wle,htt,mtt,Yle,Ctt,sh,zle=L(()=>{h();Ple();Lle();EO();yO();Xb();EO();yO();Xb();li=(t,e,r={})=>(SE(e),!r.nocomment&&e.charAt(0)==="#"?!1:new sh(e,r).match(t)),jet=/^\*+([^+@!?\*\[\(]*)$/,Yet=t=>e=>!e.startsWith(".")&&e.endsWith(t),qet=t=>e=>e.endsWith(t),$et=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Vet=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Wet=/^\*+\.\*+$/,zet=t=>!t.startsWith(".")&&t.includes("."),Xet=t=>t!=="."&&t!==".."&&t.includes("."),Zet=/^\.\*+$/,ett=t=>t!=="."&&t!==".."&&t.startsWith("."),ttt=/^\*+$/,rtt=t=>t.length!==0&&!t.startsWith("."),ntt=t=>t.length!==0&&t!=="."&&t!=="..",itt=/^\?+([^+@!?\*\[\(]*)?$/,stt=([t,e=""])=>{let r=qle([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},ott=([t,e=""])=>{let r=$le([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},att=([t,e=""])=>{let r=$le([t]);return e?n=>r(n)&&n.endsWith(e):r},Att=([t,e=""])=>{let r=qle([t]);return e?n=>r(n)&&n.endsWith(e):r},qle=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},$le=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},Vle=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jle={win32:{sep:"\\"},posix:{sep:"/"}},ctt=Vle==="win32"?jle.win32.sep:jle.posix.sep;li.sep=ctt;Ni=Symbol("globstar **");li.GLOBSTAR=Ni;utt="[^/]",ltt=utt+"*?",gtt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ptt="(?:(?!(?:\\/|^)\\.).)*?",dtt=(t,e={})=>r=>li(r,t,e);li.filter=dtt;yo=(t,e={})=>Object.assign({},t,e),ftt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return li;let e=li;return Object.assign((n,i,s={})=>e(n,i,yo(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,yo(t,s))}static defaults(i){return e.defaults(yo(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,yo(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,yo(t,s))}},unescape:(n,i={})=>e.unescape(n,yo(t,i)),escape:(n,i={})=>e.escape(n,yo(t,i)),filter:(n,i={})=>e.filter(n,yo(t,i)),defaults:n=>e.defaults(yo(t,n)),makeRe:(n,i={})=>e.makeRe(n,yo(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,yo(t,i)),match:(n,i,s={})=>e.match(n,i,yo(t,s)),sep:e.sep,GLOBSTAR:Ni})};li.defaults=ftt;Wle=(t,e={})=>(SE(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Mle(t,{max:e.braceExpandMax}));li.braceExpand=Wle;htt=(t,e={})=>new sh(t,e).makeRe();li.makeRe=htt;mtt=(t,e,r={})=>{let n=new sh(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};li.match=mtt;Yle=/[?*]|[+@!]\(.*?\)|\[|\]/,Ctt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){SE(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||Vle,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=s[0]===""&&s[1]===""&&(s[2]==="?"||!Yle.test(s[2]))&&!Yle.test(s[3]),c=/^[a-z]:/i.test(s[0]);if(A)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(c)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],A=n[i+2],c=n[i+3];if(a!==".."||!A||A==="."||A===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let A=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...A),n.length===0&&n.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),A=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),l=A?3:a?0:void 0,d=u?3:c?0:void 0;if(typeof l=="number"&&typeof d=="number"){let[g,p]=[e[l],r[d]];g.toLowerCase()===p.toLowerCase()&&(r[d]=g,s=d,i=l)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(Ni)?this.#n(e,r,n,i,s):this.#s(e,r,n,i,s)}#n(e,r,n,i,s){let o=r.indexOf(Ni,s),a=r.lastIndexOf(Ni),[A,c,u]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#s(I,A,n,0,0))return!1;i+=A.length,s+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#s(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#s(e,u,n,I,0)))return!1;l=u.length+1}}if(!c.length){let I=!!l;for(let B=i;B<e.length-l;B++){let E=String(e[B]);if(I=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||I}let d=[[[],0]],g=d[0],p=0,f=[0];for(let I of c)I===Ni?(f.push(p),g=[[],0],d.push(g)):(g[0].push(I),p++);let m=d.length-1,C=e.length-l;for(let I of d)I[1]=C-(f[m--]+I[0].length);return!!this.#c(e,d,i,0,n,0,!!l)}#c(e,r,n,i,s,o,a){let A=r[i];if(!A){for(let l=n;l<e.length;l++){a=!0;let d=e[l];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return a}let[c,u]=A;for(;n<=u;){if(this.#s(e.slice(0,n+c.length),c,s,n,0)&&o<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,s,o+1,a);if(g!==!1)return g}let d=e[n];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;n++}return s||null}#s(e,r,n,i,s){let o,a,A,c;for(o=i,a=s,c=e.length,A=r.length;o<c&&a<A;o++,a++){this.debug("matchOne loop");let u=r[a],l=e[o];if(this.debug(r,u,l),u===!1||u===Ni)return!1;let d;if(typeof u=="string"?(d=l===u,this.debug("string match",u,l,d)):(d=u.test(l),this.debug("pattern match",u,l,d)),!d)return!1}if(o===c&&a===A)return!0;if(o===c)return n;if(a===A)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Wle(this.pattern,this.options)}parse(e){SE(e);let r=this.options;if(e==="**")return Ni;if(e==="")return"";let n,i=null;(n=e.match(ttt))?i=r.dot?ntt:rtt:(n=e.match(jet))?i=(r.nocase?r.dot?Vet:$et:r.dot?qet:Yet)(n[1]):(n=e.match(itt))?i=(r.nocase?r.dot?ott:stt:r.dot?att:Att)(n):(n=e.match(Wet))?i=r.dot?Xet:zet:(n=e.match(Zet))&&(i=ett);let s=tp.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?ltt:r.dot?gtt:ptt,i=new Set(r.nocase?["i"]:[]),s=e.map(A=>{let c=A.map(l=>{if(l instanceof RegExp)for(let d of l.flags.split(""))i.add(d);return typeof l=="string"?Ctt(l):l===Ni?Ni:l._src});c.forEach((l,d)=>{let g=c[d+1],p=c[d-1];l!==Ni||p===Ni||(p===void 0?g!==void 0&&g!==Ni?c[d+1]="(?:\\/|"+n+"\\/)?"+g:c[d]=n:g===void 0?c[d-1]=p+"(?:\\/|\\/"+n+")?":g!==Ni&&(c[d-1]=p+"(?:\\/|\\/"+n+"\\/)"+g,c[d+1]=Ni))});let u=c.filter(l=>l!==Ni);if(this.partial&&u.length>=1){let l=[];for(let d=1;d<=u.length;d++)l.push(u.slice(0,d).join("/"));return"(?:"+l.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<s.length;a++){let A=s[a],c=i;if(n.matchBase&&A.length===1&&(c=[o]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return li.defaults(e).Minimatch}};li.AST=tp;li.Minimatch=sh;li.escape=BO;li.unescape=sl});async function Itt(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${Te}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let s={"Content-Type":"application/json"};t.builderPrivateKey&&(s.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Re(i,{method:"GET",headers:s,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function Ett(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Xle(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function Btt(t,e){let r=new Map;for(let i of t){let s=i.category||"general";r.has(s)||r.set(s,[]),r.get(s).push(i)}if(r.size===0)return;await eS.default.mkdir(e,{recursive:!0});let n=[];for(let[i,s]of r){let o=`${Ett(i)}.md`,a=Zle.default.join(e,o),A=s.filter(g=>g.glob),c=s.filter(g=>!g.glob),u=new Map;for(let g of A){let p=g.glob;u.has(p)||u.set(p,[]),u.get(p).push(g)}let l=[...u.keys()].sort((g,p)=>Xle(g).localeCompare(Xle(p))),d=[];if(d.push(`# ${i}`),d.push(""),l.length>0){d.push("## File-specific"),d.push("");for(let g of l){let p=u.get(g);d.push(`### \`${g}\``),d.push("");for(let f of p)d.push(`- **When**: ${f.when}`),d.push(` ${f.memory}`),d.push("")}}if(c.length>0){d.push("## General"),d.push("");for(let g of c)d.push(`- **When**: ${g.when}`),d.push(` ${g.memory}`),d.push("")}n.push(eS.default.writeFile(a,d.join(`
|
|
1829
|
+
`),"utf-8"))}await Promise.all(n)}function ytt(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let s=t[i];s==="{"?r++:s==="}"&&r>0?r--:s===","&&r===0&&(e.push(t.slice(n,i)),n=i+1)}return e.push(t.slice(n)),e.map(i=>i.trim()).filter(Boolean)}function ege(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?ytt(n.glob).some(s=>{try{return li(r,s.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function tge(t,e,r,n){try{return await Itt(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function tS(t,e,r){try{await eS.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await Btt(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var eS,Zle,QO=L(()=>{"use strict";h();eS=X(require("node:fs/promises"),1),Zle=X(require("node:path"),1);zle();vr();Qr()});function Qtt(){if(xE!==void 0)return xE;try{return xE=require("prettier"),xE}catch{return xE=null,null}}function Qo(t){try{return JSON.stringify(t)}catch{return String(t)}}var ol,wO,rS,nge,sS,nS,ige,xE,rge,Dtt,wtt,btt,Stt,Ia,DO,oh=L(()=>{"use strict";h();Pg();kse();_r();ks();vr();Qr();ol=X(require("node:fs"),1),wO=require("node:crypto");VL();WL();Pse();Use();g0();X1();$C();eoe();rS=X(require("node:os"),1);m_();Di();Qt();Aoe();D0();Boe();Doe();oo();C_();nge=X(require("chokidar"),1);E_();RO();Roe();MO();er();sS=X(require("node:events"),1);eI();nS=require("node:crypto");Fg();Moe();nL();tI();XC();Bu();yle();ua();Qle();ige=require("node:fs/promises");pO();ZC();AI();ac();Sle();QO();sa();Uw();GD();S0();rge=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-user","credits-limit-other","invalid-last-message"],Dtt=["initial-with-url","initial-without-url","success"],wtt=1800*1e3,btt=2147483647,Stt=t=>{let e=Number(process.env.AGENT_TIMEOUT_OVERRIDE_MS),r=Number.isFinite(e)&&e>0?e:t&&Number.isFinite(t)&&t>0?t:wtt;return Math.min(r,btt)},Ia=class t{#n;#c;#s;#t=[];#o;#i;#e;#a;#B;#m;#M;#F;#b;#S;#A=!!(process.env.DEBUG||process.env.FUSION_DEBUG==="true");#p=!1;#r=ve("Agent",{debug:()=>this.#A});#g=new sS.default;#H=new Map;#W=new Set;#T;#k;#R;#J=[];#tt=void 0;#yt="";#ee;#Qt=Promise.resolve(void 0);#z=[];#P;#j=[];#rt=!1;#Ee;#te=new Map;#Me=[];#ie;#Yt=0;#se;#X;#h;#I;#Dt;#nt;#it;#Pe=!1;#Be;#ye=void 0;#st;#Le;#_e;#oe;#d;#f=[];#v;#wt;#C;#ot;#Qe;#De=0;#ae;#D;#bt=[];#St=new Set;#u;#E;#y;#Ue;#Y;#Ae;#at;#Ge=!1;#vt=0;#ce=null;#ue=0;#re=!1;#Oe;#Ke;#L;#He;#xt;#Ft;#le=[];#Je=[];#At=!1;#ge=new Map;#je=new Map;#we={};#O={};#kt=!1;#Ye;#Rt;#ct=!1;#qt=new Set;#be;#N={};#ut;#qe=[];#$e=0;#pe=null;#Tt=void 0;#w=new Map;#Q={watcher:null,listeners:new Set,debounceMs:300,pendingEvents:[]};#Nt=!1;#l=null;#Ve=new Set;#We=new Map;#Se=new Map;#ve=new Map;#xe=new Map;static#ze=3e4;#Fe=null;#de=[];get primaryGitPath(){return this.#f[0]?.path||this.#d}#ke(e){if(!e)return this.primaryGitPath;let r=this.#f.find(n=>n.folderName===e);if(!r)throw new Error(`Folder "${e}" not found in git-enabled folders`);return r.path}#Mt(e,r){if(typeof e!="string")throw new TypeError(`#parsePathWithFolder: 'path' must be a string, received ${typeof e}: ${Qo(e)}`);if(r)return{repoPath:this.#ke(r),relativePath:e};for(let n of this.#f){let i=`${n.folderName}/`;if(e.startsWith(i))return{repoPath:n.path,relativePath:e.slice(i.length)}}return{repoPath:this.primaryGitPath,relativePath:e}}constructor(e){if(this.#e=e.sys,this.#Y=e.modelOverride,this.#Ae=e.agentModelOverrides,this.#a=e.credentials,"initialUrl"in e){let n=pge(e.initialUrl).id;n?this.#X=n:this.#B=e.initialUrl}typeof e.autoImportLocalMCPs=="boolean"&&(this.#Nt=e.autoImportLocalMCPs),"sessionOrCompletionId"in e?this.#X=e.sessionOrCompletionId:this.#X=e.fusionConfig?.sessionId;let r=e.workingDirectory??e.fusionConfig?.workingDirectory;if(this.#d=r?e.sys.resolve(e.sys.cwd(),r):e.sys.getCwdDir(),this.#M=e.skipFileDiff??!0,this.#m=e.position,this.#P=e.privacyMode??e.fusionConfig?.privacyMode,this.#h=e.devServerOrchestrator,this.#I=e.git??!1,this.#b=e.softContextWindow,this.#I&&(process.env.GIT_CEILING_DIRECTORIES=this.#d),this.#Dt=e.gitAutoInit??!1,this.#u=e.fusionConfig,this.#At=e.asyncSubAgents??!1,this.#o=q1(e.queueMode),this.#T=e.fusionConfig?.autoPush,this.#E=e.fusionConfig?.projectId,this.#y=e.fusionConfig?.branchName,this.#k=e.fusionConfig?.featureBranch,this.#R=e.fusionConfig?.aiBranch,this.#Oe=e.fusionConfig?.proxyOrigin,this.#Ke=e.fusionConfig?.proxyDefaultOrigin,this.#nt=e.fusionStatusMonitor,process.env.FUSION_ENV_ORIGIN&&(this.#xt=process.env.FUSION_ENV_ORIGIN),this.#L=e.agentType,this.#He=e.defaultSyncChanges,this.#kt=e.persistSessionLocally??!1,this.#Ye=e.parentSessionId,this.#Rt=e.mainSessionId,e.enabledTools)this.#D=DO(this.#u,e.enabledTools);else{let n=["Write","Edit","Read","MultiEdit","Grep","Glob","Skill","TaskCreate","TaskUpdate","TaskList","Agent","Media","WebFetch","AskUserQuestion","ExitPlanMode","EnterPlanMode",process.platform==="win32"?"PowerShell":"Bash"],i=!!(this.#P?.enabled||this.#P?.redactUserMessages||this.#P?.redactLLMMessages);i||n.push("WebSearch"),this.#E&&!i&&this.getCommitMode()!=="commits"&&n.push("SearchMemories"),i||n.push("GetScreenshot"),n.push("NavigatePreview"),this.#h&&(n.push("DevServerLogs"),n.push("DevServerRestart"),n.push("ProposeEnvVariable")),process.env.FUSION_IDE_PORT&&n.push("IDEDiagnostics"),n.push("PullPrototype"),this.#D=DO(this.#u,n)}if(this.#wt=e.maxTokens,this.#at=e.reasoning,this.#st=e.builtInCustomInstructions??[],this.#Le=e.builtInCustomAgents??[],this.#_e=e.builtInMCPServerConfig??{},this.#oe=e.systemPromptOverride,this.#C=e.fusionConfig?.workspace,this.#ot=e.mcpServers??!1,this.#v=this.#d,this.#f=[],this.#C?.folders.length){let n=this.#C.folders.filter(i=>i.enableGit);this.#f=n.map(i=>({folderName:i.name??i.path,path:this.#e.resolve(this.#d,i.path),branchName:i.branchName||"main",repoUrl:i.repoUrl,originalRepoUrl:i.originalRepoUrl,repoName:i.repoName}));for(let i of n){let s=i.backupMetadata?.check.backup,o=i.name??i.path,a=fI({version:s?.version,originalRepoUrl:s?.repoUrl,commitHash:s?.lastCommitHash});a&&(this.#we[o]=a)}}this.#f.length===0&&(this.#f=[{folderName:this.#e.basename(this.#d),path:this.#d,branchName:"main"}]),this.#be=Qge(this.#C),this.#C?.folders[0]&&this.#G()&&(this.#v=this.#e.resolve(this.#d,this.#C.folders[0].path)),this.#g.on("idle",()=>{let n=this.#$e;if(this.#$e=0,this.#E==null&&this.#y==null||this.#Ye)return;this.clearSessionCanHandleTools(),this.#r.debug("emitting ClientDevtoolsSessionIdleEventV1",{projectId:this.#E,branchName:this.#y});let i=this.#fe;QA(this.#a,"/events/publish",{event:$re,extraData:{sessionId:this.getSessionId(),lastMessage:this.getLastMessage(),projectId:this.#E,branchName:this.#y,hasPlanToApply:i,sessionMode:this.getSessionMode(),gifId:this.#O.gif_id,planContent:this.#$t,completionId:this.getLastCompletionId(),credits:n},extraAttributes:{projectId:this.#E,branchName:this.#y}},{debug:this.#A})})}get fusionConfig(){return this.#u}get gitEnabledFolder(){return this.#C?.folders.find(e=>e.enableGit)}get gitEnabledFolders(){return this.#C?.folders.filter(e=>e.enableGit)||[]}get gitRepoContexts(){return this.#f}get workingDirectory(){return this.#d}get bashWorkingDirectory(){return this.#v}getSessionMode(){return this.#n?.sessionMode??"normal"}get#$t(){let e=this.getSessionContext();for(let r=e.turns.length-1;r>=0;r--){let n=e.turns[r];if(n.state==="done"){if(n.user.role==="user")return;for(let i of n.actions??[])if(i.type==="tool"&&i.filePath==="ExitPlanMode")try{let s=JSON.parse(i.content);if(typeof s.plan=="string")return s.plan}catch{}}}}get#fe(){let e=this.getSessionContext();if(e.sessionMode!=="planning")return!1;for(let r=e.turns.length-1;r>=0;r--){let n=e.turns[r];if(n.state==="done"){if(n.user.role==="user")return!1;for(let i of n.actions??[])if(i.type==="tool"&&i.filePath==="ExitPlanMode")try{let s=JSON.parse(i.content);if(s.hasPlanToApply||s.sessionMode==="planning")return!0}catch{}}}return!1}async switchSessionMode(e){let r=this.getSessionContext();r.sessionMode!==e&&(r.sessionMode=e,await this.#Ie())}async switchModelOverride(e){this.#Y=e||void 0,await this.#Ie()}#Vt(){if(!this.#L||!this.#Ae)return;let e=this.#Ae[this.#L];if(e){if(typeof e=="string")return _u(e);if(Array.isArray(e)&&e.length){let r=this.#ge.get(this.#L)??0;return this.#ge.set(this.#L,r+1),_u(e[r%e.length])}}}removeSystemReminder(e){let r=this.#j.findIndex(n=>n.tag===e);r!==-1&&this.#j.splice(r,1)}getMemoriesForFile(e){let r=ege(this.#bt,e).filter(n=>!this.#St.has(n.id));for(let n of r)this.#St.add(n.id);return r}#lt(){return Ige(this.#u?.environmentVariables??[],this.#h?.environmentVariables??[])}#Wt(){if(this.#rt)return;let e=this.#lt();e.length!==0&&(this.#rt=!0,this.queueSystemReminder({text:`The system has the following environment variables:
|
|
1830
|
+
${UD(e,{skipCommandSecurity:this.#u?.skipCommandSecurity})}`,tag:"reminder:environment-variables"}))}queueSystemReminder(e){let r=e.tag?this.#j.findIndex(n=>n.tag===e.tag):-1;return r!==-1?e.text?(this.#j[r]=e,{operation:"update"}):(this.#j.splice(r,1),{operation:"delete"}):e.text?(this.#j.push(e),{operation:"add"}):{operation:"noop"}}setDefaultAutoPush(e){this.#T=e}async setPrivacyMode(e){if(e&&e.enabled){if(!e.encryptKey&&!this.#Ee)this.#Ee=await wle();else if(e.encryptKey){if(!await Wb(e.encryptKey))throw new Error("Invalid encryption key: key failed validation");this.#Ee=e.encryptKey}}else this.#Ee=void 0;this.#P=e}async initializeSession(e={}){return this.#it||(this.#it=this.#Zt(e)),await this.#it}async loadHistory(){let e=this.getSessionContext(),r=await iS(this.#e,this.#a,e.sessionId,!1,this.#A),n=new Map,i=new Map;for(let a of r.turns)for(let A of[a.beforeCommit,a.afterCommit,a.lastCommit]){if(!A)continue;let c=If(A,this.gitRepoContexts[0]?.folderName);n.set(A,c);for(let[u,l]of Object.entries(c))i.has(u)||i.set(u,new Set),i.get(u).add(l)}let s=new Map;for(let[a,A]of i.entries()){let c=this.gitRepoContexts.find(l=>l.folderName===a);if(!c||A.size===0)continue;let u=new Set;try{let d=(await this.git(["cat-file","--batch-check","--buffer"],{sys:this.#e,cwd:c.path,stdin:Array.from(A).map(p=>`${p}^{commit}`).join(`
|
|
1831
1831
|
`)})).trim().split(`
|
|
1832
|
-
`),g=new Set;for(let p of d)if(p.includes("missing")){let f=p.split(/\s+/)[0].replace("^{commit}","");g.add(f)}for(let p of A)g.has(p)||u.add(p)}catch(l){this.#e.Sentry?.captureException(l)}s.set(a,u)}let o=r.turns.filter(a=>{for(let A of[a.beforeCommit,a.afterCommit,a.lastCommit]){if(!A)continue;let c=n.get(A);if(c)for(let[u,l]of Object.entries(c)){if(!this.gitRepoContexts.find(p=>p.folderName===u))continue;let g=s.get(u);if(!g||!g.has(l))return!1}}return!0});return{sessionId:e.sessionId,title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:o}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let s=await this.loadMoreTurns();i+=s.length}return{sessionId:n.sessionId,title:n.title,beforeCommit:n.beforeCommit,createdUnixTime:n.createdUnixTime,updatedUnixTime:n.updatedUnixTime,addedTurns:i,turns:r?n.turns:n.turns.slice(0,i)}}async loadMoreTurns(){return this.#Be||(this.#Be=this.#zt().then(e=>(this.#Be=void 0,e))),this.#Be}async#zt(){let e=this.getSessionContext();if(e.canLoadMore){let r=e.turns[0]?.completionId,n=await iS(this.#e,this.#a,e.sessionId,!0,this.#A,r);return n.turns.length>0&&e.turns.unshift(...n.turns),e.canLoadMore=n.canLoadMore,n.turns}return[]}async#Xt(){try{let e=Qtt();if(!e)return null;let r=this.#e.join(this.primaryGitPath,"file.tsx");return await e.resolveConfig(r)}catch{return null}}async setCustomInstructions(e){this.#st=e,this.#n&&(this.#n.customInstructions=await this.#Re())}async setCustomAgents(e){this.#Le=e,this.#n&&(this.#n.customAgents=await this.#Xe())}async#Re(){let e=await NO({sys:this.#e,projectDir:this.#d,currentDir:this.#f.map(n=>n.path),rootDir:"/",allowedCommands:Pw(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}),r=FE(this.#st,this.#u?.customInstructions??[]);return FE(r,e)}async#Xe(){if(!this.#D?.includes("Agent"))return[];let e=await koe({sys:this.#e,projectDir:this.#d,currentDir:this.#f.map(n=>n.path),rootDir:"/"}),r=FE(this.#Le,this.#u?.customAgents??[]);return FE(r,e)}async#Zt(e){try{if(this.#Ge)throw new Error("Code session already closed");if(this.#n)throw new Error("Session context already initialized");this.#r.debug(`Current AI working directory: ${this.#d}`),await this.setPrivacyMode(this.#
|
|
1832
|
+
`),g=new Set;for(let p of d)if(p.includes("missing")){let f=p.split(/\s+/)[0].replace("^{commit}","");g.add(f)}for(let p of A)g.has(p)||u.add(p)}catch(l){this.#e.Sentry?.captureException(l)}s.set(a,u)}let o=r.turns.filter(a=>{for(let A of[a.beforeCommit,a.afterCommit,a.lastCommit]){if(!A)continue;let c=n.get(A);if(c)for(let[u,l]of Object.entries(c)){if(!this.gitRepoContexts.find(p=>p.folderName===u))continue;let g=s.get(u);if(!g||!g.has(l))return!1}}return!0});return{sessionId:e.sessionId,title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:o}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let s=await this.loadMoreTurns();i+=s.length}return{sessionId:n.sessionId,title:n.title,beforeCommit:n.beforeCommit,createdUnixTime:n.createdUnixTime,updatedUnixTime:n.updatedUnixTime,addedTurns:i,turns:r?n.turns:n.turns.slice(0,i)}}async loadMoreTurns(){return this.#Be||(this.#Be=this.#zt().then(e=>(this.#Be=void 0,e))),this.#Be}async#zt(){let e=this.getSessionContext();if(e.canLoadMore){let r=e.turns[0]?.completionId,n=await iS(this.#e,this.#a,e.sessionId,!0,this.#A,r);return n.turns.length>0&&e.turns.unshift(...n.turns),e.canLoadMore=n.canLoadMore,n.turns}return[]}async#Xt(){try{let e=Qtt();if(!e)return null;let r=this.#e.join(this.primaryGitPath,"file.tsx");return await e.resolveConfig(r)}catch{return null}}async setCustomInstructions(e){this.#st=e,this.#n&&(this.#n.customInstructions=await this.#Re())}async setCustomAgents(e){this.#Le=e,this.#n&&(this.#n.customAgents=await this.#Xe())}async#Re(){let e=await NO({sys:this.#e,projectDir:this.#d,currentDir:this.#f.map(n=>n.path),rootDir:"/",allowedCommands:Pw(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}),r=FE(this.#st,this.#u?.customInstructions??[]);return FE(r,e)}async#Xe(){if(!this.#D?.includes("Agent"))return[];let e=await koe({sys:this.#e,projectDir:this.#d,currentDir:this.#f.map(n=>n.path),rootDir:"/"}),r=FE(this.#Le,this.#u?.customAgents??[]);return FE(r,e)}async#Zt(e){try{if(this.#Ge)throw new Error("Code session already closed");if(this.#n)throw new Error("Session context already initialized");this.#r.debug(`Current AI working directory: ${this.#d}`),await this.setPrivacyMode(this.#P);let r=await this.#tr(),n=await this.#Xt();r&&(this.#N=await this.#K());let i=this.#f[0]?.repoUrl;if(this.#Ue=await E0(i),!this.#Ue)try{let c=await this.git(["remote","get-url","origin"],{cwd:this.#d});c&&(this.#Ue=await E0(c))}catch{}let s,o;this.#X||(this.#X=r?.sessionId),this.#X?e.skipSessionLoading?s=this.#X:(o=await iS(this.#e,this.#a,this.#X,!0,this.#A,void 0,e.signal),s=o.sessionId,this.#r.debug(`Session recovered (sessionId=${s}, turnsCount=${o.turns.length})`)):s=(0,nS.randomUUID)(),this.#k||(this.#k=r?.featureBranch?.trim());let a={turns:o?.turns??[],sessionId:s,customInstructions:await this.#Re(),customAgents:await this.#Xe(),title:o?.title,beforeCommit:o?.beforeCommit,createdUnixTime:o?.createdUnixTime??Date.now(),updatedUnixTime:o?.updatedUnixTime??Date.now(),userContext:await dge(this.#e,this.primaryGitPath),prettierConfig:n,canLoadMore:o?.canLoadMore??!1,state:o?.turns.length?"success":this.#B?"initial-with-url":"initial-without-url",sessionMode:o?.sessionMode??"normal"};if(this.#O=o?.metadata??{},o){let c=yA(o.turns);c?.completionId!==o.lastCompletionId&&this.#e.Sentry?.captureException(new Error("Last completion id mismatch"),{tags:{operation:"codegen-initialize-session"},extra:{lastTurn:c,sessionMetadata:o}})}if(this.#A&&this.#g.on("step",c=>{c.type!=="delta"&&this.#r.debug(`(${c.type}): ${of(JSON.stringify(c),400)}`)}),await this.#nr(a),this.#n=a,this.#L){let c=await this.getNamedAgentConfig(this.#L,this.getSessionId(),e.signal);if(c.success){if(this.#F=c.options.includeMemories,this.#D=c.options.enabledTools,this.#Y=c.options.modelOverride,this.#oe=c.options.systemPromptOverride,this.#m=c.options.position,this.#o=q1(c.options.queueMode),this.#At=c.options.asyncSubAgents??!1,this.#b=c.options.softContextWindow,this.#He=c.options.defaultSyncChanges,this.#_e={...this.#_e,...c.options.builtInMCPServerConfig},c.options.builtInMCPServerConfig?.chrome&&!this.#Ze){let u=new pI(this.getSessionId(),{framesDir:this.#e.join(rS.default.homedir(),".builder","recordings"),debug:this.#A});this.setTimeline(u)}typeof c.options.mcpServers=="boolean"&&(this.#ot=c.options.mcpServers)}else this.#r.error(c.response)}try{let c=await Ble(this.#e,this.primaryGitPath,this.#_e,this.#Nt,e.signal);c.length>0?(this.#r.debug(`Initializing ${c.length} local MCP server(s)...`),this.#Qe=await Ele(c,this.#e,this.primaryGitPath,e.signal)):this.#r.debug(`No local MCP servers found in: ${this.primaryGitPath}`)}catch(c){this.#r.error("Failed to initialize local MCP servers:",c,{loggerOptions:{debug:!0}})}if(this.#I&&this.#E&&this.#D?.includes("SearchMemories")){let c=await tge(this.#e,this.#a,this.#E,e.signal);await tS(this.#e,c,this.#e.join(this.#v,".builder","memories")),this.#bt=c,this.#D&&c.length===0&&(this.#D=this.#D.filter(u=>u!=="SearchMemories"))}let A=this.#h;if(A){let c=()=>{this.#g.emit("step",kO(A,this.#u))},u=()=>{this.#g.emit("step",kO(A,this.#u)),this.#Ie(),this.#me()},l=d=>{d==="ok-2xx"&&this.requestRefresh()};A.emitter.on("setupState",u),A.emitter.on("devState",u),A.emitter.on("httpServerData",u),A.emitter.on("httpServerState",l),A.emitter.on("validateState",c),this.#Me.push(()=>{A.emitter.off("setupState",u),A.emitter.off("devState",u),A.emitter.off("httpServerData",u),A.emitter.off("httpServerState",l),A.emitter.off("validateState",c)})}}catch(r){throw this.#r.error(r),this.#e.Sentry?.captureException(r,{tags:{operation:"codegen-initialize-session"}}),r}}async#gt(e,r){let n="reminder:health";this.removeSystemReminder(n);let i=this.#h;if(!i||!(this.#D?.includes("DevServerLogs")||this.#D?.includes("DevServerRestart")||this.#D?.includes("DevServerControl")||this.#D?.includes("ProposeEnvVariable")))return;let o=this.getSessionContext();if(o.sessionMode!=="normal")return;e&&await i.waitUntilIdle(500,500);let a=i.setupState,A=await this.#dt(),c=i.devCommand,u=i.devState,l=i.state,d=i.setupCommand,g=await i.getOpenPorts(),p=i.proxyTarget,f=i.httpServerState.state,m=i.lastServerStatus,C=f==="error-fetch",I=!1;this.#I&&(I=await this.getCurrentBranch()!==this.getAiBranch());let B=f==="error-5xx"||f==="error-4xx"&&m!==401&&m!==404,E="",y=!1,Q=!1;l==="install-failed"||l==="install-aborted"?E=i.getSetupOutput():(E=i.getCheckpoints(1,u!=="running"?"err":"all"),y=mge(E??""));let b="",D="",F="error",S="Try to fix",x="repair-unknown";if(l==="not-installed"||l==="install-failed"||l==="install-aborted"||l==="failed"||I||C||B||y||A.length>0){if(I&&(x="repair-bad-branch",D+=`- The current git branch is not the AI branch (${this.getAiBranch()}).
|
|
1833
1833
|
`,D+=`- Please switch to the AI branch using the 'git' tool.
|
|
1834
1834
|
`,b=`The current branch is not the AI branch (${this.getAiBranch()}).`),A.length>0){x="repair-merge-conflict",S="Resolve conflict",b="Merge conflict detected - changes from different sources need to be combined";let H=this.#ut,P=H?`
|
|
1835
1835
|
ours (:2:) = ${H.ourBranch} (AI branch), theirs (:3:) = ${H.theirBranch} (${H.theirIsMain?"main \u2014 prefer preserving these changes":"AI remote"})`:"";D+=`Merge conflict detected. Resolve ALL conflicted files:
|
|
@@ -1887,12 +1887,12 @@ ${y.join(`
|
|
|
1887
1887
|
`)}`);let b=!1;if(!await this.#Et(I)&&!A)switch(s){case"stash":await this.git(["stash","--include-untracked"],{cwd:I}),b=!0;break;case"commit":await this.git(["add","-A","."],{cwd:I}),await this.git(["commit","--no-verify","--no-gpg-sign","-m","Commit unstaged changes"],{cwd:I});break;default:throw new Error(`Uncommitted changes in ${C.folderName}`)}let F=performance.now();await this.git(["fetch","origin","--prune"],{cwd:I}),this.#_("git_sync_fetch",performance.now()-F,{folder:C.folderName});let S=await this.git(["for-each-ref","refs/remotes/origin"],{cwd:I}),x=B.filter(j=>S.includes(`refs/remotes/origin/${j}`)),U=this.#G()?"":`[${C.folderName}] `;if(A){let j=B[0];if(!S.includes(`refs/remotes/origin/${j}`))throw new Error(`${U}Cannot reset to base: "origin/${j}" was not found in the remote. Ensure the branch exists on the remote before syncing.`);let H=performance.now(),P=!0;try{await this.git(["reset","--hard",`refs/remotes/origin/${j}`],{cwd:I})}catch(G){throw P=!1,G}finally{this.#_("git_sync_reset",performance.now()-H,{folder:C.folderName,branch:j,success:String(P)})}if(j!==u)try{await this.git(["update-ref",`refs/heads/${j}`,`refs/remotes/origin/${j}`],{cwd:I})}catch(G){this.#e.Sentry?.captureException(G,{tags:{operation:"codegen-git",endpoint:"syncChanges-reset-update-ref"}})}d.push(`${U}Successfully reset "${u}" to "origin/${j}". All previous AI branch changes have been discarded and the branch now matches the remote feature branch exactly.`)}else for(let j of x){j!==u&&await this.git(["update-ref",`refs/heads/${j}`,`refs/remotes/origin/${j}`],{cwd:I});try{let H=performance.now(),P=!0,G;try{G=await this.git(["merge",...i==="never"?["--no-ff"]:[],...i==="required"?["--ff-only"]:[],...i==="auto"?["--ff"]:[],...r?["--allow-unrelated-histories"]:[],`refs/remotes/origin/${j}`],{cwd:I})}catch(K){throw P=!1,K}finally{this.#_("git_sync_merge",performance.now()-H,{folder:C.folderName,branch:j,success:String(P)})}let $=j===C.branchName;G?.includes("Already up to date")||d.push(`${U}Successfully merged branch "${j}" into ${u}${$?" (this was the main/feature branch \u2014 its changes are now in your working branch)":" (AI branch synced with remote)"}.`)}catch(H){let P=j===C.branchName;throw this.#ut={ourBranch:u,theirBranch:j,theirIsMain:P},H instanceof Do&&d.push(`${U}The user tries to sync git changes, but something failed:
|
|
1888
1888
|
- our branch (ours): ${u} -- this is the AI's working branch
|
|
1889
1889
|
- their branch (theirs): refs/remotes/origin/${j} ${P?" -- this is main/feature branch (work here needs to be preserved)":"-- same branch pushed by remote"}
|
|
1890
|
-
`),H}}if(n){let j=await this.#Pt(!0,C);await this.git(j,{cwd:C.path})}if(b)try{await this.git(["stash","pop"],{cwd:I})}catch(j){this.#e.Sentry?.captureException(j,{tags:{operation:"codegen-git",endpoint:"syncChanges-stash-pop"}})}})).results.filter(C=>!C.success||C.error);if(f.length>0){let C=f.map(I=>I.error?.message||`${I.folderName} failed`).join("; ");throw new Error(`Sync failed: ${C}`)}let m=await this.#K();if(c&&(this.#
|
|
1890
|
+
`),H}}if(n){let j=await this.#Pt(!0,C);await this.git(j,{cwd:C.path})}if(b)try{await this.git(["stash","pop"],{cwd:I})}catch(j){this.#e.Sentry?.captureException(j,{tags:{operation:"codegen-git",endpoint:"syncChanges-stash-pop"}})}})).results.filter(C=>!C.success||C.error);if(f.length>0){let C=f.map(I=>I.error?.message||`${I.folderName} failed`).join("; ");throw new Error(`Sync failed: ${C}`)}let m=await this.#K();if(c&&(this.#N={...this.#N,...m}),n){let C=await this.#Te(!1);if(!C.success)throw C.error}else await this.#x(),await this.#Ce({lastCommit:uo(m)});return d.length>0&&this.queueSystemReminder({text:d.join(`
|
|
1891
1891
|
|
|
1892
|
-
`)}),o&&this.requestRefresh(),{success:!0,message:A?`Successfully reset to remote feature branch "${e.join(", ")}" in all repos`:`Successfully merged ${e.join(", ")} in all repos`}}catch(u){if(this.#r.error(`Error syncing changes from branches: ${u}`,{loggerOptions:{debug:!0}}),await this.#x(),c){let d=await this.#K();this.#
|
|
1892
|
+
`)}),o&&this.requestRefresh(),{success:!0,message:A?`Successfully reset to remote feature branch "${e.join(", ")}" in all repos`:`Successfully merged ${e.join(", ")} in all repos`}}catch(u){if(this.#r.error(`Error syncing changes from branches: ${u}`,{loggerOptions:{debug:!0}}),await this.#x(),c){let d=await this.#K();this.#N={...this.#N,...d}}this.#e.Sentry?.captureException(u,{tags:{operation:"codegen-git",endpoint:"syncChangesFromBranches"},extra:{branches:e,allowUnrelatedHistory:r}});let l=rp(u);return{success:!1,message:l,error:u instanceof Error?u:new Error(l)}}}async getCurrentCommitHash(e="HEAD",r){if(this.#I)try{let n=["rev-parse",e];return(await this.git(n,{sys:this.#e,cwd:r})).trim()}catch{return}}async#K(e="HEAD"){let r={};for(let n of this.gitRepoContexts)try{let i=await this.getCurrentCommitHash(e,n.path);i&&(r[n.folderName]=i)}catch(i){this.#r.warn(`Failed to get commit for ${n.folderName}:`,i)}return r}async getCurrentBranch(e){return(await this.git(["branch","--show-current"],{cwd:e})).trim()}getFeatureBranch(){if(!this.#k)throw new Error("Feature branch is missing");return this.#k}getAiBranch(){if(!this.#R)throw new Error("AI branch is missing");return this.#R}async git(e,r){let n=e[0];(n==="push"||n==="fetch"||n==="pull")&&await this.#pt();let s=typeof r=="object"?{sys:this.#e,...r}:r,o=await this.#_t(()=>this.#gr(e,s));return this.#ur(n)&&(this.#xe.clear(),this.#Se.clear(),this.#ve.clear()),o}static#cr=new Set(["commit","merge","rebase","checkout","switch","pull","fetch","reset","cherry-pick","revert","am","stash","push"]);#ur(e){return!!e&&t.#cr.has(e)}async#q(e){if(this.#f.length===0)return{success:!0,partialSuccess:!1,results:[]};let n=(await Promise.allSettled(this.#f.map(o=>e(o)))).map((o,a)=>({folderName:this.#f[a].folderName,success:o.status==="fulfilled",result:o.status==="fulfilled"?o.value:void 0,error:o.status==="rejected"?o.reason:void 0,message:o.status==="rejected"?o.reason?.message:void 0})),i=n.filter(o=>o.success),s=n.filter(o=>!o.success);return{success:s.length===0,partialSuccess:i.length>0&&s.length>0,results:n}}#Lt(e){let r=Bn(e),n=this.#f.find(a=>{let A=Bn(a.folderName);return r.startsWith(A+"/")||r===A});if(n)return n;let i=e.startsWith("/")||e.includes(":")?e:this.#e.resolve(this.#d,e),s=Bn(i);return this.#f.find(a=>{let A=Bn(a.path);return s.startsWith(A+"/")||s===A})}#lr(e){let r=new Map;for(let n of e){let i=this.#Lt(n);if(i){let s=r.get(i.folderName)||[];s.push(n),r.set(i.folderName,s)}}return r}#_t(e){let r=this.#Qt.then(()=>e());return this.#Qt=r.catch(()=>{}),r}async#gr(e,r){let n=`git ${e.join(" ")}`;this.#ae&&this.#e.Sentry?.captureException(new Error(`currentGitCommand is not finished yet. Current command: ${this.#ae}, New command Received: ${n}`),{tags:{operation:"codegen-git"},extra:{oldCommand:this.#ae,newCommand:n}});try{this.#ae=n;let i=typeof r=="object"?r:void 0,s=typeof r=="string"?r:i?.cwd??this.primaryGitPath;return await ca("git",e,{...i,cwd:s,sys:this.#e,timeout:60*1e3})}finally{this.#ae=void 0}}setDebug(e){this.#A=e,e&&!process.env.DEBUG?(process.env.DEBUG="1",this.#p=!0):!e&&this.#p&&(delete process.env.DEBUG,this.#p=!1)}async createTerminal(e){let r=this.#h,n=e?.terminalId||`pty_${Date.now()}_${(0,nS.randomUUID)()}`,i=this.#ht().find(B=>B.terminalId===n),s=new Set,o=new Set;if(i&&e?.terminalId){if(!e?.force)return i;let B=this.#w.get(e.terminalId);if(!B)return i;B.onDataListeners.forEach(E=>{s.add(E)}),B.onExitListeners.forEach(E=>{o.add(E)}),this.disposeTerminal({terminalId:n,emitTerminals:!1})}let a=e?.shell||(process.platform==="win32"?"powershell.exe":process.env.SHELL||"/bin/bash"),A=e?.cols??120,c=e?.rows??30,u={...process.env,...r?.envVars,...e?.env};e?.inheritCredentials&&(u.BUILDER_USER_ID=e.createdBy??this.#a.userId,u.BUILDER_PUBLIC_KEY=this.#a.builderPublicKey,u.BUILDER_PRIVATE_KEY=this.#a.builderPrivateKey);let l=[],d=B=>{for(let E of s)E(B)},g=({exitCode:B,error:E})=>{let y=this.#w.get(n);y&&(y.state=E?"error":"exited",y.exitCode=B);for(let Q of o)Q(B);this.#w.delete(n),l.forEach(Q=>Q())},p=e?.cwd||this.#v,f,m;if(e?.readonly){f="starting";let B=!r?.hasSetupEnvVars,E=aA(a,e?.initialCommand??"true",{cwd:p,env:u,stdio:["ignore","pipe","pipe"]},B);E.on("spawn",()=>{let y=this.#w.get(n);y&&(y.state="running")}),E.stdout.on("data",y=>{d(y.toString())}),E.stderr.on("data",y=>{d(y.toString())}),E.on("error",y=>{g({exitCode:1,error:y})}),E.on("exit",y=>{g({exitCode:y??0})}),l.push(()=>{try{E.removeAllListeners()}catch{}E.kill()}),m=E}else{f="running";let B=HL(this.#e);if(!B)throw new Error("Could not import node-pty");let E=a.includes("bash")||a.includes("zsh"),y=a.includes("zsh")?"%~ $ ":"\\w $ ",Q=B.spawn(a,[],{name:"xterm-color",cwd:p,cols:A,rows:c,env:E?{...u,PS1:y}:u}),b=Q.onData(d);l.push(()=>{try{b?.dispose?.()}catch{}});let D=Q.onExit(g);l.push(()=>{try{D?.dispose?.()}catch{}});let F=e?.initialCommand;F&&(F.endsWith(`
|
|
1893
1893
|
`)||(F+=`
|
|
1894
1894
|
`),Q.write(F)),m=Q}let C=Date.now(),I={terminalId:n,title:e?.title||`Terminal ${this.#w.size+1}`,cwd:p,createdAt:C,lastWrittenAt:C,createdBy:e?.createdBy||"unknown",readonly:e?.readonly??!1,initialCommand:e?.initialCommand,builtIn:!1,state:f,stale:!1,exitCode:void 0,command:void 0};return this.#w.set(n,{...I,pty:m,onDataListeners:s,onExitListeners:o,disposeFns:l,env:e?.env,shell:a,inheritCredentials:e?.inheritCredentials}),(e?.emitTerminals??!0)&&this.#me(),I}#ht(){let e=this.getSessionContext(),r=Array.from(this.#w.values()).map(s=>({terminalId:s.terminalId,title:s.title,cwd:s.cwd,createdAt:s.createdAt,lastWrittenAt:s.lastWrittenAt,createdBy:s.createdBy,readonly:s.readonly,builtIn:s.builtIn,exitCode:s.exitCode,state:s.state,stale:s.stale,command:s.command})),n=[];this.#D?.includes("Bash")&&n.push({terminalId:"bash-tools",title:"Bash",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:Date.now(),createdBy:"fusion",readonly:!0,builtIn:!0,exitCode:void 0,state:"running",command:void 0});let i=this.#h;if(i){let s=Date.now();if(i.devState!=="unset"&&n.push({terminalId:"dev-command",title:"Dev Command",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!i.devCommandProcess?.write,builtIn:!0,state:i.devState==="running"?"running":"exited",exitCode:void 0,command:i.devCommand}),i.setupCommand&&n.push({terminalId:"setup-command",title:"Setup Command",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!0,builtIn:!0,state:i.setupState==="installing"?"running":"exited",exitCode:void 0,command:i.setupCommand}),i.validateCommandState!=="unset"){let o;switch(i.validateCommandState){case"running":o="running";break;case"success":o="exited";break;case"failure":o="error";break;case"stopped":o="exited";break}n.unshift({terminalId:"validate-command",title:"Validate Command",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!0,builtIn:!0,state:o,exitCode:void 0,command:i.validateCommand})}}return n.push(...r),n}#me(){this.#g.emit("step",{type:"terminals",terminals:this.#ht()})}updateTerminal({terminalId:e,cols:r,rows:n,title:i}){if(e==="dev-command"){if(r||n){let o=this.#h;if(o?.devCommandProcess?.resize)return o.devCommandProcess.resize(r,n),!0}return!1}let s=this.#w.get(e);return s?("resize"in s.pty&&(r||n)&&s.pty.resize(r??s.pty.cols,n??s.pty.rows),i&&(s.title=i,this.#me()),!0):!1}writeTerminal({terminalId:e,data:r}){if(e==="dev-command"){let i=this.#h;return i?.devCommandProcess?.write?(i.devCommandProcess.write(r),!0):!1}let n=this.#w.get(e);return!n||n.readonly?!1:("write"in n.pty&&n.pty.write(r),n.lastWrittenAt=Date.now(),!0)}signalTerminal({terminalId:e,signal:r}){if(e==="dev-command"){let i=this.#h;return i?.devCommandProcess?.kill?(i.devCommandProcess.kill(r),!0):!1}let n=this.#w.get(e);if(!n||n.readonly)return!1;try{"write"in n.pty?process.platform==="win32"?n.pty.kill():(r==="SIGINT"&&n.pty.write(""),n.pty.kill(r)):n.pty.kill(r)}catch{}return!0}disposeTerminal({terminalId:e,emitTerminals:r=!0}){let n=this.#w.get(e);if(!n)return!1;try{n.pty.kill()}catch{}return n.disposeFns.forEach(i=>{try{i()}catch{}}),n.onDataListeners.clear(),n.onExitListeners.clear(),n.disposeFns=[],this.#w.delete(e),r&&this.#me(),!0}async restartTerminal({terminalId:e}){if(e==="dev-command"){let i=this.#h;if(i)try{return await i.restart(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="setup-command"){let i=this.#h;if(i)try{return await i.runSetupCommand(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="validate-command"){if(this.#h)try{return await this.#Jt(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="bash-tools")return!1;let r=this.#w.get(e);return r?(await this.createTerminal({terminalId:e,title:r.title,cwd:r.cwd,env:r.env,shell:r.shell,cols:"cols"in r.pty?r.pty.cols:void 0,rows:"rows"in r.pty?r.pty.rows:void 0,createdBy:r.createdBy,emitTerminals:!1,initialCommand:r.initialCommand,readonly:r.readonly,inheritCredentials:r.inheritCredentials,force:!0}),this.#w.get(e)?(this.#me(),!0):!1):!1}subscribeTerminal({terminalId:e,onData:r,onExit:n}){if(e==="dev-command"){let i=this.#h;if(i){let s=i.getDevWrite();return s&&r(s),i.emitter.on("stdout",r),i.emitter.on("stderr",r),()=>{i.emitter.off("stdout",r),i.emitter.off("stderr",r)}}}else if(e==="setup-command"){let i=this.#h;if(i){let s=i.getSetupOutput();return s&&r(s),i.emitter.on("installStdout",r),i.emitter.on("installStderr",r),()=>{i.emitter.off("installStdout",r),i.emitter.off("installStderr",r)}}}else if(e==="validate-command"){let i=this.#h;if(i){let s=i.getValidateOutput();return s&&r(s),i.emitter.on("validateStdout",r),i.emitter.on("validateStderr",r),()=>{i.emitter.off("validateStdout",r),i.emitter.off("validateStderr",r)}}}else if(e==="bash-tools"){let i=s=>{s.type==="stdio"&&s.source==="tool-command"&&r(s.content)};return this.#g.on("step",i),()=>{this.#g.off("step",i)}}else{let i=this.#w.get(e);if(!i)throw new Error("Terminal not found");return i.onDataListeners.add(r),n&&i.onExitListeners.add(n),()=>{i.onDataListeners.delete(r),n&&i.onExitListeners.delete(n)}}}async getAllFiles(e={}){let{getDotFiles:r=!1,globbyPattern:n="**/*",includePattern:i,gitignore:s,deep:o,truncate:a,maxFiles:A=5e4,onlyFiles:c=!0}=e,u=this.#u?.accessControl,l=u?.entries?.filter(f=>f.action==="allow"&&f.permissions.includes("list")).map(f=>(f.resource.startsWith("/")?f.resource.slice(1):f.resource)||".")??[];if(!this.#C?.folders?.length){let f=await Lu({basePath:this.#d,globPattern:[i??n,...l],extraIgnorePatterns:_w(u).deny,dot:r,gitignore:s,sys:this.#e,deep:o,onlyFiles:c,maxFiles:A});return tL(f,a)}let d=[],g=await this.#e.readdir(this.#d);for(let f of g)PO(f)&&d.push(f);!d.includes("AGENTS.md")&&this.#C.agentsMD&&d.push("AGENTS.md");for(let f of this.#C.folders){let m=this.#e.resolve(this.#d,f.path),C=await Lu({basePath:m,globPattern:[n,...l],dot:r,gitignore:s,sys:this.#e,deep:o,onlyFiles:c,maxFiles:A}),I=this.#G()?".":f.name||this.#e.basename(m);for(let B of C)I!=="."?d.push(this.#e.join(I,B)):d.push(B)}let p=Af({files:d,policy:u,filterPattern:i,getDotFiles:r});return tL(p,a)}async searchFiles(e){let{query:r,caseInsensitive:n=!0,includeGlob:i,excludeGlob:s,maxResults:o=1e3,contextBefore:a=0,contextAfter:A=0}=e,c=await kE(this.#e),u=["--path-separator","/","--json","--line-number","--column","--hidden","--max-columns","500"];return n&&u.push("-i"),a>0&&u.push("-B",a.toString()),A>0&&u.push("-A",A.toString()),i&&u.push("--glob",i),s&&u.push("--glob",`!${s}`),u.push("--ignore-file",".builderignore"),u.push("--",r),new Promise(l=>{let d=oc({command:c,args:u,options:{env:process.env,cwd:this.#v,stdio:["ignore","pipe","pipe"]}}),g=new xi(5e4);d.stdout.on("data",p=>{g.write(p.toString())}),d.on("error",()=>{l({matches:[],totalMatches:0,filesWithMatches:0,truncated:!1})}),d.on("close",p=>{if(p!==0)l({matches:[],totalMatches:0,filesWithMatches:0,truncated:!1});else{let f=[],m=new Set,I=g.getContent().split(`
|
|
1895
|
-
`),B=[],E=null;for(let Q of I)if(Q.trim())try{let b=JSON.parse(Q);if(b.type==="match"){let D=b.data.path.text,F=b.data.line_number,S=b.data.lines.text.trimEnd(),x=b.data.submatches||[],U,j;x.length>0&&(U=x[0].start,j=x[0].end),m.add(D);let H={filePath:D,lineNumber:F,lineContent:S,columnStart:U,columnEnd:j,contextBefore:B,contextAfter:[]};if(B=[],E=H,f.push(H),f.length>=o)break}else if(b.type==="context"){let D=b.data.line_number,F=b.data.lines.text.trimEnd();E&&D>E.lineNumber?E.contextAfter.push(F):B.push(F)}}catch{continue}let y=f.length>=o;l({matches:f,totalMatches:f.length,filesWithMatches:m.size,truncated:y})}})})}#Ut(e){let r=this.#de.indexOf(e);r!==-1&&this.#de.splice(r,1),this.#de.unshift(e),this.#de.length>50&&(this.#de.length=50)}async#pr(){let e=this.#Fe;if(e&&Date.now()-e.timestamp<t.#ze)return e.promise;let r=this.#u?.accessControl,n=Lu({basePath:this.#v,extraIgnorePatterns:_w(r).deny,gitignore:!0,dot:!0,sys:this.#e}).then(i=>Af({files:i,policy:r,getDotFiles:!0}));return this.#Fe={promise:n,timestamp:Date.now(),fuse:null},n}async#dr(){let e=this.#Fe;if(e?.fuse)return e.fuse;let r=await this.#pr(),n=Xse(r);return this.#Fe&&(this.#Fe.fuse=n),n}async searchFileTree(e){let{query:r,maxResults:n=100}=e;if(!r){let A=this.#de.slice(0,n).map(c=>{let u=c.lastIndexOf("/");return{filePath:c,fileName:u>=0?c.slice(u+1):c,parentPath:u>=0?c.slice(0,u):"",matchIndices:[]}});return{matches:A,totalMatches:A.length,truncated:!1}}let s=(await this.#dr()).search(r,{limit:n});return{matches:s.map(a=>{let{fullPath:A,basename:c,dirname:u}=a.item,l=Zse(a);return{filePath:A,fileName:c,parentPath:u,matchIndices:l}}),totalMatches:s.length,truncated:s.length>=n}}async collectRepoMetrics(e={}){let r=this.#ke(e.folderName);return e.rootPath&&(r=this.#e.join(r,e.rootPath)),Eoe(this.#e,r)}getSessionId(){return this.getSessionContext().sessionId}getMainSessionId(){return this.#Rt??this.getSessionId()}updateMetadata(e){this.#mt(e,!1)}getMetadata(){return this.#O}#Ze=null;setTimeline(e){this.#Ze=e}getTimeline(){return this.#Ze}getSpaceId(){return this.#a.builderPublicKey}async revertToCommitSnapshot(e){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let n=(await this.#q(async s=>{let o=Mu(e,s.folderName,this.gitRepoContexts[0]?.folderName);return o?(await this.git(["revert","--no-commit",`${o}..HEAD`],{cwd:s.path}),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Revert changes"],{cwd:s.path}),{commitHash:await this.getCurrentCommitHash("HEAD",s.path)}):(this.#r.warn(`No commit found for ${s.folderName}, skipping revert`),{skipped:!0})})).results.filter(s=>!s.success);if(n.length>0)throw new Error(`Failed to revert ${n.length} repos`);let i=await this.#K();this.#M={...this.#M,...i},await this.#x(),this.requestRefresh(),await this.#Ce({lastCommit:uo(i)})}async revertToCommitHash(e){let r=If(e,this.gitRepoContexts[0]?.folderName),n=Object.keys(r).length===0?e:uo(r);return this.revertToCommitSnapshot(n)}async resetToCommitSnapshot(e,r=!0){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let i=(await this.#q(async o=>{let a=Mu(e,o.folderName,this.gitRepoContexts[0]?.folderName);if(!a)return this.#r.warn(`No commit found for ${o.folderName}, skipping reset`),{skipped:!0};await this.git(["reset","--quiet","--hard",a],{cwd:o.path}),await this.git(["clean","-fd"],{cwd:o.path});let A=await this.getCurrentCommitHash("HEAD",o.path);if(A!==a)throw new Error(`Failed to reset commit hash for ${o.folderName}: expected ${a}, got ${A}`);return{commitHash:A}})).results.filter(o=>!o.success);if(i.length>0)throw new Error(`Failed to reset ${i.length} repos`);let s=If(e,this.gitRepoContexts[0]?.folderName);this.#M={...this.#M,...s},await this.#x(),r&&this.requestRefresh()}async resetToCommitHash(e,r=!0){let n=If(e,this.gitRepoContexts[0]?.folderName),i=Object.keys(n).length===0?e:uo(n);return this.resetToCommitSnapshot(i,r)}async restore({location:e,predicate:r,revert:n=!1,dryRun:i=!1,forceReplay:s=!1,debug:o}){let a=this.getSessionContext(),A=a.turns.length,c=null;for(let p=A-1;p>=-1;p--)if(r(p>=0?a.turns[p]:null,p)){c=p;break}if(c===null)return{undone:null,message:"Could not find the target to restore to, the completion id could be wrong"};n||await this.abort({cleanCurrentMessage:!0});let u=new Map,l=!!this.#I,d=a.turns,g=Math.max(0,e==="before"?c:c+1);for(let p=d.length-1;p>=g;p--){let f=d[p];for(let m of f.applyResults)u.set(m.filePath,m.oldContent??"")}if(!i){let p;if(l){c===-1?a.beforeCommit?p=a.beforeCommit:d.length>0&&(p=d[0].beforeCommit):c<d.length&&(e==="after"?(p=d[c].afterCommit,!p&&c+1<d.length&&(p=d[c+1].beforeCommit)):p=d[c].beforeCommit);let I={commitSnapshot:p,sessionId:a.sessionId,sessionBeforeCommit:a.beforeCommit,turnsLength:d.length,targetIndex:c,currentTurn:d[d.length-1],targetTurn:d[c],targetTurnNext:d[c+1],location:e,forceReplay:s,dryRun:i,debug:o};if(!p)return this.#e.Sentry?.captureException(new Error("No commit snapshot found for restore"),{tags:{operation:"codegen-git",endpoint:"revertToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Could not find the target to restore to, the git history is missing"};try{n?await this.revertToCommitSnapshot(p):await this.resetToCommitSnapshot(p)}catch(B){return this.#e.Sentry?.captureException(new Error("Error resetting git",{cause:B}),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Failed to reset/restore, the file history is missing"}}}else for(let[I,B]of u.entries())try{B?await this.writeFile(I,B):await this.deleteFile(I)}catch{}if(n)return{undone:[],message:"The revert operation was successful"};let f=d.splice(g,d.length-g),m=yA(d);m&&m?.afterCommit!==p&&(this.#e.Sentry?.captureException(new Error("Reset After commit snapshot mismatch"),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},extra:{lastTurn:m,commitSnapshot:p}}),m.lastCommit=p,await this.#Ce({completionId:m.completionId,lastCommit:p}));let C=m?.completionId;if(f.length>0&&(await vO(this.#e,this.#a,{lastCompletionId:C,sessionId:a.sessionId},!!this.#A),a.updatedUnixTime=Date.now()),s){let I=a.state;this.#g.emit("step",{type:"batch",steps:[{type:"state",newState:"replay",abortable:!1,previousState:I},...this.#Ht(),{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e},{type:"state",newState:I,abortable:!1,previousState:"replay"}]})}else f.length>0&&this.#g.emit("step",{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e})}return await this.#Gt(),{undone:Array.from(u.keys()),message:"The restore operation was successful"}}async#Gt(e){return await this.#h?.ensureDevCommand(e)}async restoreFromCompletionId({location:e,completionId:r,forceReplay:n}){let i=this.getSessionContext();return i.turns.find(o=>o.completionId===r)?this.restore({location:e,predicate:o=>o?.completionId===r,forceReplay:n,debug:`restore to: ${r}`}):(await this.#Be,i.turns=[],i.canLoadMore=!0,await vO(this.#e,this.#a,{sessionId:i.sessionId,lastCompletionId:r},!!this.#A),await this.loadMoreTurns(),this.restore({location:e,predicate:()=>!0,forceReplay:!0,debug:"restore after history"}))}async restoreBeforeCompletionId(e){return this.restoreFromCompletionId({location:"before",completionId:e,forceReplay:!1})}async undoLastUserMessage(e=!1){return this.restore({location:"before",predicate:r=>r?.user.role==="user",dryRun:e})}getLastUserCompletionId(){let e=this.getSessionContext();return Age(e)?.completionId}getLastCompletionId(){let e=this.getSessionContext();return bO(e)?.completionId}getCurrentState(){return this.getSessionContext().state}getLastApplyResultsTurn(){let e=this.getSessionContext();return cge(e)}getLastTurn(){let e=this.getSessionContext();return bO(e)}getLastMessage(){return this.getLastTurn()?.actions.find(r=>r.type==="text")?.content}getNextUrl(){return this.getLastTurn()?.nextUrl}async sendFeedback(e){if(process.env.NODE_ENV==="test")return;if(e.feedbackSentiment){let n=e.feedbackSentiment==="positive"?`User provided positive feedback (thumbs up) on the previous completion.${e.feedbackText??""}`:`User provided negative feedback (thumbs down) on the previous completion.${e.feedbackText??""}`;this.queueSystemReminder({text:n,tag:"reminder:user-feedback"})}Pt("quality code feedback given",{spaceId:this.#a.builderPublicKey,sentiment:e.feedbackSentiment,mode:"cli"});let r=e.id??this.getLastCompletionId();r&&await this.#hr({...e,id:r})}#Ce(e){let r=e.completionId;if(!r){let i=this.getLastTurn();i&&e.lastCommit&&(i.lastCommit=e.lastCommit),r=i?.completionId}let n=SO(this.#e,this.#a,"/codegen/finalize",{completionId:r,projectId:this.#u?.projectId,branchName:this.#u?.branchName,userCompletionId:this.getLastUserCompletionId(),sessionId:this.getSessionId(),metadata:this.#O,hasPlanToApply:this.#fe,...e},this.#A);return this.#kt&&this.#fr(),this.#U(n,"completionFinalize")}#fr(){try{let e=this.#e.getCwdDir(),r=this.getSessionId();if(this.#ct){h_(this.#e,e,r).catch(()=>{});return}let n=I0(this.#e,e).then(i=>{if(i.some(l=>l.sessionId===r)){this.#ct=!0,h_(this.#e,e,r).catch(()=>{});return}let s=this.getSessionContext().turns,o=s[s.length-1],a=o?.title,A=a&&a!=="Untitled"&&!a.startsWith("completionId:"),c=o?.userMessage?.displayPrompt??o?.userMessage?.userPrompt??"",u=A?a:ooe(c);return soe(this.#e,e,r,u).then(()=>{this.#ct=!0})}).catch(()=>{});this.#U(n,"saveLocalHistory")}catch{}}#hr(e){let r=SO(this.#e,this.#a,"/codegen/feedback",e,this.#A);return this.#U(r,"completionFeedback")}#_(e,r,n={}){this.#h?.emitter.emit("metrics",{durations:[{key:e,ms:r,attributes:n}]})}#U(e,r,n=!1){let i=Ca();this.#r.debug(`(addToPendingPromises-${i}): adding ${r} (blocking: ${n})`),this.#le.push(e),n&&this.#Je.push(e);let s=new Error(`Deadlock detected in codegen (function: ${r})`),o=setTimeout(()=>{this.#e.Sentry?.captureException(s,{level:"fatal",tags:{operation:"codegen-stream",functionName:r,sessionId:this.getSessionId(),projectId:this.#E,branchName:this.#y}})},300*1e3);return e.finally(()=>{clearTimeout(o),this.#r.debug(`(addToPendingPromises-${i}): removing ${r} (blocking: ${n})`);let a=this.#Je.indexOf(e);a!==-1&&this.#Je.splice(a,1);let A=this.#le.indexOf(e);A!==-1&&this.#le.splice(A,1)})}async lastTurnHasChanges(){let e=await this.undoLastUserMessage(!0);return e.undone?e.undone.length>0:!1}#$(e){let r=this.getSessionContext(),n=r.state;return n!==e?(r.state=e,this.#g.emit("step",{type:"state",abortable:e==="generating",previousState:n,newState:e}),!0):!1}waitUntilState(e,r=1e4){return new Promise(n=>{if(this.getSessionContext().state===e){n();return}let s,o=a=>{a.type==="state"&&a.newState===e&&(clearTimeout(s),this.#g.removeListener("step",o),n())};s=setTimeout(()=>{this.#g.removeListener("step",o),n()},r),this.#g.on("step",o)})}getProxyConfig(){return Lne({devServerUrl:this.#u?.serverUrl,proxyOrigin:this.#Oe,proxyDefaultOrigin:this.#Ke,proxyDestination:this.#xt})}async clearSession(){this.#r.debug("(clearSession): clearing session"),await this.abort({cleanCurrentMessage:!0,flushMessageQueue:!1});let e=this.getSessionContext();e.turns=[],e.customInstructions=await this.#Re(),e.customAgents=await this.#Xe(),this.#j.length=0,this.#rt=!1,this.#O={},this.#ee=void 0,this.#Pe=!1,this.#$e=0,this.#pe=null,this.#qe=[],this.clearMessageQueue(!1),this.queueGitStatusReminder({trigger:"session-start"}),this.#g.emit("step",this.#Kt())}async clearMessageQueue(e=!1){let r=[],n=this.getSessionMode();if(e)for(let i of this.#t)i.user&&r.push({type:"user",previousId:this.getLastCompletionId(),displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey,sessionMode:i.sessionMode??n});this.#t.length=0,this.#Ne(),r.length>0&&this.#g.emit("step",{type:"batch",steps:r})}updateMessage(e){if(e.type==="delete"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&this.#t.splice(r,1)}else if(e.type==="move"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&yge(this.#t,r,r+e.delta)}this.#Ne()}async flushMessageQueue(){this.#r.debug("(flushMessageQueue): flushing message queue"),await this.abort({cleanCurrentMessage:!1,flushMessageQueue:!0}),this.#s&&this.#s()}#Ot(e){let r=e.idempotencyKey;if(r){let n=this.#t.findIndex(i=>i.idempotencyKey===r);if(n>=0)return this.#t[n]=e,!1}else e.idempotencyKey=(0,nS.randomUUID)();if(e.queue==null&&(e.queue=!0),e.user?e.user={...this.#ee,...e.user}:e.user=this.#ee,e.userPrompt==="___BROWSER_AUTOMATION_PROMPT___"){let n=this.getProxyConfig();e.userPrompt=aoe(n.proxyDefaultOrigin,this.#be||void 0)}return this.#o.coalesce==="replace-latest"&&(this.#t.length=0),this.#t.push(e),!0}async sendMessage(e){this.#Pe=!1;let r=this.#o.schedule,n=une(r)&&(this.#c!==void 0||this.#i!==void 0);if(r==="interrupt-clear"&&(this.#r.debug("(sendMessage): interrupt-clear schedule \u2014 clearing session"),await this.clearSession()),n&&r==="interrupt-replace"){this.#r.debug("(sendMessage): interrupt-replace schedule \u2014 undoing last user message"),await this.undoLastUserMessage();let o=Array.isArray(e)?e:[e];for(let a of o)a.dropAbortedPrompt=!0}let i=0;if(Array.isArray(e))for(let o of e)this.#Ot(o)&&i++;else this.#Ot(e)&&i++;if(i===0)return null;this.#r.debug(`(sendMessage): added messages(${i}) to queue(${this.#t.length})`),this.#Ne();let s=this.#t[this.#t.length-1];return s?(this.cancelAllPendingToolFulfilments(s.userPrompt),n&&this.#c&&(this.#r.debug(`(sendMessage): ${r} \u2014 aborting current run`),this.#c.abort(),this.#c=void 0),s.queue?this.#s&&this.#s():await this.flushMessageQueue(),await Nu(),s.idempotencyKey):null}#mr(){if(this.#o.schedule==="until-idle")return;let e=this.#t;if(e.length===0)return;let r;switch(this.#o.coalesce){case"preserve-order":r=[e[0]];break;case"replace-latest":r=[e[e.length-1]];break;default:r=e.slice();break}for(let n of r)if(n.systemReminders)for(let i of n.systemReminders)this.queueSystemReminder(i);return this.#i=xO(r),this.#ee=this.#i.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.#o.coalesce==="preserve-order"?(this.#t.shift(),this.#Ne()):this.clearMessageQueue(!0),this.#i}#Cr(){let e=this.#t.length===0||this.#Pe,r=new Promise(n=>{e?this.#s=n:n()}).then(()=>{let n=this.#t;if(n.length===0)return;if(this.#o.coalesce!=="merge"){let s=this.#o.coalesce==="replace-latest"?n.pop():n.shift();if(this.#o.coalesce==="replace-latest"&&(this.#t.length=0),s.user&&!s.forceCompact){this.#ee=s.user;let o=this.getSessionMode();this.#g.emit("step",{type:"user",previousId:this.getLastCompletionId(),displayPrompt:s.displayPrompt,user:s.user,role:s.user.role,compacting:!1,idempotencyKey:s.idempotencyKey,sessionMode:s.sessionMode??o})}if(s.systemReminders)for(let o of s.systemReminders)this.queueSystemReminder(o);return this.#i=s,this.#ee=s.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.#Ne(),s}for(let s of n)if(s.systemReminders)for(let o of s.systemReminders)this.queueSystemReminder(o);let i=xO(n);if(!i.dropAbortedPrompt&&this.#i){let s=i.idempotencyKey;i=LO(this.#i,i),i.idempotencyKey=s}return this.clearMessageQueue(!0),this.#i=i,this.#ee=i.user,i});return{shouldWait:e,promise:r}}#Ne(){this.#g.emit("step",{type:"message-queue",queue:this.#t.map(e=>({idempotencyKey:e.idempotencyKey,displayPrompt:e.displayPrompt,user:e.user}))})}#mt(e,r=!1){r&&(this.#O={}),Object.assign(this.#O,e),this.#g.emit("step",{type:"metadata",...this.#O})}async waitForSetupCommand(e){let r=this.#h;if(!r)return{state:"installed",shouldProceed:!0};if(r.setupState==="installing")try{await cc(r.setupCommandPromise,e)}catch{}let n=r.setupState;return n==="not-installed"||n==="install-failed"||n==="install-aborted"?{state:n,shouldProceed:!0}:{state:"installed",shouldProceed:!0}}async waitForDevServer(e,r,n){if(!this.#h&&this.#u?.serverUrl)return{shouldProceed:!0,message:"Dev server is ready.",serverUrl:this.#u.serverUrl};let i=await this.waitForSetupCommand(e);if(!i.shouldProceed)return{shouldProceed:!1,message:`Project setup command did not completed. State: ${i.state}`};let s=this.#h;if(s){await s.ensureDevCommand(e);let o=await s.waitUntilServer(e,r,n);return o.ok?{shouldProceed:!0,message:"Dev server is ready.",serverUrl:s.serverUrl?.toString()}:{shouldProceed:!1,message:o.message,serverUrl:void 0}}return{shouldProceed:!1,message:"Dev server is not ready.",serverUrl:void 0}}async getNamedAgentConfig(e,r,n){let i=this.getSessionContext(),s=i.customAgents,o=e?s.find(G=>G.name.toLowerCase()===e.toLowerCase()):void 0,a=o?.name??"explorer",{mcpServers:A=!1,model:c,systemPrompt:u,subagent_type:l,includeMemories:d,needDevServer:g,needValidation:p,queueMode:f,asyncSubAgents:m,resetAfterRun:C=!1,reasoning:I,softContextWindow:B,maxTimeoutMs:E}={mcpServers:o?.mcpServers,subagent_type:a,systemPrompt:o?.systemPrompt,softContextWindow:o?.softContextWindow,model:(()=>{let G=o?.name??a,$=G?this.#Ae?.[G]:void 0;if(typeof $=="string")return $;if(Array.isArray($)&&$.length){let W=G,K=this.#ge.get(W)??0;return this.#ge.set(W,K+1),$[K%$.length]}if(o?.roundRobinModels?.length){let W=o.name,K=this.#ge.get(W)??0;return this.#ge.set(W,K+1),o.roundRobinModels[K%o.roundRobinModels.length]}return o?.model})(),includeMemories:o?.includeMemories,needDevServer:o?.needDevServer,needValidation:o?.needValidation,resetAfterRun:o?.resetAfterRun,queueMode:o?.queueBehavior??o?.queueMode,asyncSubAgents:o?.asyncSubAgents,reasoning:o?.reasoning??this.#at,maxTimeoutMs:o?.maxTimeoutMs},y=(this.#D??[]).filter(G=>G!=="Agent");y.includes("ExplorationMetadata")||y.push("ExplorationMetadata");let Q=DO(this.#u,o?.tools??y),b=c,D=this.#h;if(g&&n){if(!D)return{success:!1,response:`The ${l} agent can not be used on this session. Do no try again.`};if(D.httpServerState.state==="stopped"||D.httpServerState.state==="connecting"||D.httpServerState.state==="error-fetch")try{if(D.state==="not-installed")throw new Error(`The ${l} agent can not be used until the setupCommand finish successfully. However, the dev server is not installed.`);if(D.state==="install-failed")throw new Error(`The ${l} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it failed.`);if(D.state==="install-aborted")throw new Error(`The ${l} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it was aborted.`);await this.waitForSetupCommand(n),await D.ensureDevCommand(n)}catch($){return{success:!1,response:$ instanceof Error?$.message:String($)}}if(p&&D.validateCommand&&this.#re){let $=await D.runValidateCommand(void 0,n);if($.status==="failure")return{success:!1,response:`The Agent could not start yet, because the validate command failed:
|
|
1895
|
+
`),B=[],E=null;for(let Q of I)if(Q.trim())try{let b=JSON.parse(Q);if(b.type==="match"){let D=b.data.path.text,F=b.data.line_number,S=b.data.lines.text.trimEnd(),x=b.data.submatches||[],U,j;x.length>0&&(U=x[0].start,j=x[0].end),m.add(D);let H={filePath:D,lineNumber:F,lineContent:S,columnStart:U,columnEnd:j,contextBefore:B,contextAfter:[]};if(B=[],E=H,f.push(H),f.length>=o)break}else if(b.type==="context"){let D=b.data.line_number,F=b.data.lines.text.trimEnd();E&&D>E.lineNumber?E.contextAfter.push(F):B.push(F)}}catch{continue}let y=f.length>=o;l({matches:f,totalMatches:f.length,filesWithMatches:m.size,truncated:y})}})})}#Ut(e){let r=this.#de.indexOf(e);r!==-1&&this.#de.splice(r,1),this.#de.unshift(e),this.#de.length>50&&(this.#de.length=50)}async#pr(){let e=this.#Fe;if(e&&Date.now()-e.timestamp<t.#ze)return e.promise;let r=this.#u?.accessControl,n=Lu({basePath:this.#v,extraIgnorePatterns:_w(r).deny,gitignore:!0,dot:!0,sys:this.#e}).then(i=>Af({files:i,policy:r,getDotFiles:!0}));return this.#Fe={promise:n,timestamp:Date.now(),fuse:null},n}async#dr(){let e=this.#Fe;if(e?.fuse)return e.fuse;let r=await this.#pr(),n=Xse(r);return this.#Fe&&(this.#Fe.fuse=n),n}async searchFileTree(e){let{query:r,maxResults:n=100}=e;if(!r){let A=this.#de.slice(0,n).map(c=>{let u=c.lastIndexOf("/");return{filePath:c,fileName:u>=0?c.slice(u+1):c,parentPath:u>=0?c.slice(0,u):"",matchIndices:[]}});return{matches:A,totalMatches:A.length,truncated:!1}}let s=(await this.#dr()).search(r,{limit:n});return{matches:s.map(a=>{let{fullPath:A,basename:c,dirname:u}=a.item,l=Zse(a);return{filePath:A,fileName:c,parentPath:u,matchIndices:l}}),totalMatches:s.length,truncated:s.length>=n}}async collectRepoMetrics(e={}){let r=this.#ke(e.folderName);return e.rootPath&&(r=this.#e.join(r,e.rootPath)),Eoe(this.#e,r)}getSessionId(){return this.getSessionContext().sessionId}getMainSessionId(){return this.#Rt??this.getSessionId()}updateMetadata(e){this.#mt(e,!1)}getMetadata(){return this.#O}#Ze=null;setTimeline(e){this.#Ze=e}getTimeline(){return this.#Ze}getSpaceId(){return this.#a.builderPublicKey}async revertToCommitSnapshot(e){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let n=(await this.#q(async s=>{let o=Mu(e,s.folderName,this.gitRepoContexts[0]?.folderName);return o?(await this.git(["revert","--no-commit",`${o}..HEAD`],{cwd:s.path}),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Revert changes"],{cwd:s.path}),{commitHash:await this.getCurrentCommitHash("HEAD",s.path)}):(this.#r.warn(`No commit found for ${s.folderName}, skipping revert`),{skipped:!0})})).results.filter(s=>!s.success);if(n.length>0)throw new Error(`Failed to revert ${n.length} repos`);let i=await this.#K();this.#N={...this.#N,...i},await this.#x(),this.requestRefresh(),await this.#Ce({lastCommit:uo(i)})}async revertToCommitHash(e){let r=If(e,this.gitRepoContexts[0]?.folderName),n=Object.keys(r).length===0?e:uo(r);return this.revertToCommitSnapshot(n)}async resetToCommitSnapshot(e,r=!0){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let i=(await this.#q(async o=>{let a=Mu(e,o.folderName,this.gitRepoContexts[0]?.folderName);if(!a)return this.#r.warn(`No commit found for ${o.folderName}, skipping reset`),{skipped:!0};await this.git(["reset","--quiet","--hard",a],{cwd:o.path}),await this.git(["clean","-fd"],{cwd:o.path});let A=await this.getCurrentCommitHash("HEAD",o.path);if(A!==a)throw new Error(`Failed to reset commit hash for ${o.folderName}: expected ${a}, got ${A}`);return{commitHash:A}})).results.filter(o=>!o.success);if(i.length>0)throw new Error(`Failed to reset ${i.length} repos`);let s=If(e,this.gitRepoContexts[0]?.folderName);this.#N={...this.#N,...s},await this.#x(),r&&this.requestRefresh()}async resetToCommitHash(e,r=!0){let n=If(e,this.gitRepoContexts[0]?.folderName),i=Object.keys(n).length===0?e:uo(n);return this.resetToCommitSnapshot(i,r)}async restore({location:e,predicate:r,revert:n=!1,dryRun:i=!1,forceReplay:s=!1,debug:o}){let a=this.getSessionContext(),A=a.turns.length,c=null;for(let p=A-1;p>=-1;p--)if(r(p>=0?a.turns[p]:null,p)){c=p;break}if(c===null)return{undone:null,message:"Could not find the target to restore to, the completion id could be wrong"};n||await this.abort({cleanCurrentMessage:!0});let u=new Map,l=!!this.#I,d=a.turns,g=Math.max(0,e==="before"?c:c+1);for(let p=d.length-1;p>=g;p--){let f=d[p];for(let m of f.applyResults)u.set(m.filePath,m.oldContent??"")}if(!i){let p;if(l){c===-1?a.beforeCommit?p=a.beforeCommit:d.length>0&&(p=d[0].beforeCommit):c<d.length&&(e==="after"?(p=d[c].afterCommit,!p&&c+1<d.length&&(p=d[c+1].beforeCommit)):p=d[c].beforeCommit);let I={commitSnapshot:p,sessionId:a.sessionId,sessionBeforeCommit:a.beforeCommit,turnsLength:d.length,targetIndex:c,currentTurn:d[d.length-1],targetTurn:d[c],targetTurnNext:d[c+1],location:e,forceReplay:s,dryRun:i,debug:o};if(!p)return this.#e.Sentry?.captureException(new Error("No commit snapshot found for restore"),{tags:{operation:"codegen-git",endpoint:"revertToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Could not find the target to restore to, the git history is missing"};try{n?await this.revertToCommitSnapshot(p):await this.resetToCommitSnapshot(p)}catch(B){return this.#e.Sentry?.captureException(new Error("Error resetting git",{cause:B}),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Failed to reset/restore, the file history is missing"}}}else for(let[I,B]of u.entries())try{B?await this.writeFile(I,B):await this.deleteFile(I)}catch{}if(n)return{undone:[],message:"The revert operation was successful"};let f=d.splice(g,d.length-g),m=yA(d);m&&m?.afterCommit!==p&&(this.#e.Sentry?.captureException(new Error("Reset After commit snapshot mismatch"),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},extra:{lastTurn:m,commitSnapshot:p}}),m.lastCommit=p,await this.#Ce({completionId:m.completionId,lastCommit:p}));let C=m?.completionId;if(f.length>0&&(await vO(this.#e,this.#a,{lastCompletionId:C,sessionId:a.sessionId},!!this.#A),a.updatedUnixTime=Date.now()),s){let I=a.state;this.#g.emit("step",{type:"batch",steps:[{type:"state",newState:"replay",abortable:!1,previousState:I},...this.#Ht(),{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e},{type:"state",newState:I,abortable:!1,previousState:"replay"}]})}else f.length>0&&this.#g.emit("step",{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e})}return await this.#Gt(),{undone:Array.from(u.keys()),message:"The restore operation was successful"}}async#Gt(e){return await this.#h?.ensureDevCommand(e)}async restoreFromCompletionId({location:e,completionId:r,forceReplay:n}){let i=this.getSessionContext();return i.turns.find(o=>o.completionId===r)?this.restore({location:e,predicate:o=>o?.completionId===r,forceReplay:n,debug:`restore to: ${r}`}):(await this.#Be,i.turns=[],i.canLoadMore=!0,await vO(this.#e,this.#a,{sessionId:i.sessionId,lastCompletionId:r},!!this.#A),await this.loadMoreTurns(),this.restore({location:e,predicate:()=>!0,forceReplay:!0,debug:"restore after history"}))}async restoreBeforeCompletionId(e){return this.restoreFromCompletionId({location:"before",completionId:e,forceReplay:!1})}async undoLastUserMessage(e=!1){return this.restore({location:"before",predicate:r=>r?.user.role==="user",dryRun:e})}getLastUserCompletionId(){let e=this.getSessionContext();return Age(e)?.completionId}getLastCompletionId(){let e=this.getSessionContext();return bO(e)?.completionId}getCurrentState(){return this.getSessionContext().state}getLastApplyResultsTurn(){let e=this.getSessionContext();return cge(e)}getLastTurn(){let e=this.getSessionContext();return bO(e)}getLastMessage(){return this.getLastTurn()?.actions.find(r=>r.type==="text")?.content}getNextUrl(){return this.getLastTurn()?.nextUrl}async sendFeedback(e){if(process.env.NODE_ENV==="test")return;if(e.feedbackSentiment){let n=e.feedbackSentiment==="positive"?`User provided positive feedback (thumbs up) on the previous completion.${e.feedbackText??""}`:`User provided negative feedback (thumbs down) on the previous completion.${e.feedbackText??""}`;this.queueSystemReminder({text:n,tag:"reminder:user-feedback"})}Pt("quality code feedback given",{spaceId:this.#a.builderPublicKey,sentiment:e.feedbackSentiment,mode:"cli"});let r=e.id??this.getLastCompletionId();r&&await this.#hr({...e,id:r})}#Ce(e){let r=e.completionId;if(!r){let i=this.getLastTurn();i&&e.lastCommit&&(i.lastCommit=e.lastCommit),r=i?.completionId}let n=SO(this.#e,this.#a,"/codegen/finalize",{completionId:r,projectId:this.#u?.projectId,branchName:this.#u?.branchName,userCompletionId:this.getLastUserCompletionId(),sessionId:this.getSessionId(),metadata:this.#O,hasPlanToApply:this.#fe,...e},this.#A);return this.#kt&&this.#fr(),this.#U(n,"completionFinalize")}#fr(){try{let e=this.#e.getCwdDir(),r=this.getSessionId();if(this.#ct){h_(this.#e,e,r).catch(()=>{});return}let n=I0(this.#e,e).then(i=>{if(i.some(l=>l.sessionId===r)){this.#ct=!0,h_(this.#e,e,r).catch(()=>{});return}let s=this.getSessionContext().turns,o=s[s.length-1],a=o?.title,A=a&&a!=="Untitled"&&!a.startsWith("completionId:"),c=o?.userMessage?.displayPrompt??o?.userMessage?.userPrompt??"",u=A?a:ooe(c);return soe(this.#e,e,r,u).then(()=>{this.#ct=!0})}).catch(()=>{});this.#U(n,"saveLocalHistory")}catch{}}#hr(e){let r=SO(this.#e,this.#a,"/codegen/feedback",e,this.#A);return this.#U(r,"completionFeedback")}#_(e,r,n={}){this.#h?.emitter.emit("metrics",{durations:[{key:e,ms:r,attributes:n}]})}#U(e,r,n=!1){let i=Ca();this.#r.debug(`(addToPendingPromises-${i}): adding ${r} (blocking: ${n})`),this.#le.push(e),n&&this.#Je.push(e);let s=new Error(`Deadlock detected in codegen (function: ${r})`),o=setTimeout(()=>{this.#e.Sentry?.captureException(s,{level:"fatal",tags:{operation:"codegen-stream",functionName:r,sessionId:this.getSessionId(),projectId:this.#E,branchName:this.#y}})},300*1e3);return e.finally(()=>{clearTimeout(o),this.#r.debug(`(addToPendingPromises-${i}): removing ${r} (blocking: ${n})`);let a=this.#Je.indexOf(e);a!==-1&&this.#Je.splice(a,1);let A=this.#le.indexOf(e);A!==-1&&this.#le.splice(A,1)})}async lastTurnHasChanges(){let e=await this.undoLastUserMessage(!0);return e.undone?e.undone.length>0:!1}#$(e){let r=this.getSessionContext(),n=r.state;return n!==e?(r.state=e,this.#g.emit("step",{type:"state",abortable:e==="generating",previousState:n,newState:e}),!0):!1}waitUntilState(e,r=1e4){return new Promise(n=>{if(this.getSessionContext().state===e){n();return}let s,o=a=>{a.type==="state"&&a.newState===e&&(clearTimeout(s),this.#g.removeListener("step",o),n())};s=setTimeout(()=>{this.#g.removeListener("step",o),n()},r),this.#g.on("step",o)})}getProxyConfig(){return Lne({devServerUrl:this.#u?.serverUrl,proxyOrigin:this.#Oe,proxyDefaultOrigin:this.#Ke,proxyDestination:this.#xt})}async clearSession(){this.#r.debug("(clearSession): clearing session"),await this.abort({cleanCurrentMessage:!0,flushMessageQueue:!1});let e=this.getSessionContext();e.turns=[],e.customInstructions=await this.#Re(),e.customAgents=await this.#Xe(),this.#j.length=0,this.#rt=!1,this.#O={},this.#ee=void 0,this.#Pe=!1,this.#$e=0,this.#pe=null,this.#qe=[],this.clearMessageQueue(!1),this.queueGitStatusReminder({trigger:"session-start"}),this.#g.emit("step",this.#Kt())}async clearMessageQueue(e=!1){let r=[],n=this.getSessionMode();if(e)for(let i of this.#t)i.user&&r.push({type:"user",previousId:this.getLastCompletionId(),displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey,sessionMode:i.sessionMode??n});this.#t.length=0,this.#Ne(),r.length>0&&this.#g.emit("step",{type:"batch",steps:r})}updateMessage(e){if(e.type==="delete"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&this.#t.splice(r,1)}else if(e.type==="move"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&yge(this.#t,r,r+e.delta)}this.#Ne()}async flushMessageQueue(){this.#r.debug("(flushMessageQueue): flushing message queue"),await this.abort({cleanCurrentMessage:!1,flushMessageQueue:!0}),this.#s&&this.#s()}#Ot(e){let r=e.idempotencyKey;if(r){let n=this.#t.findIndex(i=>i.idempotencyKey===r);if(n>=0)return this.#t[n]=e,!1}else e.idempotencyKey=(0,nS.randomUUID)();if(e.queue==null&&(e.queue=!0),e.user?e.user={...this.#ee,...e.user}:e.user=this.#ee,e.userPrompt==="___BROWSER_AUTOMATION_PROMPT___"){let n=this.getProxyConfig();e.userPrompt=aoe(n.proxyDefaultOrigin,this.#be||void 0)}return this.#o.coalesce==="replace-latest"&&(this.#t.length=0),this.#t.push(e),!0}async sendMessage(e){this.#Pe=!1;let r=this.#o.schedule,n=une(r)&&(this.#c!==void 0||this.#i!==void 0);if(r==="interrupt-clear"&&(this.#r.debug("(sendMessage): interrupt-clear schedule \u2014 clearing session"),await this.clearSession()),n&&r==="interrupt-replace"){this.#r.debug("(sendMessage): interrupt-replace schedule \u2014 undoing last user message"),await this.undoLastUserMessage();let o=Array.isArray(e)?e:[e];for(let a of o)a.dropAbortedPrompt=!0}let i=0;if(Array.isArray(e))for(let o of e)this.#Ot(o)&&i++;else this.#Ot(e)&&i++;if(i===0)return null;this.#r.debug(`(sendMessage): added messages(${i}) to queue(${this.#t.length})`),this.#Ne();let s=this.#t[this.#t.length-1];return s?(this.cancelAllPendingToolFulfilments(s.userPrompt),n&&this.#c&&(this.#r.debug(`(sendMessage): ${r} \u2014 aborting current run`),this.#c.abort(),this.#c=void 0),s.queue?this.#s&&this.#s():await this.flushMessageQueue(),await Nu(),s.idempotencyKey):null}#mr(){if(this.#o.schedule==="until-idle")return;let e=this.#t;if(e.length===0)return;let r;switch(this.#o.coalesce){case"preserve-order":r=[e[0]];break;case"replace-latest":r=[e[e.length-1]];break;default:r=e.slice();break}for(let n of r)if(n.systemReminders)for(let i of n.systemReminders)this.queueSystemReminder(i);return this.#i=xO(r),this.#ee=this.#i.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.#o.coalesce==="preserve-order"?(this.#t.shift(),this.#Ne()):this.clearMessageQueue(!0),this.#i}#Cr(){let e=this.#t.length===0||this.#Pe,r=new Promise(n=>{e?this.#s=n:n()}).then(()=>{let n=this.#t;if(n.length===0)return;if(this.#o.coalesce!=="merge"){let s=this.#o.coalesce==="replace-latest"?n.pop():n.shift();if(this.#o.coalesce==="replace-latest"&&(this.#t.length=0),s.user&&!s.forceCompact){this.#ee=s.user;let o=this.getSessionMode();this.#g.emit("step",{type:"user",previousId:this.getLastCompletionId(),displayPrompt:s.displayPrompt,user:s.user,role:s.user.role,compacting:!1,idempotencyKey:s.idempotencyKey,sessionMode:s.sessionMode??o})}if(s.systemReminders)for(let o of s.systemReminders)this.queueSystemReminder(o);return this.#i=s,this.#ee=s.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.#Ne(),s}for(let s of n)if(s.systemReminders)for(let o of s.systemReminders)this.queueSystemReminder(o);let i=xO(n);if(!i.dropAbortedPrompt&&this.#i){let s=i.idempotencyKey;i=LO(this.#i,i),i.idempotencyKey=s}return this.clearMessageQueue(!0),this.#i=i,this.#ee=i.user,i});return{shouldWait:e,promise:r}}#Ne(){this.#g.emit("step",{type:"message-queue",queue:this.#t.map(e=>({idempotencyKey:e.idempotencyKey,displayPrompt:e.displayPrompt,user:e.user}))})}#mt(e,r=!1){r&&(this.#O={}),Object.assign(this.#O,e),this.#g.emit("step",{type:"metadata",...this.#O})}async waitForSetupCommand(e){let r=this.#h;if(!r)return{state:"installed",shouldProceed:!0};if(r.setupState==="installing")try{await cc(r.setupCommandPromise,e)}catch{}let n=r.setupState;return n==="not-installed"||n==="install-failed"||n==="install-aborted"?{state:n,shouldProceed:!0}:{state:"installed",shouldProceed:!0}}async waitForDevServer(e,r,n){if(!this.#h&&this.#u?.serverUrl)return{shouldProceed:!0,message:"Dev server is ready.",serverUrl:this.#u.serverUrl};let i=await this.waitForSetupCommand(e);if(!i.shouldProceed)return{shouldProceed:!1,message:`Project setup command did not completed. State: ${i.state}`};let s=this.#h;if(s){await s.ensureDevCommand(e);let o=await s.waitUntilServer(e,r,n);return o.ok?{shouldProceed:!0,message:"Dev server is ready.",serverUrl:s.serverUrl?.toString()}:{shouldProceed:!1,message:o.message,serverUrl:void 0}}return{shouldProceed:!1,message:"Dev server is not ready.",serverUrl:void 0}}async getNamedAgentConfig(e,r,n){let i=this.getSessionContext(),s=i.customAgents,o=e?s.find(G=>G.name.toLowerCase()===e.toLowerCase()):void 0,a=o?.name??"explorer",{mcpServers:A=!1,model:c,systemPrompt:u,subagent_type:l,includeMemories:d,needDevServer:g,needValidation:p,queueMode:f,asyncSubAgents:m,resetAfterRun:C=!1,reasoning:I,softContextWindow:B,maxTimeoutMs:E}={mcpServers:o?.mcpServers,subagent_type:a,systemPrompt:o?.systemPrompt,softContextWindow:o?.softContextWindow,model:(()=>{let G=o?.name??a,$=G?this.#Ae?.[G]:void 0;if(typeof $=="string")return $;if(Array.isArray($)&&$.length){let W=G,K=this.#ge.get(W)??0;return this.#ge.set(W,K+1),$[K%$.length]}if(o?.roundRobinModels?.length){let W=o.name,K=this.#ge.get(W)??0;return this.#ge.set(W,K+1),o.roundRobinModels[K%o.roundRobinModels.length]}return o?.model})(),includeMemories:o?.includeMemories,needDevServer:o?.needDevServer,needValidation:o?.needValidation,resetAfterRun:o?.resetAfterRun,queueMode:o?.queueBehavior??o?.queueMode,asyncSubAgents:o?.asyncSubAgents,reasoning:o?.reasoning??this.#at,maxTimeoutMs:o?.maxTimeoutMs},y=(this.#D??[]).filter(G=>G!=="Agent");y.includes("ExplorationMetadata")||y.push("ExplorationMetadata");let Q=DO(this.#u,o?.tools??y),b=c,D=this.#h;if(g&&n){if(!D)return{success:!1,response:`The ${l} agent can not be used on this session. Do no try again.`};if(D.httpServerState.state==="stopped"||D.httpServerState.state==="connecting"||D.httpServerState.state==="error-fetch")try{if(D.state==="not-installed")throw new Error(`The ${l} agent can not be used until the setupCommand finish successfully. However, the dev server is not installed.`);if(D.state==="install-failed")throw new Error(`The ${l} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it failed.`);if(D.state==="install-aborted")throw new Error(`The ${l} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it was aborted.`);await this.waitForSetupCommand(n),await D.ensureDevCommand(n)}catch($){return{success:!1,response:$ instanceof Error?$.message:String($)}}if(p&&D.validateCommand&&this.#re){let $=await D.runValidateCommand(void 0,n);if($.status==="failure")return{success:!1,response:`The Agent could not start yet, because the validate command failed:
|
|
1896
1896
|
<command>
|
|
1897
1897
|
${$.command}
|
|
1898
1898
|
</command>
|
|
@@ -1901,7 +1901,7 @@ ${$.output}
|
|
|
1901
1901
|
</logs>
|
|
1902
1902
|
|
|
1903
1903
|
Make the necessary changes and try again.`};if($.status==="aborted")return{success:!1,response:"The Agent could not start yet, because the validate command was aborted by the user."};this.#re=!1}let G=await this.waitForDevServer(n);if(!G.shouldProceed)return{success:!1,response:G.message}}let F=this.#m.replace(/-agent$/,""),S={},x=a==="browser-testing",U,j;if(Q.includes("mcp:chrome")){let G=await this.#Ir(r,n,{recordReplay:x});if(G?.wsUrl)x&&(U=G.uuid),j=G.disconnectUrl,S.chrome={command:"npx",args:["-y","chrome-devtools-mcp@latest","--wsEndpoint",G.wsUrl],retries:5};else{let $=["mcp:chrome","RecordFrame"];for(let W of $){let K=Q.indexOf(W);K!==-1&&Q.splice(K,1)}this.#r.debug("Chrome MCP not available \u2014 browser tools removed from agent")}}let H=["## Workspace Context","",`**Bash tool Working Directory:** ${this.#v}`,"","**Git Repositories:**",...this.#f.map(G=>`- repository: ${G.repoName} in folder: ${G.folderName}`)].join(`
|
|
1904
|
-
`),P=u?o0(u,{cwd:this.#v,env:{...D?.envVars??process.env,FUSION_CONTEXT:H,FUSION_TEST_PROMPT:this.#u?.browserAutomationInstructions??"",...Tse(i.customAgents)},allowedCommands:Pw(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}):void 0;return{success:!0,subagent_type:l,resetAfterRun:C,replayId:U,browserDisconnectUrl:j,maxTimeoutMs:E,options:{sys:this.#e,credentials:this.#a,position:o?.position??`${F}-${a}`,softContextWindow:B,includeMemories:d,modelOverride:_u(b)??this.#Ft??this.#Y,agentModelOverrides:this.#Ae,sessionOrCompletionId:r,workingDirectory:this.#d,mcpServers:A,fusionStatusMonitor:this.#nt,autoImportLocalMCPs:!1,fusionConfig:this.#u,privacyMode:this.#
|
|
1904
|
+
`),P=u?o0(u,{cwd:this.#v,env:{...D?.envVars??process.env,FUSION_CONTEXT:H,FUSION_TEST_PROMPT:this.#u?.browserAutomationInstructions??"",...Tse(i.customAgents)},allowedCommands:Pw(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}):void 0;return{success:!0,subagent_type:l,resetAfterRun:C,replayId:U,browserDisconnectUrl:j,maxTimeoutMs:E,options:{sys:this.#e,credentials:this.#a,position:o?.position??`${F}-${a}`,softContextWindow:B,includeMemories:d,modelOverride:_u(b)??this.#Ft??this.#Y,agentModelOverrides:this.#Ae,sessionOrCompletionId:r,workingDirectory:this.#d,mcpServers:A,fusionStatusMonitor:this.#nt,autoImportLocalMCPs:!1,fusionConfig:this.#u,privacyMode:this.#P,enabledTools:Q,builtInMCPServerConfig:S,builtInCustomAgents:this.#Le,systemPromptOverride:P,queueMode:f,asyncSubAgents:m,reasoning:I,defaultSyncChanges:o?.defaultSyncChanges,devServerOrchestrator:Q.includes("DevServerLogs")||Q.includes("DevServerRestart")||Q.includes("DevServerControl")||Q.includes("ProposeEnvVariable")?this.#h:void 0}}}async spawnNamedAgent(e,r){let n=r.resume??r.sessionId,i=await this.getNamedAgentConfig(e,n,r.signal);if(!i.success)return this.#r.debug(`(spawnNamedAgent) failed to resolve config for "${e}": ${i.response}`),{success:!1,response:i.response};this.#r.debug(`(spawnNamedAgent) spawning "${i.subagent_type}" (sessionId=${n}), tools=${(i.options.enabledTools??[]).join(",")}, resetAfterRun=${i.resetAfterRun}`),await this.waitUntilBlockingPendingPromises(),await this.#ne(!0);let s;if(i.resetAfterRun){if(this.#I&&!await this.#Et())return{success:!1,response:`Cannot run browser automation with uncommitted changes. The "${i.subagent_type}" agent modifies code during testing and automatically resets changes afterward. Your uncommitted changes would be permanently lost.
|
|
1905
1905
|
|
|
1906
1906
|
Please commit or stash your changes first, then try again.`};s=(await this.#x())?.currentCommit}let o=i.subagent_type,a=new t({...i.options,git:!1,parentSessionId:this.getSessionId(),mainSessionId:this.getMainSessionId()}),A=r.sessionId??r.resume??n,c=Promise.withResolvers();this.#je.set(A,{description:r.prompt.substring(0,200),startedAt:Date.now(),promise:c.promise});let u=!1,l=W=>{u||(u=!0,c.resolve(W))},d=new AbortController,g=En([r.signal,d.signal]);await a.initializeSession({skipSessionLoading:!r.resume,signal:g}),r.resume&&i.options.builtInMCPServerConfig?.chrome&&a.queueSystemReminder({text:"The connected browser might have restarted. This means cookies and open pages might have been cleared."});let p=a.getSessionId(),f={important_files:[]},m=new pI(p,{framesDir:this.#e.join(rS.default.homedir(),".builder","recordings"),debug:this.#A}),C,I=()=>{C||!i.replayId||(C=new zb({credentials:this.#a,replayId:i.replayId,debug:this.#A}),m.setReplayUploader(C))};a.setTimeline(m);let B=W=>{let K=m.readState(),J=new Map;for(let O of K)O.kind==="test_outcome"&&O.status==="accepted"&&O.test_case_id&&J.set(O.test_case_id,O);return{success:!1,response:`Agent finalized from disk (${W}): ${J.size} test case(s) recovered`}},E=Stt(i.maxTimeoutMs),y=setTimeout(()=>{u||(this.#r.warn(`[${o}] Agent max timeout fired after ${E/1e3}s \u2014 aborting agent`),d.abort(),l(B("watchdog_timeout")))},E),Q=[],b={value:null},D=[],F={value:null},x=[...r.prompt.matchAll(/###\s+(TC-\d+)[:\s]+([^\n]*)/g)].map(W=>({id:W[1],title:W[2].trim(),description:W[2].trim(),expected_outcome:"",priority:"high"}));x.length>0&&(F.value={mode:"extracted-from-prompt",test_cases:x});let U=[],j=r.maxCompletions,H=0,P=a.connectToEventLoop(!1,W=>{try{if(W.type==="tool_result"&&W.result.tool_name==="ExplorationMetadata"&&typeof W.result.content=="string")try{f=JSON.parse(W.result.content)}catch(K){this.#e.Sentry?.captureException(K,{extra:{contentPreview:W.result.content.substring(0,500),contentLength:W.result.content.length},tags:{operation:"exploration-metadata-parse"}})}else{if(W.type==="done"&&(j--,j<10)){let K="";if(F.value){let J=new Set(U.map(te=>te.test_case_id)),O=F.value.test_cases.filter(te=>!J.has(te.id));O.length>0&&(K=` You have ${O.length} unreported test cases: ${O.map(te=>te.id).join(", ")}. Report them as "couldnt_verify" with failure_category="timeout" if you cannot test them.`)}a.queueSystemReminder({text:`The agent has been working for a while. Please try to wrap up soon because soon it will be interrupted. T-minus ${j} turns.${K}`})}this.#g.emit("step",{type:"agent",id:p,step:W,subagent_type:o})}if(W.type==="tool"&&(m.onToolCall(W.name,W.content),W.name==="mcp__chrome__navigate_page"&&I()),W.type==="thinking"&&(m.onThinking(W.content),C&&typeof W.content=="string"&&C.recordReasoning(W.content)),W.type==="text"&&C&&C.recordText(W.content),W.type==="tool_result"){let K=m.getFrameCount();if(K>H&&(H=K,this.#mt({timeline_progress:m.getProgressSnapshot()},!1)),W.result.tool_name==="ReportUIIssue")try{let J=JSON.parse(W.result.tool_input||"{}");J.title&&J.description&&Q.push({title:J.title,description:J.description,debugInfo:J.debugInfo})}catch{}if(W.result.tool_name==="ReportTestOutcome")try{let J=JSON.parse(W.result.tool_input||"{}");if(J.test_case_id){let O=F.value&&!F.value.test_cases.some(ge=>ge.id===J.test_case_id);O&&a.queueSystemReminder({text:`WARNING: "${J.test_case_id}" is not in your registered test plan. Use one of: ${F.value.test_cases.map(ge=>ge.id).join(", ")}`,tag:"reminder:unknown-test-case"});let te=!!O;if(J.outcome==="succeeded"&&(!J.evidence_frame_count||J.evidence_frame_count<1)&&(a.queueSystemReminder({text:`REJECTED: You reported "${J.test_case_id}" as "succeeded" but evidence_frame_count is ${J.evidence_frame_count??0}. A test case CANNOT be "succeeded" without visual evidence. Take a screenshot, call RecordFrame, then re-report this test case with evidence_frame_count >= 1. If you cannot get visual evidence, report as "couldnt_verify" instead.`,tag:"reminder:evidence-required"}),te=!0),J.outcome!=="succeeded"&&J.outcome!=="other"&&!J.failure_category&&(a.queueSystemReminder({text:`WARNING: "${J.test_case_id}" reported as "${J.outcome}" without failure_category. Re-report with a failure_category (env_issue, creds_missing, needs_user_input, server_not_ready, feature_not_reachable, timeout, assertion_failed, unexpected_error, not_applicable).`,tag:"reminder:failure-category-required"}),te=!0),!te){let ge=U.findIndex(ce=>ce.test_case_id===J.test_case_id),Ce={...J,timestamp:Date.now()};if(ge!==-1?U[ge]=Ce:U.push(Ce),F.value){let ce=new Set(U.map(we=>we.test_case_id)),Z=F.value.test_cases.filter(we=>!ce.has(we.id));Z.length>0&&a.queueSystemReminder({text:`Progress: ${U.length}/${F.value.test_cases.length} test cases reported. Remaining: ${Z.map(we=>we.id).join(", ")}`,tag:"reminder:test-progress"})}}}else if(J.outcome&&J.summary&&(b.value={outcome:J.outcome,summary:J.summary,details:J.details}),F.value){let O=new Set(U.map(ge=>ge.test_case_id)),te=F.value.test_cases.filter(ge=>!O.has(ge.id)).map(ge=>ge.id);te.length>0&&a.queueSystemReminder({text:`WARNING: ${te.length} test cases unreported: ${te.join(", ")}. Call ReportTestOutcome with test_case_id for each remaining case before the final summary.`,tag:"reminder:missing-test-cases"})}}catch{}if(W.result.tool_name==="ReportIssue"){let J=W.result.tool_input||"{}";try{let O=JSON.parse(J),te=[];O.file_path||te.push("file_path"),O.line||te.push("line"),O.title||te.push("title"),O.severity||te.push("severity"),O.body||te.push("body"),te.length>0?this.#e.Sentry?.captureException(new Error(`ReportIssue tool call missing required fields: ${te.join(", ")}`),{level:"error",tags:{tool:"ReportIssue",reason:"missing_fields"},extra:{rawInput:J,missingFields:te}}):O.severity!=="high"&&O.severity!=="medium"&&O.severity!=="low"?this.#e.Sentry?.captureException(new Error(`ReportIssue tool call had invalid severity: ${String(O.severity)}`),{level:"error",tags:{tool:"ReportIssue",reason:"invalid_severity"},extra:{rawInput:J}}):D.push({file_path:O.file_path,line:O.line,...O.start_line?{start_line:O.start_line}:{},title:O.title,severity:O.severity,body:O.body})}catch(O){this.#e.Sentry?.captureException(new Error("ReportIssue tool call had invalid JSON input",{cause:O}),{level:"error",tags:{tool:"ReportIssue",reason:"invalid_json"},extra:{rawInput:J}})}}}}catch{}}),G=async()=>{if(P(),C)try{await C.close()}catch{}if(i.browserDisconnectUrl)try{let W=new AbortController,K=setTimeout(()=>W.abort(),2e3);await fetch(i.browserDisconnectUrl,{method:"POST",signal:W.signal,keepalive:!0}).finally(()=>clearTimeout(K))}catch{}await a.close(!1)};if(r.signal?.aborted){await G(),this.#je.delete(A),clearTimeout(y);let W={success:!1,response:"Agent task aborted"};return l(W),W}let $=async()=>{await G()};g.addEventListener("abort",$);try{let W=r.attachmentUrls?.map(ce=>({type:"url",value:ce}));await a.sendMessage({userPrompt:r.prompt,user:r.user,maxCompletions:r.maxCompletions,category:"background-subagent",includeRelevantMemories:i.options.includeMemories,queue:!0,...W?.length&&{attachments:W}}),await a.waitUntilIdle(g);let K=a.getLastTurn();if(!K){let ce=B("no_last_turn");return l(ce),ce}let J=K.actions.filter(ce=>ce.type==="text").map(ce=>ce.content).join(`
|
|
1907
1907
|
`),O=m.getMergedTestCaseResults();if(O.length>0)for(let ce of O){if(!ce.test_case_id){U.push(ce);continue}let Z=U.findIndex(be=>be.test_case_id===ce.test_case_id);if(Z===-1){U.push(ce);continue}let we=U[Z],Xe=Number(we.timestamp??we.ts??0);Number(ce.timestamp??ce.ts??Date.now())>=Xe&&(U[Z]=ce)}let te=m.getMergedTestPlan()??F.value;te&&(J=`<browser_automation_test_plan>${JSON.stringify(te,null,2)}</browser_automation_test_plan>
|
|
@@ -1911,9 +1911,9 @@ ${J}`),Q.length>0&&(J=`<browser_automation_ui_issues>${JSON.stringify(Q,null,2)}
|
|
|
1911
1911
|
<browser_automation_recorded_frames>${JSON.stringify(Ct)}</browser_automation_recorded_frames>
|
|
1912
1912
|
|
|
1913
1913
|
${J}`}}this.#mt({gif_id:f.gif_id,gif_frames:we,timeline_id:pe,recording_id:f.recording_id,...i.replayId?{replay_id:i.replayId,replay_url:`${Te}/replay/${i.replayId}`}:{}},!1)}catch(ce){this.#r.warn(`[${o}] Failed to generate recording (non-critical): ${ce instanceof Error?ce.message:String(ce)}`),this.#e.Sentry?.captureException(ce,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages",subagent_type:o},extra:{sessionId:a.getSessionId(),frameCount:m.getFrameCount()}})}let Ce={success:!0,response:J,metadata:f,sessionId:p,lastTurn:K};return l(Ce),Ce}catch(W){let K={success:!1,response:`Agent task failed: ${W instanceof Error?W.message:String(W)}`,metadata:{important_files:[]}};return l(K),K}finally{u||l(B("finally_safety_net")),clearTimeout(y),this.#je.delete(A),g.removeEventListener("abort",$);try{await G()}catch(W){this.#r.warn(`[${o}] Cleanup failed: ${W instanceof Error?W.message:String(W)}`)}if(i.resetAfterRun&&s)try{await this.resetToCommitHash(s,!1)}catch(W){this.#r.warn(`[${o}] Failed to reset changes: ${W instanceof Error?W.message:String(W)}`)}}}getRunningSubAgents(){return Array.from(this.#je.entries()).map(([e,r])=>({id:e,description:r.description,startedAt:r.startedAt}))}canHandleTool(e){let n=(this.#H.get(e)??0)>0,i=this.#W.has(e);return n||i}setSessionCanHandleTools(e){for(let r of e)this.#W.add(r)}clearSessionCanHandleTools(){this.#W.clear()}setProxyOrigin(e,r){if(e!==this.#Oe||r!==this.#Ke){this.#Oe=e,this.#Ke=r;let n=this.getProxyConfig();n.proxyDestination&&n.proxyDefaultOrigin&&this.queueSystemReminder({text:`The dev server is running at ${n.proxyDefaultOrigin}. e.g. for taking screenshots of a "/foo" route take a screenshot of ${n.proxyDefaultOrigin}/foo`,tag:"reminder:url"})}}async#Ir(e,r,n){let i=this.getProxyConfig();if(i.proxyOrigin&&!i.proxyDestination)return;let s=await QA(this.#a,"/codegen/get-browser-connection",{sessionId:e,projectId:this.#E,branchName:this.#y,proxyOrigin:i.proxyOrigin,proxyDefaultOrigin:i.proxyDefaultOrigin,proxyDst:i.proxyDestination,recordReplay:n?.recordReplay===!0},{signal:r,debug:this.#A});if(typeof s?.wsUrl=="string")return{wsUrl:s.wsUrl,uuid:s.uuid,disconnectUrl:s.disconnectUrl}}getTurns(){let e=this.getSessionContext();return structuredClone(e.turns)}getSessionContext(){if(!this.#n)throw new Error("Session context not initialized");return this.#n}async runSetupCommand(){return await this.#h?.runSetupCommand()}abortSetupCommand(){return this.#h?.abortSetupCommand()}abortValidateCommand(){return this.#h?.abortValidateCommand()}toolsRunning(){return this.#z.length>0}abortAllTools(){for(let e of this.#z)e.abortController.abort()}toolFullfilment(e,r){return typeof r=="string"&&(r={toolResult:r,isError:!1}),this.fulfillToolCall(e,r)}cancelAllPendingToolFulfilments(e){for(let[r,n]of Array.from(this.#te.entries()))n.messageValid&&e?this.fulfillToolCall(r,{toolResult:"The user answered with a follow-up message (see the next user message in the conversation).",isError:!1,title:"Resolved by user message"}):this.fulfillToolCall(r,{toolResult:"Aborted by the user. So the task could not be completed.",isError:!0,title:"Aborted by the user."});this.#te.clear()}fulfillToolCall(e,r){let n=this.#te.get(e);return n?(n.resolve(r),this.#te.delete(e),!0):!1}abortToolCall(e,r){let n=this.#z.find(s=>s.id===e),i=tn(r??"The user manually aborted the tool call.");if(n)return n.abortController.abort(i),!0;if(this.#z.length===0){let s=new AbortController;return s.abort(i),this.#z.push({id:e,abortController:s,input:{id:e},name:"Bash"}),!0}return!1}async acceptCode(){if(this.#It()){let e=this.getLinesStats();await this.sendFeedback({position:this.#m,acceptedLines:e.net,linesOfCodeAdded:e.added,linesOfCodeRemoved:e.removed})}}async abort(e){this.#A&&this.#r.debug(`(abort): ${JSON.stringify(e)}`);let r=!1,n=!0;return typeof e=="boolean"?r=e:(r=e?.cleanCurrentMessage??!1,n=e?.flushMessageQueue??!0),r&&(this.#i=void 0,this.#$e=0,this.clearMessageQueue()),this.#Pe=!n,this.cancelAllPendingToolFulfilments(),this.#ue=0,this.#c?(this.#c.abort(),this.#c=void 0,!0):!1}async stopEventLoop(){await this.abort({cleanCurrentMessage:!0}),this.#S?.abort(),this.#S=void 0,this.#s&&this.#s()}requestRefresh(){this.#g.emit("step",{type:"builder-action",action:"refresh",metadata:{}})}async configureDevOrchestrator(e){let r=this.#h,n={devCommand:!1,hosts:!1,setupCommand:!1,proxyServer:!1,validateCommand:!1,env:!1,fileOverrides:!1,setupResult:void 0,devResult:void 0,validateResult:void 0};if(r){let i=[];if(e.env&&(e.replaceEnvs&&(r.environmentVariables.length>0&&(n.env=!0),r.clearEnvVariables()),Object.entries(e.env).forEach(([s,o])=>{r.setEnvVariable(s,o??void 0)&&(n.env=!0)}),this.queueSystemReminder({text:`The system has the following environment variables:
|
|
1914
|
-
${UD(this.#lt(),{skipCommandSecurity:this.#u?.skipCommandSecurity})}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(s=>{n.proxyServer=s.updatedProxyServer,n.hosts=s.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(s=>n.proxyServer=s)),e.fileOverrides&&(n.fileOverrides=r.setFileOverrides(e.fileOverrides)),e.setupCommand!==void 0||e.setupDependencies!==void 0?i.push(r.setSetupCommand({setupDependencies:e.setupDependencies,setupCommand:e.setupCommand,forceRestart:e.forceSetupCommand}).then(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(s=>{n.devCommand=s.status==="success",n.devResult=s??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(s=>{n.devCommand=!0,n.devResult=s??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(s=>n.proxyServer=n.proxyServer||s)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(s=>n.validateResult=s)),await Promise.allSettled(i),n.env){let s=!1;for(let o of this.#w.values())(o.state==="running"||o.state==="starting")&&(o.stale=!0,s=!0);s&&this.#me()}}return n}#Er(){for(let e of Array.from(this.#w.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#w.clear()}async#Ct(){if(this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.pendingEvents=[],this.#Q.listeners.clear(),this.#Q.watcher){try{await this.#Q.watcher.close()}catch{}this.#Q.watcher=null}}#Br(){if(this.#Q.watcher)return;let e=this.#f.map(A=>A.path),r=new Map;for(let A of this.#f)r.set(A.path,TO(A.path));let n=A=>{for(let c of this.#f)if(A.startsWith(c.path+"/")||A===c.path)return c.path;return null},i=A=>{let c=n(A);if(!c)return!1;let u=this.#e.relative(c,A).replace(/\\/g,"/");if(!u)return!1;if(this.#jt(u))return!0;let l=r.get(c);return l?l(u):!1},s,o=!1;try{s=nge.default.watch(e,{ignored:i,ignoreInitial:!0,persistent:!0,awaitWriteFinish:{stabilityThreshold:200,pollInterval:100},ignorePermissionErrors:!0,followSymlinks:!1,usePolling:!0,interval:1e3,binaryInterval:3e5,atomic:!0})}catch(A){this.#e.Sentry?.captureException(A,{tags:{operation:"global-file-watch-init"}}),this.#r.error(`Failed to initialize file watcher: ${A instanceof Error?A.message:String(A)}`),this.#r.error("File watching will be disabled. Code generation will still work but may not detect all changes automatically.");return}let a=(A,c)=>{let u=n(c),l=u?this.#e.relative(u,c).replace(/\\/g,"/"):this.#e.relative(this.primaryGitPath,c).replace(/\\/g,"/");if(this.#f.length>1&&u){let g=this.#f.find(p=>p.path===u);g&&!this.#G()&&(l=`${g.folderName}/${l}`)}let d={type:"folder-watch",watchId:"global",event:A,path:l,timestamp:Date.now()};this.#Q.pendingEvents.push(d),this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.debounceTimer=setTimeout(()=>{let g=this.#Q.pendingEvents;this.#Q.pendingEvents=[];for(let p of g)for(let f of this.#Q.listeners)try{f(p)}catch(m){this.#e.Sentry?.captureException(m)}},this.#Q.debounceMs)};s.on("add",A=>a("add",A)).on("change",A=>a("change",A)).on("unlink",A=>a("unlink",A)).on("addDir",A=>a("addDir",A)).on("unlinkDir",A=>a("unlinkDir",A)).on("error",A=>{o||(o=!0,this.#e.Sentry?.captureException(A,{tags:{operation:"global-file-watch"}}),this.#r.error(`File watcher error: ${A instanceof Error?A.message:String(A)}`),this.#r.error("Closing file watcher to prevent further errors. File watching will be disabled."),this.#Ct().catch(()=>{}))}),this.#Q.watcher=s,this.#r.debug(`Initialized global file watcher on: ${e.join(", ")}`)}subscribeToFileChanges(e){return this.#Q.listeners.size===0&&this.#Br(),this.#Q.listeners.add(e),this.#r.debug(`Subscribed to file changes(${this.#Q.listeners.size} active listeners)`),async()=>{this.#Q.listeners.delete(e),this.#r.debug(`Unsubscribed from file changes(${this.#Q.listeners.size} remaining listeners)`),this.#Q.listeners.size===0&&this.#Q.watcher&&(await this.#Ct(),this.#r.debug("Closed global file watcher (no more listeners)"))}}async tsServerInit(){try{return this.#l?{ok:!0,cwd:this.#d}:(this.#l=new b0(this.#d),this.#l.setEventHandler(e=>{for(let r of this.#Ve)r(e)}),await this.#l.start(),{ok:!0,cwd:this.#d})}catch(e){return this.#l=null,{ok:!1,error:e?.message||"Failed to start tsserver"}}}async tsServerOpenFile(e,r){this.#l&&await this.#l.openFile(e,r)}async tsServerChangeFile(e,r){this.#l&&await this.#l.changeFile(e,r)}async tsServerCloseFile(e){this.#l&&await this.#l.closeFile(e)}async tsServerGetCompletions(e,r,n,i){return this.#l?this.#l.getCompletions(e,r,n,i):{success:!1,body:null}}async tsServerGetCompletionDetails(e,r,n,i){return this.#l?this.#l.getCompletionDetails(e,r,n,i):{success:!1,body:null}}async tsServerGetDefinition(e,r,n){return this.#l?this.#l.getDefinition(e,r,n):{success:!1,body:null}}async tsServerGetTypeDefinition(e,r,n){return this.#l?this.#l.getTypeDefinition(e,r,n):{success:!1,body:null}}async tsServerGetQuickInfo(e,r,n){return this.#l?this.#l.getQuickInfo(e,r,n):{success:!1,body:null}}async tsServerGetReferences(e,r,n){return this.#l?this.#l.getReferences(e,r,n):{success:!1,body:null}}async tsServerGetSignatureHelp(e,r,n){return this.#l?this.#l.getSignatureHelp(e,r,n):{success:!1,body:null}}async tsServerRequestDiagnostics(e){this.#l&&await this.#l.requestDiagnostics(e)}async tsServerGetRenameLocations(e,r,n){return this.#l?this.#l.getRenameLocations(e,r,n):{success:!1,body:null}}async tsServerGetNavTree(e){return this.#l?this.#l.getNavTree(e):{success:!1,body:null}}async tsServerOrganizeImports(e){return this.#l?this.#l.organizeImports(e):{success:!1,body:null}}async tsServerGetInlayHints(e){return this.#l?this.#l.getInlayHints(e):{success:!1,body:null}}async tsServerGetCodeFixes(e,r,n,i,s,o){return this.#l?this.#l.getCodeFixes(e,r,n,i,s,o):{success:!1,body:null}}async tsServerGetApplicableRefactors(e,r,n,i,s){return this.#l?this.#l.getApplicableRefactors(e,r,n,i,s):{success:!1,body:null}}async tsServerGetEditsForRefactor(e,r,n,i,s,o,a){return this.#l?this.#l.getEditsForRefactor(e,r,n,i,s,o,a):{success:!1,body:null}}async tsServerGetImplementation(e,r,n){return this.#l?this.#l.getImplementation(e,r,n):{success:!1,body:null}}async tsServerGetSelectionRange(e,r){return this.#l?this.#l.getSelectionRange(e,r):{success:!1,body:null}}async tsServerGetLinkedEditingRange(e,r,n){return this.#l?this.#l.getLinkedEditingRange(e,r,n):{success:!1,body:null}}async tsServerGetFormatRange(e,r,n,i,s){return this.#l?this.#l.getFormatRange(e,r,n,i,s):{success:!1,body:null}}subscribeToDiagnostics(e){return this.#Ve.add(e),()=>{this.#Ve.delete(e)}}async close(e=!1){if(!this.#Ge){if(this.#Ge=!0,this.#p&&(delete process.env.DEBUG,this.#p=!1),this.#Me.forEach(r=>r()),this.#Er(),await this.#Ct(),this.#l&&(this.#l.dispose(),this.#l=null),this.#Ve.clear(),this.#Qe)try{this.#r.debug("Cleaning up local MCP servers"),await this.#Qe.cleanup()}catch(r){this.#e.Sentry?.captureException(r,{level:"warning",tags:{operation:"local-mcp-cleanup"}})}if(await this.stopEventLoop(),await this.waitUntilState("close",5e3),this.#g.removeAllListeners(),await Promise.allSettled(this.#le),e){let r=await this.needsBackup();this.#A&&this.#r.debug(`Closing code gen server: ${JSON.stringify({uploadGitBackup:e,needsBackup:r})}`),r&&await this.uploadBackup()}else this.#A&&this.#r.debug(`Closing code gen server: ${JSON.stringify({uploadGitBackup:e})}`)}}async#x(){if(this.#f.length===0||this.#Ye)return null;let r=(await this.#q(async i=>this.#Qr(i))).results.filter(i=>i.success&&i.result).map(i=>i.result);if(r.length===0)return null;for(let i of r)this.#g.emit("step",i);return this.#J=r,this.#U(this.#yr(r),"updateBranchUnpushedStatus",!1),r.some(i=>i.hasMergeConflict)&&await this.#Ie(),r[0]}async#yr(e){if(!this.#E||!this.#y||!this.#a.builderPublicKey||!this.#a.userId||!this.#a.builderPrivateKey)return;let r=e.some(n=>n.ahead>0||n.isSessionDirty);try{let n=new URL("/projects/branches",Te);n.searchParams.set("apiKey",this.#a.builderPublicKey),n.searchParams.set("userId",this.#a.userId),n.searchParams.set("projectId",this.#E),n.searchParams.set("branchName",this.#y);let i=await Re(n,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#a.builderPrivateKey}`},body:JSON.stringify({hasUnpushedChanges:r}),signal:AbortSignal.timeout(1e4)},this.#A);i.ok||this.#r.error(`Failed to update branch unpushed status: ${i.status} ${i.statusText}`,{loggerOptions:{debug:!0}})}catch(n){this.#r.error("Failed to update branch unpushed status:",n,{loggerOptions:{debug:!0}})}}async sendMessageToOrgAgent(e){try{let r=new URL("/projects/org-agent/send-message",Te);this.#a.builderPublicKey&&r.searchParams.set("apiKey",this.#a.builderPublicKey),this.#a.userId&&r.searchParams.set("userId",this.#a.userId);let n=await Re(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#a.builderPrivateKey}`},body:JSON.stringify(e),signal:AbortSignal.timeout(1e4)},this.#A),i=await n.json();return n.ok?{status:"success"}:{status:"error",error:i.error??`HTTP ${n.status}`}}catch(r){return{status:"error",error:r?.message??"Unknown error"}}}queueGitStatusReminder(e){if(this.#J.length===0||this.#
|
|
1914
|
+
${UD(this.#lt(),{skipCommandSecurity:this.#u?.skipCommandSecurity})}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(s=>{n.proxyServer=s.updatedProxyServer,n.hosts=s.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(s=>n.proxyServer=s)),e.fileOverrides&&(n.fileOverrides=r.setFileOverrides(e.fileOverrides)),e.setupCommand!==void 0||e.setupDependencies!==void 0?i.push(r.setSetupCommand({setupDependencies:e.setupDependencies,setupCommand:e.setupCommand,forceRestart:e.forceSetupCommand}).then(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(s=>{n.devCommand=s.status==="success",n.devResult=s??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(s=>{n.devCommand=!0,n.devResult=s??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(s=>n.proxyServer=n.proxyServer||s)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(s=>n.validateResult=s)),await Promise.allSettled(i),n.env){let s=!1;for(let o of this.#w.values())(o.state==="running"||o.state==="starting")&&(o.stale=!0,s=!0);s&&this.#me()}}return n}#Er(){for(let e of Array.from(this.#w.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#w.clear()}async#Ct(){if(this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.pendingEvents=[],this.#Q.listeners.clear(),this.#Q.watcher){try{await this.#Q.watcher.close()}catch{}this.#Q.watcher=null}}#Br(){if(this.#Q.watcher)return;let e=this.#f.map(A=>A.path),r=new Map;for(let A of this.#f)r.set(A.path,TO(A.path));let n=A=>{for(let c of this.#f)if(A.startsWith(c.path+"/")||A===c.path)return c.path;return null},i=A=>{let c=n(A);if(!c)return!1;let u=this.#e.relative(c,A).replace(/\\/g,"/");if(!u)return!1;if(this.#jt(u))return!0;let l=r.get(c);return l?l(u):!1},s,o=!1;try{s=nge.default.watch(e,{ignored:i,ignoreInitial:!0,persistent:!0,awaitWriteFinish:{stabilityThreshold:200,pollInterval:100},ignorePermissionErrors:!0,followSymlinks:!1,usePolling:!0,interval:1e3,binaryInterval:3e5,atomic:!0})}catch(A){this.#e.Sentry?.captureException(A,{tags:{operation:"global-file-watch-init"}}),this.#r.error(`Failed to initialize file watcher: ${A instanceof Error?A.message:String(A)}`),this.#r.error("File watching will be disabled. Code generation will still work but may not detect all changes automatically.");return}let a=(A,c)=>{let u=n(c),l=u?this.#e.relative(u,c).replace(/\\/g,"/"):this.#e.relative(this.primaryGitPath,c).replace(/\\/g,"/");if(this.#f.length>1&&u){let g=this.#f.find(p=>p.path===u);g&&!this.#G()&&(l=`${g.folderName}/${l}`)}let d={type:"folder-watch",watchId:"global",event:A,path:l,timestamp:Date.now()};this.#Q.pendingEvents.push(d),this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.debounceTimer=setTimeout(()=>{let g=this.#Q.pendingEvents;this.#Q.pendingEvents=[];for(let p of g)for(let f of this.#Q.listeners)try{f(p)}catch(m){this.#e.Sentry?.captureException(m)}},this.#Q.debounceMs)};s.on("add",A=>a("add",A)).on("change",A=>a("change",A)).on("unlink",A=>a("unlink",A)).on("addDir",A=>a("addDir",A)).on("unlinkDir",A=>a("unlinkDir",A)).on("error",A=>{o||(o=!0,this.#e.Sentry?.captureException(A,{tags:{operation:"global-file-watch"}}),this.#r.error(`File watcher error: ${A instanceof Error?A.message:String(A)}`),this.#r.error("Closing file watcher to prevent further errors. File watching will be disabled."),this.#Ct().catch(()=>{}))}),this.#Q.watcher=s,this.#r.debug(`Initialized global file watcher on: ${e.join(", ")}`)}subscribeToFileChanges(e){return this.#Q.listeners.size===0&&this.#Br(),this.#Q.listeners.add(e),this.#r.debug(`Subscribed to file changes(${this.#Q.listeners.size} active listeners)`),async()=>{this.#Q.listeners.delete(e),this.#r.debug(`Unsubscribed from file changes(${this.#Q.listeners.size} remaining listeners)`),this.#Q.listeners.size===0&&this.#Q.watcher&&(await this.#Ct(),this.#r.debug("Closed global file watcher (no more listeners)"))}}async tsServerInit(){try{return this.#l?{ok:!0,cwd:this.#d}:(this.#l=new b0(this.#d),this.#l.setEventHandler(e=>{for(let r of this.#Ve)r(e)}),await this.#l.start(),{ok:!0,cwd:this.#d})}catch(e){return this.#l=null,{ok:!1,error:e?.message||"Failed to start tsserver"}}}async tsServerOpenFile(e,r){this.#l&&await this.#l.openFile(e,r)}async tsServerChangeFile(e,r){this.#l&&await this.#l.changeFile(e,r)}async tsServerCloseFile(e){this.#l&&await this.#l.closeFile(e)}async tsServerGetCompletions(e,r,n,i){return this.#l?this.#l.getCompletions(e,r,n,i):{success:!1,body:null}}async tsServerGetCompletionDetails(e,r,n,i){return this.#l?this.#l.getCompletionDetails(e,r,n,i):{success:!1,body:null}}async tsServerGetDefinition(e,r,n){return this.#l?this.#l.getDefinition(e,r,n):{success:!1,body:null}}async tsServerGetTypeDefinition(e,r,n){return this.#l?this.#l.getTypeDefinition(e,r,n):{success:!1,body:null}}async tsServerGetQuickInfo(e,r,n){return this.#l?this.#l.getQuickInfo(e,r,n):{success:!1,body:null}}async tsServerGetReferences(e,r,n){return this.#l?this.#l.getReferences(e,r,n):{success:!1,body:null}}async tsServerGetSignatureHelp(e,r,n){return this.#l?this.#l.getSignatureHelp(e,r,n):{success:!1,body:null}}async tsServerRequestDiagnostics(e){this.#l&&await this.#l.requestDiagnostics(e)}async tsServerGetRenameLocations(e,r,n){return this.#l?this.#l.getRenameLocations(e,r,n):{success:!1,body:null}}async tsServerGetNavTree(e){return this.#l?this.#l.getNavTree(e):{success:!1,body:null}}async tsServerOrganizeImports(e){return this.#l?this.#l.organizeImports(e):{success:!1,body:null}}async tsServerGetInlayHints(e){return this.#l?this.#l.getInlayHints(e):{success:!1,body:null}}async tsServerGetCodeFixes(e,r,n,i,s,o){return this.#l?this.#l.getCodeFixes(e,r,n,i,s,o):{success:!1,body:null}}async tsServerGetApplicableRefactors(e,r,n,i,s){return this.#l?this.#l.getApplicableRefactors(e,r,n,i,s):{success:!1,body:null}}async tsServerGetEditsForRefactor(e,r,n,i,s,o,a){return this.#l?this.#l.getEditsForRefactor(e,r,n,i,s,o,a):{success:!1,body:null}}async tsServerGetImplementation(e,r,n){return this.#l?this.#l.getImplementation(e,r,n):{success:!1,body:null}}async tsServerGetSelectionRange(e,r){return this.#l?this.#l.getSelectionRange(e,r):{success:!1,body:null}}async tsServerGetLinkedEditingRange(e,r,n){return this.#l?this.#l.getLinkedEditingRange(e,r,n):{success:!1,body:null}}async tsServerGetFormatRange(e,r,n,i,s){return this.#l?this.#l.getFormatRange(e,r,n,i,s):{success:!1,body:null}}subscribeToDiagnostics(e){return this.#Ve.add(e),()=>{this.#Ve.delete(e)}}async close(e=!1){if(!this.#Ge){if(this.#Ge=!0,this.#p&&(delete process.env.DEBUG,this.#p=!1),this.#Me.forEach(r=>r()),this.#Er(),await this.#Ct(),this.#l&&(this.#l.dispose(),this.#l=null),this.#Ve.clear(),this.#Qe)try{this.#r.debug("Cleaning up local MCP servers"),await this.#Qe.cleanup()}catch(r){this.#e.Sentry?.captureException(r,{level:"warning",tags:{operation:"local-mcp-cleanup"}})}if(await this.stopEventLoop(),await this.waitUntilState("close",5e3),this.#g.removeAllListeners(),await Promise.allSettled(this.#le),e){let r=await this.needsBackup();this.#A&&this.#r.debug(`Closing code gen server: ${JSON.stringify({uploadGitBackup:e,needsBackup:r})}`),r&&await this.uploadBackup()}else this.#A&&this.#r.debug(`Closing code gen server: ${JSON.stringify({uploadGitBackup:e})}`)}}async#x(){if(this.#f.length===0||this.#Ye)return null;let r=(await this.#q(async i=>this.#Qr(i))).results.filter(i=>i.success&&i.result).map(i=>i.result);if(r.length===0)return null;for(let i of r)this.#g.emit("step",i);return this.#J=r,this.#U(this.#yr(r),"updateBranchUnpushedStatus",!1),r.some(i=>i.hasMergeConflict)&&await this.#Ie(),r[0]}async#yr(e){if(!this.#E||!this.#y||!this.#a.builderPublicKey||!this.#a.userId||!this.#a.builderPrivateKey)return;let r=e.some(n=>n.ahead>0||n.isSessionDirty);try{let n=new URL("/projects/branches",Te);n.searchParams.set("apiKey",this.#a.builderPublicKey),n.searchParams.set("userId",this.#a.userId),n.searchParams.set("projectId",this.#E),n.searchParams.set("branchName",this.#y);let i=await Re(n,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#a.builderPrivateKey}`},body:JSON.stringify({hasUnpushedChanges:r}),signal:AbortSignal.timeout(1e4)},this.#A);i.ok||this.#r.error(`Failed to update branch unpushed status: ${i.status} ${i.statusText}`,{loggerOptions:{debug:!0}})}catch(n){this.#r.error("Failed to update branch unpushed status:",n,{loggerOptions:{debug:!0}})}}async sendMessageToOrgAgent(e){try{let r=new URL("/projects/org-agent/send-message",Te);this.#a.builderPublicKey&&r.searchParams.set("apiKey",this.#a.builderPublicKey),this.#a.userId&&r.searchParams.set("userId",this.#a.userId);let n=await Re(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#a.builderPrivateKey}`},body:JSON.stringify(e),signal:AbortSignal.timeout(1e4)},this.#A),i=await n.json();return n.ok?{status:"success"}:{status:"error",error:i.error??`HTTP ${n.status}`}}catch(r){return{status:"error",error:r?.message??"Unknown error"}}}queueGitStatusReminder(e){if(this.#J.length===0||this.#L)return;let r=this.#J.map(n=>Dge(n,this.gitEnabledFolders,e));this.queueSystemReminder({text:r.join(`
|
|
1915
1915
|
|
|
1916
|
-
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#I)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#K();Object.keys(n).length>0&&(r.beforeCommit=uo(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#se}async#Ie(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#se=void 0,!1;let r=await this.#gt(!0,"all");return e=this.getSessionContext(),e.state!=="generating"&&e.state!=="close"?(this.#se=r,this.#g.emit("step",{type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:e.state,suggestion:r,sessionMode:e.sessionMode,hasPlanToApply:this.#fe,modelOverride:this.#Y}),!0):!1}async#Qr(e){this.#De++;try{let r=this.getCommitMode(),n=this.#I?this.getFeatureBranch():e.branchName,i=this.#he(e),s=e.path,o=e.folderName===this.#f[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:s});l=this.#e.join(E.trim(),"FETCH_HEAD"),ol.default.existsSync(l)&&ol.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#De,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:s}),A=!0}catch{A=!1}let d=await this.#e.getRepoInfo(s),g=Mu(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!o&&!e.initialCommit&&d.commit&&(e.initialCommit=d.commit),!g&&e.initialCommit&&(g=e.initialCommit);let p=this.#It(e.folderName),f=p?1:0,m=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:s}),c=!1}catch{c=!0}else c=!0;try{let E=FO(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:s}));f=E.ahead,m=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(s,".git/FETCH_HEAD")),y=`FETCH_HEAD: ${y} `}catch(Q){y=`FETCH_HEAD FAILED: ${String(Q)} `}else y="FETCH_HEAD MISSING";this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchOutput:u,fetchHead:y,remoteBranch:i,currentBranch:d.currentBranch,currentCommit:d.commit,isCheckingGitStatus:this.#De,folderName:e.folderName}})}}else if(!A&&r!=="commits")try{let E=await this.#et(s),y=FO(await this.git(["--no-pager","rev-list","--left-right","--count",`HEAD...${E}`],{cwd:s}));f=y.ahead,m=y.behind}catch{g&&g!==d.commit&&(f=Math.max(f,1))}let C=await this.#Z(s),I=C.length>0,B=await this.#Rr(s);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#Fr(),isSessionDirty:p||!!g&&g!==d.commit,canSync:(f>0||m>0||B)&&!I,canPush:(f>0||m>0)&&!I,hasStagedChanges:B,canPull:m>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:m,currentCommit:d.commit,currentBranch:d.currentBranch,pendingValidation:this.#re,remoteBranch:i,unmergedFiles:C}}finally{this.#De--}}#Kt(){let e=this.getSessionContext();return{type:"session",title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:e.turns.length,id:e.sessionId,lastCompletionId:this.getLastCompletionId(),sessionMode:e.sessionMode,fusionConfig:Zw(this.#u),hasBrowserAutomation:e.customAgents.some(r=>r.name==="browser-testing"),customInstructions:e.customInstructions.filter(r=>!r.hideUI&&(r.userInvocable??!0)).map(r=>({name:r.name,description:r.description??"",type:r.type??"always",glob:r.glob,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,userInvocable:r.userInvocable})),hasPlanToApply:this.#fe}}#Ht(){let e=this.getSessionContext(),r=e.turns,n=[];n.push(this.#Kt()),Object.keys(this.#O).length>0&&n.push({type:"metadata",...this.#O}),this.#t.length>0&&n.push({type:"message-queue",queue:this.#t.map(s=>({idempotencyKey:s.idempotencyKey,displayPrompt:s.displayPrompt,user:s.user}))});let i;for(let s of r){n.push({type:"user",previousId:i,displayPrompt:s.userMessage?s.userMessage.displayPrompt??s.userMessage.userPrompt:void 0,attachments:s.userMessage?.attachments,id:s.completionId,user:s.user,role:s.user.role,compacting:!1,idempotencyKey:s.userMessage?.idempotencyKey??"",sessionMode:e.sessionMode}),i=s.completionId;for(let o of s.actions)if(o.type==="tool"||o.type==="text"||o.type==="thinking")if(n.push({type:"start",name:o.type,content:"",id:o.id??"",filePath:o.filePath??"",title:o.actionTitle??o.artifactTitle??o.filePath??""}),n.push({type:"delta",name:o.type,delta:o.content}),o.type==="tool"){if(n.push({type:o.type,id:o.id,name:o.filePath,content:o.content}),o.filePath==="UpdateSetupValue"||o.filePath==="ProposeConfig")try{let a=JSON.parse(o.content);if(o.filePath==="UpdateSetupValue")n.push({type:"update_setup_value",field:a.field,value:a.value,reason:a.reason});else{let A=a.config,c=A!=null&&!A.installCommand?.command&&(!A.runtimeDependencies||A.runtimeDependencies.length===0);n.push({type:"propose_config",config:A,message:a.message,noDependencies:c})}}catch{}}else o.type==="thinking"?n.push({type:"thinking",content:o.content}):o.type==="text"&&n.push({type:"text",content:o.content})}return n}connectToEventLoop(e,r,n){let i=n?.canHandleTools??[];if(e){let s=[],o=this.getSessionContext();s.push({type:"state",newState:"replay",abortable:!1,previousState:o.state}),this.#tt&&s.push(this.#tt),s.push(...this.#J),s.push(...this.#Ht()),this.#te.forEach(c=>{s.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#ye?yA(this.#ye):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":s.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),s.push({type:"delta",name:a.type,delta:a.content});break}s.push({type:"terminals",terminals:this.#ht()});let A=this.#h;A?(s.push({type:"dev-server",devServerState:A.devState,setupState:A.setupState,httpServerState:A.httpServerState.state,devCommand:A.devCommand,setupCommand:A.setupCommand,proxyServer:A.proxyTarget,proxyServerSelection:A.proxyServerSelection,remoteAddress:A.httpServerState.remoteAddress,remotePort:A.httpServerState.remotePort,proxyServerReachable:!!this.#u?.isLocal,validateState:A.validateCommandState}),A.setupState!=="installed"&&s.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),s.push({type:"stdio",id:"devServer",command:A.devCommand,content:A.getDevWrite(),source:"run-command",stream:"stdout"})):r({type:"dev-server",devServerState:"running",setupState:"installed",httpServerState:"ok-2xx",devCommand:this.#u?.devCommand,setupCommand:this.#u?.setupCommand,proxyServer:this.#u?.serverUrl,proxyServerSelection:"hardcoded",remoteAddress:void 0,remotePort:void 0,proxyServerReachable:!!this.#u?.isLocal,validateState:"unset"}),s.push({type:"state",newState:o.state,abortable:o.state==="generating",previousState:"replay"}),this.#ie&&o.state!=="generating"&&s.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:o.state,suggestion:this.#se,sessionMode:o.sessionMode,hasPlanToApply:this.#fe}),r({type:"batch",steps:s})}this.#g.on("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)-1)}}waitUntilPendingPromises(e){let r=Ca();return this.#r.debug(`(waitUntilPendingPromises-${r}): started`),cc(Promise.allSettled(this.#le),e).then(()=>Nu()).then(()=>{this.#r.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=Ca();return this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): started`),cc(Promise.allSettled(this.#Je),e).then(()=>Nu()).then(()=>{this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=Ca();return this.waitForEventLoop(),this.#r.debug(`(waitUntilIdle-${r}): started`),cc(Nu().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#r.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,sS.once)(this.#g,"idle"):Promise.resolve(void 0)}).then(()=>this.waitUntilPendingPromises()).then(()=>{this.#r.debug(`(waitUntilIdle-${r}): idle reached in ${this.getSessionContext().state} `)}),e)}async#Jt(e){let r=this.#h;if(!r)throw new Error("Dev server not found");let n=await r.runValidateCommand(void 0,e);return n.status==="success"&&(this.#re=!1,this.#I&&(await this.#dt()).length===0&&(await this.#Et()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#ie?this.#ie:this.#ie=this.#Dr()}async#Dr(){if(this.#ie||this.#S)throw new Error("Event loop already started");this.#r.debug("(eventLoop): started");let e=Cge(),r=c=>{c.type==="error"&&this.#ue>0&&(rge.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,lge(this.#e,this.#a,s.sessionId,c.restoreCredits).catch(l=>{this.#e.Sentry?.captureException(l)})));let u=["ExitPlanMode","TodoWrite","TaskCreate","TaskUpdate"];if(c.type==="tool_result"&&u.includes(c.result.tool_name)&&(this.#r.debug("emitting ClientDevtoolsToolResultV1",{toolName:c.result.tool_name,projectId:this.#E,branchName:this.#y}),QA(this.#a,"/events/publish",{event:zre,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:s.sessionId,projectId:this.#E,branchName:this.#y},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#E,branchName:this.#y}},{debug:this.#A})),c.type==="tool"&&c.name==="Agent"){let l;try{l=JSON.parse(c.content)?.description}catch{}let d=JSON.stringify({description:l});this.#r.debug("emitting ClientDevtoolsToolCallV1",{toolName:c.name,projectId:this.#E,branchName:this.#y}),QA(this.#a,"/events/publish",{event:Wre,extraData:{toolUseId:c.id,toolName:c.name,content:d,sessionId:s.sessionId,projectId:this.#E,branchName:this.#y},extraAttributes:{toolName:c.name,projectId:this.#E,branchName:this.#y}},{debug:this.#A})}this.#g.emit("step",c)};this.#S=new AbortController;let n=this.#S.signal,i=this.#h,s=this.getSessionContext(),o=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:s.sessionId,get completionId(){return o()}}),await this.#U(this.#x(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#De>0||this.#x().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Me.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{Une().then(u=>{let l=JSON.stringify(u);l!==this.#yt&&(this.#yt=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?One(u):"",tag:"reminder:ide-context"}))}).catch(()=>{})},1e3);this.#Me.push(()=>clearInterval(c))}this.queueGitStatusReminder({trigger:"session-start"}),i?.setupState==="not-installed"&&this.runSetupCommand();try{let c=0;for(;!n.aborted;){c++,this.#c=void 0;let u=this.#Cr();if(this.#r.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#Gt();let g=await this.#Ie();if(n.aborted)break;g&&Bge(u.promise,500).then(p=>{p&&(this.#r.debug(`(eventLoop-${c}): emitting idle on next message wait`),this.#g.emit("idle"))})}let l=await u.promise;if(n.aborted)break;if(!l)continue;this.#c=new AbortController;let d=En([n,this.#c.signal]);try{if(this.#se=void 0,l.logsCheckpoint&&i?.addCheckpoint(),d?.aborted)throw tn(d.reason);this.#$("generating"),i?.abortValidateCommand();let g=l.syncChanges??this.#He;g&&(this.#r.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(g),await this.#gt(!1,"critical")),l.sessionMode&&l.sessionMode!==s.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#wr(l,d,r),this.#$("success");let p=l.autoPush??this.#T??"none";if(p!=="none"&&this.#I&&(this.#r.debug(`(eventLoop-${c}): autoPush: ${p}`),await this.waitUntilBlockingPendingPromises(),(await this.#dt()).length===0)){let m=(()=>{switch(p){case"force-push":return{actor:"agent",forcePush:!0,pullFirst:!1};case"merge-push":return{actor:"agent",pullFirst:!0,forcePush:!1};case"ff-push":return{actor:"agent",requireFastForward:!0,pullFirst:!1};case"safe-push":return{actor:"agent",pullFirst:!0,abortOnMergeConflict:!0};default:return{actor:"agent"}}})();if(this.#f.length>1)for(let C of this.#f)await this.#Te({...m,folderName:C.folderName});else await this.#Te(m)}this.#se=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#$("abort")):g instanceof Ye?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):g instanceof gt?(this.#i=void 0,r({type:"error",code:"unknown",message:"An internal error occurred. Please try again."}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):g instanceof ti?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),rge.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):(this.#i=void 0,r({type:"error",code:"cli-genetic-error",message:g.message,metadata:{error:g}}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):this.#$("error")}this.#Yt++}}catch(c){throw this.#e.Sentry?.captureException(c,{level:"fatal"}),c}finally{A(),this.#S=void 0,this.#ie=void 0,e()}this.#r.debug("(eventLoop): emitting idle on close"),this.#g.emit("idle"),this.#$("close")}async#wr(e,r,n){this.#ue=0,this.#re=!1;let i=this.getSessionContext(),s=e.displayPrompt||e.userPrompt||"";s&&this.#qe.push(s);let o;if(e.agentType&&e.agentType!==this.#N){let Q=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);Q.success&&(o={enabledTools:this.#D,modelOverride:this.#Y,systemPromptOverride:this.#oe,position:this.#m,includeMemories:this.#F},this.#D=Q.options.enabledTools,this.#Y=Q.options.modelOverride,this.#oe=Q.options.systemPromptOverride,this.#m=Q.options.position,this.#F=Q.options.includeMemories)}let a=e.maxCompletions??this.#u?.maxAgentCompletions,A=a??oS,c=a??age,u=0,l=0,d=!0,g=!1,p=!1,f=!1,m,C=0,I=0,B=!1,E=0;try{for(;;E++){if(this.#r.debug(`(agentCompletion-${E}): started`),this.#e.connectionTracker.getConnectionCount()>0&&l>=A||l>=c){n({type:"error",code:"ask-to-continue",message:"The agent has been working for a while. Do you want to continue?"});break}if(r?.aborted)throw tn(r.reason);try{if(this.cancelAllPendingToolFulfilments(),m||(m=await this.#vr(e,d,r,n),m.modelOverride=e.modelOverride,m.reasoning=e.reasoning,m.agentModelOverrides=e.agentModelOverrides),m.user.role==="user"){let b=m.files.filter(D=>(D.importance??0)>2.5&&D.content).map(D=>({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!1,wasIncluded:D.wasIncluded}));i.customInstructions.forEach(D=>{D.filePath&&D.type==="always"&&b.push({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:m.userMessage?.displayPrompt??m.userPrompt,files:b})}try{let b=await this.#br(i,m,r,n),{shouldContinue:D,completions:F,filesChanged:S}=b;if(this.#A&&this.#r.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(b)}`),d=!1,m=void 0,u=0,g||=S,p||=S,f||=b.navigatePreviewCalled,l+=F,this.#re||=S,this.#i=void 0,S&&this.#h?.addCheckpoint(),r?.aborted)throw tn(r.reason);let x=this.#mr();if(x){let j=x.syncChanges??this.#He;j&&await this.syncChangesFromRemote(j)}let{hasHealthIssue:U}=await this.#er();if(x){this.#r.debug(`(agentCompletion-${E}): consumed queued messages`),d=!0,e=x,l=0;continue}if(!D){if(r?.aborted)throw tn(r.reason);let j=this.getSessionMode();if((j==="planning"||j==="auto-planning")&&!this.#fe&&!B&&I<3){this.#r.debug(`(agentCompletion-${E}): adding reminder for missing plan`),B=!0,I++,this.queueSystemReminder({text:"Remember to always write the plan file and call the ExitPlanMode tool before finishing. Also, prefer using AskUserQuestion tool to ask questions to the user."});continue}if(U&&I<3){this.#r.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let H=this.#h,P=e.runValidateCommand??!0;if(H?.validateCommand&&P&&C<2&&this.#re&&j==="normal"){p=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let G=e.autoPush;this.#r.debug(`(agentCompletion-${E}): running validate command`),this.#Jt(r).then($=>{if(this.#r.debug(`(validate-command): result status ${$.status}`),$.status==="failure"&&$.code){let W=$.output?oa($.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${$.code}):
|
|
1916
|
+
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#I)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#K();Object.keys(n).length>0&&(r.beforeCommit=uo(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#se}async#Ie(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#se=void 0,!1;let r=await this.#gt(!0,"all");return e=this.getSessionContext(),e.state!=="generating"&&e.state!=="close"?(this.#se=r,this.#g.emit("step",{type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:e.state,suggestion:r,sessionMode:e.sessionMode,hasPlanToApply:this.#fe,modelOverride:this.#Y}),!0):!1}async#Qr(e){this.#De++;try{let r=this.getCommitMode(),n=this.#I?this.getFeatureBranch():e.branchName,i=this.#he(e),s=e.path,o=e.folderName===this.#f[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:s});l=this.#e.join(E.trim(),"FETCH_HEAD"),ol.default.existsSync(l)&&ol.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#De,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:s}),A=!0}catch{A=!1}let d=await this.#e.getRepoInfo(s),g=Mu(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!o&&!e.initialCommit&&d.commit&&(e.initialCommit=d.commit),!g&&e.initialCommit&&(g=e.initialCommit);let p=this.#It(e.folderName),f=p?1:0,m=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:s}),c=!1}catch{c=!0}else c=!0;try{let E=FO(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:s}));f=E.ahead,m=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(s,".git/FETCH_HEAD")),y=`FETCH_HEAD: ${y} `}catch(Q){y=`FETCH_HEAD FAILED: ${String(Q)} `}else y="FETCH_HEAD MISSING";this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchOutput:u,fetchHead:y,remoteBranch:i,currentBranch:d.currentBranch,currentCommit:d.commit,isCheckingGitStatus:this.#De,folderName:e.folderName}})}}else if(!A&&r!=="commits")try{let E=await this.#et(s),y=FO(await this.git(["--no-pager","rev-list","--left-right","--count",`HEAD...${E}`],{cwd:s}));f=y.ahead,m=y.behind}catch{g&&g!==d.commit&&(f=Math.max(f,1))}let C=await this.#Z(s),I=C.length>0,B=await this.#Rr(s);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#Fr(),isSessionDirty:p||!!g&&g!==d.commit,canSync:(f>0||m>0||B)&&!I,canPush:(f>0||m>0)&&!I,hasStagedChanges:B,canPull:m>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:m,currentCommit:d.commit,currentBranch:d.currentBranch,pendingValidation:this.#re,remoteBranch:i,unmergedFiles:C}}finally{this.#De--}}#Kt(){let e=this.getSessionContext();return{type:"session",title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:e.turns.length,id:e.sessionId,lastCompletionId:this.getLastCompletionId(),sessionMode:e.sessionMode,fusionConfig:Zw(this.#u),hasBrowserAutomation:e.customAgents.some(r=>r.name==="browser-testing"),customInstructions:e.customInstructions.filter(r=>!r.hideUI&&(r.userInvocable??!0)).map(r=>({name:r.name,description:r.description??"",type:r.type??"always",glob:r.glob,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,userInvocable:r.userInvocable})),hasPlanToApply:this.#fe}}#Ht(){let e=this.getSessionContext(),r=e.turns,n=[];n.push(this.#Kt()),Object.keys(this.#O).length>0&&n.push({type:"metadata",...this.#O}),this.#t.length>0&&n.push({type:"message-queue",queue:this.#t.map(s=>({idempotencyKey:s.idempotencyKey,displayPrompt:s.displayPrompt,user:s.user}))});let i;for(let s of r){n.push({type:"user",previousId:i,displayPrompt:s.userMessage?s.userMessage.displayPrompt??s.userMessage.userPrompt:void 0,attachments:s.userMessage?.attachments,id:s.completionId,user:s.user,role:s.user.role,compacting:!1,idempotencyKey:s.userMessage?.idempotencyKey??"",sessionMode:e.sessionMode}),i=s.completionId;for(let o of s.actions)if(o.type==="tool"||o.type==="text"||o.type==="thinking")if(n.push({type:"start",name:o.type,content:"",id:o.id??"",filePath:o.filePath??"",title:o.actionTitle??o.artifactTitle??o.filePath??""}),n.push({type:"delta",name:o.type,delta:o.content}),o.type==="tool"){if(n.push({type:o.type,id:o.id,name:o.filePath,content:o.content}),o.filePath==="UpdateSetupValue"||o.filePath==="ProposeConfig")try{let a=JSON.parse(o.content);if(o.filePath==="UpdateSetupValue")n.push({type:"update_setup_value",field:a.field,value:a.value,reason:a.reason});else{let A=a.config,c=A!=null&&!A.installCommand?.command&&(!A.runtimeDependencies||A.runtimeDependencies.length===0);n.push({type:"propose_config",config:A,message:a.message,noDependencies:c})}}catch{}}else o.type==="thinking"?n.push({type:"thinking",content:o.content}):o.type==="text"&&n.push({type:"text",content:o.content})}return n}connectToEventLoop(e,r,n){let i=n?.canHandleTools??[];if(e){let s=[],o=this.getSessionContext();s.push({type:"state",newState:"replay",abortable:!1,previousState:o.state}),this.#tt&&s.push(this.#tt),s.push(...this.#J),s.push(...this.#Ht()),this.#te.forEach(c=>{s.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#ye?yA(this.#ye):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":s.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),s.push({type:"delta",name:a.type,delta:a.content});break}s.push({type:"terminals",terminals:this.#ht()});let A=this.#h;A?(s.push({type:"dev-server",devServerState:A.devState,setupState:A.setupState,httpServerState:A.httpServerState.state,devCommand:A.devCommand,setupCommand:A.setupCommand,proxyServer:A.proxyTarget,proxyServerSelection:A.proxyServerSelection,remoteAddress:A.httpServerState.remoteAddress,remotePort:A.httpServerState.remotePort,proxyServerReachable:!!this.#u?.isLocal,validateState:A.validateCommandState}),A.setupState!=="installed"&&s.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),s.push({type:"stdio",id:"devServer",command:A.devCommand,content:A.getDevWrite(),source:"run-command",stream:"stdout"})):r({type:"dev-server",devServerState:"running",setupState:"installed",httpServerState:"ok-2xx",devCommand:this.#u?.devCommand,setupCommand:this.#u?.setupCommand,proxyServer:this.#u?.serverUrl,proxyServerSelection:"hardcoded",remoteAddress:void 0,remotePort:void 0,proxyServerReachable:!!this.#u?.isLocal,validateState:"unset"}),s.push({type:"state",newState:o.state,abortable:o.state==="generating",previousState:"replay"}),this.#ie&&o.state!=="generating"&&s.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:o.state,suggestion:this.#se,sessionMode:o.sessionMode,hasPlanToApply:this.#fe}),r({type:"batch",steps:s})}this.#g.on("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)-1)}}waitUntilPendingPromises(e){let r=Ca();return this.#r.debug(`(waitUntilPendingPromises-${r}): started`),cc(Promise.allSettled(this.#le),e).then(()=>Nu()).then(()=>{this.#r.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=Ca();return this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): started`),cc(Promise.allSettled(this.#Je),e).then(()=>Nu()).then(()=>{this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=Ca();return this.waitForEventLoop(),this.#r.debug(`(waitUntilIdle-${r}): started`),cc(Nu().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#r.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,sS.once)(this.#g,"idle"):Promise.resolve(void 0)}).then(()=>this.waitUntilPendingPromises()).then(()=>{this.#r.debug(`(waitUntilIdle-${r}): idle reached in ${this.getSessionContext().state} `)}),e)}async#Jt(e){let r=this.#h;if(!r)throw new Error("Dev server not found");let n=await r.runValidateCommand(void 0,e);return n.status==="success"&&(this.#re=!1,this.#I&&(await this.#dt()).length===0&&(await this.#Et()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#ie?this.#ie:this.#ie=this.#Dr()}async#Dr(){if(this.#ie||this.#S)throw new Error("Event loop already started");this.#r.debug("(eventLoop): started");let e=Cge(),r=c=>{c.type==="error"&&this.#ue>0&&(rge.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,lge(this.#e,this.#a,s.sessionId,c.restoreCredits).catch(l=>{this.#e.Sentry?.captureException(l)})));let u=["ExitPlanMode","TodoWrite","TaskCreate","TaskUpdate"];if(c.type==="tool_result"&&u.includes(c.result.tool_name)&&(this.#r.debug("emitting ClientDevtoolsToolResultV1",{toolName:c.result.tool_name,projectId:this.#E,branchName:this.#y}),QA(this.#a,"/events/publish",{event:zre,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:s.sessionId,projectId:this.#E,branchName:this.#y},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#E,branchName:this.#y}},{debug:this.#A})),c.type==="tool"&&c.name==="Agent"){let l;try{l=JSON.parse(c.content)?.description}catch{}let d=JSON.stringify({description:l});this.#r.debug("emitting ClientDevtoolsToolCallV1",{toolName:c.name,projectId:this.#E,branchName:this.#y}),QA(this.#a,"/events/publish",{event:Wre,extraData:{toolUseId:c.id,toolName:c.name,content:d,sessionId:s.sessionId,projectId:this.#E,branchName:this.#y},extraAttributes:{toolName:c.name,projectId:this.#E,branchName:this.#y}},{debug:this.#A})}this.#g.emit("step",c)};this.#S=new AbortController;let n=this.#S.signal,i=this.#h,s=this.getSessionContext(),o=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:s.sessionId,get completionId(){return o()}}),await this.#U(this.#x(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#De>0||this.#x().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Me.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{Une().then(u=>{let l=JSON.stringify(u);l!==this.#yt&&(this.#yt=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?One(u):"",tag:"reminder:ide-context"}))}).catch(()=>{})},1e3);this.#Me.push(()=>clearInterval(c))}this.queueGitStatusReminder({trigger:"session-start"}),i?.setupState==="not-installed"&&this.runSetupCommand();try{let c=0;for(;!n.aborted;){c++,this.#c=void 0;let u=this.#Cr();if(this.#r.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#Gt();let g=await this.#Ie();if(n.aborted)break;g&&Bge(u.promise,500).then(p=>{p&&(this.#r.debug(`(eventLoop-${c}): emitting idle on next message wait`),this.#g.emit("idle"))})}let l=await u.promise;if(n.aborted)break;if(!l)continue;this.#c=new AbortController;let d=En([n,this.#c.signal]);try{if(this.#se=void 0,l.logsCheckpoint&&i?.addCheckpoint(),d?.aborted)throw tn(d.reason);this.#$("generating"),i?.abortValidateCommand();let g=l.syncChanges??this.#He;g&&(this.#r.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(g),await this.#gt(!1,"critical")),l.sessionMode&&l.sessionMode!==s.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#wr(l,d,r),this.#$("success");let p=l.autoPush??this.#T??"none";if(p!=="none"&&this.#I&&(this.#r.debug(`(eventLoop-${c}): autoPush: ${p}`),await this.waitUntilBlockingPendingPromises(),(await this.#dt()).length===0)){let m=(()=>{switch(p){case"force-push":return{actor:"agent",forcePush:!0,pullFirst:!1};case"merge-push":return{actor:"agent",pullFirst:!0,forcePush:!1};case"ff-push":return{actor:"agent",requireFastForward:!0,pullFirst:!1};case"safe-push":return{actor:"agent",pullFirst:!0,abortOnMergeConflict:!0};default:return{actor:"agent"}}})();if(this.#f.length>1)for(let C of this.#f)await this.#Te({...m,folderName:C.folderName});else await this.#Te(m)}this.#se=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#$("abort")):g instanceof Ye?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):g instanceof gt?(this.#i=void 0,r({type:"error",code:"unknown",message:"An internal error occurred. Please try again."}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):g instanceof ti?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),rge.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):(this.#i=void 0,r({type:"error",code:"cli-genetic-error",message:g.message,metadata:{error:g}}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):this.#$("error")}this.#Yt++}}catch(c){throw this.#e.Sentry?.captureException(c,{level:"fatal"}),c}finally{A(),this.#S=void 0,this.#ie=void 0,e()}this.#r.debug("(eventLoop): emitting idle on close"),this.#g.emit("idle"),this.#$("close")}async#wr(e,r,n){this.#ue=0,this.#re=!1;let i=this.getSessionContext(),s=e.displayPrompt||e.userPrompt||"";s&&this.#qe.push(s);let o;if(e.agentType&&e.agentType!==this.#L){let Q=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);Q.success&&(o={enabledTools:this.#D,modelOverride:this.#Y,systemPromptOverride:this.#oe,position:this.#m,includeMemories:this.#F},this.#D=Q.options.enabledTools,this.#Y=Q.options.modelOverride,this.#oe=Q.options.systemPromptOverride,this.#m=Q.options.position,this.#F=Q.options.includeMemories)}let a=e.maxCompletions??this.#u?.maxAgentCompletions,A=a??oS,c=a??age,u=0,l=0,d=!0,g=!1,p=!1,f=!1,m,C=0,I=0,B=!1,E=0;try{for(;;E++){if(this.#r.debug(`(agentCompletion-${E}): started`),this.#e.connectionTracker.getConnectionCount()>0&&l>=A||l>=c){n({type:"error",code:"ask-to-continue",message:"The agent has been working for a while. Do you want to continue?"});break}if(r?.aborted)throw tn(r.reason);try{if(this.cancelAllPendingToolFulfilments(),m||(m=await this.#vr(e,d,r,n),m.modelOverride=e.modelOverride,m.reasoning=e.reasoning,m.agentModelOverrides=e.agentModelOverrides),m.user.role==="user"){let b=m.files.filter(D=>(D.importance??0)>2.5&&D.content).map(D=>({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!1,wasIncluded:D.wasIncluded}));i.customInstructions.forEach(D=>{D.filePath&&D.type==="always"&&b.push({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:m.userMessage?.displayPrompt??m.userPrompt,files:b})}try{let b=await this.#br(i,m,r,n),{shouldContinue:D,completions:F,filesChanged:S}=b;if(this.#A&&this.#r.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(b)}`),d=!1,m=void 0,u=0,g||=S,p||=S,f||=b.navigatePreviewCalled,l+=F,this.#re||=S,this.#i=void 0,S&&this.#h?.addCheckpoint(),r?.aborted)throw tn(r.reason);let x=this.#mr();if(x){let j=x.syncChanges??this.#He;j&&await this.syncChangesFromRemote(j)}let{hasHealthIssue:U}=await this.#er();if(x){this.#r.debug(`(agentCompletion-${E}): consumed queued messages`),d=!0,e=x,l=0;continue}if(!D){if(r?.aborted)throw tn(r.reason);let j=this.getSessionMode();if((j==="planning"||j==="auto-planning")&&!this.#fe&&!B&&I<3){this.#r.debug(`(agentCompletion-${E}): adding reminder for missing plan`),B=!0,I++,this.queueSystemReminder({text:"Remember to always write the plan file and call the ExitPlanMode tool before finishing. Also, prefer using AskUserQuestion tool to ask questions to the user."});continue}if(U&&I<3){this.#r.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let H=this.#h,P=e.runValidateCommand??!0;if(H?.validateCommand&&P&&C<2&&this.#re&&j==="normal"){p=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let G=e.autoPush;this.#r.debug(`(agentCompletion-${E}): running validate command`),this.#Jt(r).then($=>{if(this.#r.debug(`(validate-command): result status ${$.status}`),$.status==="failure"&&$.code){let W=$.output?oa($.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${$.code}):
|
|
1917
1917
|
<validate_command>
|
|
1918
1918
|
${$.command}
|
|
1919
1919
|
</validate_command>
|
|
@@ -1922,17 +1922,17 @@ ${$.command}
|
|
|
1922
1922
|
${W}
|
|
1923
1923
|
</output>
|
|
1924
1924
|
|
|
1925
|
-
failed with code ${$.code}`,dropAbortedPrompt:!0,attachments:void 0,displayPrompt:`The validation command ${$.command} failed with code ${$.code}.`,queue:!0,category:"repair-validate-command",syncChanges:void 0,autoPush:G})}})}break}}catch(b){throw await this.#x(),b}}catch(b){let D=function(F){return!!(F instanceof ti&&F.code==="abrupt-end"||F instanceof Error&&F.name==="HTTPStreamBroke"||F instanceof Ye&&[502,503].includes(F.statusCode??0)||F instanceof Ye&&!F.statusCode&&["connection_reset","connection_timeout","connection_aborted"].includes(F.type))};var y=D;if(u<3&&D(b)){this.#r.debug(`(agentCompletion-${E}): retrying error`,b),await mg(u,r),u++;continue}throw b}finally{uge(i.turns)}}}finally{this.#r.debug(`(agentCompletion-${E}): finally block`),o&&(this.#D=o.enabledTools,this.#Y=o.modelOverride,this.#oe=o.systemPromptOverride,this.#m=o.position,this.#F=o.includeMemories),await this.#ne(!0);let Q=this.#u?.refreshPreview??!0;g&&Q&&!f&&this.requestRefresh()}}async#br(e,r,n,i){if(n.aborted)throw tn(n.reason);if(this.#ye)throw new Error("generateCompletion already started");let s=Ca(),o=this.getLastTurn()?.nextUrl??this.#B,a=!1,A=0,c=!1;try{let u=this.#ye=[];if(!e.beforeCommit){let S=await this.#K();Object.keys(S).length>0&&(e.beforeCommit=uo(S))}let l=await this.#K(),d=uo(l),g=this.#ot;g&&this.#
|
|
1925
|
+
failed with code ${$.code}`,dropAbortedPrompt:!0,attachments:void 0,displayPrompt:`The validation command ${$.command} failed with code ${$.code}.`,queue:!0,category:"repair-validate-command",syncChanges:void 0,autoPush:G})}})}break}}catch(b){throw await this.#x(),b}}catch(b){let D=function(F){return!!(F instanceof ti&&F.code==="abrupt-end"||F instanceof Error&&F.name==="HTTPStreamBroke"||F instanceof Ye&&[502,503].includes(F.statusCode??0)||F instanceof Ye&&!F.statusCode&&["connection_reset","connection_timeout","connection_aborted"].includes(F.type))};var y=D;if(u<3&&D(b)){this.#r.debug(`(agentCompletion-${E}): retrying error`,b),await mg(u,r),u++;continue}throw b}finally{uge(i.turns)}}}finally{this.#r.debug(`(agentCompletion-${E}): finally block`),o&&(this.#D=o.enabledTools,this.#Y=o.modelOverride,this.#oe=o.systemPromptOverride,this.#m=o.position,this.#F=o.includeMemories),await this.#ne(!0);let Q=this.#u?.refreshPreview??!0;g&&Q&&!f&&this.requestRefresh()}}async#br(e,r,n,i){if(n.aborted)throw tn(n.reason);if(this.#ye)throw new Error("generateCompletion already started");let s=Ca(),o=this.getLastTurn()?.nextUrl??this.#B,a=!1,A=0,c=!1;try{let u=this.#ye=[];if(!e.beforeCommit){let S=await this.#K();Object.keys(S).length>0&&(e.beforeCommit=uo(S))}let l=await this.#K(),d=uo(l),g=this.#ot;g&&this.#P?.enabled&&(g=!!this.#P.mcpServers);let p=r.userMessage?.uiContextPrompt;if(p&&!this.#G()){let S=this.#u?.workspace?.folders.find(x=>x.enableGit);S?.path&&(p=`Relative file paths are relative to: ${S.path}/`)}let f=this.#D,m={...e.userContext,fullstoryUrl:r.userMessage?.metadata?.fullstoryUrl,prNumber:r.userMessage?.metadata?.PR_NUMBER??e.userContext?.prNumber,prHeadSha:r.userMessage?.metadata?.PR_HEAD_SHA??e.userContext?.prHeadSha,repoFullName:r.userMessage?.metadata?.REPO_FULL_NAME??e.userContext?.repoFullName,hostname:r.userMessage?.metadata?.HOSTNAME??e.userContext?.hostname,checkRunId:r.userMessage?.metadata?.CHECK_RUN_ID??e.userContext?.checkRunId,containerUrl:process.env.FUSION_ENV_ORIGIN??e.userContext?.containerUrl,browserTestingShadowMode:r.userMessage?.metadata?.BROWSER_TESTING_SHADOW_MODE??e.userContext?.browserTestingShadowMode};e.userContext=m,this.#Ft=r.modelOverride,r.agentModelOverrides&&(this.#Ae=r.agentModelOverrides);let C=this.#Qe?.listTools(),I={url:o,position:this.#m,eventName:"cli code",maxPages:2,autoContinue:1,codeGenMode:"quality-v4",userContext:m,systemReminders:r.systemReminders,files:r.files,skipFileDiff:this.#M,maxTokens:this.#wt,aclPolicy:this.#u?.accessControl,softContextWindow:this.#b,repoIndexingConfig:this.#u?.repoIndexingConfig??{designSystems:[]},recommendedRoot:this.#be,attachments:r.attachments,customInstructions:e.customInstructions,customAgents:e.customAgents.filter(S=>S.name!==this.#L).map(S=>({name:S.name,description:S.description})),systemPromptOverride:this.#oe,sessionId:e.sessionId,userPrompt:r.userPrompt,metadata:{...m.prNumber&&{PR_NUMBER:m.prNumber},...m.prHeadSha&&{PR_HEAD_SHA:m.prHeadSha},...m.repoFullName&&{REPO_FULL_NAME:m.repoFullName},...m.hostname&&{HOSTNAME:m.hostname},...m.containerUrl&&{CONTAINER_URL:m.containerUrl},...m.checkRunId&&{CHECK_RUN_ID:m.checkRunId},...r.userMessage?.metadata},ephemeralUserPrompt:r.userMessage?.ephemeralUserPrompt,uiContextPrompt:r.userMessage?.uiContextPrompt,displayUserPrompt:r.userMessage?.displayPrompt,isManualContinue:r.userMessage?.isManualContinue,sessionMode:this.getSessionMode(),includeRelevantMemories:r.userMessage?r.userMessage.includeRelevantMemories??this.#F:void 0,projectId:this.#E,branchName:this.#y,repoHash:this.#Ue,repoBranch:this.#R,pingEvents:!0,workingDirectory:this.#v,beforeCommit:d,toolResults:r.toolResults,role:r.user.role,user:r.user,repair:r.repair,category:r.category,enabledTools:f,enabledMCPs:g?r.enabledMCPs:void 0,localMCPTools:C,isLocal:this.#u?.isLocal,searchResponse:r.searchResponse,encryptKey:this.#Ee,maxAgentTiming:180*1e3,mcpServers:g,environmentVariables:this.#lt(),skipCommandSecurity:this.#u?.skipCommandSecurity,redactUserMessages:this.#P?.redactUserMessages,redactLLMMessages:this.#P?.redactLLMMessages,modelOverride:this.#Y??r.modelOverride??this.#Vt(),reasoning:this.#at,interruptActiveTask:r.userMessage?.queue===!1||void 0,parentSessionId:this.#Ye,mainSessionId:this.getMainSessionId(),forceCompact:r.userMessage?.forceCompact};this.#A&&this.#r.debug(`(generateCompletion-${s}): request partial body. ${JSON.stringify({url:I.url,userPrompt:I.userPrompt,systemReminders:I.systemReminders,toolResultsCount:I.toolResults?.length})}`);let B=gge(this.#e,this.#a,I,n,this.#A),E,y=!1,Q=!1,b=async S=>{if(S.type==="user"){E&&E.state!=="done"&&this.#e.Sentry?.captureException(new Error("Turn was not completed before starting a new turn"),{tags:{operation:"codegen-stream"},extra:{lastTurn:E}});let x=E={state:"running",unixTime:Date.now(),title:"",sentiment:void 0,userMessage:r.userMessage,afterCommit:d,beforeCommit:d,lastCommit:void 0,creditsUsed:0,actions:[],applyResults:[],completionId:S.id??"",nextUrl:void 0,user:S.user,autoContinue:!1};E=x,e.turns.push(x),S.compacting&&(e.customInstructions=await this.#Re(),e.customAgents=await this.#Xe()),i({type:"user",previousId:S.previousId,displayPrompt:S.displayPrompt,id:S.id,user:S.user,role:S.user.role,compacting:S.compacting,idempotencyKey:r.userMessage?.idempotencyKey,sessionMode:S.sessionMode})}else if(S.type==="mcp-status")this.#tt=S,i(S);else{if(S.type==="mcp-auth-required")return Q=!0,i(S),!0;if(S.type==="error")return Q=!0,i(S),!0;if(S.type==="done"){A++,this.#j.length=0,this.#ue+=S.creditsUsed;let x=E=await this.#xr(e,S,E,d);for(let H of S.actions??[])H.type==="tool_result"&&(H.filePath==="NavigatePreview"&&(c=!0),i({type:"tool_result",result:{content:H.content,tool_use_id:H.id,type:"tool_result",title:H.actionTitle,tool_name:H.filePath,is_error:!!H.errors?.length}}));await this.waitUntilBlockingPendingPromises(n);let U=await this.#Tr(this.#e,x),j=U.length>0;j&&(a=!0),await this.commitWorkInProgress(`${E.title}
|
|
1926
1926
|
${E.completionId}`,U),this.#I&&await this.#x(),this.#Ce({completionId:x.completionId,beforeCommit:x.beforeCommit}),i({type:"done",stopReason:S.stopReason,id:S.id,applyResults:x.applyResults,actions:S.actions??[],creditsUsed:S.creditsUsed,sessionUsage:S.sessionUsage,contextWindow:S.contextWindow,model:S.model,usage:S.usage,url:S.nextUrl,promptVersion:S.promptVersion,planPath:S.planPath,hasChanges:j})}else{if(S.type==="continue")return y=S.autoContinue,Q=!0,i({type:"continue",id:S.id,url:S.nextUrl,autoContinue:S.autoContinue}),!0;S.type==="thinking"&&(S.actionTitle="Planning"),"content"in S&&S.type!=="delta"&&i({type:"start",name:S.type,filePath:S.filePath??"",id:"id"in S?S.id:void 0,title:S.actionTitle??S.artifactTitle??S.filePath??"",content:S.content??""})}}return!1},D=S=>{if(S.type==="thinking"&&i({type:"thinking",content:S.content}),S.type==="server_tool_result"){let x;try{x=JSON.parse(S.content)}catch(U){this.#e.Sentry?.captureException(U,{extra:{contentPreview:S.content?.substring(0,500),contentLength:S.content?.length},tags:{operation:"server-tool-result-parse"}}),x=S.content}i({type:"server_tool_result",content:x,title:S.actionTitle??S.artifactTitle??"Server Tool Result",id:S.id})}S.type==="file"&&S.filePath&&!S.synthetic&&i({type:"file",filePath:S.filePath,content:S.content,title:S.actionTitle??S.artifactTitle??"Created",id:S.id,errors:S.errors}),S.type==="diff"&&S.filePath&&!S.synthetic&&i({type:"diff",filePath:S.filePath,title:S.actionTitle??S.artifactTitle??"Updated",content:S.content,id:S.id,errors:S.errors}),S.type==="tool"&&S.filePath?i({type:"tool",name:S.filePath,id:S.id,content:S.content}):S.type==="text"&&i({type:"text",content:S.content})},F=(S,x)=>{i({type:"delta",name:S.type,delta:x})};for await(let S of B){if(S.type==="ping"){this.#r.debug(`(generateCompletion-${s}): ping`);continue}if(S.type==="delta"){let x=S.content,U=yA(u);U&&"content"in U&&(U.content+=x,F(U,x))}else{let x=yA(u);if(S.type==="thinking"&&x?.type==="thinking")continue;if(x&&"content"in x&&(x.incomplete=!1,D(x)),u.push(S),await b(S))break}}if(!Q)throw new ti("Completion stream ended abruptly","abrupt-end");if(!E)throw new ti("Completion stream ended abruptly","abrupt-end");return{completions:A,filesChanged:a,navigatePreviewCalled:c,shouldContinue:y||E.actions.some(S=>S.type==="tool")||E.autoContinue}}finally{this.#ye=void 0}}async commitWorkInProgress(e,r){if(!this.#I)return;let n=this.#lr(r);await this.#q(async i=>{let s=n.get(i.folderName)||[],o=await this.#Z(i.path);try{o.length>0?(s.length>0&&await this.git(["add",...s],{cwd:i.path,retry:2}),(await this.#Z(i.path)).length===0&&await this.git(["add","-A","."],{cwd:i.path,retry:2})):await this.git(["add","-A","."],{cwd:i.path,retry:2})}catch(a){this.#e.Sentry?.captureException(new Error(`Error staging files in ${i.folderName}: ${a}`),{tags:{operation:"codegen-git-stage"}})}}),typeof this.#pe=="string"?this.#pe+=`
|
|
1927
1927
|
${e}`:this.#pe=e}async#ne(e){if(!this.#I)return!1;let r=this.#pe,n=this.#qe,i=this.getLastTurn(),s=i?.completionId;this.#pe=null,this.#qe=[];let a=(async()=>{if(await this.#Tt,!r)return!1;this.#r.debug("(#commitAccumulatedChanges): committing pending changes");let A=!1;try{await this.#q(async l=>{let d="";try{await this.git(["--no-pager","diff","--cached","--quiet"],{cwd:l.path});return}catch{try{if(d=await this.git(["--no-pager","diff","--cached","--no-color"],{cwd:l.path}),!d.trim())return}catch{return}}let g=await this.#Ar(l.path),p=r,f=performance.now(),m=await QA(this.#a,"/codegen/commit-message",{diff:oa(d,500),userMessages:n,recentCommits:g,projectId:this.#E},{signal:AbortSignal.timeout(2e4),debug:this.#A});this.#_("git_commit_message_llm",performance.now()-f,{folder:l.folderName});let B=(m?.message||p).split(`
|
|
1928
|
-
`).flatMap(E=>["-m",E]);try{await this.git(["commit","--quiet","--no-verify","--no-gpg-sign",...B],{cwd:l.path}),A=!0}catch(E){this.#e.Sentry?.captureException(new Error(`Error in batch commit for ${l.folderName}: ${E}`),{tags:{operation:"codegen-git-batch-commit"}})}});let c=await this.#K(),u=uo(c);return u&&(this.#
|
|
1928
|
+
`).flatMap(E=>["-m",E]);try{await this.git(["commit","--quiet","--no-verify","--no-gpg-sign",...B],{cwd:l.path}),A=!0}catch(E){this.#e.Sentry?.captureException(new Error(`Error in batch commit for ${l.folderName}: ${E}`),{tags:{operation:"codegen-git-batch-commit"}})}});let c=await this.#K(),u=uo(c);return u&&(this.#N={...this.#N,...c},i&&(i.afterCommit=u,i.lastCommit=u),this.#Ce({completionId:s,beforeCommit:i?.beforeCommit,afterCommit:u,lastCommit:u,commitFailed:!1})),e&&await this.#x(),A}catch(c){return this.#e.Sentry?.captureException(new Error(`Error in #commitAccumulatedChanges: ${c}`),{tags:{operation:"codegen-git-batch-commit"}}),A}})();return this.#Tt=a,this.#U(a,"commitAccumulatedChanges",!0)}async#Sr(e,r,n,i){let s=r.actions.filter(o=>o.type==="tool"&&o.id).map(o=>{let a=o.content.trim(),A={};try{A=a?JSON.parse(a):{}}catch{A={}}return{id:o.id,name:o.filePath,input:A,abortController:this.#z.find(c=>c.id===o.id)?.abortController??new AbortController}})??[];if(s.length>0){this.#z=s;for(let o of s)["Read","Write","Edit","MultiEdit"].includes(o.name)&&typeof o.input.file_path=="string"&&this.#Ut(o.input.file_path);try{let o={debug:this.#A,logger:ve("ToolContext",{debug:()=>!!(this.#A||process.env.DEBUG)}),sys:this.#e,credentials:this.#a,files:e.files,user:e.user,projectId:this.#E,branchName:this.#y,position:this.#m,fusionConfig:this.#u,enabledTools:this.#D??[],sessionMode:this.getSessionMode(),fusionStatusMonitor:this.#nt,asyncSubAgents:this.#At,switchSessionMode:A=>this.switchSessionMode(A),signal:n,canCollapseWorkspace:this.#G(),emitter:this.#g,session:this,filterText:A=>(A=fX(A,this.#v),this.#u?.accessControl?.secrets&&(A=hX(A,this.#u.accessControl.secrets)),A),allowedCommands:Pw(this.#u?.allowedCommands??[]),getAllFiles:A=>this.getAllFiles({getDotFiles:A.getDotFiles,includePattern:A.pattern,gitignore:!0,maxFiles:A.maxFiles}),workingDirectory:this.#d,bashWorkingDirectory:this.#v,workspaceFolders:this.#C?.folders??[],restore:A=>this.restore(A),patchFusionConfig:A=>{e.patchFusionConfig||(e.patchFusionConfig={});let c=e.patchFusionConfig.envVariables;Object.assign(e.patchFusionConfig,A),e.patchFusionConfig.envVariables={...c,...A.envVariables}},readFile:A=>this.readFile(A),writeFile:(A,c)=>this.writeFile(A,c),deleteFile:A=>this.deleteFile(A),fileExists:A=>this.fileExists(A),listDir:A=>this.listDir(A),evaluateAccess:(A,c)=>ao(ni(A),c,this.#u?.accessControl,this.#V()),stat:A=>this.stat(A),localMCPManager:this.#Qe,passThrough:(A,c)=>new Promise((u,l)=>{let d=c?.messageValid??!1,g=c?.signal??new AbortController().signal;if(!this.canHandleTool(A.name)&&!d){l(new Error("The user is currently not present in the chat. Ie, he is not able to respond to the request"));return}let f=()=>{g.removeEventListener("abort",m),this.#te.delete(A.id)},m=()=>{f(),l(new Error("Aborted by the user. So the task could not be completed."))};if(g.aborted){m();return}g.addEventListener("abort",m,{once:!0}),this.#te.set(A.id,{id:A.id,name:A.name,input:A.input,messageValid:d,resolve:C=>{f(),u(C)}}),this.#g.emit("step",{type:"tool-call-request",id:A.id,name:A.name,input:A.input,messageValid:d}),A.name==="AskUserQuestion"&&(this.#r.debug("emitting ClientDevtoolsToolCallRequestV1",{toolName:A.name,projectId:this.#E,branchName:this.#y}),QA(this.#a,"/events/publish",{event:Vre,extraData:{toolUseId:A.id,toolName:A.name,input:A.input,sessionId:this.getSessionId(),projectId:this.#E,branchName:this.#y,messageValid:d},extraAttributes:{toolName:A.name,projectId:this.#E,branchName:this.#y}},{debug:this.#A}))}),resolveWorkspacePath:(A,c)=>{if(typeof A!="string")throw new TypeError(`resolveWorkspacePath: 'path' must be a string, received ${typeof A}: ${Qo(A)}`);return this.resolveWorkspacePath(A,c)},absolutePathToWorkspaceUrl:A=>this.absolutePathToWorkspaceUrl(A),devServerOrchestrator:this.#h},a=await sge(o,s,r.cachedToolResults,i);if(r.cachedToolResults=a,o.signal?.aborted)throw tn(o.signal.reason);e.patchFusionConfig&&this.#g.emit("step",{type:"fusion-config-patch",patch:e.patchFusionConfig}),e.files=o.files,e.toolResults=a}finally{this.#z=[]}}}async#vr(e,r,n,i){let s=this.getSessionContext(),o=yA(s.turns),a=structuredClone(e.user??o?.user??{source:"agent",role:"agent"});this.#Wt();let A={userMessage:void 0,userPrompt:"",systemReminders:this.#j.slice(),files:[],attachments:[],searchResponse:null,rerankFiles:0,mostRelevantFile:null,toolResults:[],user:a,modelOverride:e.modelOverride,agentModelOverrides:e.agentModelOverrides,repair:e.repair,category:e.category,enabledMCPs:e.enabledMCPs},c=!!this.getLastTurn()?.nextUrl,u=s.turns.length<2||!c;if(r){let d=null;if(u){let g=oge(await this.getAllFiles({getDotFiles:!1,gitignore:!0,deep:4,truncate:2e4})),p=new Set,f=new Set;if(e.files)for(let E of e.files)p.add(pX(E));let m=e.includeBaseFiles??s.turns.length===0,C=Array.from(p),I=E=>m&&hge(E,this.#be)?10:m&&fge(E,this.#be)?5:f.has(E)||C.some(y=>E.toLowerCase().startsWith(y.toLowerCase()))?2:0,B=n.aborted?[]:g.map(E=>{let y=I(E);if(y===0)return{filePath:E};let Q=null;try{if(Q=this.readFileSync(E),!Q)return{filePath:E}}catch{return{filePath:E}}let b=Q.length<3e4;return{filePath:E,content:Q,importance:b?y:2}});A.files=B,A.attachments=e.attachments??[]}if(this.#I&&!this.#L){let g,p=await this.getChangesReport();if(p){for(let f of p.files)A.files.some(m=>m.filePath===f)||A.files.push({filePath:f,importance:0});p.diff.length<1e3?g=p.diff:g=p.files.map(f=>`- ${f}`).join(`
|
|
1929
1929
|
`).trim(),g&&A.systemReminders.push({text:`
|
|
1930
1930
|
Some files changed by the user or tools (Bash, auto-formatting, etc.):
|
|
1931
1931
|
<modified-files-context>
|
|
1932
1932
|
${oa(g,30)}
|
|
1933
1933
|
</modified-files-context>`,tag:"reminder:modified-files-context"})}}A.userMessage=e,A.userPrompt=e.userPrompt,A.attachments=e.attachments??[],A.searchResponse=d,A.rerankFiles=0,A.mostRelevantFile=null,A.toolResults=[]}else A.user.role="agent";let l=0;return A.files=A.files.filter(d=>{let g=d.content?.length??0;return g>3e6||l+g>8e6?!1:(l+=g,!0)}),o&&await this.#Sr(A,o,n,i),A}async#xr(e,r,n,i){let{actions:s}=r,o=n||{state:"done",unixTime:r.unixTime??Date.now(),title:r.actionTitle,user:{source:"agent",role:"agent"},completionId:r.id??"",creditsUsed:r.creditsUsed??0,nextUrl:r.nextUrl,applyResults:[],actions:s??[],userMessage:void 0,beforeCommit:i,afterCommit:i,lastCommit:void 0,sentiment:void 0,autoContinue:r.autoContinue};if(o.state="done",o.title=r.actionTitle??"",o.creditsUsed=r.creditsUsed??0,o.nextUrl=r.nextUrl,o.autoContinue=r.autoContinue,o.actions=s??[],n||e.turns.push(o),Array.isArray(s))for(let a of s){let A=a.filePath;if(a.type==="file"&&A&&!a.incomplete){let u=!!await this.stat(A,!0),l=null,d=!0;if(u)try{l=this.readFileSync(A,!0)}catch{d=!1}if(l)if(a.content.trim()==="")o.applyResults.push({action:"delete",filePath:A,addedLines:0,removedLines:l.split(`
|
|
1934
1934
|
`).length,content:"",oldContent:l});else{let g=Fse(l,a.content);o.applyResults.push({action:"update",filePath:A,addedLines:g.filter(p=>p.added).reduce((p,f)=>p+(f.count??0),0),removedLines:g.filter(p=>p.removed).reduce((p,f)=>p+(f.count??0),0),content:a.content,oldContent:l})}else u&&!d?o.applyResults.push({action:"update",filePath:A,addedLines:0,removedLines:0,content:a.content,oldContent:void 0}):o.applyResults.push({action:"create",filePath:A,addedLines:a.content.split(`
|
|
1935
|
-
`).length,removedLines:0,content:a.content,oldContent:""})}}return o}#It(e){let r=this.getSessionContext();if(!e)return this.gitRepoContexts.some(A=>this.#It(A.folderName));let n=e,i=Mu(r.beforeCommit,n,this.gitRepoContexts[0]?.folderName),s=r.turns.findLast(A=>A.afterCommit??A.beforeCommit),o=s?.afterCommit??s?.beforeCommit,a=Mu(o,n,this.gitRepoContexts[0]?.folderName);return i&&a&&i!==a?!0:r.turns.some(A=>A.applyResults.some(c=>this.#Lt(c.filePath)?.folderName===e))}async#Fr(){try{let e="{/* TODO: FUSION_GENERATION_APP_PLACEHOLDER replace everything here with the actual app! */}",r=await this.#e.readFile(this.resolveWorkspacePath("client/pages/Index.tsx",!0).resolvedPath);if((await this.#e.readFile(this.resolveWorkspacePath("client/App.tsx",!0).resolvedPath))?.includes('<Route path="/" element={<Index />} />')&&r&&r.includes(e))return!0}catch{}return!1}#jt(e){let r=e.toLowerCase(),n=[".next/","dist/","build/","out/","node_modules/",".cache/","coverage/","__pycache__/","target/","vendor/",".gradle/",".build/"],i=[".gz",".zip",".tar",".tgz",".7z",".rar",".pack",".bin",".exe",".dll",".so",".dylib",".o",".a",".jar",".class",".pyc",".pyo",".wasm",".png",".jpg",".jpeg",".gif",".ico",".webp",".svg",".mp4",".mp3",".wav",".pdf",".woff",".woff2",".ttf",".eot",".map",".min.js",".min.css",".bundle.js",".chunk.js",".tsbuildinfo"];for(let s of n)if(r.includes(s))return!0;for(let s of i)if(r.endsWith(s))return!0;return!!(r.endsWith("package-lock.json")||r.endsWith("yarn.lock")||r.endsWith("pnpm-lock.yaml")||r.endsWith(".lock"))}async getChangesReport(){if(this.#I)try{let e=[],r=[];for(let i of this.#f){let s=this.#
|
|
1935
|
+
`).length,removedLines:0,content:a.content,oldContent:""})}}return o}#It(e){let r=this.getSessionContext();if(!e)return this.gitRepoContexts.some(A=>this.#It(A.folderName));let n=e,i=Mu(r.beforeCommit,n,this.gitRepoContexts[0]?.folderName),s=r.turns.findLast(A=>A.afterCommit??A.beforeCommit),o=s?.afterCommit??s?.beforeCommit,a=Mu(o,n,this.gitRepoContexts[0]?.folderName);return i&&a&&i!==a?!0:r.turns.some(A=>A.applyResults.some(c=>this.#Lt(c.filePath)?.folderName===e))}async#Fr(){try{let e="{/* TODO: FUSION_GENERATION_APP_PLACEHOLDER replace everything here with the actual app! */}",r=await this.#e.readFile(this.resolveWorkspacePath("client/pages/Index.tsx",!0).resolvedPath);if((await this.#e.readFile(this.resolveWorkspacePath("client/App.tsx",!0).resolvedPath))?.includes('<Route path="/" element={<Index />} />')&&r&&r.includes(e))return!0}catch{}return!1}#jt(e){let r=e.toLowerCase(),n=[".next/","dist/","build/","out/","node_modules/",".cache/","coverage/","__pycache__/","target/","vendor/",".gradle/",".build/"],i=[".gz",".zip",".tar",".tgz",".7z",".rar",".pack",".bin",".exe",".dll",".so",".dylib",".o",".a",".jar",".class",".pyc",".pyo",".wasm",".png",".jpg",".jpeg",".gif",".ico",".webp",".svg",".mp4",".mp3",".wav",".pdf",".woff",".woff2",".ttf",".eot",".map",".min.js",".min.css",".bundle.js",".chunk.js",".tsbuildinfo"];for(let s of n)if(r.includes(s))return!0;for(let s of i)if(r.endsWith(s))return!0;return!!(r.endsWith("package-lock.json")||r.endsWith("yarn.lock")||r.endsWith("pnpm-lock.yaml")||r.endsWith(".lock"))}async getChangesReport(){if(this.#I)try{let e=[],r=[];for(let i of this.#f){let s=this.#N[i.folderName];if(!s)continue;if((await this.#Z(i.path)).length>0)return;try{let c=(await this.git(["--no-pager","diff","--name-only",s],{cwd:i.path})).trim().split(`
|
|
1936
1936
|
`).map(d=>d.trim()).filter(d=>d).filter(d=>!this.#jt(d));if(c.length===0)continue;let u=c.map(d=>this.absolutePathToWorkspaceUrl(this.#e.join(i.path,d))).filter(d=>d!=null);e.push(...u);let l=await this.git(["--no-pager","diff","-U0","--no-color",s,"--",...c],{cwd:i.path}).then(d=>d.trim());l.length>0&&(this.#f.length>1?r.push(`
|
|
1937
1937
|
### Changes in ${i.folderName}:
|
|
1938
1938
|
${l}`):r.push(l))}catch(a){this.#e.Sentry?.captureException(a,{tags:{operation:"codegen-git",folderName:i.folderName}})}}if(e.length===0)return{files:[],diff:""};let n="";if(!this.#G()&&r.length>0)if(this.#f.length>1)n=`Notice: This is a multi-repo workspace with folders: ${this.#f.map(s=>s.folderName).join(", ")}. File paths are prefixed with their folder names when using Read/Write/Edit tools.
|
|
@@ -2803,7 +2803,7 @@ return fn.apply(this, arguments)
|
|
|
2803
2803
|
`)+`\r
|
|
2804
2804
|
\r
|
|
2805
2805
|
`+r)}function Ep(t,e,r,n,i,s){if(t.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,Ep),t.emit("wsClientError",o,r,e)}else QB(r,n,i,s)}});var cQe=N((sur,AQe)=>{h();var _4=class{constructor(e,r,n){this.etaBufferLength=e||100,this.valueBuffer=[n],this.timeBuffer=[r],this.eta="0"}update(e,r,n){this.valueBuffer.push(r),this.timeBuffer.push(e),this.calculate(n-r)}getTime(){return this.eta}calculate(e){let r=this.valueBuffer.length,n=Math.min(this.etaBufferLength,r),i=this.valueBuffer[r-1]-this.valueBuffer[r-n],s=this.timeBuffer[r-1]-this.timeBuffer[r-n],o=i/s;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/o/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};AQe.exports=_4});var G4=N((aur,uQe)=>{h();var yp=require("readline"),U4=class{constructor(e){this.stream=e,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(e){this.stream.isTTY&&(e?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(e=null,r=null){this.stream.isTTY&&yp.cursorTo(this.stream,e,r)}cursorRelative(e=null,r=null){this.stream.isTTY&&(this.dy=this.dy+r,yp.moveCursor(this.stream,e,r))}cursorRelativeReset(){this.stream.isTTY&&(yp.moveCursor(this.stream,0,-this.dy),yp.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&yp.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&yp.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&yp.clearScreenDown(this.stream)}newline(){this.stream.write(`
|
|
2806
|
-
`),this.dy++}write(e,r=!1){this.linewrap===!0&&r===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};uQe.exports=U4});var gQe=N((cur,O4)=>{"use strict";h();var lQe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);O4.exports=lQe;O4.exports.default=lQe});var dQe=N((lur,pQe)=>{"use strict";h();pQe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var hQe=N((pur,K4)=>{"use strict";h();var Fht=sL(),kht=gQe(),Rht=dQe(),fQe=t=>{if(typeof t!="string"||t.length===0||(t=Fht(t),t.length===0))return 0;t=t.replace(Rht()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=kht(n)?2:1)}return e};K4.exports=fQe;K4.exports.default=fQe});var H4=N((fur,mQe)=>{h();mQe.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(s,o){return(r.autopaddingChar+s).slice(-o)}return n==="percentage"?i(e,3):e}});var J4=N((mur,CQe)=>{h();CQe.exports=function(e,r){let n=Math.round(e*r.barsize),i=r.barsize-n;return r.barCompleteString.substr(0,n)+r.barGlue+r.barIncompleteString.substr(0,i)}});var j4=N((Iur,IQe)=>{h();IQe.exports=function(e,r,n){function i(o){return n?n*Math.round(o/n):o}function s(o){return(r.autopaddingChar+o).slice(-2)}return e>3600?s(Math.floor(e/3600))+"h"+s(i(e%3600/60))+"m":e>60?s(Math.floor(e/60))+"m"+s(i(e%60))+"s":e>10?s(i(e))+"s":s(e)+"s"}});var Y4=N((Bur,EQe)=>{h();var Tht=hQe(),Nht=H4(),Mht=J4(),Pht=j4();EQe.exports=function(e,r,n){let i=e.format,s=e.formatTime||Pht,o=e.formatValue||Nht,a=e.formatBar||Mht,A=Math.floor(r.progress*100)+"",c=r.stopTime||Date.now(),u=Math.round((c-r.startTime)/1e3),l=Object.assign({},n,{bar:a(r.progress,e),percentage:o(A,e,"percentage"),total:o(r.total,e,"total"),value:o(r.value,e,"value"),eta:o(r.eta,e,"eta"),eta_formatted:s(r.eta,e,5),duration:o(u,e,"duration"),duration_formatted:s(u,e,1)});i=i.replace(/\{(\w+)\}/g,function(p,f){return typeof l[f]<"u"?l[f]:p});let d=Math.max(0,r.maxWidth-Tht(i)-2),g=Math.floor(d/2);switch(e.align){case"right":i=d>0?" ".repeat(d)+i:i;break;case"center":i=g>0?" ".repeat(g)+i:i;break;default:break}return i}});var nx=N((Qur,BQe)=>{h();function Cr(t,e){return typeof t>"u"||t===null?e:t}BQe.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/Cr(i.fps,10),n.stream=Cr(i.stream,process.stderr),n.terminal=Cr(i.terminal,null),n.clearOnComplete=Cr(i.clearOnComplete,!1),n.stopOnComplete=Cr(i.stopOnComplete,!1),n.barsize=Cr(i.barsize,40),n.align=Cr(i.align,"left"),n.hideCursor=Cr(i.hideCursor,!1),n.linewrap=Cr(i.linewrap,!1),n.barGlue=Cr(i.barGlue,""),n.barCompleteChar=Cr(i.barCompleteChar,"="),n.barIncompleteChar=Cr(i.barIncompleteChar,"-"),n.format=Cr(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=Cr(i.formatTime,null),n.formatValue=Cr(i.formatValue,null),n.formatBar=Cr(i.formatBar,null),n.etaBufferLength=Cr(i.etaBuffer,10),n.etaAsynchronousUpdate=Cr(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=Cr(i.progressCalculationRelative,!1),n.synchronousUpdate=Cr(i.synchronousUpdate,!0),n.noTTYOutput=Cr(i.noTTYOutput,!1),n.notTTYSchedule=Cr(i.notTTYSchedule,2e3),n.emptyOnZero=Cr(i.emptyOnZero,!1),n.forceRedraw=Cr(i.forceRedraw,!1),n.autopadding=Cr(i.autopadding,!1),n.gracefulExit=Cr(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?Cr(e.autopaddingChar," "):"",e}}});var q4=N((bur,QQe)=>{h();var yQe=cQe(),Lht=G4(),_ht=Y4(),Uht=nx(),Ght=require("events");QQe.exports=class extends Ght{constructor(e){super(),this.options=Uht.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new Lht(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new yQe(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:_ht}render(e=!1){let r={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,r,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,r,n){this.value=r||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=r||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new yQe(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,r)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,r={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:r)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,r={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,r)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var wQe=N((xur,DQe)=>{h();var Oht=q4(),Kht=nx();DQe.exports=class extends Oht{constructor(e,r){super(Kht.parse(e,r)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,r){this.timer&&(super.update(e,r),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,r,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,r,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var SQe=N((Rur,bQe)=>{h();var Hht=G4(),Jht=q4(),jht=nx(),Yht=require("events");bQe.exports=class extends Yht{constructor(e,r){super(),this.bars=[],this.options=jht.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Hht(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,r,n,i={}){let s=new Jht(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(s),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,s.start(e,r,n),this.emit("start")),s}remove(e){let r=this.bars.indexOf(e);return r<0?!1:(this.bars.splice(r,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var xQe=N((Nur,vQe)=>{h();vQe.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var kQe=N((Pur,FQe)=>{h();FQe.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var TQe=N((_ur,RQe)=>{h();RQe.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var MQe=N((Gur,NQe)=>{h();NQe.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var LQe=N((Kur,PQe)=>{h();var qht=xQe(),$ht=kQe(),Vht=TQe(),Wht=MQe();PQe.exports={legacy:qht,shades_classic:$ht,shades_grey:Vht,rect:Wht}});var GQe=N((Jur,UQe)=>{h();var _Qe=wQe(),zht=SQe(),Xht=LQe(),Zht=Y4(),emt=H4(),tmt=J4(),rmt=j4();UQe.exports={Bar:_Qe,SingleBar:_Qe,MultiBar:zht,Presets:Xht,Format:{Formatter:Zht,BarFormat:tmt,ValueFormat:emt,TimeFormat:rmt}}});var qQe=N((plr,YQe)=>{h();YQe.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var uDt={};ty(uDt,{default:()=>cDt});module.exports=Vr(uDt);h();h();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="ed38daea-e50f-4d4a-a2ae-669a0d1b2657",t._sentryDebugIdIdentifier="sentry-dbid-ed38daea-e50f-4d4a-a2ae-669a0d1b2657")}catch{}})();h();Qt();var Dxe=require("../core/index.cjs"),wxe=require("../node/index.cjs"),bxe=require("../server/index.cjs"),Sxe=X(ij(),1);h();h();var FS=require("fs/promises");JF();_r();JC();er();var Or=X(Ir(),1),hh=require("node:path");vs();ks();Qr();Wr();rh();var Ynt="https://cdn.builder.io",ide=async(t,e)=>{console.log(""),nr((0,Or.bgCyan)((0,Or.bold)((0,Or.white)(" figma migrate ")))+" "+(0,Or.dim)(dt));let{builderPrivateKey:r,builderPublicKey:n}=await Wt(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await Pt("figma publish started",{spaceId:n});let i=await HC(t);if(i.length>0){await Pt("figma migrate with existing files",{spaceId:n}),q.warning(`${(0,Or.yellow)("This repo already has figma mappings in:")}
|
|
2806
|
+
`),this.dy++}write(e,r=!1){this.linewrap===!0&&r===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};uQe.exports=U4});var gQe=N((cur,O4)=>{"use strict";h();var lQe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);O4.exports=lQe;O4.exports.default=lQe});var dQe=N((lur,pQe)=>{"use strict";h();pQe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var hQe=N((pur,K4)=>{"use strict";h();var Fht=sL(),kht=gQe(),Rht=dQe(),fQe=t=>{if(typeof t!="string"||t.length===0||(t=Fht(t),t.length===0))return 0;t=t.replace(Rht()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=kht(n)?2:1)}return e};K4.exports=fQe;K4.exports.default=fQe});var H4=N((fur,mQe)=>{h();mQe.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(s,o){return(r.autopaddingChar+s).slice(-o)}return n==="percentage"?i(e,3):e}});var J4=N((mur,CQe)=>{h();CQe.exports=function(e,r){let n=Math.round(e*r.barsize),i=r.barsize-n;return r.barCompleteString.substr(0,n)+r.barGlue+r.barIncompleteString.substr(0,i)}});var j4=N((Iur,IQe)=>{h();IQe.exports=function(e,r,n){function i(o){return n?n*Math.round(o/n):o}function s(o){return(r.autopaddingChar+o).slice(-2)}return e>3600?s(Math.floor(e/3600))+"h"+s(i(e%3600/60))+"m":e>60?s(Math.floor(e/60))+"m"+s(i(e%60))+"s":e>10?s(i(e))+"s":s(e)+"s"}});var Y4=N((Bur,EQe)=>{h();var Tht=hQe(),Nht=H4(),Mht=J4(),Pht=j4();EQe.exports=function(e,r,n){let i=e.format,s=e.formatTime||Pht,o=e.formatValue||Nht,a=e.formatBar||Mht,A=Math.floor(r.progress*100)+"",c=r.stopTime||Date.now(),u=Math.round((c-r.startTime)/1e3),l=Object.assign({},n,{bar:a(r.progress,e),percentage:o(A,e,"percentage"),total:o(r.total,e,"total"),value:o(r.value,e,"value"),eta:o(r.eta,e,"eta"),eta_formatted:s(r.eta,e,5),duration:o(u,e,"duration"),duration_formatted:s(u,e,1)});i=i.replace(/\{(\w+)\}/g,function(p,f){return typeof l[f]<"u"?l[f]:p});let d=Math.max(0,r.maxWidth-Tht(i)-2),g=Math.floor(d/2);switch(e.align){case"right":i=d>0?" ".repeat(d)+i:i;break;case"center":i=g>0?" ".repeat(g)+i:i;break;default:break}return i}});var nx=N((Qur,BQe)=>{h();function Cr(t,e){return typeof t>"u"||t===null?e:t}BQe.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/Cr(i.fps,10),n.stream=Cr(i.stream,process.stderr),n.terminal=Cr(i.terminal,null),n.clearOnComplete=Cr(i.clearOnComplete,!1),n.stopOnComplete=Cr(i.stopOnComplete,!1),n.barsize=Cr(i.barsize,40),n.align=Cr(i.align,"left"),n.hideCursor=Cr(i.hideCursor,!1),n.linewrap=Cr(i.linewrap,!1),n.barGlue=Cr(i.barGlue,""),n.barCompleteChar=Cr(i.barCompleteChar,"="),n.barIncompleteChar=Cr(i.barIncompleteChar,"-"),n.format=Cr(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=Cr(i.formatTime,null),n.formatValue=Cr(i.formatValue,null),n.formatBar=Cr(i.formatBar,null),n.etaBufferLength=Cr(i.etaBuffer,10),n.etaAsynchronousUpdate=Cr(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=Cr(i.progressCalculationRelative,!1),n.synchronousUpdate=Cr(i.synchronousUpdate,!0),n.noTTYOutput=Cr(i.noTTYOutput,!1),n.notTTYSchedule=Cr(i.notTTYSchedule,2e3),n.emptyOnZero=Cr(i.emptyOnZero,!1),n.forceRedraw=Cr(i.forceRedraw,!1),n.autopadding=Cr(i.autopadding,!1),n.gracefulExit=Cr(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?Cr(e.autopaddingChar," "):"",e}}});var q4=N((bur,QQe)=>{h();var yQe=cQe(),Lht=G4(),_ht=Y4(),Uht=nx(),Ght=require("events");QQe.exports=class extends Ght{constructor(e){super(),this.options=Uht.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new Lht(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new yQe(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:_ht}render(e=!1){let r={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,r,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,r,n){this.value=r||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=r||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new yQe(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,r)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,r={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:r)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,r={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,r)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var wQe=N((xur,DQe)=>{h();var Oht=q4(),Kht=nx();DQe.exports=class extends Oht{constructor(e,r){super(Kht.parse(e,r)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,r){this.timer&&(super.update(e,r),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,r,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,r,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var SQe=N((Rur,bQe)=>{h();var Hht=G4(),Jht=q4(),jht=nx(),Yht=require("events");bQe.exports=class extends Yht{constructor(e,r){super(),this.bars=[],this.options=jht.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Hht(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,r,n,i={}){let s=new Jht(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(s),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,s.start(e,r,n),this.emit("start")),s}remove(e){let r=this.bars.indexOf(e);return r<0?!1:(this.bars.splice(r,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var xQe=N((Nur,vQe)=>{h();vQe.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var kQe=N((Pur,FQe)=>{h();FQe.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var TQe=N((_ur,RQe)=>{h();RQe.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var MQe=N((Gur,NQe)=>{h();NQe.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var LQe=N((Kur,PQe)=>{h();var qht=xQe(),$ht=kQe(),Vht=TQe(),Wht=MQe();PQe.exports={legacy:qht,shades_classic:$ht,shades_grey:Vht,rect:Wht}});var GQe=N((Jur,UQe)=>{h();var _Qe=wQe(),zht=SQe(),Xht=LQe(),Zht=Y4(),emt=H4(),tmt=J4(),rmt=j4();UQe.exports={Bar:_Qe,SingleBar:_Qe,MultiBar:zht,Presets:Xht,Format:{Formatter:Zht,BarFormat:tmt,ValueFormat:emt,TimeFormat:rmt}}});var qQe=N((plr,YQe)=>{h();YQe.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var uDt={};ty(uDt,{default:()=>cDt});module.exports=Vr(uDt);h();h();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="66c2fd53-7280-4104-bfda-140266cde807",t._sentryDebugIdIdentifier="sentry-dbid-66c2fd53-7280-4104-bfda-140266cde807")}catch{}})();h();Qt();var Dxe=require("../core/index.cjs"),wxe=require("../node/index.cjs"),bxe=require("../server/index.cjs"),Sxe=X(ij(),1);h();h();var FS=require("fs/promises");JF();_r();JC();er();var Or=X(Ir(),1),hh=require("node:path");vs();ks();Qr();Wr();rh();var Ynt="https://cdn.builder.io",ide=async(t,e)=>{console.log(""),nr((0,Or.bgCyan)((0,Or.bold)((0,Or.white)(" figma migrate ")))+" "+(0,Or.dim)(dt));let{builderPrivateKey:r,builderPublicKey:n}=await Wt(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await Pt("figma publish started",{spaceId:n});let i=await HC(t);if(i.length>0){await Pt("figma migrate with existing files",{spaceId:n}),q.warning(`${(0,Or.yellow)("This repo already has figma mappings in:")}
|
|
2807
2807
|
|
|
2808
2808
|
${i.map(c=>` - ${(0,hh.relative)(t.getAppRootDir(),c)}`).join(`
|
|
2809
2809
|
`)}
|