@builder.io/dev-tools 1.50.1-beta.202604291533.c11e968 → 1.50.1-beta.202604291652.1363068
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 +39 -39
- package/cli/index.cjs.map +4 -4
- 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 KUe=Object.create;var HD=Object.defineProperty;var HUe=Object.getOwnPropertyDescriptor;var $Ue=Object.getOwnPropertyNames;var JUe=Object.getPrototypeOf,jUe=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),CA=(t,e)=>{for(var r in e)HD(t,r,{get:e[r],enumerable:!0})},FV=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $Ue(e))!jUe.call(t,i)&&i!==r&&HD(t,i,{get:()=>e[i],enumerable:!(n=HUe(e,i))||n.enumerable});return t};var W=(t,e,r)=>(r=t!=null?KUe(JUe(t)):{},FV(e||!t||!t.__esModule?HD(r,"default",{value:t,enumerable:!0}):r,t)),In=t=>FV(HD({},"__esModule",{value:!0}),t);var m=N(()=>{(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 KUe=Object.create;var HD=Object.defineProperty;var HUe=Object.getOwnPropertyDescriptor;var $Ue=Object.getOwnPropertyNames;var JUe=Object.getPrototypeOf,jUe=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),CA=(t,e)=>{for(var r in e)HD(t,r,{get:e[r],enumerable:!0})},FV=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $Ue(e))!jUe.call(t,i)&&i!==r&&HD(t,i,{get:()=>e[i],enumerable:!(n=HUe(e,i))||n.enumerable});return t};var W=(t,e,r)=>(r=t!=null?KUe(JUe(t)):{},FV(e||!t||!t.__esModule?HD(r,"default",{value:t,enumerable:!0}):r,t)),In=t=>FV(HD({},"__esModule",{value:!0}),t);var m=N(()=>{(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"1363068f0bb9a11aba5919b8ae56bbad71e30df3"}}catch{}})()});var RV=k((GTt,kV)=>{m();function RT(t){return t==null?[]:Array.isArray(t)?t:[t]}function YUe(t,e,r,n){var i,o=t[e],s=~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]=o==null?s:Array.isArray(o)?o.concat(s):[o,s]}kV.exports=function(t,e){t=t||[],e=e||{};var r,n,i,o,s,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=RT(e.string),e.boolean=RT(e.boolean),d)for(r in e.alias)for(n=e.alias[r]=RT(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(o=typeof e.default[r],n=e.alias[r]=e.alias[r]||[],e[o]!==void 0)for(e[o].push(r),A=0;A<n.length;A++)e[o].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(o=i.substring(c+3),g&&!~f.indexOf(o))return e.unknown(i);a[o]=!1}else{for(u=c+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(o=i.substring(c,u),s=i.substring(++u)||A+1===l||(""+t[A+1]).charCodeAt(0)===45||t[++A],n=c===2?[o]:o,u=0;u<n.length;u++){if(o=n[u],g&&!~f.indexOf(o))return e.unknown("-".repeat(c)+o);YUe(a,o,u+1<n.length||s,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 qUe(){if(ZC!==void 0)return ZC;try{return ZC=require("prettier"),ZC}catch{return ZC=null,null}}function VUe(t){let e=[],r=Hg.default.dirname(t);for(;r!==Hg.default.dirname(r);){let n=Hg.default.join(r,".prettierignore");NT.default.existsSync(n)&&e.push(n);let i=Hg.default.join(r,".git");if(NT.default.existsSync(i))break;r=Hg.default.dirname(r)}return e}function zUe(t){if(t)try{let r=(0,NV.createRequire)(t)("prettier");if(r)return r}catch{}return qUe()}async function Rc(t,e,r,n){try{let i=Hg.default.resolve(t,n??"file.tsx"),o=zUe(i);if(!o)return e;if(n){let A=VUe(i);if((await o.getFileInfo(i,{ignorePath:A.length>0?A:void 0})).ignored)return e}let s=await o.resolveConfig(i);return await o.format(e,{...s,filepath:n,parser:r})}catch{return e}}var NV,Hg,NT,ZC,TT=N(()=>{"use strict";m();NV=require("node:module"),Hg=W(require("node:path"),1),NT=W(require("node:fs"),1)});var MT,qd,$D,JD,TV,$g,PT,_T,Jg,MV,Vd=N(()=>{"use strict";m();MT="preview-url",qd="framework",$D="platform",JD="node",TV="/~builder-connect",$g="/~builder-connected",PT="/~builder-dev-tools",_T="/~builder-dev-tools.js",Jg="/~builder-dev-tools-close",MV="/mappings"});var jD=k((YTt,PV)=>{"use strict";m();var LT={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"},WUe={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},ZUe={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?LT.up():"");return t&&(e+=LT.left),e}};PV.exports={cursor:LT,scroll:WUe,erase:ZUe,beep:"\x07"}});var Gr=k((VTt,UT)=>{m();var qD=process||{},_V=qD.argv||[],YD=qD.env||{},XUe=!(YD.NO_COLOR||_V.includes("--no-color"))&&(!!YD.FORCE_COLOR||_V.includes("--color")||qD.platform==="win32"||(qD.stdout||{}).isTTY&&YD.TERM!=="dumb"||!!YD.CI),e2e=(t,e,r=t)=>n=>{let i=""+n,o=i.indexOf(e,t.length);return~o?t+t2e(i,e,r,o)+e:t+i+e},t2e=(t,e,r,n)=>{let i="",o=0;do i+=t.substring(o,n)+r,o=n+e.length,n=t.indexOf(e,o);while(~n);return i+t.substring(o)},LV=(t=XUe)=>{let e=t?e2e:()=>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")}};UT.exports=LV();UT.exports.createColors=LV});function r2e({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 VV(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(n2e,"")}function zV(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function XC(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=VV(t),t.length===0))return 0;t=t.replace(a2e()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let o=i.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(o2e.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function u2e(){let t=new Map;for(let[e,r]of Object.entries(sn)){for(let[n,i]of Object.entries(r))sn[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=sn[n],t.set(i[0],i[1]);Object.defineProperty(sn,e,{value:r,enumerable:!1})}return Object.defineProperty(sn,"codes",{value:t,enumerable:!1}),sn.color.close="\x1B[39m",sn.bgColor.close="\x1B[49m",sn.color.ansi=UV(),sn.color.ansi256=OV(),sn.color.ansi16m=GV(),sn.bgColor.ansi=UV(OT),sn.bgColor.ansi256=OV(OT),sn.bgColor.ansi16m=GV(OT),Object.defineProperties(sn,{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(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>sn.rgbToAnsi256(...sn.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 o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>sn.ansi256ToAnsi(sn.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>sn.ansi256ToAnsi(sn.hexToAnsi256(e)),enumerable:!1}}),sn}function $V(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`).map(n=>m2e(n,e,r)).join(`
|
|
4
4
|
`)}function jT(t,e){if(typeof t=="string")return zD.aliases.get(t)===e;for(let r of t)if(r!==void 0&&jT(r,e))return!0;return!1}function C2e(t,e){if(t===e)return;let r=t.split(`
|
|
@@ -73,7 +73,7 @@ ${iz}${n.trimStart()}`),r=3+(0,jg.stripVTControlCharacters)(n.trimStart()).lengt
|
|
|
73
73
|
`),p(),i()};return{start:I,stop:B,message:(E="")=>{a=h(E??a)}}}});function ur(t,e=""){return t.ts.createSourceFile("module.tsx",typeof e=="string"?e:"",t.ts.ScriptTarget.Latest,void 0)}function nw(t,e=""){let r=ur(t,e?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${e}`);return r.statements[0]}function ai(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()+`
|
|
74
74
|
`:n.printNode(t.ts.EmitHint.Unspecified,e,t.ts.createSourceFile("module.tsx","",t.ts.ScriptTarget.Latest)).trim()+`
|
|
75
75
|
`}return""}var mn=N(()=>{"use strict";m()});var gz=k((lMt,lz)=>{"use strict";m();lz.exports=function(){if(process.env.npm_config_user_agent)return M2e(process.env.npm_config_user_agent)};function M2e(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 ks(t){return t.endsWith(".mapper.tsx")||t.endsWith(".mapper.jsx")||t.endsWith(".mapper.ts")||t.endsWith(".mapper.js")||t.endsWith(".mapper.mjs")}function lr(t,e,r){e=va(e),r=va(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=va(t.normalize(i)),i.startsWith(".")||(i="./"+i),i}function va(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}function qg(t,e){let r=t.extname(e),n=t.basename(e,r).split(/[\/\\]/),i=n[n.length-1];return pz(i==="index"?t.basename(t.dirname(e)):i)}function pz(t){return Kr(t).replace(/ /g,"")}function Rs(t,e){let r=t.extname(e),n=va(t.basename(e,r)).split("/").pop();return Kr(n==="index"?t.basename(t.dirname(e)):n)}function Hr(t,e){let r=va(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 yr(t,e){let r=e,n=[];for(let i=0;i<2;i++){let o=t.basename(r);if(!o||o==="components")break;n.unshift(o),r=t.dirname(r)}return n.join("/")}function Kr(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 Mo(t){return t.sort((e,r)=>e.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function Mr(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 fz(t){return(await t.hash(t.getAppRootDir())).substring(0,8)}function tI(t){return typeof t=="number"}function Xd(t){return typeof t=="boolean"}function co(t){return typeof t=="string"}function ef(t){return typeof t=="string"?/^[A-Z][A-Za-z0-9]*$/.test(t):!1}function As(t){return JSON.parse(JSON.stringify(t))}function iw(t,e,r){for(let n of e)if(t.dirname(r).includes(n))return!0;return!1}function mz(){try{let t=(0,dz.default)();if(t?.name)return t.name}catch{}return"npm"}function P2e(){return process.platform.startsWith("win")}function Bt(){return process.pkg?"@builder.io/agent":P2e()?'"@builder.io/dev-tools"':"builder.io"}function ZT(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_")}var dz,jt=N(()=>{"use strict";m();dz=W(gz(),1)});function uo(t){let e=t.join(t.getAppRootDir(),"tsconfig.json");return t.exists(e)}async function Po(t,e){async function r(i,o){if(o>10)return;let s=await t.readdir(i);for(let a of s){if(_2e.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,o+1);if(u)return u}}}}let n=await r(t.getAppRootDir(),0);if(!n){let o=`builder-registry.${await uo(t)?"ts":"js"}`;return t.join(e,o)}return n}async function Sa(t,e){let r=t.resolve("/");for(let n=0;n<20;n++){let i=t.join(e,"package.json"),o=await t.readFile(i);if(o)return JSON.parse(o);if(e===r)break;e=t.dirname(e)}return null}async function hz(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 rI(t,e,r){let n=await t.readdir(e);return n.includes(r)?t.join(e,r):(await Promise.all(n.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=t.join(e,o);if((await t.stat(s)).isDirectory()){let A=await rI(t,s,r);if(A)return A}}))).find(o=>typeof o=="string")}var _2e,ji=N(()=>{"use strict";m();_2e=["node_modules","dist","build","public"]});async function Yn(t,e,r){if(!Array.isArray(e)||e.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${e}`);let n=await hz(t,e[0]),i=t.join(n,"typescript","lib"),o=new Map,s={fileExists:a=>{if(a=t.normalize(a),a.includes("node_modules")){let A=nI.get(a);if(!A){try{t.statSync(a).isFile()?A={exists:!0,content:t.readFileSync(a)}:A={exists:!1}}catch{A={exists:!1}}nI.set(a,A)}return A.exists}if(!o.has(a))if(t.existsSync(a)){let c=t.statSync(a);o.set(a,c.isFile())}else o.set(a,!1);return o.get(a)},getCanonicalFileName:a=>t.normalize(a),getCurrentDirectory:()=>t.cwd(),getDefaultLibFileName:()=>t.join(i,"lib.d.ts"),getDefaultLibLocation:()=>i,getNewLine:()=>`
|
|
76
|
-
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=nI.get(a);if(c)return ur(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=Iz.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new sw(c)}return a.includes("node_modules")&&(A?nI.set(a,{exists:!0,content:A}):nI.set(a,{exists:!1})),ur(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return L2e(t,s,e,r)}catch(a){if(a instanceof sw){await U2e(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function L2e(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},o=t.ts.findConfigFile(t.dirname(r[0]),s=>t.existsSync(s));if(o){let s=Cz.get(o);if(!s){let a=t.ts.readConfigFile(o,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:o}}):(s=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(o),void 0,o).options,Cz.set(o,s))}s&&(i.options=As(s))}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 tf(t,e,r){r||(r=await Yn(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 U2e(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;ow.has(e)||ow.set(e,fetch(r).then(n=>n.text()).then(n=>{Iz.set(e,n)})),await ow.get(e),ow.delete(e)}async function Ez(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:XT(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function XT(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 sw,Iz,ow,nI,Cz,Ns=N(()=>{"use strict";m();mn();jt();ji();sw=class{libName;constructor(e){this.libName=e}};Iz=new Map,ow=new Map,nI=new Map,Cz=new Map});var O2e,xt,vn=N(()=>{"use strict";m();O2e="1.50.1-beta.
|
|
76
|
+
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=nI.get(a);if(c)return ur(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=Iz.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new sw(c)}return a.includes("node_modules")&&(A?nI.set(a,{exists:!0,content:A}):nI.set(a,{exists:!1})),ur(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return L2e(t,s,e,r)}catch(a){if(a instanceof sw){await U2e(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function L2e(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},o=t.ts.findConfigFile(t.dirname(r[0]),s=>t.existsSync(s));if(o){let s=Cz.get(o);if(!s){let a=t.ts.readConfigFile(o,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:o}}):(s=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(o),void 0,o).options,Cz.set(o,s))}s&&(i.options=As(s))}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 tf(t,e,r){r||(r=await Yn(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 U2e(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;ow.has(e)||ow.set(e,fetch(r).then(n=>n.text()).then(n=>{Iz.set(e,n)})),await ow.get(e),ow.delete(e)}async function Ez(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:XT(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function XT(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 sw,Iz,ow,nI,Cz,Ns=N(()=>{"use strict";m();mn();jt();ji();sw=class{libName;constructor(e){this.libName=e}};Iz=new Map,ow=new Map,nI=new Map,Cz=new Map});var O2e,xt,vn=N(()=>{"use strict";m();O2e="1.50.1-beta.202604291652.1363068",xt=process.env.OVERRIDE_VERSION??O2e});async function Vg(t){let e=[],r=await Sa(t,t.getRepoRootDir());if(r){let n=await yz(r,t);e.push(...n)}return e}async function yz(t,e){let r=[];if(t&&typeof t=="object"){let n=new Set(Object.keys({...t.dependencies,...t.devDependencies}));for(let i of G2e)if(n.has(i)&&!r.some(o=>o.name===i)){let o={name:i};Bz.has(i)&&(o.version=await Bz.get(i)(e)),r.push(o)}}return r}function eM(t){let e=parseInt(t);return Number.isNaN(e)?void 0:e}var Bz,G2e,zg=N(()=>{"use strict";m();ji();jt();Bz=new Map([["next",async t=>{if(!t.spawnSync)return;let e=mz(),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 o=i[0].split("Next.js v")[1],[s,a,A]=o.split(".");return{major:eM(s),minor:eM(a),patch:eM(A)}}]]),G2e=["@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 Ts(t){let e=Qz(t),r=await t.readFile(e);return typeof r=="string"?JSON.parse(r):{}}async function Ms(t,e){e=typeof e=="object"&&e!=null?e:{};let r=Qz(t);await t.writeFile(r,JSON.stringify(e??{},null,2))}function Qz(t){let e=t.getAppRootDir();return t.join(e,"node_modules",".builder","builder-cache.json")}var Wg=N(()=>{"use strict";m()});async function IA(t,e,r){let n={envKey:r,envValue:null,file:""};for(let i of e){let o=t.join(t.getAppRootDir(),i),s=await K2e(t,o);if(s){let a=s[r];if(typeof a=="string"&&a.length>0&&a!=="YOUR_API_KEY")return n.envValue=a,n.file=o,n}}return n.file=t.join(t.getAppRootDir(),e[e.length-1]),n}async function K2e(t,e){let r=await t.readFile(e);return typeof r=="string"?Dz(r):null}function Dz(t){let e={},r=t.replace(/\r\n?/gm,`
|
|
77
77
|
`),n;for(;(n=H2e.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
|
|
78
78
|
`),o=o.replace(/\\r/g,"\r")),e[i]=o}return e}async function EA(t,e,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",o=await t.readFile(e);try{if(o)if(o.includes(r))if(o.includes(n))t.debug(`"${r}" with "${n}" already set in ${e}`);else return t.debug(`Replace "${r}" in ${e}`),o=o.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await t.writeFile(e,o),"update";else return t.debug(`Append "${r}" to ${e}`),o+=`
|
|
79
79
|
|
|
@@ -1107,7 +1107,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),G=$,L=H),O===void 0&&(
|
|
|
1107
1107
|
`:`
|
|
1108
1108
|
`)+r,i=n+1,n=t.indexOf(`
|
|
1109
1109
|
`,i)}while(n!==-1);return o+=t.slice(i),o}var Oee=N(()=>{m()});function FI(t){return $ee(t)}var Gee,Kee,CP,yf,xI,Hee,Qf,G3e,jw,$ee,IP,K3e,H3e,EP,Yw,$3e,Y3t,q3t,Jee=N(()=>{m();Nee();_ee();Oee();({stdout:Gee,stderr:Kee}=Pee),CP=Symbol("GENERATOR"),yf=Symbol("STYLER"),xI=Symbol("IS_EMPTY"),Hee=["ansi","ansi","ansi256","ansi16m"],Qf=Object.create(null),G3e=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Gee?Gee.level:0;t.level=e.level===void 0?r:e.level},jw=class{constructor(e){return $ee(e)}},$ee=t=>{let e=(...r)=>r.join(" ");return G3e(e,t),Object.setPrototypeOf(e,FI.prototype),e};Object.setPrototypeOf(FI.prototype,Function.prototype);for(let[t,e]of Object.entries(Na))Qf[t]={get(){let r=Yw(this,EP(e.open,e.close,this[yf]),this[xI]);return Object.defineProperty(this,t,{value:r}),r}};Qf.visible={get(){let t=Yw(this,this[yf],!0);return Object.defineProperty(this,"visible",{value:t}),t}};IP=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?Na[r].ansi16m(...n):e==="ansi256"?Na[r].ansi256(Na.rgbToAnsi256(...n)):Na[r].ansi(Na.rgbToAnsi(...n)):t==="hex"?IP("rgb",e,r,...Na.hexToRgb(...n)):Na[r][t](...n),K3e=["rgb","hex","ansi256"];for(let t of K3e){Qf[t]={get(){let{level:r}=this;return function(...n){let i=EP(IP(t,Hee[r],"color",...n),Na.color.close,this[yf]);return Yw(this,i,this[xI])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);Qf[e]={get(){let{level:r}=this;return function(...n){let i=EP(IP(t,Hee[r],"bgColor",...n),Na.bgColor.close,this[yf]);return Yw(this,i,this[xI])}}}}H3e=Object.defineProperties(()=>{},{...Qf,level:{enumerable:!0,get(){return this[CP].level},set(t){this[CP].level=t}}}),EP=(t,e,r)=>{let n,i;return r===void 0?(n=t,i=e):(n=r.openAll+t,i=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:i,parent:r}},Yw=(t,e,r)=>{let n=(...i)=>$3e(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,H3e),n[CP]=t,n[yf]=e,n[xI]=r,n},$3e=(t,e)=>{if(t.level<=0||!e)return t[xI]?"":e;let r=t[yf];if(r===void 0)return e;let{openAll:n,closeAll:i}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=Lee(e,r.close,r.open),r=r.parent;let o=e.indexOf(`
|
|
1110
|
-
`);return o!==-1&&(e=Uee(e,i,n,o)),n+e+i};Object.defineProperties(FI.prototype,Qf);Y3t=FI(),q3t=FI({level:Kee?Kee.level:0})});function yP(t){let e=fP(t);return{highlight:r,highlightAuto:n,listLanguages:e.listLanguages,register:e.register,registerAlias:e.registerAlias,registered:e.registered};function r(i,o,s){let a=e.highlight(i,o),A=a.data;return{language:A.language,relevance:A.relevance,value:BP(s||jee,a)}}function n(i,o){let s,a;if(o&&("subset"in o||"sheet"in o)){let u=o;a={subset:u.subset},s=u.sheet}else s=o;let A=e.highlightAuto(i,a),c=A.data;return{language:c.language,relevance:c.relevance,value:BP(s||jee,A)}}}function BP(t,e){let r=new Set(e.type==="element"&&Array.isArray(e.properties.className)?e.properties.className.map(function(a){return String(a).replace(/^hljs-/,"")}):[]),n={},i,o="",s;for(s in t)if(Object.hasOwn(t,s)){let a=s.split(" "),A=t[s];r.has(a[0])?a.length===1?i=A:n[a.slice(1).join(" ")]=A:n[s]=A}return"value"in e?o=e.value:"children"in e&&(o=J3e(n,e.children)),i&&(o=i(o)),o}function J3e(t,e){let r=[],n=-1;for(;++n<e.length;)r.push(BP(t,e[n]));return r.join("")}var sr,jee,Yee=N(()=>{m();Jee();mP();sr=new jw({level:2}),jee={comment:sr.gray,quote:sr.gray,keyword:sr.green,"selector-tag":sr.green,addition:sr.green,number:sr.cyan,string:sr.cyan,"meta meta-string":sr.cyan,literal:sr.cyan,doctag:sr.cyan,regexp:sr.cyan,title:sr.blue,section:sr.blue,name:sr.blue,"selector-id":sr.blue,"selector-class":sr.blue,attribute:sr.yellow,attr:sr.yellow,variable:sr.yellow,"template-variable":sr.yellow,"class title":sr.yellow,type:sr.yellow,symbol:sr.magenta,bullet:sr.magenta,subst:sr.magenta,meta:sr.magenta,"meta keyword":sr.magenta,"selector-attr":sr.magenta,"selector-pseudo":sr.magenta,link:sr.magenta,built_in:sr.red,deletion:sr.red,emphasis:sr.italic,strong:sr.bold,formula:sr.inverse}});var qee=N(()=>{m();mP();Yee()});async function Ke(t){if(process.env.NODE_ENV!=="test")try{let e=process.env.BUILDER_DISABLE_AMPLITUDE==="true",r=[Vee.flush(2e3)];e||r.push(zee.flush().promise),await Promise.allSettled(r)}catch(e){j3e.error(e)}process.exit(t)}var Vee,zee,j3e,Ta=N(()=>{"use strict";m();Vee=W(require("@sentry/node"),1),zee=W(require("@amplitude/analytics-node"),1);Gt();j3e=ke("Exit")});var
|
|
1110
|
+
`);return o!==-1&&(e=Uee(e,i,n,o)),n+e+i};Object.defineProperties(FI.prototype,Qf);Y3t=FI(),q3t=FI({level:Kee?Kee.level:0})});function yP(t){let e=fP(t);return{highlight:r,highlightAuto:n,listLanguages:e.listLanguages,register:e.register,registerAlias:e.registerAlias,registered:e.registered};function r(i,o,s){let a=e.highlight(i,o),A=a.data;return{language:A.language,relevance:A.relevance,value:BP(s||jee,a)}}function n(i,o){let s,a;if(o&&("subset"in o||"sheet"in o)){let u=o;a={subset:u.subset},s=u.sheet}else s=o;let A=e.highlightAuto(i,a),c=A.data;return{language:c.language,relevance:c.relevance,value:BP(s||jee,A)}}}function BP(t,e){let r=new Set(e.type==="element"&&Array.isArray(e.properties.className)?e.properties.className.map(function(a){return String(a).replace(/^hljs-/,"")}):[]),n={},i,o="",s;for(s in t)if(Object.hasOwn(t,s)){let a=s.split(" "),A=t[s];r.has(a[0])?a.length===1?i=A:n[a.slice(1).join(" ")]=A:n[s]=A}return"value"in e?o=e.value:"children"in e&&(o=J3e(n,e.children)),i&&(o=i(o)),o}function J3e(t,e){let r=[],n=-1;for(;++n<e.length;)r.push(BP(t,e[n]));return r.join("")}var sr,jee,Yee=N(()=>{m();Jee();mP();sr=new jw({level:2}),jee={comment:sr.gray,quote:sr.gray,keyword:sr.green,"selector-tag":sr.green,addition:sr.green,number:sr.cyan,string:sr.cyan,"meta meta-string":sr.cyan,literal:sr.cyan,doctag:sr.cyan,regexp:sr.cyan,title:sr.blue,section:sr.blue,name:sr.blue,"selector-id":sr.blue,"selector-class":sr.blue,attribute:sr.yellow,attr:sr.yellow,variable:sr.yellow,"template-variable":sr.yellow,"class title":sr.yellow,type:sr.yellow,symbol:sr.magenta,bullet:sr.magenta,subst:sr.magenta,meta:sr.magenta,"meta keyword":sr.magenta,"selector-attr":sr.magenta,"selector-pseudo":sr.magenta,link:sr.magenta,built_in:sr.red,deletion:sr.red,emphasis:sr.italic,strong:sr.bold,formula:sr.inverse}});var qee=N(()=>{m();mP();Yee()});async function Ke(t){if(process.env.NODE_ENV!=="test")try{let e=process.env.BUILDER_DISABLE_AMPLITUDE==="true",r=[Vee.flush(2e3)];e||r.push(zee.flush().promise),await Promise.allSettled(r)}catch(e){j3e.error(e)}process.exit(t)}var Vee,zee,j3e,Ta=N(()=>{"use strict";m();Vee=W(require("@sentry/node"),1),zee=W(require("@amplitude/analytics-node"),1);Gt();j3e=ke("Exit")});var Pe,Zr=N(()=>{"use strict";m();Pe=process.env.AIR_HOST||process.env.BUILDER_HOST||"https://api.builder.io"});var Zee,Wee=N(()=>{Zee="1.50.1"});var Ste=k(OI=>{"use strict";m();Object.defineProperty(OI,"__esModule",{value:!0});function q3e(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var LA=class{constructor(e,r,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=e,this.column=r,this.index=n}},vf=class{constructor(e,r){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=e,this.end=r}};function fo(t,e){let{line:r,column:n,index:i}=t;return new LA(r,n+e,i+e)}var Xee="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",V3e={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:Xee},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:Xee}},ete={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},zw=t=>t.type==="UpdateExpression"?ete.UpdateExpression[`${t.prefix}`]:ete[t.type],z3e={AccessorIsGenerator:({kind:t})=>`A ${t}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:t})=>`Missing initializer in ${t} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:t})=>`\`${t}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:t,exportName:e})=>`A string literal cannot be used as an exported binding without \`from\`.
|
|
1111
1111
|
- Did you mean \`export { '${t}' as '${e}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:t})=>`'${t==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:t})=>`Unsyntactic ${t==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:t})=>`A string literal cannot be used as an imported binding.
|
|
1112
1112
|
- Did you mean \`import { "${t}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:t})=>`Expected number in radix ${t}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:t})=>`Escape sequence in keyword ${t}.`,InvalidIdentifier:({identifierName:t})=>`Invalid identifier ${t}.`,InvalidLhs:({ancestor:t})=>`Invalid left-hand side in ${zw(t)}.`,InvalidLhsBinding:({ancestor:t})=>`Binding invalid left-hand side in ${zw(t)}.`,InvalidLhsOptionalChaining:({ancestor:t})=>`Invalid optional chaining in the left-hand side of ${zw(t)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:t})=>`Unexpected character '${t}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:t})=>`Private name #${t} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:t})=>`Label '${t}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:t})=>`This experimental syntax requires enabling the parser plugin: ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:t})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:t})=>`Duplicate key "${t}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:t})=>`An export name cannot include a lone surrogate, found '\\u${t.toString(16)}'.`,ModuleExportUndefined:({localName:t})=>`Export '${t}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:t})=>`Private names are only allowed in property accesses (\`obj.#${t}\`) or in \`in\` expressions (\`#${t} in obj\`).`,PrivateNameRedeclaration:({identifierName:t})=>`Duplicate private name #${t}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:t})=>`Unexpected keyword '${t}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:t})=>`Unexpected reserved word '${t}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:t,unexpected:e})=>`Unexpected token${e?` '${e}'.`:""}${t?`, expected "${t}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:t,onlyValidPropertyName:e})=>`The only valid meta property for ${t} is ${t}.${e}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:t})=>`Identifier '${t}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},W3e={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:t})=>`Assigning to '${t}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:t})=>`Binding '${t}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},Z3e={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:t})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(t)}\`.`},X3e=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),eKe=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:t})=>`Invalid topic token ${t}. In order to use ${t} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${t}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:t})=>`Hack-style pipe body cannot be an unparenthesized ${zw({type:t})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'}),tKe=["message"];function tte(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!0,value:r})}function rKe({toMessage:t,code:e,reasonCode:r,syntaxPlugin:n}){let i=r==="MissingPlugin"||r==="MissingOneOfPlugins",o={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return o[r]&&(r=o[r]),function s(a,A){let c=new SyntaxError;return c.code=e,c.reasonCode=r,c.loc=a,c.pos=a.index,c.syntaxPlugin=n,i&&(c.missingPlugin=A.missingPlugin),tte(c,"clone",function(l={}){var d;let{line:g,column:p,index:f}=(d=l.loc)!=null?d:a;return s(new LA(g,p,f),Object.assign({},A,l.details))}),tte(c,"details",A),Object.defineProperty(c,"message",{configurable:!0,get(){let u=`${t(A)} (${a.line}:${a.column})`;return this.message=u,u},set(u){Object.defineProperty(this,"message",{value:u,writable:!0})}}),c}}function PA(t,e){if(Array.isArray(t))return n=>PA(n,t[0]);let r={};for(let n of Object.keys(t)){let i=t[n],o=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,{message:s}=o,a=q3e(o,tKe),A=typeof s=="string"?()=>s:s;r[n]=rKe(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:A},e?{syntaxPlugin:e}:{},a))}return r}var V=Object.assign({},PA(V3e),PA(z3e),PA(W3e),PA(Z3e),PA`pipelineOperator`(eKe));function nKe(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function iKe(t){let e=nKe();if(t==null)return e;if(t.annexB!=null&&t.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let r of Object.keys(e))t[r]!=null&&(e[r]=t[r]);if(e.startLine===1)t.startIndex==null&&e.startColumn>0?e.startIndex=e.startColumn:t.startColumn==null&&e.startIndex>0&&(e.startColumn=e.startIndex);else if((t.startColumn==null||t.startIndex==null)&&t.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(e.sourceType==="commonjs"){if(t.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(t.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(t.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return e}var{defineProperty:oKe}=Object,rte=(t,e)=>{t&&oKe(t,e,{enumerable:!1,value:t[e]})};function kI(t){return rte(t.loc.start,"index"),rte(t.loc.end,"index"),t}var sKe=t=>class extends t{parse(){let r=kI(super.parse());return this.optionFlags&256&&(r.tokens=r.tokens.map(kI)),r}parseRegExpLiteral({pattern:r,flags:n}){let i=null;try{i=new RegExp(r,n)}catch{}let o=this.estreeParseLiteral(i);return o.regex={pattern:r,flags:n},o}parseBigIntLiteral(r){let n;try{n=BigInt(r)}catch{n=null}let i=this.estreeParseLiteral(n);return i.bigint=String(i.value||r),i}parseDecimalLiteral(r){let i=this.estreeParseLiteral(null);return i.decimal=String(i.value||r),i}estreeParseLiteral(r){return this.parseLiteral(r,"Literal")}parseStringLiteral(r){return this.estreeParseLiteral(r)}parseNumericLiteral(r){return this.estreeParseLiteral(r)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(r){return this.estreeParseLiteral(r)}estreeParseChainExpression(r,n){let i=this.startNodeAtNode(r);return i.expression=r,this.finishNodeAt(i,"ChainExpression",n)}directiveToStmt(r){let n=r.value;delete r.value,this.castNodeTo(n,"Literal"),n.raw=n.extra.raw,n.value=n.extra.expressionValue;let i=this.castNodeTo(r,"ExpressionStatement");return i.expression=n,i.directive=n.extra.rawValue,delete n.extra,i}fillOptionalPropertiesForTSESLint(r){}cloneEstreeStringLiteral(r){let{start:n,end:i,loc:o,range:s,raw:a,value:A}=r,c=Object.create(r.constructor.prototype);return c.type="Literal",c.start=n,c.end=i,c.loc=o,c.range=s,c.raw=a,c.value=A,c}initFunction(r,n){super.initFunction(r,n),r.expression=!1}checkDeclaration(r){r!=null&&this.isObjectProperty(r)?this.checkDeclaration(r.value):super.checkDeclaration(r)}getObjectOrClassMethodParams(r){return r.value.params}isValidDirective(r){var n;return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&typeof r.expression.value=="string"&&!((n=r.expression.extra)!=null&&n.parenthesized)}parseBlockBody(r,n,i,o,s){super.parseBlockBody(r,n,i,o,s);let a=r.directives.map(A=>this.directiveToStmt(A));r.body=a.concat(r.body),delete r.directives}parsePrivateName(){let r=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(r):r}convertPrivateNameToPrivateIdentifier(r){let n=super.getPrivateNameSV(r);return delete r.id,r.name=n,this.castNodeTo(r,"PrivateIdentifier")}isPrivateName(r){return this.getPluginOption("estree","classFeatures")?r.type==="PrivateIdentifier":super.isPrivateName(r)}getPrivateNameSV(r){return this.getPluginOption("estree","classFeatures")?r.name:super.getPrivateNameSV(r)}parseLiteral(r,n){let i=super.parseLiteral(r,n);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(r,n,i=!1){super.parseFunctionBody(r,n,i),r.expression=r.body.type!=="BlockStatement"}parseMethod(r,n,i,o,s,a,A=!1){let c=this.startNode();c.kind=r.kind,c=super.parseMethod(c,n,i,o,s,a,A),delete c.kind;let{typeParameters:u}=r;u&&(delete r.typeParameters,c.typeParameters=u,this.resetStartLocationFromNode(c,u));let l=this.castNodeTo(c,"FunctionExpression");return r.value=l,a==="ClassPrivateMethod"&&(r.computed=!1),a==="ObjectMethod"?(r.kind==="method"&&(r.kind="init"),r.shorthand=!1,this.finishNode(r,"Property")):this.finishNode(r,"MethodDefinition")}nameIsConstructor(r){return r.type==="Literal"?r.value==="constructor":super.nameIsConstructor(r)}parseClassProperty(...r){let n=super.parseClassProperty(...r);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(n,"PropertyDefinition"),n}parseClassPrivateProperty(...r){let n=super.parseClassPrivateProperty(...r);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(n,"PropertyDefinition"),n.computed=!1),n}parseClassAccessorProperty(r){let n=super.parseClassAccessorProperty(r);return this.getPluginOption("estree","classFeatures")&&(n.abstract&&this.hasPlugin("typescript")?(delete n.abstract,this.castNodeTo(n,"TSAbstractAccessorProperty")):this.castNodeTo(n,"AccessorProperty")),n}parseObjectProperty(r,n,i,o){let s=super.parseObjectProperty(r,n,i,o);return s&&(s.kind="init",this.castNodeTo(s,"Property")),s}finishObjectProperty(r){return r.kind="init",this.finishNode(r,"Property")}isValidLVal(r,n,i,o){return r==="Property"?"value":super.isValidLVal(r,n,i,o)}isAssignable(r,n){return r!=null&&this.isObjectProperty(r)?this.isAssignable(r.value,n):super.isAssignable(r,n)}toAssignable(r,n=!1){if(r!=null&&this.isObjectProperty(r)){let{key:i,value:o}=r;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(o,n)}else super.toAssignable(r,n)}toAssignableObjectExpressionProp(r,n,i){r.type==="Property"&&(r.kind==="get"||r.kind==="set")?this.raise(V.PatternHasAccessor,r.key):r.type==="Property"&&r.method?this.raise(V.PatternHasMethod,r.key):super.toAssignableObjectExpressionProp(r,n,i)}finishCallExpression(r,n){let i=super.finishCallExpression(r,n);if(i.callee.type==="Import"){var o,s;this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=(o=i.arguments[1])!=null?o:null,i.attributes=(s=i.arguments[1])!=null?s:null,delete i.arguments,delete i.callee}else i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1;return i}toReferencedArguments(r){r.type!=="ImportExpression"&&super.toReferencedArguments(r)}parseExport(r,n){let i=this.state.lastTokStartLoc,o=super.parseExport(r,n);switch(o.type){case"ExportAllDeclaration":o.exported=null;break;case"ExportNamedDeclaration":o.specifiers.length===1&&o.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(o,"ExportAllDeclaration"),o.exported=o.specifiers[0].exported,delete o.specifiers);case"ExportDefaultDeclaration":{var s;let{declaration:a}=o;a?.type==="ClassDeclaration"&&((s=a.decorators)==null?void 0:s.length)>0&&a.start===o.start&&this.resetStartLocation(o,i)}break}return o}stopParseSubscript(r,n){let i=super.stopParseSubscript(r,n);return n.optionalChainMember?this.estreeParseChainExpression(i,r.loc.end):i}parseMember(r,n,i,o,s){let a=super.parseMember(r,n,i,o,s);return a.type==="OptionalMemberExpression"?this.castNodeTo(a,"MemberExpression"):a.optional=!1,a}isOptionalMemberExpression(r){return r.type==="ChainExpression"?r.expression.type==="MemberExpression":super.isOptionalMemberExpression(r)}hasPropertyAsPrivateName(r){return r.type==="ChainExpression"&&(r=r.expression),super.hasPropertyAsPrivateName(r)}isObjectProperty(r){return r.type==="Property"&&r.kind==="init"&&!r.method}isObjectMethod(r){return r.type==="Property"&&(r.method||r.kind==="get"||r.kind==="set")}castNodeTo(r,n){let i=super.castNodeTo(r,n);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(r){let n=super.cloneIdentifier(r);return this.fillOptionalPropertiesForTSESLint(n),n}cloneStringLiteral(r){return r.type==="Literal"?this.cloneEstreeStringLiteral(r):super.cloneStringLiteral(r)}finishNodeAt(r,n,i){return kI(super.finishNodeAt(r,n,i))}finishNode(r,n){let i=super.finishNode(r,n);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(r,n){super.resetStartLocation(r,n),kI(r)}resetEndLocation(r,n=this.state.lastTokEndLoc){super.resetEndLocation(r,n),kI(r)}},lp=class{constructor(e,r){this.token=void 0,this.preserveSpace=void 0,this.token=e,this.preserveSpace=!!r}},Ir={brace:new lp("{"),j_oTag:new lp("<tag"),j_cTag:new lp("</tag"),j_expr:new lp("<tag>...</tag>",!0)};Ir.template=new lp("`",!0);var _t=!0,xe=!0,QP=!0,RI=!0,ll=!0,aKe=!0,Xw=class{constructor(e,r={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=e,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.rightAssociative=!!r.rightAssociative,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop!=null?r.binop:null,this.updateContext=null}},zP=new Map;function ar(t,e={}){e.keyword=t;let r=et(t,e);return zP.set(t,r),r}function po(t,e){return et(t,{beforeExpr:_t,binop:e})}var PI=-1,Kc=[],WP=[],ZP=[],XP=[],e_=[],t_=[];function et(t,e={}){var r,n,i,o;return++PI,WP.push(t),ZP.push((r=e.binop)!=null?r:-1),XP.push((n=e.beforeExpr)!=null?n:!1),e_.push((i=e.startsExpr)!=null?i:!1),t_.push((o=e.prefix)!=null?o:!1),Kc.push(new Xw(t,e)),PI}function Kt(t,e={}){var r,n,i,o;return++PI,zP.set(t,PI),WP.push(t),ZP.push((r=e.binop)!=null?r:-1),XP.push((n=e.beforeExpr)!=null?n:!1),e_.push((i=e.startsExpr)!=null?i:!1),t_.push((o=e.prefix)!=null?o:!1),Kc.push(new Xw("name",e)),PI}var AKe={bracketL:et("[",{beforeExpr:_t,startsExpr:xe}),bracketHashL:et("#[",{beforeExpr:_t,startsExpr:xe}),bracketBarL:et("[|",{beforeExpr:_t,startsExpr:xe}),bracketR:et("]"),bracketBarR:et("|]"),braceL:et("{",{beforeExpr:_t,startsExpr:xe}),braceBarL:et("{|",{beforeExpr:_t,startsExpr:xe}),braceHashL:et("#{",{beforeExpr:_t,startsExpr:xe}),braceR:et("}"),braceBarR:et("|}"),parenL:et("(",{beforeExpr:_t,startsExpr:xe}),parenR:et(")"),comma:et(",",{beforeExpr:_t}),semi:et(";",{beforeExpr:_t}),colon:et(":",{beforeExpr:_t}),doubleColon:et("::",{beforeExpr:_t}),dot:et("."),question:et("?",{beforeExpr:_t}),questionDot:et("?."),arrow:et("=>",{beforeExpr:_t}),template:et("template"),ellipsis:et("...",{beforeExpr:_t}),backQuote:et("`",{startsExpr:xe}),dollarBraceL:et("${",{beforeExpr:_t,startsExpr:xe}),templateTail:et("...`",{startsExpr:xe}),templateNonTail:et("...${",{beforeExpr:_t,startsExpr:xe}),at:et("@"),hash:et("#",{startsExpr:xe}),interpreterDirective:et("#!..."),eq:et("=",{beforeExpr:_t,isAssign:RI}),assign:et("_=",{beforeExpr:_t,isAssign:RI}),slashAssign:et("_=",{beforeExpr:_t,isAssign:RI}),xorAssign:et("_=",{beforeExpr:_t,isAssign:RI}),moduloAssign:et("_=",{beforeExpr:_t,isAssign:RI}),incDec:et("++/--",{prefix:ll,postfix:aKe,startsExpr:xe}),bang:et("!",{beforeExpr:_t,prefix:ll,startsExpr:xe}),tilde:et("~",{beforeExpr:_t,prefix:ll,startsExpr:xe}),doubleCaret:et("^^",{startsExpr:xe}),doubleAt:et("@@",{startsExpr:xe}),pipeline:po("|>",0),nullishCoalescing:po("??",1),logicalOR:po("||",1),logicalAND:po("&&",2),bitwiseOR:po("|",3),bitwiseXOR:po("^",4),bitwiseAND:po("&",5),equality:po("==/!=/===/!==",6),lt:po("</>/<=/>=",7),gt:po("</>/<=/>=",7),relational:po("</>/<=/>=",7),bitShift:po("<</>>/>>>",8),bitShiftL:po("<</>>/>>>",8),bitShiftR:po("<</>>/>>>",8),plusMin:et("+/-",{beforeExpr:_t,binop:9,prefix:ll,startsExpr:xe}),modulo:et("%",{binop:10,startsExpr:xe}),star:et("*",{binop:10}),slash:po("/",10),exponent:et("**",{beforeExpr:_t,binop:11,rightAssociative:!0}),_in:ar("in",{beforeExpr:_t,binop:7}),_instanceof:ar("instanceof",{beforeExpr:_t,binop:7}),_break:ar("break"),_case:ar("case",{beforeExpr:_t}),_catch:ar("catch"),_continue:ar("continue"),_debugger:ar("debugger"),_default:ar("default",{beforeExpr:_t}),_else:ar("else",{beforeExpr:_t}),_finally:ar("finally"),_function:ar("function",{startsExpr:xe}),_if:ar("if"),_return:ar("return",{beforeExpr:_t}),_switch:ar("switch"),_throw:ar("throw",{beforeExpr:_t,prefix:ll,startsExpr:xe}),_try:ar("try"),_var:ar("var"),_const:ar("const"),_with:ar("with"),_new:ar("new",{beforeExpr:_t,startsExpr:xe}),_this:ar("this",{startsExpr:xe}),_super:ar("super",{startsExpr:xe}),_class:ar("class",{startsExpr:xe}),_extends:ar("extends",{beforeExpr:_t}),_export:ar("export"),_import:ar("import",{startsExpr:xe}),_null:ar("null",{startsExpr:xe}),_true:ar("true",{startsExpr:xe}),_false:ar("false",{startsExpr:xe}),_typeof:ar("typeof",{beforeExpr:_t,prefix:ll,startsExpr:xe}),_void:ar("void",{beforeExpr:_t,prefix:ll,startsExpr:xe}),_delete:ar("delete",{beforeExpr:_t,prefix:ll,startsExpr:xe}),_do:ar("do",{isLoop:QP,beforeExpr:_t}),_for:ar("for",{isLoop:QP}),_while:ar("while",{isLoop:QP}),_as:Kt("as",{startsExpr:xe}),_assert:Kt("assert",{startsExpr:xe}),_async:Kt("async",{startsExpr:xe}),_await:Kt("await",{startsExpr:xe}),_defer:Kt("defer",{startsExpr:xe}),_from:Kt("from",{startsExpr:xe}),_get:Kt("get",{startsExpr:xe}),_let:Kt("let",{startsExpr:xe}),_meta:Kt("meta",{startsExpr:xe}),_of:Kt("of",{startsExpr:xe}),_sent:Kt("sent",{startsExpr:xe}),_set:Kt("set",{startsExpr:xe}),_source:Kt("source",{startsExpr:xe}),_static:Kt("static",{startsExpr:xe}),_using:Kt("using",{startsExpr:xe}),_yield:Kt("yield",{startsExpr:xe}),_asserts:Kt("asserts",{startsExpr:xe}),_checks:Kt("checks",{startsExpr:xe}),_exports:Kt("exports",{startsExpr:xe}),_global:Kt("global",{startsExpr:xe}),_implements:Kt("implements",{startsExpr:xe}),_intrinsic:Kt("intrinsic",{startsExpr:xe}),_infer:Kt("infer",{startsExpr:xe}),_is:Kt("is",{startsExpr:xe}),_mixins:Kt("mixins",{startsExpr:xe}),_proto:Kt("proto",{startsExpr:xe}),_require:Kt("require",{startsExpr:xe}),_satisfies:Kt("satisfies",{startsExpr:xe}),_keyof:Kt("keyof",{startsExpr:xe}),_readonly:Kt("readonly",{startsExpr:xe}),_unique:Kt("unique",{startsExpr:xe}),_abstract:Kt("abstract",{startsExpr:xe}),_declare:Kt("declare",{startsExpr:xe}),_enum:Kt("enum",{startsExpr:xe}),_module:Kt("module",{startsExpr:xe}),_namespace:Kt("namespace",{startsExpr:xe}),_interface:Kt("interface",{startsExpr:xe}),_type:Kt("type",{startsExpr:xe}),_opaque:Kt("opaque",{startsExpr:xe}),name:et("name",{startsExpr:xe}),placeholder:et("%%",{startsExpr:xe}),string:et("string",{startsExpr:xe}),num:et("num",{startsExpr:xe}),bigint:et("bigint",{startsExpr:xe}),decimal:et("decimal",{startsExpr:xe}),regexp:et("regexp",{startsExpr:xe}),privateName:et("#name",{startsExpr:xe}),eof:et("eof"),jsxName:et("jsxName"),jsxText:et("jsxText",{beforeExpr:_t}),jsxTagStart:et("jsxTagStart",{startsExpr:xe}),jsxTagEnd:et("jsxTagEnd")};function Qr(t){return t>=93&&t<=133}function cKe(t){return t<=92}function Ma(t){return t>=58&&t<=133}function dte(t){return t>=58&&t<=137}function uKe(t){return XP[t]}function TI(t){return e_[t]}function lKe(t){return t>=29&&t<=33}function nte(t){return t>=129&&t<=131}function gKe(t){return t>=90&&t<=92}function r_(t){return t>=58&&t<=92}function pKe(t){return t>=39&&t<=59}function dKe(t){return t===34}function fKe(t){return t_[t]}function mKe(t){return t>=121&&t<=123}function hKe(t){return t>=124&&t<=130}function pl(t){return WP[t]}function Ww(t){return ZP[t]}function CKe(t){return t===57}function e0(t){return t>=24&&t<=25}function Gc(t){return Kc[t]}Kc[8].updateContext=t=>{t.pop()};Kc[5].updateContext=Kc[7].updateContext=Kc[23].updateContext=t=>{t.push(Ir.brace)};Kc[22].updateContext=t=>{t[t.length-1]===Ir.template?t.pop():t.push(Ir.template)};Kc[143].updateContext=t=>{t.push(Ir.j_expr,Ir.j_oTag)};var n_="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",fte="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",IKe=new RegExp("["+n_+"]"),EKe=new RegExp("["+n_+fte+"]");n_=fte=null;var mte=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],BKe=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function xP(t,e){let r=65536;for(let n=0,i=e.length;n<i;n+=2){if(r+=e[n],r>t)return!1;if(r+=e[n+1],r>=t)return!0}return!1}function _A(t){return t<65?t===36:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&IKe.test(String.fromCharCode(t)):xP(t,mte)}function gp(t){return t<48?t===36:t<58?!0:t<65?!1:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&EKe.test(String.fromCharCode(t)):xP(t,mte)||xP(t,BKe)}var i_={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},yKe=new Set(i_.keyword),QKe=new Set(i_.strict),DKe=new Set(i_.strictBind);function hte(t,e){return e&&t==="await"||t==="enum"}function Cte(t,e){return hte(t,e)||QKe.has(t)}function Ite(t){return DKe.has(t)}function Ete(t,e){return Cte(t,e)||Ite(t)}function wKe(t){return yKe.has(t)}function bKe(t,e,r){return t===64&&e===64&&_A(r)}var vKe=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function SKe(t){return vKe.has(t)}var _I=class{constructor(e){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=e}},LI=class{constructor(e,r){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=e,this.inModule=r}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&128)return!0;if(r&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new _I(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(e){return!!(e.flags&130||!this.parser.inModule&&e.flags&1)}declareName(e,r,n){let i=this.currentScope();if(r&8||r&16){this.checkRedeclarationInScope(i,e,r,n);let o=i.names.get(e)||0;r&16?o=o|4:(i.firstLexicalName||(i.firstLexicalName=e),o=o|2),i.names.set(e,o),r&8&&this.maybeExportDefined(i,e)}else if(r&4)for(let o=this.scopeStack.length-1;o>=0&&(i=this.scopeStack[o],this.checkRedeclarationInScope(i,e,r,n),i.names.set(e,(i.names.get(e)||0)|1),this.maybeExportDefined(i,e),!(i.flags&1667));--o);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(e)}maybeExportDefined(e,r){this.parser.inModule&&e.flags&1&&this.undefinedExports.delete(r)}checkRedeclarationInScope(e,r,n,i){this.isRedeclaredInScope(e,r,n)&&this.parser.raise(V.VarRedeclaration,i,{identifierName:r})}isRedeclaredInScope(e,r,n){if(!(n&1))return!1;if(n&8)return e.names.has(r);let i=e.names.get(r)||0;return n&16?(i&2)>0||!this.treatFunctionsAsVarInScope(e)&&(i&1)>0:(i&2)>0&&!(e.flags&8&&e.firstLexicalName===r)||!this.treatFunctionsAsVarInScope(e)&&(i&4)>0}checkLocalExport(e){let{name:r}=e;this.scopeStack[0].names.has(r)||this.undefinedExports.set(r,e.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&1667)return r}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&1731&&!(r&4))return r}}},FP=class extends _I{constructor(...e){super(...e),this.declareFunctions=new Set}},kP=class extends LI{createScope(e){return new FP(e)}declareName(e,r,n){let i=this.currentScope();if(r&2048){this.checkRedeclarationInScope(i,e,r,n),this.maybeExportDefined(i,e),i.declareFunctions.add(e);return}super.declareName(e,r,n)}isRedeclaredInScope(e,r,n){if(super.isRedeclaredInScope(e,r,n))return!0;if(n&2048&&!e.declareFunctions.has(r)){let i=e.names.get(r);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(e){this.scopeStack[0].declareFunctions.has(e.name)||super.checkLocalExport(e)}},xKe=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),nt=PA`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:t})=>`Cannot overwrite reserved type ${t}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:t,enumName:e})=>`Boolean enum members need to be initialized. Use either \`${t} = true,\` or \`${t} = false,\` in enum \`${e}\`.`,EnumDuplicateMemberName:({memberName:t,enumName:e})=>`Enum member names need to be unique, but the name \`${t}\` has already been used before in enum \`${e}\`.`,EnumInconsistentMemberValues:({enumName:t})=>`Enum \`${t}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:t,enumName:e})=>`Enum type \`${t}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:t})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:t,memberName:e,explicitType:r})=>`Enum \`${t}\` has type \`${r}\`, so the initializer of \`${e}\` needs to be a ${r} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:t,memberName:e})=>`Symbol enum members cannot be initialized. Use \`${e},\` in enum \`${t}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:t,memberName:e})=>`The enum member initializer for \`${e}\` needs to be a literal (either a boolean, number, or string) in enum \`${t}\`.`,EnumInvalidMemberName:({enumName:t,memberName:e,suggestion:r})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${e}\`, consider using \`${r}\`, in enum \`${t}\`.`,EnumNumberMemberNotInitialized:({enumName:t,memberName:e})=>`Number enum members need to be initialized, e.g. \`${e} = 1\` in enum \`${t}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:t})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${t}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:t})=>`Unexpected reserved type ${t}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:t,suggestion:e})=>`\`declare export ${t}\` is not supported. Use \`${e}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function FKe(t){return t.type==="DeclareExportAllDeclaration"||t.type==="DeclareExportDeclaration"&&(!t.declaration||t.declaration.type!=="TypeAlias"&&t.declaration.type!=="InterfaceDeclaration")}function ite(t){return t.importKind==="type"||t.importKind==="typeof"}var kKe={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function RKe(t,e){let r=[],n=[];for(let i=0;i<t.length;i++)(e(t[i],i,t)?r:n).push(t[i]);return[r,n]}var NKe=/\*?\s*@((?:no)?flow)\b/,TKe=t=>class extends t{constructor(...r){super(...r),this.flowPragma=void 0}getScopeHandler(){return kP}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(r,n){r!==134&&r!==13&&r!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(r,n)}addComment(r){if(this.flowPragma===void 0){let n=NKe.exec(r.value);if(n)if(n[1]==="flow")this.flowPragma="flow";else if(n[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(r)}flowParseTypeInitialiser(r){let n=this.state.inType;this.state.inType=!0,this.expect(r||14);let i=this.flowParseType();return this.state.inType=n,i}flowParsePredicate(){let r=this.startNode(),n=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>n.index+1&&this.raise(nt.UnexpectedSpaceBetweenModuloChecks,n),this.eat(10)?(r.value=super.parseExpression(),this.expect(11),this.finishNode(r,"DeclaredPredicate")):this.finishNode(r,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){let r=this.state.inType;this.state.inType=!0,this.expect(14);let n=null,i=null;return this.match(54)?(this.state.inType=r,i=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=r,this.match(54)&&(i=this.flowParsePredicate())),[n,i]}flowParseDeclareClass(r){return this.next(),this.flowParseInterfaceish(r,!0),this.finishNode(r,"DeclareClass")}flowParseDeclareFunction(r){this.next();let n=r.id=this.parseIdentifier(),i=this.startNode(),o=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);let s=this.flowParseFunctionTypeParams();return i.params=s.params,i.rest=s.rest,i.this=s._this,this.expect(11),[i.returnType,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),o.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(o,"TypeAnnotation"),this.resetEndLocation(n),this.semicolon(),this.scope.declareName(r.id.name,2048,r.id.loc.start),this.finishNode(r,"DeclareFunction")}flowParseDeclare(r,n){if(this.match(80))return this.flowParseDeclareClass(r);if(this.match(68))return this.flowParseDeclareFunction(r);if(this.match(74))return this.flowParseDeclareVariable(r);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(r):(n&&this.raise(nt.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(r));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(r);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(r);if(this.isContextual(129))return this.flowParseDeclareInterface(r);if(this.match(82))return this.flowParseDeclareExportDeclaration(r,n);throw this.unexpected()}flowParseDeclareVariable(r){return this.next(),r.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(r.id.name,5,r.id.loc.start),this.semicolon(),this.finishNode(r,"DeclareVariable")}flowParseDeclareModule(r){this.scope.enter(0),this.match(134)?r.id=super.parseExprAtom():r.id=this.parseIdentifier();let n=r.body=this.startNode(),i=n.body=[];for(this.expect(5);!this.match(8);){let a=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(nt.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(a))):(this.expectContextual(125,nt.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(a,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let o=null,s=!1;return i.forEach(a=>{FKe(a)?(o==="CommonJS"&&this.raise(nt.AmbiguousDeclareModuleKind,a),o="ES"):a.type==="DeclareModuleExports"&&(s&&this.raise(nt.DuplicateDeclareModuleExports,a),o==="ES"&&this.raise(nt.AmbiguousDeclareModuleKind,a),o="CommonJS",s=!0)}),r.kind=o||"CommonJS",this.finishNode(r,"DeclareModule")}flowParseDeclareExportDeclaration(r,n){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?r.declaration=this.flowParseDeclare(this.startNode()):(r.declaration=this.flowParseType(),this.semicolon()),r.default=!0,this.finishNode(r,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!n){let i=this.state.value;throw this.raise(nt.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:kKe[i]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return r.declaration=this.flowParseDeclare(this.startNode()),r.default=!1,this.finishNode(r,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return r=this.parseExport(r,null),r.type==="ExportNamedDeclaration"?(r.default=!1,delete r.exportKind,this.castNodeTo(r,"DeclareExportDeclaration")):this.castNodeTo(r,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(r){return this.next(),this.expectContextual(111),r.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(r,"DeclareModuleExports")}flowParseDeclareTypeAlias(r){this.next();let n=this.flowParseTypeAlias(r);return this.castNodeTo(n,"DeclareTypeAlias"),n}flowParseDeclareOpaqueType(r){this.next();let n=this.flowParseOpaqueType(r,!0);return this.castNodeTo(n,"DeclareOpaqueType"),n}flowParseDeclareInterface(r){return this.next(),this.flowParseInterfaceish(r,!1),this.finishNode(r,"DeclareInterface")}flowParseInterfaceish(r,n){if(r.id=this.flowParseRestrictedIdentifier(!n,!0),this.scope.declareName(r.id.name,n?17:8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.extends=[],this.eat(81))do r.extends.push(this.flowParseInterfaceExtends());while(!n&&this.eat(12));if(n){if(r.implements=[],r.mixins=[],this.eatContextual(117))do r.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do r.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}r.body=this.flowParseObjectType({allowStatic:n,allowExact:!1,allowSpread:!1,allowProto:n,allowInexact:!1})}flowParseInterfaceExtends(){let r=this.startNode();return r.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?r.typeParameters=this.flowParseTypeParameterInstantiation():r.typeParameters=null,this.finishNode(r,"InterfaceExtends")}flowParseInterface(r){return this.flowParseInterfaceish(r,!1),this.finishNode(r,"InterfaceDeclaration")}checkNotUnderscore(r){r==="_"&&this.raise(nt.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(r,n,i){xKe.has(r)&&this.raise(i?nt.AssignReservedType:nt.UnexpectedReservedType,n,{reservedType:r})}flowParseRestrictedIdentifier(r,n){return this.checkReservedType(this.state.value,this.state.startLoc,n),this.parseIdentifier(r)}flowParseTypeAlias(r){return r.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(r.id.name,8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(r,"TypeAlias")}flowParseOpaqueType(r,n){return this.expectContextual(130),r.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(r.id.name,8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.supertype=null,this.match(14)&&(r.supertype=this.flowParseTypeInitialiser(14)),r.impltype=null,n||(r.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(r,"OpaqueType")}flowParseTypeParameter(r=!1){let n=this.state.startLoc,i=this.startNode(),o=this.flowParseVariance(),s=this.flowParseTypeAnnotatableIdentifier();return i.name=s.name,i.variance=o,i.bound=s.typeAnnotation,this.match(29)?(this.eat(29),i.default=this.flowParseType()):r&&this.raise(nt.MissingTypeParamDefault,n),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let r=this.state.inType,n=this.startNode();n.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let i=!1;do{let o=this.flowParseTypeParameter(i);n.params.push(o),o.default&&(i=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=r,this.finishNode(n,"TypeParameterDeclaration")}flowInTopLevelContext(r){if(this.curContext()!==Ir.brace){let n=this.state.context;this.state.context=[n[0]];try{return r()}finally{this.state.context=n}}else return r()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let r=this.startNode(),n=this.state.inType;return this.state.inType=!0,r.params=[],this.flowInTopLevelContext(()=>{this.expect(47);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)r.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=i}),this.state.inType=n,!this.state.inType&&this.curContext()===Ir.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(r,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;let r=this.startNode(),n=this.state.inType;for(r.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)r.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=n,this.finishNode(r,"TypeParameterInstantiation")}flowParseInterfaceType(){let r=this.startNode();if(this.expectContextual(129),r.extends=[],this.eat(81))do r.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return r.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(r,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(r,n,i){return r.static=n,this.lookahead().type===14?(r.id=this.flowParseObjectPropertyKey(),r.key=this.flowParseTypeInitialiser()):(r.id=null,r.key=this.flowParseType()),this.expect(3),r.value=this.flowParseTypeInitialiser(),r.variance=i,this.finishNode(r,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(r,n){return r.static=n,r.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(r.method=!0,r.optional=!1,r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start))):(r.method=!1,this.eat(17)&&(r.optional=!0),r.value=this.flowParseTypeInitialiser()),this.finishNode(r,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(r){for(r.params=[],r.rest=null,r.typeParameters=null,r.this=null,this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(r.this=this.flowParseFunctionTypeParam(!0),r.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)r.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(r.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),r.returnType=this.flowParseTypeInitialiser(),this.finishNode(r,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(r,n){let i=this.startNode();return r.static=n,r.value=this.flowParseObjectTypeMethodish(i),this.finishNode(r,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:r,allowExact:n,allowSpread:i,allowProto:o,allowInexact:s}){let a=this.state.inType;this.state.inType=!0;let A=this.startNode();A.callProperties=[],A.properties=[],A.indexers=[],A.internalSlots=[];let c,u,l=!1;for(n&&this.match(6)?(this.expect(6),c=9,u=!0):(this.expect(5),c=8,u=!1),A.exact=u;!this.match(c);){let g=!1,p=null,f=null,h=this.startNode();if(o&&this.isContextual(118)){let I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),p=this.state.startLoc,r=!1)}if(r&&this.isContextual(106)){let I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),g=!0)}let C=this.flowParseVariance();if(this.eat(0))p!=null&&this.unexpected(p),this.eat(0)?(C&&this.unexpected(C.loc.start),A.internalSlots.push(this.flowParseObjectTypeInternalSlot(h,g))):A.indexers.push(this.flowParseObjectTypeIndexer(h,g,C));else if(this.match(10)||this.match(47))p!=null&&this.unexpected(p),C&&this.unexpected(C.loc.start),A.callProperties.push(this.flowParseObjectTypeCallProperty(h,g));else{let I="init";if(this.isContextual(99)||this.isContextual(104)){let E=this.lookahead();dte(E.type)&&(I=this.state.value,this.next())}let B=this.flowParseObjectTypeProperty(h,g,p,C,I,i,s??!u);B===null?(l=!0,f=this.state.lastTokStartLoc):A.properties.push(B)}this.flowObjectTypeSemicolon(),f&&!this.match(8)&&!this.match(9)&&this.raise(nt.UnexpectedExplicitInexactInObject,f)}this.expect(c),i&&(A.inexact=l);let d=this.finishNode(A,"ObjectTypeAnnotation");return this.state.inType=a,d}flowParseObjectTypeProperty(r,n,i,o,s,a,A){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(a?A||this.raise(nt.InexactInsideExact,this.state.lastTokStartLoc):this.raise(nt.InexactInsideNonObject,this.state.lastTokStartLoc),o&&this.raise(nt.InexactVariance,o),null):(a||this.raise(nt.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),o&&this.raise(nt.SpreadVariance,o),r.argument=this.flowParseType(),this.finishNode(r,"ObjectTypeSpreadProperty"));{r.key=this.flowParseObjectPropertyKey(),r.static=n,r.proto=i!=null,r.kind=s;let c=!1;return this.match(47)||this.match(10)?(r.method=!0,i!=null&&this.unexpected(i),o&&this.unexpected(o.loc.start),r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start)),(s==="get"||s==="set")&&this.flowCheckGetterSetterParams(r),!a&&r.key.name==="constructor"&&r.value.this&&this.raise(nt.ThisParamBannedInConstructor,r.value.this)):(s!=="init"&&this.unexpected(),r.method=!1,this.eat(17)&&(c=!0),r.value=this.flowParseTypeInitialiser(),r.variance=o),r.optional=c,this.finishNode(r,"ObjectTypeProperty")}}flowCheckGetterSetterParams(r){let n=r.kind==="get"?0:1,i=r.value.params.length+(r.value.rest?1:0);r.value.this&&this.raise(r.kind==="get"?nt.GetterMayNotHaveThisParam:nt.SetterMayNotHaveThisParam,r.value.this),i!==n&&this.raise(r.kind==="get"?V.BadGetterArity:V.BadSetterArity,r),r.kind==="set"&&r.value.rest&&this.raise(V.BadSetterRestParameter,r)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(r,n){r??(r=this.state.startLoc);let i=n||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let o=this.startNodeAt(r);o.qualification=i,o.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(o,"QualifiedTypeIdentifier")}return i}flowParseGenericType(r,n){let i=this.startNodeAt(r);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(r,n),this.match(47)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let r=this.startNode();return this.expect(87),r.argument=this.flowParsePrimaryType(),this.finishNode(r,"TypeofTypeAnnotation")}flowParseTupleType(){let r=this.startNode();for(r.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(r.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(r,"TupleTypeAnnotation")}flowParseFunctionTypeParam(r){let n=null,i=!1,o=null,s=this.startNode(),a=this.lookahead(),A=this.state.type===78;return a.type===14||a.type===17?(A&&!r&&this.raise(nt.ThisParamMustBeFirst,s),n=this.parseIdentifier(A),this.eat(17)&&(i=!0,A&&this.raise(nt.ThisParamMayNotBeOptional,s)),o=this.flowParseTypeInitialiser()):o=this.flowParseType(),s.name=n,s.optional=i,s.typeAnnotation=o,this.finishNode(s,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(r){let n=this.startNodeAt(r.loc.start);return n.name=null,n.optional=!1,n.typeAnnotation=r,this.finishNode(n,"FunctionTypeParam")}flowParseFunctionTypeParams(r=[]){let n=null,i=null;for(this.match(78)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)r.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(n=this.flowParseFunctionTypeParam(!1)),{params:r,rest:n,_this:i}}flowIdentToTypeAnnotation(r,n,i){switch(i.name){case"any":return this.finishNode(n,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(n,"BooleanTypeAnnotation");case"mixed":return this.finishNode(n,"MixedTypeAnnotation");case"empty":return this.finishNode(n,"EmptyTypeAnnotation");case"number":return this.finishNode(n,"NumberTypeAnnotation");case"string":return this.finishNode(n,"StringTypeAnnotation");case"symbol":return this.finishNode(n,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(r,i)}}flowParsePrimaryType(){let r=this.state.startLoc,n=this.startNode(),i,o,s=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,o=this.flowParseTupleType(),this.state.noAnonFunctionType=a,o;case 47:{let A=this.startNode();return A.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),i=this.flowParseFunctionTypeParams(),A.params=i.params,A.rest=i.rest,A.this=i._this,this.expect(11),this.expect(19),A.returnType=this.flowParseType(),this.finishNode(A,"FunctionTypeAnnotation")}case 10:{let A=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(Qr(this.state.type)||this.match(78)){let c=this.lookahead().type;s=c!==17&&c!==14}else s=!0;if(s){if(this.state.noAnonFunctionType=!1,o=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),o;this.eat(12)}return o?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(o)]):i=this.flowParseFunctionTypeParams(),A.params=i.params,A.rest=i.rest,A.this=i._this,this.expect(11),this.expect(19),A.returnType=this.flowParseType(),A.typeParameters=null,this.finishNode(A,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return n.value=this.match(85),this.next(),this.finishNode(n,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",n);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",n);throw this.raise(nt.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(n,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(n,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(n,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(n,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(r_(this.state.type)){let A=pl(this.state.type);return this.next(),super.createIdentifier(n,A)}else if(Qr(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(r,n,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let r=this.state.startLoc,n=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){let o=this.startNodeAt(r),s=this.eat(18);i=i||s,this.expect(0),!s&&this.match(3)?(o.elementType=n,this.next(),n=this.finishNode(o,"ArrayTypeAnnotation")):(o.objectType=n,o.indexType=this.flowParseType(),this.expect(3),i?(o.optional=s,n=this.finishNode(o,"OptionalIndexedAccessType")):n=this.finishNode(o,"IndexedAccessType"))}return n}flowParsePrefixType(){let r=this.startNode();return this.eat(17)?(r.typeAnnotation=this.flowParsePrefixType(),this.finishNode(r,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let r=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){let n=this.startNodeAt(r.loc.start);return n.params=[this.reinterpretTypeAsFunctionTypeParam(r)],n.rest=null,n.this=null,n.returnType=this.flowParseType(),n.typeParameters=null,this.finishNode(n,"FunctionTypeAnnotation")}return r}flowParseIntersectionType(){let r=this.startNode();this.eat(45);let n=this.flowParseAnonFunctionWithoutParens();for(r.types=[n];this.eat(45);)r.types.push(this.flowParseAnonFunctionWithoutParens());return r.types.length===1?n:this.finishNode(r,"IntersectionTypeAnnotation")}flowParseUnionType(){let r=this.startNode();this.eat(43);let n=this.flowParseIntersectionType();for(r.types=[n];this.eat(43);)r.types.push(this.flowParseIntersectionType());return r.types.length===1?n:this.finishNode(r,"UnionTypeAnnotation")}flowParseType(){let r=this.state.inType;this.state.inType=!0;let n=this.flowParseUnionType();return this.state.inType=r,n}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){let r=this.state.startLoc,n=this.parseIdentifier();return this.flowParseGenericType(r,n)}else return this.flowParseType()}flowParseTypeAnnotation(){let r=this.startNode();return r.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(r,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(r){let n=r?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(n.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(n)),n}typeCastToParameter(r){return r.expression.typeAnnotation=r.typeAnnotation,this.resetEndLocation(r.expression,r.typeAnnotation.loc.end),r.expression}flowParseVariance(){let r=null;return this.match(53)?(r=this.startNode(),this.state.value==="+"?r.kind="plus":r.kind="minus",this.next(),this.finishNode(r,"Variance")):r}parseFunctionBody(r,n,i=!1){if(n){this.forwardNoArrowParamsConversionAt(r,()=>super.parseFunctionBody(r,!0,i));return}super.parseFunctionBody(r,!1,i)}parseFunctionBodyAndFinish(r,n,i=!1){if(this.match(14)){let o=this.startNode();[o.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.returnType=o.typeAnnotation?this.finishNode(o,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(r,n,i)}parseStatementLike(r){if(this.state.strict&&this.isContextual(129)){let i=this.lookahead();if(Ma(i.type)){let o=this.startNode();return this.next(),this.flowParseInterface(o)}}else if(this.isContextual(126)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let n=super.parseStatementLike(r);return this.flowPragma===void 0&&!this.isValidDirective(n)&&(this.flowPragma=null),n}parseExpressionStatement(r,n,i){if(n.type==="Identifier"){if(n.name==="declare"){if(this.match(80)||Qr(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(r)}else if(Qr(this.state.type)){if(n.name==="interface")return this.flowParseInterface(r);if(n.name==="type")return this.flowParseTypeAlias(r);if(n.name==="opaque")return this.flowParseOpaqueType(r,!1)}}return super.parseExpressionStatement(r,n,i)}shouldParseExportDeclaration(){let{type:r}=this.state;return r===126||nte(r)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:r}=this.state;return r===126||nte(r)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){let r=this.startNode();return this.next(),this.flowParseEnumDeclaration(r)}return super.parseExportDefaultExpression()}parseConditional(r,n,i){if(!this.match(17))return r;if(this.state.maybeInArrowParameters){let d=this.lookaheadCharCode();if(d===44||d===61||d===58||d===41)return this.setOptionalParametersError(i),r}this.expect(17);let o=this.state.clone(),s=this.state.noArrowAt,a=this.startNodeAt(n),{consequent:A,failed:c}=this.tryParseConditionalConsequent(),[u,l]=this.getArrowLikeExpressions(A);if(c||l.length>0){let d=[...s];if(l.length>0){this.state=o,this.state.noArrowAt=d;for(let g=0;g<l.length;g++)d.push(l[g].start);({consequent:A,failed:c}=this.tryParseConditionalConsequent()),[u,l]=this.getArrowLikeExpressions(A)}c&&u.length>1&&this.raise(nt.AmbiguousConditionalArrow,o.startLoc),c&&u.length===1&&(this.state=o,d.push(u[0].start),this.state.noArrowAt=d,{consequent:A,failed:c}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(A,!0),this.state.noArrowAt=s,this.expect(14),a.test=r,a.consequent=A,a.alternate=this.forwardNoArrowParamsConversionAt(a,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(a,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let r=this.parseMaybeAssignAllowIn(),n=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:r,failed:n}}getArrowLikeExpressions(r,n){let i=[r],o=[];for(;i.length!==0;){let s=i.pop();s.type==="ArrowFunctionExpression"&&s.body.type!=="BlockStatement"?(s.typeParameters||!s.returnType?this.finishArrowValidation(s):o.push(s),i.push(s.body)):s.type==="ConditionalExpression"&&(i.push(s.consequent),i.push(s.alternate))}return n?(o.forEach(s=>this.finishArrowValidation(s)),[o,[]]):RKe(o,s=>s.params.every(a=>this.isAssignable(a,!0)))}finishArrowValidation(r){var n;this.toAssignableList(r.params,(n=r.extra)==null?void 0:n.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(r,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(r,n){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=n(),this.state.noArrowParamsConversionAt.pop()):i=n(),i}parseParenItem(r,n){let i=super.parseParenItem(r,n);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(r)),this.match(14)){let o=this.startNodeAt(n);return o.expression=i,o.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(o,"TypeCastExpression")}return i}assertModuleNodeAllowed(r){r.type==="ImportDeclaration"&&(r.importKind==="type"||r.importKind==="typeof")||r.type==="ExportNamedDeclaration"&&r.exportKind==="type"||r.type==="ExportAllDeclaration"&&r.exportKind==="type"||super.assertModuleNodeAllowed(r)}parseExportDeclaration(r){if(this.isContextual(130)){r.exportKind="type";let n=this.startNode();return this.next(),this.match(5)?(r.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(r),null):this.flowParseTypeAlias(n)}else if(this.isContextual(131)){r.exportKind="type";let n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}else if(this.isContextual(129)){r.exportKind="type";let n=this.startNode();return this.next(),this.flowParseInterface(n)}else if(this.isContextual(126)){r.exportKind="value";let n=this.startNode();return this.next(),this.flowParseEnumDeclaration(n)}else return super.parseExportDeclaration(r)}eatExportStar(r){return super.eatExportStar(r)?!0:this.isContextual(130)&&this.lookahead().type===55?(r.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(r){let{startLoc:n}=this.state,i=super.maybeParseExportNamespaceSpecifier(r);return i&&r.exportKind==="type"&&this.unexpected(n),i}parseClassId(r,n,i){super.parseClassId(r,n,i),this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(r,n,i){let{startLoc:o}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(r,n))return;n.declare=!0}super.parseClassMember(r,n,i),n.declare&&(n.type!=="ClassProperty"&&n.type!=="ClassPrivateProperty"&&n.type!=="PropertyDefinition"?this.raise(nt.DeclareClassElement,o):n.value&&this.raise(nt.DeclareClassFieldInitializer,n.value))}isIterator(r){return r==="iterator"||r==="asyncIterator"}readIterator(){let r=super.readWord1(),n="@@"+r;(!this.isIterator(r)||!this.state.inType)&&this.raise(V.InvalidIdentifier,this.state.curPosition(),{identifierName:n}),this.finishToken(132,n)}getTokenFromCode(r){let n=this.input.charCodeAt(this.state.pos+1);r===123&&n===124?this.finishOp(6,2):this.state.inType&&(r===62||r===60)?this.finishOp(r===62?48:47,1):this.state.inType&&r===63?n===46?this.finishOp(18,2):this.finishOp(17,1):bKe(r,n,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(r)}isAssignable(r,n){return r.type==="TypeCastExpression"?this.isAssignable(r.expression,n):super.isAssignable(r,n)}toAssignable(r,n=!1){!n&&r.type==="AssignmentExpression"&&r.left.type==="TypeCastExpression"&&(r.left=this.typeCastToParameter(r.left)),super.toAssignable(r,n)}toAssignableList(r,n,i){for(let o=0;o<r.length;o++){let s=r[o];s?.type==="TypeCastExpression"&&(r[o]=this.typeCastToParameter(s))}super.toAssignableList(r,n,i)}toReferencedList(r,n){for(let o=0;o<r.length;o++){var i;let s=r[o];s&&s.type==="TypeCastExpression"&&!((i=s.extra)!=null&&i.parenthesized)&&(r.length>1||!n)&&this.raise(nt.TypeCastInPattern,s.typeAnnotation)}return r}parseArrayLike(r,n,i){let o=super.parseArrayLike(r,n,i);return i!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(o.elements),o}isValidLVal(r,n,i,o){return r==="TypeCastExpression"||super.isValidLVal(r,n,i,o)}parseClassProperty(r){return this.match(14)&&(r.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(r)}parseClassPrivateProperty(r){return this.match(14)&&(r.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(r)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(r){return!this.match(14)&&super.isNonstaticConstructor(r)}pushClassMethod(r,n,i,o,s,a){if(n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(r,n,i,o,s,a),n.params&&s){let A=n.params;A.length>0&&this.isThisParam(A[0])&&this.raise(nt.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&s&&n.value.params){let A=n.value.params;A.length>0&&this.isThisParam(A[0])&&this.raise(nt.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(r,n,i,o){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(r,n,i,o)}parseClassSuper(r){if(super.parseClassSuper(r),r.superClass&&(this.match(47)||this.match(51))&&(r.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();let n=r.implements=[];do{let i=this.startNode();i.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,n.push(this.finishNode(i,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(r){super.checkGetterSetterParams(r);let n=this.getObjectOrClassMethodParams(r);if(n.length>0){let i=n[0];this.isThisParam(i)&&r.kind==="get"?this.raise(nt.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(nt.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(r){r.variance=this.flowParseVariance()}parseObjPropValue(r,n,i,o,s,a,A){r.variance&&this.unexpected(r.variance.loc.start),delete r.variance;let c;this.match(47)&&!a&&(c=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let u=super.parseObjPropValue(r,n,i,o,s,a,A);return c&&((u.value||u).typeParameters=c),u}parseFunctionParamType(r){return this.eat(17)&&(r.type!=="Identifier"&&this.raise(nt.PatternIsOptional,r),this.isThisParam(r)&&this.raise(nt.ThisParamMayNotBeOptional,r),r.optional=!0),this.match(14)?r.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(r)&&this.raise(nt.ThisParamAnnotationRequired,r),this.match(29)&&this.isThisParam(r)&&this.raise(nt.ThisParamNoDefault,r),this.resetEndLocation(r),r}parseMaybeDefault(r,n){let i=super.parseMaybeDefault(r,n);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(nt.TypeBeforeInitializer,i.typeAnnotation),i}checkImportReflection(r){super.checkImportReflection(r),r.module&&r.importKind!=="value"&&this.raise(nt.ImportReflectionHasImportType,r.specifiers[0].loc.start)}parseImportSpecifierLocal(r,n,i){n.local=ite(r)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),r.specifiers.push(this.finishImportSpecifier(n,i))}isPotentialImportPhase(r){if(super.isPotentialImportPhase(r))return!0;if(this.isContextual(130)){if(!r)return!0;let n=this.lookaheadCharCode();return n===123||n===42}return!r&&this.isContextual(87)}applyImportPhase(r,n,i,o){if(super.applyImportPhase(r,n,i,o),n){if(!i&&this.match(65))return;r.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(55)&&this.unexpected(),r.importKind=i==="type"||i==="typeof"?i:"value"}parseImportSpecifier(r,n,i,o,s){let a=r.imported,A=null;a.type==="Identifier"&&(a.name==="type"?A="type":a.name==="typeof"&&(A="typeof"));let c=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){let l=this.parseIdentifier(!0);A!==null&&!Ma(this.state.type)?(r.imported=l,r.importKind=A,r.local=this.cloneIdentifier(l)):(r.imported=a,r.importKind=null,r.local=this.parseIdentifier())}else{if(A!==null&&Ma(this.state.type))r.imported=this.parseIdentifier(!0),r.importKind=A;else{if(n)throw this.raise(V.ImportBindingIsString,r,{importName:a.value});r.imported=a,r.importKind=null}this.eatContextual(93)?r.local=this.parseIdentifier():(c=!0,r.local=this.cloneIdentifier(r.imported))}let u=ite(r);return i&&u&&this.raise(nt.ImportTypeShorthandOnlyInPureImport,r),(i||u)&&this.checkReservedType(r.local.name,r.local.loc.start,!0),c&&!i&&!u&&this.checkReservedWord(r.local.name,r.loc.start,!0,!0),this.finishImportSpecifier(r,"ImportSpecifier")}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseFunctionParams(r,n){let i=r.kind;i!=="get"&&i!=="set"&&this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(r,n)}parseVarId(r,n){super.parseVarId(r,n),this.match(14)&&(r.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(r.id))}parseAsyncArrowFromCallExpression(r,n){if(this.match(14)){let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,r.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(r,n)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(r,n){var i;let o=null,s;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(o=this.state.clone(),s=this.tryParse(()=>super.parseMaybeAssign(r,n),o),!s.error)return s.node;let{context:c}=this.state,u=c[c.length-1];(u===Ir.j_oTag||u===Ir.j_expr)&&c.pop()}if((i=s)!=null&&i.error||this.match(47)){var a,A;o=o||this.state.clone();let c,u=this.tryParse(d=>{var g;c=this.flowParseTypeParameterDeclaration();let p=this.forwardNoArrowParamsConversionAt(c,()=>{let h=super.parseMaybeAssign(r,n);return this.resetStartLocationFromNode(h,c),h});(g=p.extra)!=null&&g.parenthesized&&d();let f=this.maybeUnwrapTypeCastExpression(p);return f.type!=="ArrowFunctionExpression"&&d(),f.typeParameters=c,this.resetStartLocationFromNode(f,c),p},o),l=null;if(u.node&&this.maybeUnwrapTypeCastExpression(u.node).type==="ArrowFunctionExpression"){if(!u.error&&!u.aborted)return u.node.async&&this.raise(nt.UnexpectedTypeParameterBeforeAsyncArrowFunction,c),u.node;l=u.node}if((a=s)!=null&&a.node)return this.state=s.failState,s.node;if(l)return this.state=u.failState,l;throw(A=s)!=null&&A.thrown?s.error:u.thrown?u.error:this.raise(nt.UnexpectedTokenAfterTypeParameter,c)}return super.parseMaybeAssign(r,n)}parseArrow(r){if(this.match(14)){let n=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let o=this.startNode();return[o.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),o});if(n.thrown)return null;n.error&&(this.state=n.failState),r.returnType=n.node.typeAnnotation?this.finishNode(n.node,"TypeAnnotation"):null}return super.parseArrow(r)}shouldParseArrow(r){return this.match(14)||super.shouldParseArrow(r)}setArrowFunctionParameters(r,n){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start))?r.params=n:super.setArrowFunctionParameters(r,n)}checkParams(r,n,i,o=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start)))){for(let s=0;s<r.params.length;s++)this.isThisParam(r.params[s])&&s>0&&this.raise(nt.ThisParamMustBeFirst,r.params[s]);super.checkParams(r,n,i,o)}}parseParenAndDistinguishExpression(r){return super.parseParenAndDistinguishExpression(r&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(r,n,i){if(r.type==="Identifier"&&r.name==="async"&&this.state.noArrowAt.includes(n.index)){this.next();let o=this.startNodeAt(n);o.callee=r,o.arguments=super.parseCallExpressionArguments(),r=this.finishNode(o,"CallExpression")}else if(r.type==="Identifier"&&r.name==="async"&&this.match(47)){let o=this.state.clone(),s=this.tryParse(A=>this.parseAsyncArrowWithTypeParameters(n)||A(),o);if(!s.error&&!s.aborted)return s.node;let a=this.tryParse(()=>super.parseSubscripts(r,n,i),o);if(a.node&&!a.error)return a.node;if(s.node)return this.state=s.failState,s.node;if(a.node)return this.state=a.failState,a.node;throw s.error||a.error}return super.parseSubscripts(r,n,i)}parseSubscript(r,n,i,o){if(this.match(18)&&this.isLookaheadToken_lt()){if(o.optionalChainMember=!0,i)return o.stop=!0,r;this.next();let s=this.startNodeAt(n);return s.callee=r,s.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),s.arguments=this.parseCallExpressionArguments(),s.optional=!0,this.finishCallExpression(s,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){let s=this.startNodeAt(n);s.callee=r;let a=this.tryParse(()=>(s.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),s.arguments=super.parseCallExpressionArguments(),o.optionalChainMember&&(s.optional=!1),this.finishCallExpression(s,o.optionalChainMember)));if(a.node)return a.error&&(this.state=a.failState),a.node}return super.parseSubscript(r,n,i,o)}parseNewCallee(r){super.parseNewCallee(r);let n=null;this.shouldParseTypes()&&this.match(47)&&(n=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),r.typeArguments=n}parseAsyncArrowWithTypeParameters(r){let n=this.startNodeAt(r);if(this.parseFunctionParams(n,!1),!!this.parseArrow(n))return super.parseArrowExpression(n,void 0,!0)}readToken_mult_modulo(r){let n=this.input.charCodeAt(this.state.pos+1);if(r===42&&n===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(r)}readToken_pipe_amp(r){let n=this.input.charCodeAt(this.state.pos+1);if(r===124&&n===125){this.finishOp(9,2);return}super.readToken_pipe_amp(r)}parseTopLevel(r,n){let i=super.parseTopLevel(r,n);return this.state.hasFlowComment&&this.raise(nt.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(nt.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let r=this.skipFlowComment();r&&(this.state.pos+=r,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:r}=this.state,n=2;for(;[32,9].includes(this.input.charCodeAt(r+n));)n++;let i=this.input.charCodeAt(n+r),o=this.input.charCodeAt(n+r+1);return i===58&&o===58?n+2:this.input.slice(n+r,n+r+12)==="flow-include"?n+12:i===58&&o!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(V.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(r,{enumName:n,memberName:i}){this.raise(nt.EnumBooleanMemberNotInitialized,r,{memberName:i,enumName:n})}flowEnumErrorInvalidMemberInitializer(r,n){return this.raise(n.explicitType?n.explicitType==="symbol"?nt.EnumInvalidMemberInitializerSymbolType:nt.EnumInvalidMemberInitializerPrimaryType:nt.EnumInvalidMemberInitializerUnknownType,r,n)}flowEnumErrorNumberMemberNotInitialized(r,n){this.raise(nt.EnumNumberMemberNotInitialized,r,n)}flowEnumErrorStringMemberInconsistentlyInitialized(r,n){this.raise(nt.EnumStringMemberInconsistentlyInitialized,r,n)}flowEnumMemberInit(){let r=this.state.startLoc,n=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{let i=this.parseNumericLiteral(this.state.value);return n()?{type:"number",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}case 134:{let i=this.parseStringLiteral(this.state.value);return n()?{type:"string",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}case 85:case 86:{let i=this.parseBooleanLiteral(this.match(85));return n()?{type:"boolean",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}default:return{type:"invalid",loc:r}}}flowEnumMemberRaw(){let r=this.state.startLoc,n=this.parseIdentifier(!0),i=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:r};return{id:n,init:i}}flowEnumCheckExplicitTypeMismatch(r,n,i){let{explicitType:o}=n;o!==null&&o!==i&&this.flowEnumErrorInvalidMemberInitializer(r,n)}flowEnumMembers({enumName:r,explicitType:n}){let i=new Set,o={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},s=!1;for(;!this.match(8);){if(this.eat(21)){s=!0;break}let a=this.startNode(),{id:A,init:c}=this.flowEnumMemberRaw(),u=A.name;if(u==="")continue;/^[a-z]/.test(u)&&this.raise(nt.EnumInvalidMemberName,A,{memberName:u,suggestion:u[0].toUpperCase()+u.slice(1),enumName:r}),i.has(u)&&this.raise(nt.EnumDuplicateMemberName,A,{memberName:u,enumName:r}),i.add(u);let l={enumName:r,explicitType:n,memberName:u};switch(a.id=A,c.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"boolean"),a.init=c.value,o.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"number"),a.init=c.value,o.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"string"),a.init=c.value,o.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(c.loc,l);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(c.loc,l);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(c.loc,l);break;default:o.defaultedMembers.push(this.finishNode(a,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:o,hasUnknownMembers:s}}flowEnumStringMembers(r,n,{enumName:i}){if(r.length===0)return n;if(n.length===0)return r;if(n.length>r.length){for(let o of r)this.flowEnumErrorStringMemberInconsistentlyInitialized(o,{enumName:i});return n}else{for(let o of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(o,{enumName:i});return r}}flowEnumParseExplicitType({enumName:r}){if(!this.eatContextual(102))return null;if(!Qr(this.state.type))throw this.raise(nt.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:r});let{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(nt.EnumInvalidExplicitType,this.state.startLoc,{enumName:r,invalidEnumType:n}),n}flowEnumBody(r,n){let i=n.name,o=n.loc.start,s=this.flowEnumParseExplicitType({enumName:i});this.expect(5);let{members:a,hasUnknownMembers:A}=this.flowEnumMembers({enumName:i,explicitType:s});switch(r.hasUnknownMembers=A,s){case"boolean":return r.explicitType=!0,r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody");case"number":return r.explicitType=!0,r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody");case"string":return r.explicitType=!0,r.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(r,"EnumStringBody");case"symbol":return r.members=a.defaultedMembers,this.expect(8),this.finishNode(r,"EnumSymbolBody");default:{let c=()=>(r.members=[],this.expect(8),this.finishNode(r,"EnumStringBody"));r.explicitType=!1;let u=a.booleanMembers.length,l=a.numberMembers.length,d=a.stringMembers.length,g=a.defaultedMembers.length;if(!u&&!l&&!d&&!g)return c();if(!u&&!l)return r.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(r,"EnumStringBody");if(!l&&!d&&u>=g){for(let p of a.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(p.loc.start,{enumName:i,memberName:p.id.name});return r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody")}else if(!u&&!d&&l>=g){for(let p of a.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(p.loc.start,{enumName:i,memberName:p.id.name});return r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody")}else return this.raise(nt.EnumInconsistentMemberValues,o,{enumName:i}),c()}}}flowParseEnumDeclaration(r){let n=this.parseIdentifier();return r.id=n,r.body=this.flowEnumBody(this.startNode(),n),this.finishNode(r,"EnumDeclaration")}jsxParseOpeningElementAfterName(r){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(r.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(r)}isLookaheadToken_lt(){let r=this.nextTokenStart();if(this.input.charCodeAt(r)===60){let n=this.input.charCodeAt(r+1);return n!==60&&n!==61}return!1}reScan_lt_gt(){let{type:r}=this.state;r===47?(this.state.pos-=1,this.readToken_lt()):r===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:r}=this.state;return r===51?(this.state.pos-=2,this.finishOp(47,1),47):r}maybeUnwrapTypeCastExpression(r){return r.type==="TypeCastExpression"?r.expression:r}},MKe={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},PKe=/\r\n|[\r\n\u2028\u2029]/,qw=new RegExp(PKe.source,"g");function wf(t){switch(t){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function ote(t,e,r){for(let n=e;n<r;n++)if(wf(t.charCodeAt(n)))return!0;return!1}var DP=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,wP=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function _Ke(t){switch(t){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}var up=PA`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:t})=>`Expected corresponding JSX closing tag for <${t}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:t,HTMLEntity:e})=>`Unexpected token \`${t}\`. Did you mean \`${e}\` or \`{'${t}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function gl(t){return t?t.type==="JSXOpeningFragment"||t.type==="JSXClosingFragment":!1}function Df(t){if(t.type==="JSXIdentifier")return t.name;if(t.type==="JSXNamespacedName")return t.namespace.name+":"+t.name.name;if(t.type==="JSXMemberExpression")return Df(t.object)+"."+Df(t.property);throw new Error("Node had unexpected type: "+t.type)}var LKe=t=>class extends t{jsxReadToken(){let r="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(up.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(i);return}r+=this.input.slice(n,this.state.pos),this.finishToken(142,r);return;case 38:r+=this.input.slice(n,this.state.pos),r+=this.jsxReadEntity(),n=this.state.pos;break;default:wf(i)?(r+=this.input.slice(n,this.state.pos),r+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}}jsxReadNewLine(r){let n=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,n===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=r?`
|
|
1113
1113
|
`:`\r
|
|
@@ -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.50.1-beta.202604291533.c11e968"}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.50.1-beta.202604291652.1363068"}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.50.1-beta.
|
|
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.50.1-beta.202604291652.1363068"),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.50.1-beta.202604291652.1363068"),mo());})();`)}async function Zce(t){return Xce(t,`<!doctype html>
|
|
1319
1319
|
<html lang="en" dir="ltr">
|
|
1320
1320
|
<head>
|
|
1321
1321
|
<meta charset="utf-8" />
|
|
@@ -1482,7 +1482,7 @@ Restarting server after Builder Devtools update...
|
|
|
1482
1482
|
</body>
|
|
1483
1483
|
</html>
|
|
1484
1484
|
`)}async function Xce(t,e){let r=await fz(t),n=t.getFrameworks();return e.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,t.devToolsServerUrl).replace(/__CLIENT_ID__/g,t.getClientId()).replace(/__FRAMEWORK__/g,n.length?n[0].name:"")}var eue=N(()=>{"use strict";m();jt()});async function rue(t,e){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",t.getClientId()),r.searchParams.set("host",await t.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let n=new URL($g,t.devToolsServerUrl);n.searchParams.set($D,(0,tue.platform)()),n.searchParams.set(JD,process.versions.node);let i=t.getFrameworks();return i.length>0&&(r.searchParams.set(qd,i[0].name),n.searchParams.set(qd,i[0].name)),r.searchParams.set("redirect_url",n.href),r.searchParams.set("preview_url",e),r.href}var tue,nue=N(()=>{"use strict";m();Vd();tue=require("node:os")});async function oue(t,e,r,n){try{if(!t)return fm(r,n,400,"Builder context closed");let i=aWe(r);if(i.pathname===PT){if(r.method==="POST"){let o=await sWe(r);if(o)try{let s=await Vce(t,JSON.parse(o));return iue(r,n,200,s)}catch(s){t.debug("Dev API Error",s.stack||s.message||s);let a={errors:[String(s.message||s)]};return iue(r,n,500,a)}}else if(r.method==="OPTIONS"){let o={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version, sentry-trace, baggage"},s=r.headers.origin;s&&s!=="null"?sue(new URL(s))&&(o["Access-Control-Allow-Origin"]=s):o["Access-Control-Allow-Origin"]="*",n.writeHead(200,o),n.end();return}return fm(r,n,405,`${PT} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===_T)return nWe(r,n,200,await Wce(t));if(i.pathname===TV){let o=i.searchParams.get(MT);return o?oWe(n,302,await rue(t,o)):fm(r,n,400,`Missing ${MT} querystring`)}if(i.pathname===$g)return iWe(r,n,200,await Zce(t));if(i.pathname===MV){await mr(t,{_:[]},{});let o=await bE(t),{figmaBuilderLinks:s,diagnostics:a}=await m2({mappingFiles:o,sys:t});return wE(r,n,200,"application/json",JSON.stringify({figmaBuilderLinks:s,foundErrors:a.length>0,diagnostics:a,version:2,local:!0},null,2))}return i.pathname===Jg?(t.debug(`Close Dev Tools Server Requested: ${i.href}`),setTimeout(()=>{try{e.close(o=>{t.debug(`Dev Tools Server Closed Error: ${o}`)})}catch(o){t.debug(`Error closing devtools server: ${o}`)}},20),fm(r,n,200,"Closing Dev Tools Server")):fm(r,n,404,"Not found")}catch(i){return t?.Sentry?.captureException(i),fm(r,n,500,`Dev Server Error: ${i}`)}}function iue(t,e,r,n){wE(t,e,r,"application/json",JSON.stringify(n))}function nWe(t,e,r,n){wE(t,e,r,"application/javascript",n)}function iWe(t,e,r,n){wE(t,e,r,"text/html",n)}function fm(t,e,r,n){wE(t,e,r,"text/plain",n)}function wE(t,e,r,n,i){let o={"Content-Type":`${n}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":xt},s=t.headers.origin;s&&s!=="null"?sue(new URL(s))&&(o["Access-Control-Allow-Origin"]=s):o["Access-Control-Allow-Origin"]="*",e.writeHead(r,o),e.end(i)}function sue(t){return t.hostname==="localhost"||t.origin==="https://builder.io"||t.origin==="https://www.builder.io"||t.origin.endsWith(".builder.io")?!0:t.port===""?!1:t.port!=="80"&&t.port!=="443"}function oWe(t,e,r){t.writeHead(e,{Location:r}),t.end()}async function sWe(t){let e="";for await(let r of t)e+=r;return e}function aWe(t){let e=t.url||"/";return new URL(e,`http://${t.headers.host}`)}var aue=N(()=>{"use strict";m();Vd();zce();eue();nue();un();vE();vn()});async function Aue(t){if(globalThis.__builderDevToolsServer)return t.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(t),globalThis.__builderDevToolsServer;let e=await AWe(t),r=(0,lv.createServer)((i,o)=>{oue(t,r,i,o)}),n=()=>new Promise((i,o)=>{r.listening?(t.debug(`closing devtools server on port ${e}`),r.close(s=>{t=null,s?(t.debug(`error closing devtools server on port ${e}`),o(s)):(t&&t.debug(`closed devtools server on port ${e}`),i())})):(t.debug(`devtools server on port ${e} not listening`),i())});return process.once("SIGTERM",n),process.once("SIGINT",n),process.env.CI!=="true"&&process.stdin.on("end",n),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${e}`).href,port:e,setContext:i=>{t.debug(`set devtools context on server ${e}`),t=i},close:async()=>{globalThis.__builderDevToolsServer=null,await n()}},new Promise(i=>{r.listen(e,()=>{t.debug(`started devtools server on port ${e}`),i(globalThis.__builderDevToolsServer)})})}function AWe(t){return new Promise(e=>{let r=t.port;try{(0,lv.request)({hostname:"localhost",port:r,path:Jg,method:"GET"},i=>{i.on("end",()=>{t.debug(`${Jg} - Response ended`),e(r)})}).on("error",i=>{t.debug(`${Jg} - No response ${i}`),e(r)}).end()}catch(n){t.debug(`${Jg} - Error ${n}`),e(r)}})}var lv,cue=N(()=>{"use strict";m();lv=require("node:http");aue();Vd()});async function h2(t){let e={...t,devToolsServerUrl:"",isValid:!1,serverShouldRestart:!1,publicApiKey:"",port:t.port||5273,ignoreMissingConfig:!1,getAllProjectFiles:t.getAllProjectFiles||(()=>Promise.resolve([]))},r=t.getFrameworks().map(o=>o.name).join(", ");e.debug(`create devtools ${lue} [${r}]`);let n=await Aue(e);return e.devToolsServerUrl=n.url,e.port=n.port,{getUrl:()=>e.devToolsServerUrl}}var uue=N(()=>{"use strict";m();cue();C2()});var lue,C2=N(()=>{"use strict";m();vn();uue();lue=xt});async function gue(t){if(console.log(""),Br((0,Fl.bgCyan)((0,Fl.bold)((0,Fl.white)(" add ")))+" "+(0,Fl.dim)(xt)),!t.path&&!process.stdout.isTTY&&process.env.FORCE_TTY!=="1")return qe(`This command requires a TTY-enabled terminal.
|
|
1485
|
-
If you are using Windows Git Bash, try a different terminal or wrap the command with winpty.`),await Ke(1);let e=t.snippetId;if(!e&&!t.snippet)return qe("SnippetId expected. npx builder.io add <snippetId>"),await Ke(1);let r=To(),n=t.snippet||null;if(!n&&e&&(r.start(`Fetching snippet ${e}`),n=await I2(e),r.stop(`Fetched snippet ${e}`)),!n)return qe(`No snippet found for id ${e}`),await Ke(1);let i=process.cwd(),o=nE(i)??i;if(n.files?.length>0){let s=E2(o,n.framework||"react"),a=t.path||await xr({message:"Where should we copy the files?",initialValue:s,validate(c){if(c.length===0)return"File path is required!";if(c[0]!==".")return"Please enter a relative path."}});if(Xe(a))return qe("Cancelled sync"),await Ke(0);let A=await gv(o,n,n.files,a,!1);return j.success("All files have been written successfully."),{snippet:n,pathInput:a,writtenFiles:A,timeStamp:Date.now()}}else{let{code:s,suggestedName:a,framework:A}=n;A&&(a=await uWe(o,A,s)),a??="./src/components/MyComponent.jsx";let c=pue(n,cWe(n.code),n.framework);try{n.framework==="html"?c=await Rc(o,c,"html",void 0):n.framework==="angular"?c=await Rc(o,c,"angular",void 0):n.framework==="vue"?c=await Rc(o,c,"vue",void 0):n.framework==="svelte"?c=await Rc(o,c,"svelte",void 0):c=await Rc(o,c,"typescript",void 0)}catch{}let u=t.path;if(!u){try{let g=(await Ure({cwd:process.cwd()})).getFrameworks();if(g.length>0){let p;if(g.some(f=>f.name.includes("qwik"))?p="qwik":g.some(f=>f.name.includes("react"))?p="react":p=g[0].name,n.framework&&n.framework!==p){let f=await Vr({message:`This snippet is for ${n.framework}, but you are using ${p}. Continue?`,initialValue:!1});if(Xe(f)||!f)return console.log("Please go back to builder and change the output framework to match your project."),console.log(),await Ke(0)}}}catch{}if(u=await xr({message:"Where should we copy the code?",initialValue:a?.startsWith("./")?a:`./${a}`,validate(d){if(d.length===0)return"File path is required!";if(d[0]!==".")return"Please enter a relative path."}}),Xe(u))return console.log(""),await Ke(0)}let l=(0,Ja.resolve)(o,u);j.info(`Writing code to ${l}`),(0,bi.mkdirSync)((0,Ja.dirname)(l),{recursive:!0}),(0,bi.writeFileSync)(l,c)}}function I2(t){return
|
|
1485
|
+
If you are using Windows Git Bash, try a different terminal or wrap the command with winpty.`),await Ke(1);let e=t.snippetId;if(!e&&!t.snippet)return qe("SnippetId expected. npx builder.io add <snippetId>"),await Ke(1);let r=To(),n=t.snippet||null;if(!n&&e&&(r.start(`Fetching snippet ${e}`),n=await I2(e),r.stop(`Fetched snippet ${e}`)),!n)return qe(`No snippet found for id ${e}`),await Ke(1);let i=process.cwd(),o=nE(i)??i;if(n.files?.length>0){let s=E2(o,n.framework||"react"),a=t.path||await xr({message:"Where should we copy the files?",initialValue:s,validate(c){if(c.length===0)return"File path is required!";if(c[0]!==".")return"Please enter a relative path."}});if(Xe(a))return qe("Cancelled sync"),await Ke(0);let A=await gv(o,n,n.files,a,!1);return j.success("All files have been written successfully."),{snippet:n,pathInput:a,writtenFiles:A,timeStamp:Date.now()}}else{let{code:s,suggestedName:a,framework:A}=n;A&&(a=await uWe(o,A,s)),a??="./src/components/MyComponent.jsx";let c=pue(n,cWe(n.code),n.framework);try{n.framework==="html"?c=await Rc(o,c,"html",void 0):n.framework==="angular"?c=await Rc(o,c,"angular",void 0):n.framework==="vue"?c=await Rc(o,c,"vue",void 0):n.framework==="svelte"?c=await Rc(o,c,"svelte",void 0):c=await Rc(o,c,"typescript",void 0)}catch{}let u=t.path;if(!u){try{let g=(await Ure({cwd:process.cwd()})).getFrameworks();if(g.length>0){let p;if(g.some(f=>f.name.includes("qwik"))?p="qwik":g.some(f=>f.name.includes("react"))?p="react":p=g[0].name,n.framework&&n.framework!==p){let f=await Vr({message:`This snippet is for ${n.framework}, but you are using ${p}. Continue?`,initialValue:!1});if(Xe(f)||!f)return console.log("Please go back to builder and change the output framework to match your project."),console.log(),await Ke(0)}}}catch{}if(u=await xr({message:"Where should we copy the code?",initialValue:a?.startsWith("./")?a:`./${a}`,validate(d){if(d.length===0)return"File path is required!";if(d[0]!==".")return"Please enter a relative path."}}),Xe(u))return console.log(""),await Ke(0)}let l=(0,Ja.resolve)(o,u);j.info(`Writing code to ${l}`),(0,bi.mkdirSync)((0,Ja.dirname)(l),{recursive:!0}),(0,bi.writeFileSync)(l,c)}}function I2(t){return Me(`https://cdn.builder.io/api/v1/snippet/${t}`).then(e=>e.status===404?null:e.json())}function cWe(t){return t.replace(/^```jsx\s?|\s?```$/g,"").trim()}function pue(t,e,r,n=!1){if(!r)return e;let i="This code was generated by Builder.io",o=n?`https://builder.io/content/${t.contentId}?codeSession=${t.sessionKey}&sid=${t.id}`:"",s=["vue","html","svelte"].includes(r.toLowerCase()),a=[i,o].filter(Boolean);return`${s?a.map(c=>`<!-- ${c} -->`).join(`
|
|
1486
1486
|
`):`/**
|
|
1487
1487
|
${a.map(c=>` * ${c}`).join(`
|
|
1488
1488
|
`)}
|
|
@@ -1795,7 +1795,7 @@ ${r}
|
|
|
1795
1795
|
Changes outside this path (e.g., Docker files, CI/CD configs, monorepo root configs, unrelated packages) have no visual impact and do NOT require browser testing.
|
|
1796
1796
|
Before scheduling browser tests, check whether the modified files are inside \`${t}\`. If all changes are outside this path, skip browser testing entirely.
|
|
1797
1797
|
`:""}var Spe=N(()=>{"use strict";m()});function _Xe(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 rS(t){if(!t)return;let e=_Xe(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 ZO=N(()=>{"use strict";m()});var XO,xpe=N(()=>{"use strict";m();ZO();XO="code"});function Rm(t,e=XO){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 o=i.indexOf(":");if(o===-1)continue;let s;try{s=decodeURIComponent(i.substring(0,o))}catch{continue}let a=i.substring(o+1).trim();s&&a&&(n[s]=a)}return n}function Vs(t){return!t||Object.keys(t).length===0?"":Object.keys(t).sort().filter(r=>t[r]).map(r=>`${encodeURIComponent(r)}:${t[r]}`).join(",")}function Ml(t,e,r=XO){return Rm(t,r)[e]}var eG=N(()=>{"use strict";m();Js();xpe()});async function nS({sys:t,credentials:e,projectId:r,branchName:n,repoPath:i,aiBranch:o,featureBranch:s,workspace:a,isConnectedToProvider:A,debug:c,forcedFullBackup:u,canAbortMerge:l,folderName:d,repoUrl:g}){let p=performance.now();async function f(M){return Va("git",M,{cwd:i,sys:t})}async function h(){return(await f(["branch","--show-current"])).trim()}async function C(M,U){try{return await f(["merge-base","--is-ancestor",M,U]),!0}catch{return!1}}async function I(){try{return await f(["rev-parse","-q","--verify","MERGE_HEAD"]),!0}catch{return!1}}async function B(M){if(M!=null)try{let U=await f(["--no-pager","show","-s","--format='%an%n%ad%n%B'",M]);return Cm(U.trim(),1e3)}catch{return}}async function E(){try{return(await f(["rev-parse","HEAD"])).trim()}catch{return null}}async function y(M,U){try{let H=(await f(["rev-list",M,`--max-count=${U}`])).trim();return H?H.split(`
|
|
1798
|
-
`):[]}catch{return[]}}let Q=u;if(!a)throw new Error("Workspace is required for backup upload");if(await I())if(l)jr.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 ou(i,t)||(jr.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(M=>(M.name??M.path)===d):a.folders.find(M=>M.enableGit))?.originalRepoUrl??g;if(!D)throw new Error("Original repo URL is required for backup upload");let x=u?"offline-full":A?void 0:"offline",v=await E();if(!v){let M=null;try{let U=await f(["rev-list","--all","--count"]);M=parseInt(U.trim(),10)}catch{}if(M===0){jr.info("Repository has no commits (empty repo) \u2014 nothing to back up");let U={projectId:r,branchName:n,size:0,partial:!0,initialBranch:s,initialCommitHash:void 0,lastCommitHash:"",gitBranchName:o,empty:!0,status:"completed",version:"v2",repoUrl:D,forced:x,...d&&{folderName:d}};return{success:!0,empty:!0,lastCommitHash:"",partial:!0,repoUrl:D,backupRef:void 0,backupEntry:U}}throw new Error(M===null?"Failed to get current commit hash (git rev-list failed)":`Failed to get current commit hash (rev-list --all --count returned ${M})`)}let S=await h();if(!Q&&S!==o)throw new Error(`Current branch "${S}" is not the ai branch "${o}"`);let P=await LXe({sys:t,repoPath:i,featureBranch:s,debug:c,workspace:a,isConnectedToProvider:A,forcedFullBackup:u,credentials:e,projectId:r,folderName:d}),Y=await y(P.initialBranch,10),K=await y(o,10);try{if(P.partial&&(P.initialCommitHash===v||await C(v,P.initialBranch))){jr.debug(`No commits to backup. ${v}`);let Z={projectId:r,branchName:n,size:0,partial:P.partial,initialBranch:P.initialBranch,initialCommitHash:P.initialCommitHash,lastCommitHash:v,gitBranchName:o,empty:!0,status:"completed",version:"v2",repoUrl:D,forced:x,...d&&{folderName:d},metadata:{initialCommitMeta:await B(P.initialCommitHash),lastCommitMeta:await B(v),rangeInRemote:Y,rangeInLocal:K}};return{success:!0,empty:!0,lastCommitHash:v,partial:P.partial,repoUrl:D,backupRef:WE({version:"v2",originalRepoUrl:D,commitHash:v}),backupEntry:Z}}jr.debug("Creating git bundle...");let M=Date.now(),U=Math.random().toString(36).substring(2,8),$=`backup-${M}-${U}.bundle`,H="/tmp",O=t.join(H,$);Pl.default.mkdirSync(H,{recursive:!0}),await f(["bundle","create","--quiet",O,...P.partial?[`${P.initialCommitHash}..${o}`]:["--branches","--tags"]]),jr.debug("Computing MD5 hash of bundle file...");let{contentMd5:L,size:G}=await GXe(O);jr.debug("Verify bundle file integrity"),await f(["bundle","verify","--quiet",O]),jr.debug(`Requesting signed upload URL for size: ${G} bytes`);let ie=await UXe(e,{projectId:r,branchName:n,size:G,partial:P.partial,contentMd5:L,...d&&{folderName:d},...g&&{repoUrl:g}},c);if(!ie)return jr.info("Project/branch was removed, it's okay to skip backup"),{success:!1,reason:"project_removed"};let{signedUrl:ge}=ie;jr.debug(`Uploading to URL: ${ge}`),await OXe(O,ge,G,L),jr.debug("Uploaded successfully");let he={projectId:r,branchName:n,size:G,partial:P.partial,initialBranch:P.initialBranch,initialCommitHash:P.initialCommitHash,lastCommitHash:v,gitBranchName:o,empty:!1,status:"completed",contentMd5:L,version:"v2",repoUrl:D,forced:x,...d&&{folderName:d},metadata:{initialCommitMeta:await B(P.initialCommitHash),lastCommitMeta:await B(v),rangeInRemote:Y,rangeInLocal:K}};try{Pl.default.unlinkSync(O)}catch(Ae){t.Sentry?.captureException(Ae,{level:"warning",tags:{operation:"codegen-backup"}})}return jr.debug("Everything is done"),{success:!0,empty:!1,lastCommitHash:v,partial:P.partial,repoUrl:D,backupRef:WE({version:"v2",originalRepoUrl:D,commitHash:v}),backupEntry:he}}catch(M){let U=performance.now()-p,$=M instanceof Error?M.message:String(M);try{await kpe(e,{elapsedTime:U,error:$,backups:[]},c)}catch(H){jr.error("Failed to record backup failure",H)}throw M}}async function LXe({sys:t,repoPath:e,featureBranch:r,debug:n,workspace:i,isConnectedToProvider:o,forcedFullBackup:s,credentials:a,projectId:A,folderName:c}){async function u(Q){return Va("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 w=(await u(["remote","show","origin"])).match(/HEAD branch: (.+)/);if(w){let D=w[1].trim();if(D)return D}return null}catch(Q){let w=new Error("failed to get default remote branch",{cause:Q});throw t.Sentry?.captureException(w,{tags:{operation:"codegen-backup"}}),w}}async function p(Q){let w;try{w=(await u(["remote","get-url","origin"])).trim()}catch{}w!==Q&&(w?await u(["remote","set-url","origin",Q]):await u(["remote","add","origin",Q]))}let f=async()=>{if(i?.folders.length){let w=c?i.folders.find(D=>(D.name??D.path)===c):i.folders.find(D=>D.enableGit);if(!w?.repoName)throw new Error("Git workspace not found");return!FE.includes(w.repoName)}return!!await d("origin")};async function h(){let Q=!1;try{if(i?.folders?.length){let w=c?i.folders.find(D=>(D.name??D.path)===c):i.folders.find(D=>D.enableGit);if(w?.repoName&&A){let D=await Nm(a,A,n);if(D.success){let x=D.gitConfigs?.[w.repoName];x?.url?(jr.info(`Refreshing origin remote URL to ${x.url}`),await p(x.url)):(jr.warn("Config URL was not returned for repo",w.repoName),Q=!0)}else jr.warn("Failed to fetch git configs",D.error instanceof Error?D.error.message:String(D.error)),Q=!0}}}catch(w){jr.warn("Failed to refresh remote origin URL",w instanceof Error?w.message:String(w)),Q=!0}return Q}if(s){let Q=await l(r);return{initialBranch:r,initialCommitHash:Q??void 0,partial:!1,forcedFullBackup:s}}let C=await f();if(C){if(!o){jr.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:s}}}else{jr.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:s}}jr.debug("Re-fetching all branches");let I=await h();await u(["fetch","origin"]);let B=await g();if(!B)throw new Error("Failed to get default remote branch");if(B==="(unknown)"){jr.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:s,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:s,tokenRefreshFailed:I}}async function UXe(t,e,r){let n=new URL(`${Me}/projects/git-backup-upload-url`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Pe(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 kpe(t,e,r){let n=new URL(`${Me}/projects/git-backup-record`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Pe(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 iS(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(", ");jr.info(`Recording ${e.length} folder(s): ${i}`);let o=Date.now();if(!(await kpe(t,{backups:e,elapsedTime:r},n)).success)throw new Error("Commit(s) not found on remote when recording backup batch");jr.info(`Recorded in ${Date.now()-o}ms \u2014 ${e.length} folder(s) committed`)}async function tG(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(),o=Math.random().toString(36).substring(2,8),s=`download-${i}-${o}.bundle`,a="/tmp",A=t.join(a,s);Pl.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();Pl.default.writeFileSync(A,new Uint8Array(u));let l=await t.stat(A);return jr.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 OXe(t,e,r,n){let i=Pl.default.createReadStream(t),o=await fetch(e,{method:"PUT",body:i,headers:{"Content-Type":"application/octet-stream","Content-Length":r.toString(),"Content-MD5":n},duplex:"half"}),s=await o.text();if(!o.ok)throw new Error(`Failed to upload bundle: ${o.statusText}: ${s}`);return jr.info(`Uploaded bundle: ${s}`),o}async function GXe(t){let e=await Pl.default.promises.stat(t);if(!e.isFile())throw new Error("Bundle file does not exist");let r=(0,Fpe.createHash)("md5"),n=Pl.default.createReadStream(t);return await new Promise((o,s)=>{n.on("error",s),n.on("data",a=>r.update(a)),n.on("end",o)}),{contentMd5:r.digest("base64"),size:e.size}}async function rG(t,e,r,n){try{let i=JSON.stringify(r),o=new URL(`${Me}/projects/set-runtime-status`);e.builderPublicKey&&o.searchParams.set("apiKey",e.builderPublicKey),e.userId&&o.searchParams.set("userId",e.userId);let s={"Content-Type":"application/json"};e.builderPrivateKey&&(s.Authorization=`Bearer ${e.builderPrivateKey}`);let a=await Pe(o,{method:"POST",body:i,keepalive:!0,headers:s,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 oS(t,e,r,n){let i=Vs(r.commits);if(!i)return;let o=Object.keys(r.commits).length;jr.info(`Syncing snapshot (${o} folder(s)): ${i}`),await rG(t,e,{projectId:r.projectId,branchName:r.branchName,lastCommitHash:i,clearSecondaryVolumeId:!1},n)}function WE(t){if(!(t.originalRepoUrl==null||t.commitHash==null))return`${t.version??"v1"}::${t.originalRepoUrl}::${t.commitHash}`}var Pl,Fpe,jr,sS=N(()=>{"use strict";m();Pl=W(require("node:fs"),1);Zr();Jr();Js();Fpe=require("node:crypto");za();Gt();PE();eG();jr=ke("Backup")});function su(t){try{if((0,Tm.existsSync)(t)){let e=(0,Tm.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return null}function zs(t){try{if((0,Tm.existsSync)(t))return(0,Tm.readFileSync)(t,"utf-8")}catch{}return null}function Mm(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 Rpe(t,e){return t.some(r=>r===e)}function ZE(t,e){return t.filter(n=>!n.includes("/")).some(e)}function Pm(t,e){return t.some(r=>r.startsWith(`${e}/`))}var Tm,XE=N(()=>{"use strict";m();Tm=require("node:fs")});async function Tpe(t,e){try{let r=Mm(e);if(!r||!ZE(e,A=>/^next\.config\.(js|ts|mjs)$/.test(A))||!Pm(e,"app"))return null;let o=(0,Npe.join)(t,"package.json"),s=su(o);if(!s?.scripts?.dev)return null;let a=s.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 Npe,Mpe=N(()=>{"use strict";m();Npe=require("node:path");XE()});async function Ppe(t,e){try{let r=Mm(e);if(!r)return null;let n=ZE(e,d=>d==="vue.config.js"||d==="vue.config.ts"),i=ZE(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,nG.join)(t,d[0]),p=zs(g);if(!p||!p.includes("@vitejs/plugin-vue")&&!p.includes("vite-plugin-vue"))return null}}if(!Pm(e,"src"))return null;let s=(0,nG.join)(t,"package.json"),a=su(s);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 nG,_pe=N(()=>{"use strict";m();nG=require("node:path");XE()});async function Lpe(t,e){try{let r=Mm(e);if(!r||!Rpe(e,"svelte.config.js")||!Pm(e,"src"))return null;let o=(0,iG.join)(t,"package.json"),s=su(o);if(!s||!(s.dependencies?.svelte||s.devDependencies?.svelte))return null;let A=s.dependencies?.["@sveltejs/kit"]||s.devDependencies?.["@sveltejs/kit"],c=s.dependencies?.["@sveltejs/vite-plugin-svelte"]||s.devDependencies?.["@sveltejs/vite-plugin-svelte"];if(!A&&!c||!s.scripts?.dev)return null;let u=s.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,iG.join)(t,g[0]),f=zs(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 iG,Upe=N(()=>{"use strict";m();iG=require("node:path");XE()});function KXe(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 ec(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 HXe(t,e){try{let r=e.filter(A=>A.endsWith("package.json")),n=su((0,kn.join)(t,"package.json"));if(e.some(A=>A.includes("pnpm-workspace.yaml")))return{isMonorepo:!0,type:"pnpm-workspaces",possibleRoots:await tc(e)};if(n?.workspaces){let A=await tc(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 tc(e)};if(e.some(A=>A.includes("nx.json")))return{isMonorepo:!0,type:"nx",possibleRoots:await tc(e)};if(e.some(A=>A.includes("turbo.json")))return{isMonorepo:!0,type:"turborepo",possibleRoots:await tc(e)};if(e.some(A=>A.includes("rush.json")))return{isMonorepo:!0,type:"rush",possibleRoots:await tc(e)};if(e.some(A=>A.includes(".moon/workspace.yml")||A.includes(".moon/workspace.yaml")))return{isMonorepo:!0,type:"moon",possibleRoots:await tc(e)};if(zs((0,kn.join)(t,"Cargo.toml"))?.includes("[workspace]"))return{isMonorepo:!0,type:"cargo-workspaces",possibleRoots:await tc(e)};if(e.some(A=>A.endsWith("go.work")))return{isMonorepo:!0,type:"go-workspaces",possibleRoots:await tc(e)};let s=await tc(e);return s.length>=3?{isMonorepo:!0,type:"other",possibleRoots:s}:r.length>3?{isMonorepo:!0,type:"other",possibleRoots:s}:e.filter(A=>A.endsWith("Cargo.toml")).length>3?{isMonorepo:!0,type:"other",possibleRoots:s}:{isMonorepo:!1,possibleRoots:s.length>0?s:void 0}}catch{return{isMonorepo:!1}}}async function $Xe(t,e){try{let r=[],n=e.filter(l=>l.endsWith("package.json")),i={};for(let l of n){let d=(0,kn.join)(t,l),g=su(d);g&&(Object.assign(i,g.dependencies||{}),Object.assign(i,g.devDependencies||{}))}let o={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(o)){let g=[],p="low",f=d.deps.some(h=>i?.[h]);f&&(g.push(`dependency: ${d.deps.find(h=>i?.[h])}`),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 s={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(s)){let g=[],p="low";if(d.files.some(h=>e.some(C=>C.includes(h)))&&(g.push(`file: ${d.files.find(h=>e.some(C=>C.includes(h)))}`),p="high"),d.imports){let h=e.filter(I=>I.includes("requirements.txt")),C=e.filter(I=>I.includes("pyproject.toml"));for(let I of h){let B=zs((0,kn.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=zs((0,kn.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=zs((0,kn.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=zs((0,kn.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 JXe(t,e){let r=[];try{let n=(0,kn.join)(t,".npmrc");if((0,ln.existsSync)(n)){r.push({tool:".npmrc"});let p=(0,ln.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 o=(0,kn.join)(t,".nvmrc"),s=(0,kn.join)(t,".node-version");if((0,ln.existsSync)(o)){let p=(0,ln.readFileSync)(o,"utf-8").trim();ec(p)?r.push({tool:"node",version:p}):r.push({tool:"node"})}else if((0,ln.existsSync)(s)){let p=(0,ln.readFileSync)(s,"utf-8").trim();ec(p)?r.push({tool:"node",version:p}):r.push({tool:"node"})}else{let p=(0,kn.join)(t,"package.json");if((0,ln.existsSync)(p))try{let f=JSON.parse((0,ln.readFileSync)(p,"utf-8"));if(f.engines?.node){let h=f.engines.node;ec(h)?r.push({tool:"node",version:h}):r.push({tool:"node"})}}catch{}}let a=(0,kn.join)(t,"rust-toolchain"),A=(0,kn.join)(t,"rust-toolchain.toml");if((0,ln.existsSync)(a)){let p=(0,ln.readFileSync)(a,"utf-8").trim();ec(p)?r.push({tool:"rust",version:p}):r.push({tool:"rust"})}else if((0,ln.existsSync)(A)){let h=(0,ln.readFileSync)(A,"utf-8").match(/channel\s*=\s*"(.+?)"/)?.[1];ec(h)?r.push({tool:"rust",version:h}):r.push({tool:"rust"})}let c=(0,kn.join)(t,".python-version");if((0,ln.existsSync)(c)){let p=(0,ln.readFileSync)(c,"utf-8").trim();ec(p)?r.push({tool:"python",version:p}):r.push({tool:"python"})}else{let p=(0,kn.join)(t,"pyproject.toml");if((0,ln.existsSync)(p)){let h=(0,ln.readFileSync)(p,"utf-8").match(/requires-python\s*=\s*"(.+?)"/);if(h){let C=h[1];ec(C)?r.push({tool:"python",version:C}):r.push({tool:"python"})}}}let u=(0,kn.join)(t,".go-version");if((0,ln.existsSync)(u)){let p=(0,ln.readFileSync)(u,"utf-8").trim();ec(p)?r.push({tool:"go",version:p}):r.push({tool:"go"})}else{let p=(0,kn.join)(t,"go.mod");if((0,ln.existsSync)(p)){let h=(0,ln.readFileSync)(p,"utf-8").match(/go\s+(\d+\.\d+)/);if(h){let C=h[1];ec(C)?r.push({tool:"go",version:C}):r.push({tool:"go"})}}}let l=(0,kn.join)(t,".ruby-version");if((0,ln.existsSync)(l)){let p=(0,ln.readFileSync)(l,"utf-8").trim();ec(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 jXe(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 YXe(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(s=>t.some(a=>a.includes(s)))&&e.push(n);return e}catch{return[]}}function qXe(t,e){let r=[],n=t.split(`
|
|
1798
|
+
`):[]}catch{return[]}}let Q=u;if(!a)throw new Error("Workspace is required for backup upload");if(await I())if(l)jr.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 ou(i,t)||(jr.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(M=>(M.name??M.path)===d):a.folders.find(M=>M.enableGit))?.originalRepoUrl??g;if(!D)throw new Error("Original repo URL is required for backup upload");let x=u?"offline-full":A?void 0:"offline",v=await E();if(!v){let M=null;try{let U=await f(["rev-list","--all","--count"]);M=parseInt(U.trim(),10)}catch{}if(M===0){jr.info("Repository has no commits (empty repo) \u2014 nothing to back up");let U={projectId:r,branchName:n,size:0,partial:!0,initialBranch:s,initialCommitHash:void 0,lastCommitHash:"",gitBranchName:o,empty:!0,status:"completed",version:"v2",repoUrl:D,forced:x,...d&&{folderName:d}};return{success:!0,empty:!0,lastCommitHash:"",partial:!0,repoUrl:D,backupRef:void 0,backupEntry:U}}throw new Error(M===null?"Failed to get current commit hash (git rev-list failed)":`Failed to get current commit hash (rev-list --all --count returned ${M})`)}let S=await h();if(!Q&&S!==o)throw new Error(`Current branch "${S}" is not the ai branch "${o}"`);let P=await LXe({sys:t,repoPath:i,featureBranch:s,debug:c,workspace:a,isConnectedToProvider:A,forcedFullBackup:u,credentials:e,projectId:r,folderName:d}),Y=await y(P.initialBranch,10),K=await y(o,10);try{if(P.partial&&(P.initialCommitHash===v||await C(v,P.initialBranch))){jr.debug(`No commits to backup. ${v}`);let Z={projectId:r,branchName:n,size:0,partial:P.partial,initialBranch:P.initialBranch,initialCommitHash:P.initialCommitHash,lastCommitHash:v,gitBranchName:o,empty:!0,status:"completed",version:"v2",repoUrl:D,forced:x,...d&&{folderName:d},metadata:{initialCommitMeta:await B(P.initialCommitHash),lastCommitMeta:await B(v),rangeInRemote:Y,rangeInLocal:K}};return{success:!0,empty:!0,lastCommitHash:v,partial:P.partial,repoUrl:D,backupRef:WE({version:"v2",originalRepoUrl:D,commitHash:v}),backupEntry:Z}}jr.debug("Creating git bundle...");let M=Date.now(),U=Math.random().toString(36).substring(2,8),$=`backup-${M}-${U}.bundle`,H="/tmp",O=t.join(H,$);Pl.default.mkdirSync(H,{recursive:!0}),await f(["bundle","create","--quiet",O,...P.partial?[`${P.initialCommitHash}..${o}`]:["--branches","--tags"]]),jr.debug("Computing MD5 hash of bundle file...");let{contentMd5:L,size:G}=await GXe(O);jr.debug("Verify bundle file integrity"),await f(["bundle","verify","--quiet",O]),jr.debug(`Requesting signed upload URL for size: ${G} bytes`);let ie=await UXe(e,{projectId:r,branchName:n,size:G,partial:P.partial,contentMd5:L,...d&&{folderName:d},...g&&{repoUrl:g}},c);if(!ie)return jr.info("Project/branch was removed, it's okay to skip backup"),{success:!1,reason:"project_removed"};let{signedUrl:ge}=ie;jr.debug(`Uploading to URL: ${ge}`),await OXe(O,ge,G,L),jr.debug("Uploaded successfully");let he={projectId:r,branchName:n,size:G,partial:P.partial,initialBranch:P.initialBranch,initialCommitHash:P.initialCommitHash,lastCommitHash:v,gitBranchName:o,empty:!1,status:"completed",contentMd5:L,version:"v2",repoUrl:D,forced:x,...d&&{folderName:d},metadata:{initialCommitMeta:await B(P.initialCommitHash),lastCommitMeta:await B(v),rangeInRemote:Y,rangeInLocal:K}};try{Pl.default.unlinkSync(O)}catch(Ae){t.Sentry?.captureException(Ae,{level:"warning",tags:{operation:"codegen-backup"}})}return jr.debug("Everything is done"),{success:!0,empty:!1,lastCommitHash:v,partial:P.partial,repoUrl:D,backupRef:WE({version:"v2",originalRepoUrl:D,commitHash:v}),backupEntry:he}}catch(M){let U=performance.now()-p,$=M instanceof Error?M.message:String(M);try{await kpe(e,{elapsedTime:U,error:$,backups:[]},c)}catch(H){jr.error("Failed to record backup failure",H)}throw M}}async function LXe({sys:t,repoPath:e,featureBranch:r,debug:n,workspace:i,isConnectedToProvider:o,forcedFullBackup:s,credentials:a,projectId:A,folderName:c}){async function u(Q){return Va("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 w=(await u(["remote","show","origin"])).match(/HEAD branch: (.+)/);if(w){let D=w[1].trim();if(D)return D}return null}catch(Q){let w=new Error("failed to get default remote branch",{cause:Q});throw t.Sentry?.captureException(w,{tags:{operation:"codegen-backup"}}),w}}async function p(Q){let w;try{w=(await u(["remote","get-url","origin"])).trim()}catch{}w!==Q&&(w?await u(["remote","set-url","origin",Q]):await u(["remote","add","origin",Q]))}let f=async()=>{if(i?.folders.length){let w=c?i.folders.find(D=>(D.name??D.path)===c):i.folders.find(D=>D.enableGit);if(!w?.repoName)throw new Error("Git workspace not found");return!FE.includes(w.repoName)}return!!await d("origin")};async function h(){let Q=!1;try{if(i?.folders?.length){let w=c?i.folders.find(D=>(D.name??D.path)===c):i.folders.find(D=>D.enableGit);if(w?.repoName&&A){let D=await Nm(a,A,n);if(D.success){let x=D.gitConfigs?.[w.repoName];x?.url?(jr.info(`Refreshing origin remote URL to ${x.url}`),await p(x.url)):(jr.warn("Config URL was not returned for repo",w.repoName),Q=!0)}else jr.warn("Failed to fetch git configs",D.error instanceof Error?D.error.message:String(D.error)),Q=!0}}}catch(w){jr.warn("Failed to refresh remote origin URL",w instanceof Error?w.message:String(w)),Q=!0}return Q}if(s){let Q=await l(r);return{initialBranch:r,initialCommitHash:Q??void 0,partial:!1,forcedFullBackup:s}}let C=await f();if(C){if(!o){jr.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:s}}}else{jr.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:s}}jr.debug("Re-fetching all branches");let I=await h();await u(["fetch","origin"]);let B=await g();if(!B)throw new Error("Failed to get default remote branch");if(B==="(unknown)"){jr.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:s,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:s,tokenRefreshFailed:I}}async function UXe(t,e,r){let n=new URL(`${Pe}/projects/git-backup-upload-url`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Me(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 kpe(t,e,r){let n=new URL(`${Pe}/projects/git-backup-record`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Me(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 iS(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(", ");jr.info(`Recording ${e.length} folder(s): ${i}`);let o=Date.now();if(!(await kpe(t,{backups:e,elapsedTime:r},n)).success)throw new Error("Commit(s) not found on remote when recording backup batch");jr.info(`Recorded in ${Date.now()-o}ms \u2014 ${e.length} folder(s) committed`)}async function tG(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(),o=Math.random().toString(36).substring(2,8),s=`download-${i}-${o}.bundle`,a="/tmp",A=t.join(a,s);Pl.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();Pl.default.writeFileSync(A,new Uint8Array(u));let l=await t.stat(A);return jr.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 OXe(t,e,r,n){let i=Pl.default.createReadStream(t),o=await fetch(e,{method:"PUT",body:i,headers:{"Content-Type":"application/octet-stream","Content-Length":r.toString(),"Content-MD5":n},duplex:"half"}),s=await o.text();if(!o.ok)throw new Error(`Failed to upload bundle: ${o.statusText}: ${s}`);return jr.info(`Uploaded bundle: ${s}`),o}async function GXe(t){let e=await Pl.default.promises.stat(t);if(!e.isFile())throw new Error("Bundle file does not exist");let r=(0,Fpe.createHash)("md5"),n=Pl.default.createReadStream(t);return await new Promise((o,s)=>{n.on("error",s),n.on("data",a=>r.update(a)),n.on("end",o)}),{contentMd5:r.digest("base64"),size:e.size}}async function rG(t,e,r,n){try{let i=JSON.stringify(r),o=new URL(`${Pe}/projects/set-runtime-status`);e.builderPublicKey&&o.searchParams.set("apiKey",e.builderPublicKey),e.userId&&o.searchParams.set("userId",e.userId);let s={"Content-Type":"application/json"};e.builderPrivateKey&&(s.Authorization=`Bearer ${e.builderPrivateKey}`);let a=await Me(o,{method:"POST",body:i,keepalive:!0,headers:s,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 oS(t,e,r,n){let i=Vs(r.commits);if(!i)return;let o=Object.keys(r.commits).length;jr.info(`Syncing snapshot (${o} folder(s)): ${i}`),await rG(t,e,{projectId:r.projectId,branchName:r.branchName,lastCommitHash:i,clearSecondaryVolumeId:!1},n)}function WE(t){if(!(t.originalRepoUrl==null||t.commitHash==null))return`${t.version??"v1"}::${t.originalRepoUrl}::${t.commitHash}`}var Pl,Fpe,jr,sS=N(()=>{"use strict";m();Pl=W(require("node:fs"),1);Zr();Jr();Js();Fpe=require("node:crypto");za();Gt();PE();eG();jr=ke("Backup")});function su(t){try{if((0,Tm.existsSync)(t)){let e=(0,Tm.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return null}function zs(t){try{if((0,Tm.existsSync)(t))return(0,Tm.readFileSync)(t,"utf-8")}catch{}return null}function Mm(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 Rpe(t,e){return t.some(r=>r===e)}function ZE(t,e){return t.filter(n=>!n.includes("/")).some(e)}function Pm(t,e){return t.some(r=>r.startsWith(`${e}/`))}var Tm,XE=N(()=>{"use strict";m();Tm=require("node:fs")});async function Tpe(t,e){try{let r=Mm(e);if(!r||!ZE(e,A=>/^next\.config\.(js|ts|mjs)$/.test(A))||!Pm(e,"app"))return null;let o=(0,Npe.join)(t,"package.json"),s=su(o);if(!s?.scripts?.dev)return null;let a=s.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 Npe,Mpe=N(()=>{"use strict";m();Npe=require("node:path");XE()});async function Ppe(t,e){try{let r=Mm(e);if(!r)return null;let n=ZE(e,d=>d==="vue.config.js"||d==="vue.config.ts"),i=ZE(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,nG.join)(t,d[0]),p=zs(g);if(!p||!p.includes("@vitejs/plugin-vue")&&!p.includes("vite-plugin-vue"))return null}}if(!Pm(e,"src"))return null;let s=(0,nG.join)(t,"package.json"),a=su(s);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 nG,_pe=N(()=>{"use strict";m();nG=require("node:path");XE()});async function Lpe(t,e){try{let r=Mm(e);if(!r||!Rpe(e,"svelte.config.js")||!Pm(e,"src"))return null;let o=(0,iG.join)(t,"package.json"),s=su(o);if(!s||!(s.dependencies?.svelte||s.devDependencies?.svelte))return null;let A=s.dependencies?.["@sveltejs/kit"]||s.devDependencies?.["@sveltejs/kit"],c=s.dependencies?.["@sveltejs/vite-plugin-svelte"]||s.devDependencies?.["@sveltejs/vite-plugin-svelte"];if(!A&&!c||!s.scripts?.dev)return null;let u=s.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,iG.join)(t,g[0]),f=zs(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 iG,Upe=N(()=>{"use strict";m();iG=require("node:path");XE()});function KXe(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 ec(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 HXe(t,e){try{let r=e.filter(A=>A.endsWith("package.json")),n=su((0,kn.join)(t,"package.json"));if(e.some(A=>A.includes("pnpm-workspace.yaml")))return{isMonorepo:!0,type:"pnpm-workspaces",possibleRoots:await tc(e)};if(n?.workspaces){let A=await tc(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 tc(e)};if(e.some(A=>A.includes("nx.json")))return{isMonorepo:!0,type:"nx",possibleRoots:await tc(e)};if(e.some(A=>A.includes("turbo.json")))return{isMonorepo:!0,type:"turborepo",possibleRoots:await tc(e)};if(e.some(A=>A.includes("rush.json")))return{isMonorepo:!0,type:"rush",possibleRoots:await tc(e)};if(e.some(A=>A.includes(".moon/workspace.yml")||A.includes(".moon/workspace.yaml")))return{isMonorepo:!0,type:"moon",possibleRoots:await tc(e)};if(zs((0,kn.join)(t,"Cargo.toml"))?.includes("[workspace]"))return{isMonorepo:!0,type:"cargo-workspaces",possibleRoots:await tc(e)};if(e.some(A=>A.endsWith("go.work")))return{isMonorepo:!0,type:"go-workspaces",possibleRoots:await tc(e)};let s=await tc(e);return s.length>=3?{isMonorepo:!0,type:"other",possibleRoots:s}:r.length>3?{isMonorepo:!0,type:"other",possibleRoots:s}:e.filter(A=>A.endsWith("Cargo.toml")).length>3?{isMonorepo:!0,type:"other",possibleRoots:s}:{isMonorepo:!1,possibleRoots:s.length>0?s:void 0}}catch{return{isMonorepo:!1}}}async function $Xe(t,e){try{let r=[],n=e.filter(l=>l.endsWith("package.json")),i={};for(let l of n){let d=(0,kn.join)(t,l),g=su(d);g&&(Object.assign(i,g.dependencies||{}),Object.assign(i,g.devDependencies||{}))}let o={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(o)){let g=[],p="low",f=d.deps.some(h=>i?.[h]);f&&(g.push(`dependency: ${d.deps.find(h=>i?.[h])}`),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 s={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(s)){let g=[],p="low";if(d.files.some(h=>e.some(C=>C.includes(h)))&&(g.push(`file: ${d.files.find(h=>e.some(C=>C.includes(h)))}`),p="high"),d.imports){let h=e.filter(I=>I.includes("requirements.txt")),C=e.filter(I=>I.includes("pyproject.toml"));for(let I of h){let B=zs((0,kn.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=zs((0,kn.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=zs((0,kn.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=zs((0,kn.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 JXe(t,e){let r=[];try{let n=(0,kn.join)(t,".npmrc");if((0,ln.existsSync)(n)){r.push({tool:".npmrc"});let p=(0,ln.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 o=(0,kn.join)(t,".nvmrc"),s=(0,kn.join)(t,".node-version");if((0,ln.existsSync)(o)){let p=(0,ln.readFileSync)(o,"utf-8").trim();ec(p)?r.push({tool:"node",version:p}):r.push({tool:"node"})}else if((0,ln.existsSync)(s)){let p=(0,ln.readFileSync)(s,"utf-8").trim();ec(p)?r.push({tool:"node",version:p}):r.push({tool:"node"})}else{let p=(0,kn.join)(t,"package.json");if((0,ln.existsSync)(p))try{let f=JSON.parse((0,ln.readFileSync)(p,"utf-8"));if(f.engines?.node){let h=f.engines.node;ec(h)?r.push({tool:"node",version:h}):r.push({tool:"node"})}}catch{}}let a=(0,kn.join)(t,"rust-toolchain"),A=(0,kn.join)(t,"rust-toolchain.toml");if((0,ln.existsSync)(a)){let p=(0,ln.readFileSync)(a,"utf-8").trim();ec(p)?r.push({tool:"rust",version:p}):r.push({tool:"rust"})}else if((0,ln.existsSync)(A)){let h=(0,ln.readFileSync)(A,"utf-8").match(/channel\s*=\s*"(.+?)"/)?.[1];ec(h)?r.push({tool:"rust",version:h}):r.push({tool:"rust"})}let c=(0,kn.join)(t,".python-version");if((0,ln.existsSync)(c)){let p=(0,ln.readFileSync)(c,"utf-8").trim();ec(p)?r.push({tool:"python",version:p}):r.push({tool:"python"})}else{let p=(0,kn.join)(t,"pyproject.toml");if((0,ln.existsSync)(p)){let h=(0,ln.readFileSync)(p,"utf-8").match(/requires-python\s*=\s*"(.+?)"/);if(h){let C=h[1];ec(C)?r.push({tool:"python",version:C}):r.push({tool:"python"})}}}let u=(0,kn.join)(t,".go-version");if((0,ln.existsSync)(u)){let p=(0,ln.readFileSync)(u,"utf-8").trim();ec(p)?r.push({tool:"go",version:p}):r.push({tool:"go"})}else{let p=(0,kn.join)(t,"go.mod");if((0,ln.existsSync)(p)){let h=(0,ln.readFileSync)(p,"utf-8").match(/go\s+(\d+\.\d+)/);if(h){let C=h[1];ec(C)?r.push({tool:"go",version:C}):r.push({tool:"go"})}}}let l=(0,kn.join)(t,".ruby-version");if((0,ln.existsSync)(l)){let p=(0,ln.readFileSync)(l,"utf-8").trim();ec(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 jXe(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 YXe(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(s=>t.some(a=>a.includes(s)))&&e.push(n);return e}catch{return[]}}function qXe(t,e){let r=[],n=t.split(`
|
|
1799
1799
|
`);for(let i of n){let o=i.trim();if(!o||o.startsWith("#"))continue;let s=o.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(s){let a=s[1],A=s[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 VXe(t,e){let r=[],n=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,i,o=new Set;for(;(i=n.exec(t))!==null;){let s=i[1];o.has(s)||(o.add(s),r.push({key:s,source:e,type:"npmrc"}))}return r}async function zXe(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"],o=[],s=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,kn.join)(t,A),u=zs(c);if(u){let l=VXe(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}`))&&!s.has(c)&&(s.add(c),o.push(c))}for(let A of o){let c=(0,kn.join)(t,A),u=zs(c);if(u){let l=qXe(u,A);for(let d of l)n.has(d.key)||(n.add(d.key),r.push(d))}}return r}catch{return[]}}async function WXe(t,e){try{let r=await Tpe(t,e);if(r)return r;let n=await Ppe(t,e);if(n)return n;let i=await Lpe(t,e);return i||null}catch{return null}}async function tc(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 o=Array.from(e).sort(),s=o.filter(a=>a!==".");return s.length>0?s:o}catch{return[]}}async function Ope(t,e){let r=[];try{let n=await _l({sys:t,basePath:e,globPattern:"**/*",dot:!0}),i=KXe(n),o=await HXe(e,n),s=await $Xe(e,n),a=await JXe(e,n),A=await jXe(n),c=await YXe(n),u=await zXe(e,n),l=await WXe(e,n),d={languages:[],isEmpty:i,isMonorepo:o.isMonorepo,monorepoType:o.type,frameworks:s,setupRequirements:a,packageManagers:A,buildTools:c,environmentVariables:u.length>0?u:void 0,possibleMonorepoRoots:o.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 ln,kn,Gpe=N(()=>{"use strict";m();Kp();XE();Mpe();_pe();Upe();ln=require("node:fs"),kn=require("node:path")});var Hpe,Ws,aS,Kpe,AS,$pe=N(()=>{"use strict";m();Hpe=require("node:child_process"),Ws=W(require("node:path"),1),aS=W(require("node:fs"),1);ja();Gt();Kpe=ke("TsServer"),AS=class t{#n=null;#c=0;#o=new Map;#t="";#A;#i=!1;#e=null;#s=new Set;#E=!1;#m=null;static REQUEST_TIMEOUT=3e4;constructor(e){this.#A=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.#k();if(!e)throw new Error("Could not find tsserver. Ensure TypeScript is installed in the project.");this.#n=(0,Hpe.spawn)("node",[e,"--useInferredProjectConfig"],{cwd:this.#A,stdio:["pipe","pipe","pipe"],env:{...process.env,TSS_LOG:void 0}}),fv.track(this.#n),this.#n.stdout.on("data",r=>{this.#v(r.toString("utf-8"))}),this.#n.stderr.on("data",r=>{Kpe.debug("stderr",r.toString("utf-8"),{loggerOptions:{stderr:!0}})}),this.#n.on("exit",r=>{this.#n=null,this.#E=!1;for(let[,n]of this.#o)clearTimeout(n.timer),n.reject(new Error(`tsserver exited with code ${r}`));this.#o.clear()}),this.#n.on("error",r=>{Kpe.error("Process error:",r.message)}),this.#E=!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}})}#k(){let e=Ws.default.join(this.#A,"node_modules","typescript","lib","tsserver.js");if(aS.default.existsSync(e))return e;let r=Ws.default.join(this.#A,"..","node_modules","typescript","lib","tsserver.js");if(aS.default.existsSync(r))return r;try{let n=require.resolve("typescript/lib/tsserver.js",{paths:[this.#A]});if(aS.default.existsSync(n))return n}catch{}return null}#v(e){for(this.#t+=e;;){let r=this.#t.match(/^Content-Length:\s*(\d+)\r?\n\r?\n/);if(r){let o=parseInt(r[1],10),s=r[0].length,a=s+o;if(this.#t.length>=a){let A=this.#t.substring(s,a);this.#t=this.#t.substring(a),this.#S(A);continue}break}let n=this.#t.indexOf(`
|
|
1800
1800
|
`);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.#o.get(n.request_seq);i&&(clearTimeout(i.timer),this.#o.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.#E)throw new Error("tsserver is not running");let n=++this.#c,i={seq:n,type:"request",command:e,arguments:r};return new Promise((o,s)=>{let a=setTimeout(()=>{this.#o.delete(n),s(new Error(`tsserver request "${e}" timed out`))},t.REQUEST_TIMEOUT);this.#o.set(n,{resolve:o,reject:s,timer:a});let A=JSON.stringify(i)+`
|
|
1801
1801
|
`;this.#n.stdin.write(A)})}setEventHandler(e){this.#e=e}async openFile(e,r,n){await this.start();let i=Ws.default.isAbsolute(e)?e:Ws.default.resolve(this.#A,e);if(this.#s.has(i)){await this.changeFile(e,r);return}await this.#a("open",{file:i,fileContent:r,scriptKindName:this.#r(i),projectRootPath:n||this.#A}),this.#s.add(i)}async changeFile(e,r){if(!this.#E)return;let n=Ws.default.isAbsolute(e)?e:Ws.default.resolve(this.#A,e);if(!this.#s.has(n)){await this.openFile(e,r);return}await this.#a("open",{file:n,fileContent:r,scriptKindName:this.#r(n),projectRootPath:this.#A})}async closeFile(e){if(!this.#E)return;let r=Ws.default.isAbsolute(e)?e:Ws.default.resolve(this.#A,e);this.#s.has(r)&&(await this.#a("close",{file:r}),this.#s.delete(r))}async getCompletions(e,r,n,i){let o=this.#p(e);return this.#a("completionInfo",{file:o,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 o=this.#p(e);return this.#a("completionEntryDetails",{file:o,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,o,s){let a=this.#p(e);return this.#a("getCodeFixes",{file:a,startLine:r,startOffset:n,endLine:i,endOffset:o,errorCodes:s})}async getApplicableRefactors(e,r,n,i,o){let s=this.#p(e);return this.#a("getApplicableRefactors",{file:s,startLine:r,startOffset:n,endLine:i,endOffset:o})}async getEditsForRefactor(e,r,n,i,o,s,a){let A=this.#p(e);return this.#a("getEditsForRefactor",{file:A,startLine:r,startOffset:n,endLine:i,endOffset:o,refactor:s,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,o){let s=this.#p(e);return this.#a("format",{file:s,line:r,offset:n,endLine:i,endOffset:o})}getCwd(){return this.#A}isRunning(){return this.#E&&this.#n!==null}dispose(){if(this.#i=!0,this.#E=!1,this.#n){try{this.#n.kill("SIGTERM")}catch{}fv.untrack(this.#n),this.#n=null}for(let[,e]of this.#o)clearTimeout(e.timer),e.reject(new Error("tsserver disposed"));this.#o.clear(),this.#s.clear(),this.#e=null}#p(e){return Ws.default.isAbsolute(e)?e:Ws.default.resolve(this.#A,e)}#r(e){switch(Ws.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 Ll(t){if(!t)return;let e=t.toLowerCase();if(e!=="inherit")return ZXe[e]??t}var ZXe,cS=N(()=>{"use strict";m();ZXe={"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 Jpe(t,e){try{if(!t||!t.trim())return null;let r=nm(t);if(!r.frontmatter||Object.keys(r.frontmatter).length===0)return{name:eB.default.basename(e,eB.default.extname(e)),systemPrompt:r.body||t.trim(),filePath:e};let n=r.body;if(!n)return null;let i=r.frontmatter.name||eB.default.basename(e,eB.default.extname(e)),o;r.frontmatter.tools&&(Array.isArray(r.frontmatter.tools)?o=r.frontmatter.tools.map(E=>E.trim()):typeof r.frontmatter.tools=="string"&&(o=r.frontmatter.tools.split(",").map(E=>E.trim())));let s=r.frontmatter.model?Ll(r.frontmatter.model):void 0,a=r.frontmatter.mode,A=!!r.frontmatter.includeMemories,c=!!r.frontmatter.needDevServer,u=!!r.frontmatter.needValidation,l=!!r.frontmatter.resetAfterRun,d=["low","medium","high","minimal"],g=r.frontmatter.reasoning&&d.includes(r.frontmatter.reasoning)?r.frontmatter.reasoning:void 0,p=r.frontmatter.maxTimeoutMs,f=typeof p=="number"?p:typeof p=="string"?Number(p):void 0,h=f&&Number.isFinite(f)&&f>0?f:void 0,C=r.frontmatter.maxCompletions,I=typeof C=="number"?C:typeof C=="string"?Number(C):void 0,B=I&&Number.isFinite(I)&&I>0?Math.floor(I):void 0;return{name:i,description:r.frontmatter.description,systemPrompt:n,tools:o,model:s,mode:a,filePath:e,includeMemories:A,needDevServer:c,needValidation:u,resetAfterRun:l,maxTimeoutMs:h,maxCompletions:B,reasoning:g}}catch{return null}}var eB,jpe=N(()=>{"use strict";m();eB=W(require("node:path"),1);xb();cS()});async function Ype(t,e,r,n="",i,o){let s=[];try{if(!await t.exists(e))return s;let a=await t.readdir(e);for(let A of a){let c=t.join(e,A);if(i&&o){let l=t.relative(o,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 Ype(t,c,r,l,i,o);s.push(...d)}else(A.endsWith(".mdc")||A.endsWith(".md")||A.endsWith(".yml")||A.endsWith(".yaml"))&&s.push(c)}}catch{}return s}async function eet(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 o=t.relative(r,e);return Jpe(i,o)}catch(n){return t.Sentry?.captureException(n),null}}async function qpe({sys:t,projectDir:e,currentDir:r,rootDir:n}){let i=[],o=[".claude/agents",".builder/agents",".cursor/agents",".agents/agents"],s=await uS(e,t),a;do{try{for(let A of o){let c=t.resolve(r,A);if(await t.exists(c)){let u=await Ype(t,c,c,"",s,e);for(let l of u){let d=await eet(t,l,e);d&&i.push(d)}}}}catch(A){XXe.debug(`Error reading ${r}:`,A)}if(a=r,r=t.dirname(r),r===a)break}while(a!==n);return i}var XXe,Vpe=N(()=>{"use strict";m();jpe();Kp();Gt();XXe=ke("AgentDiscovery")});function tet(t){try{return JSON.stringify(t)}catch{return String(t)}}function zpe(t){let{filePath:e,forceWorkspace:r=!1,workspace:n,workingDirectory:i,sys:o,canCollapseWorkspace:s}=t;if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${tet(e)}`);let a=e;if(a.startsWith("/")?a=a.substring(1):a.startsWith("./")&&(a=a.substring(2)),!n?.folders?.length)return{resolvedPath:o.resolve(i,a)};if(n.folders.length===1&&n.folders[0].name==="."||s){let p=n.folders[0],f=o.resolve(i,p.path);return{resolvedPath:o.resolve(f,a),workspaceFolder:p}}let c=a.indexOf("/");if(c===-1){if(r){let p=n.folders[0],f=o.resolve(i,p.path);return{resolvedPath:o.resolve(f,a),workspaceFolder:p}}return{resolvedPath:o.resolve(i,a)}}let u=a.substring(0,c),l=a.substring(c+1),d=n.folders.find(p=>p.name?p.name===u:o.basename(p.path)===u);if(!d){if(!r)return{resolvedPath:o.resolve(i,a)};d=n.folders[0];let p=o.resolve(i,d.path);return{resolvedPath:o.resolve(p,a),workspaceFolder:d}}let g=o.resolve(i,d.path);return{resolvedPath:o.resolve(g,l),workspaceFolder:d}}function Wpe(t){let{absolutePath:e,workspace:r,workingDirectory:n,sys:i,canCollapseWorkspace:o}=t;if(!r?.folders?.length)return;let s=vi(i.resolve(e));if(r.folders.length===1&&r.folders[0].name==="."){let A=r.folders[0],c=vi(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}if(o&&r.folders.length===1){let A=r.folders[0],c=vi(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}for(let A of r.folders){let c=vi(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.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(o&&r.folders.length>0){let A=r.folders[0],c=vi(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}}function Zpe(t){let{resolvedPath:e,workingDirectory:r,workspace:n,sys:i}=t,o=i.normalize(e),s=i.normalize(r),a=s.includes("\\")?"\\":"/",A=c=>o.startsWith(c+a)||o===c;if(A(s))return!0;if(n?.folders)for(let c of n.folders){let u=i.normalize(i.resolve(r,c.path));if(A(u))return!0}return!1}var Xpe=N(()=>{"use strict";m();qv()});var ir,ede,Le,au,tB=N(()=>{m();(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ir||(ir={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ede||(ede={}));Le=ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),au=t=>{switch(typeof t){case"undefined":return Le.undefined;case"string":return Le.string;case"number":return Number.isNaN(t)?Le.nan:Le.number;case"boolean":return Le.boolean;case"function":return Le.function;case"bigint":return Le.bigint;case"symbol":return Le.symbol;case"object":return Array.isArray(t)?Le.array:t===null?Le.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Le.promise:typeof Map<"u"&&t instanceof Map?Le.map:typeof Set<"u"&&t instanceof Set?Le.set:typeof Date<"u"&&t instanceof Date?Le.date:Le.object;default:return Le.unknown}}});var De,Es,lS=N(()=>{m();tB();De=ir.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Es=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,A=0;for(;A<s.path.length;){let c=s.path[A];A===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],A++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ir.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Es.create=t=>new Es(t)});var ret,Ul,oG=N(()=>{m();lS();tB();ret=(t,e)=>{let r;switch(t.code){case De.invalid_type:t.received===Le.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case De.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ir.jsonStringifyReplacer)}`;break;case De.unrecognized_keys:r=`Unrecognized key(s) in object: ${ir.joinValues(t.keys,", ")}`;break;case De.invalid_union:r="Invalid input";break;case De.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ir.joinValues(t.options)}`;break;case De.invalid_enum_value:r=`Invalid enum value. Expected ${ir.joinValues(t.options)}, received '${t.received}'`;break;case De.invalid_arguments:r="Invalid function arguments";break;case De.invalid_return_type:r="Invalid function return type";break;case De.invalid_date:r="Invalid date";break;case De.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ir.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case De.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case De.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case De.custom:r="Invalid input";break;case De.invalid_intersection_types:r="Intersection results could not be merged";break;case De.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case De.not_finite:r="Number must be finite";break;default:r=e.defaultError,ir.assertNever(t)}return{message:r}},Ul=ret});function rB(){return net}var net,gS=N(()=>{m();oG();net=Ul});function Ne(t,e){let r=rB(),n=pS({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ul?void 0:Ul].filter(i=>!!i)});t.common.issues.push(n)}var pS,ro,pt,_m,Io,sG,aG,Hp,nB,AG=N(()=>{m();gS();oG();pS=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",A=n.filter(c=>!!c).slice().reverse();for(let c of A)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};ro=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return pt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return pt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},pt=Object.freeze({status:"aborted"}),_m=t=>({status:"dirty",value:t}),Io=t=>({status:"valid",value:t}),sG=t=>t.status==="aborted",aG=t=>t.status==="dirty",Hp=t=>t.status==="valid",nB=t=>typeof Promise<"u"&&t instanceof Promise});var tde=N(()=>{m()});var je,rde=N(()=>{m();(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(je||(je={}))});function Ft(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:A}=t;return s.code==="invalid_enum_value"?{message:A??a.defaultError}:typeof a.data>"u"?{message:A??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:A??r??a.defaultError}},description:i}}function ode(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Bet(t){return new RegExp(`^${ode(t)}$`)}function yet(t){let e=`${ide}T${ode(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Qet(t,e){return!!((e==="v4"||!e)&&det.test(t)||(e==="v6"||!e)&&met.test(t))}function Det(t,e){if(!cet.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function wet(t,e){return!!((e==="v4"||!e)&&fet.test(t)||(e==="v6"||!e)&&het.test(t))}function bet(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function Lm(t){if(t instanceof Bs){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Wa.create(Lm(n))}return new Bs({...t._def,shape:()=>e})}else return t instanceof Gl?new Gl({...t._def,type:Lm(t.element)}):t instanceof Wa?Wa.create(Lm(t.unwrap())):t instanceof uu?uu.create(Lm(t.unwrap())):t instanceof cu?cu.create(t.items.map(e=>Lm(e))):t}function lG(t,e){let r=au(t),n=au(e);if(t===e)return{valid:!0,data:t};if(r===Le.object&&n===Le.object){let i=ir.objectKeys(e),o=ir.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let A=lG(t[a],e[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(r===Le.array&&n===Le.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],A=lG(s,a);if(!A.valid)return{valid:!1};i.push(A.data)}return{valid:!0,data:i}}else return r===Le.date&&n===Le.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function sde(t,e){return new jm({values:t,typeName:st.ZodEnum,...Ft(e)})}var Zs,nde,Ht,iet,oet,set,aet,Aet,cet,uet,get,pet,cG,det,fet,met,het,Cet,Iet,ide,Eet,Um,iB,oB,sB,aB,AB,Om,Gm,cB,Ol,rc,uB,Gl,Bs,Km,Au,uG,Hm,cu,gG,lB,gB,pG,$m,Jm,jm,Ym,$p,Za,Wa,uu,qm,Vm,pB,dS,fS,zm,I7t,st,E7t,B7t,y7t,Q7t,D7t,w7t,b7t,v7t,S7t,x7t,F7t,k7t,R7t,N7t,vet,T7t,M7t,P7t,_7t,L7t,U7t,O7t,G7t,K7t,H7t,$7t,J7t,j7t,Y7t,q7t,V7t,z7t,W7t,Z7t,ade=N(()=>{m();lS();gS();rde();AG();tB();Zs=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},nde=(t,e)=>{if(Hp(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Es(t.common.issues);return this._error=r,this._error}}};Ht=class{get description(){return this._def.description}_getType(e){return au(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:au(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ro,ctx:{common:e.parent.common,data:e.data,parsedType:au(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(nB(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:au(e)},i=this._parseSync({data:e,path:n.path,parent:n});return nde(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:au(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Hp(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Hp(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:au(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(nB(i)?i:Promise.resolve(i));return nde(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:De.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(A=>A?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Za({schema:this,typeName:st.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Wa.create(this,this._def)}nullable(){return uu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Gl.create(this)}promise(){return $p.create(this,this._def)}or(e){return Km.create([this,e],this._def)}and(e){return Hm.create(this,e,this._def)}transform(e){return new Za({...Ft(this._def),schema:this,typeName:st.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new qm({...Ft(this._def),innerType:this,defaultValue:r,typeName:st.ZodDefault})}brand(){return new dS({typeName:st.ZodBranded,type:this,...Ft(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Vm({...Ft(this._def),innerType:this,catchValue:r,typeName:st.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return fS.create(this,e)}readonly(){return zm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},iet=/^c[^\s-]{8,}$/i,oet=/^[0-9a-z]+$/,set=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aet=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Aet=/^[a-z0-9_-]{21}$/i,cet=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uet=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,get=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pet="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",det=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fet=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,met=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,het=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cet=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Iet=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ide="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Eet=new RegExp(`^${ide}$`);Um=class t extends Ht{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Le.string){let o=this._getOrReturnCtx(e);return Ne(o,{code:De.invalid_type,expected:Le.string,received:o.parsedType}),pt}let n=new ro,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?Ne(i,{code:De.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Ne(i,{code:De.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")get.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"email",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")cG||(cG=new RegExp(pet,"u")),cG.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"emoji",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")aet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"uuid",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Aet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"nanoid",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")iet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cuid",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")oet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cuid2",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")set.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"ulid",code:De.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ne(i,{validation:"url",code:De.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"regex",code:De.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?yet(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Eet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Bet(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?uet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"duration",code:De.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Qet(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"ip",code:De.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Det(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"jwt",code:De.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?wet(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cidr",code:De.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Cet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"base64",code:De.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Iet.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"base64url",code:De.invalid_string,message:o.message}),n.dirty()):ir.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:De.invalid_string,...je.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...je.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...je.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...je.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...je.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...je.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...je.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...je.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...je.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...je.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...je.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...je.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...je.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...je.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...je.errToObj(r)})}nonempty(e){return this.min(1,je.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Um.create=t=>new Um({checks:[],typeName:st.ZodString,coerce:t?.coerce??!1,...Ft(t)});iB=class t extends Ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Le.number){let o=this._getOrReturnCtx(e);return Ne(o,{code:De.invalid_type,expected:Le.number,received:o.parsedType}),pt}let n,i=new ro;for(let o of this._def.checks)o.kind==="int"?ir.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?bet(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.not_finite,message:o.message}),i.dirty()):ir.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,je.toString(r))}gt(e,r){return this.setLimit("min",e,!1,je.toString(r))}lte(e,r){return this.setLimit("max",e,!0,je.toString(r))}lt(e,r){return this.setLimit("max",e,!1,je.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:je.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:je.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:je.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:je.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ir.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};iB.create=t=>new iB({checks:[],typeName:st.ZodNumber,coerce:t?.coerce||!1,...Ft(t)});oB=class t extends Ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Le.bigint)return this._getInvalidInput(e);let n,i=new ro;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:De.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ir.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Ne(r,{code:De.invalid_type,expected:Le.bigint,received:r.parsedType}),pt}gte(e,r){return this.setLimit("min",e,!0,je.toString(r))}gt(e,r){return this.setLimit("min",e,!1,je.toString(r))}lte(e,r){return this.setLimit("max",e,!0,je.toString(r))}lt(e,r){return this.setLimit("max",e,!1,je.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:je.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:je.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:je.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};oB.create=t=>new oB({checks:[],typeName:st.ZodBigInt,coerce:t?.coerce??!1,...Ft(t)});sB=class extends Ht{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Le.boolean){let n=this._getOrReturnCtx(e);return Ne(n,{code:De.invalid_type,expected:Le.boolean,received:n.parsedType}),pt}return Io(e.data)}};sB.create=t=>new sB({typeName:st.ZodBoolean,coerce:t?.coerce||!1,...Ft(t)});aB=class t extends Ht{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Le.date){let o=this._getOrReturnCtx(e);return Ne(o,{code:De.invalid_type,expected:Le.date,received:o.parsedType}),pt}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Ne(o,{code:De.invalid_date}),pt}let n=new ro,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:De.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ir.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:je.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:je.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};aB.create=t=>new aB({checks:[],coerce:t?.coerce||!1,typeName:st.ZodDate,...Ft(t)});AB=class extends Ht{_parse(e){if(this._getType(e)!==Le.symbol){let n=this._getOrReturnCtx(e);return Ne(n,{code:De.invalid_type,expected:Le.symbol,received:n.parsedType}),pt}return Io(e.data)}};AB.create=t=>new AB({typeName:st.ZodSymbol,...Ft(t)});Om=class extends Ht{_parse(e){if(this._getType(e)!==Le.undefined){let n=this._getOrReturnCtx(e);return Ne(n,{code:De.invalid_type,expected:Le.undefined,received:n.parsedType}),pt}return Io(e.data)}};Om.create=t=>new Om({typeName:st.ZodUndefined,...Ft(t)});Gm=class extends Ht{_parse(e){if(this._getType(e)!==Le.null){let n=this._getOrReturnCtx(e);return Ne(n,{code:De.invalid_type,expected:Le.null,received:n.parsedType}),pt}return Io(e.data)}};Gm.create=t=>new Gm({typeName:st.ZodNull,...Ft(t)});cB=class extends Ht{constructor(){super(...arguments),this._any=!0}_parse(e){return Io(e.data)}};cB.create=t=>new cB({typeName:st.ZodAny,...Ft(t)});Ol=class extends Ht{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Io(e.data)}};Ol.create=t=>new Ol({typeName:st.ZodUnknown,...Ft(t)});rc=class extends Ht{_parse(e){let r=this._getOrReturnCtx(e);return Ne(r,{code:De.invalid_type,expected:Le.never,received:r.parsedType}),pt}};rc.create=t=>new rc({typeName:st.ZodNever,...Ft(t)});uB=class extends Ht{_parse(e){if(this._getType(e)!==Le.undefined){let n=this._getOrReturnCtx(e);return Ne(n,{code:De.invalid_type,expected:Le.void,received:n.parsedType}),pt}return Io(e.data)}};uB.create=t=>new uB({typeName:st.ZodVoid,...Ft(t)});Gl=class t extends Ht{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Le.array)return Ne(r,{code:De.invalid_type,expected:Le.array,received:r.parsedType}),pt;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Ne(r,{code:s?De.too_big:De.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Ne(r,{code:De.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Ne(r,{code:De.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Zs(r,s,r.path,a)))).then(s=>ro.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Zs(r,s,r.path,a)));return ro.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:je.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:je.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:je.toString(r)}})}nonempty(e){return this.min(1,e)}};Gl.create=(t,e)=>new Gl({type:t,minLength:null,maxLength:null,exactLength:null,typeName:st.ZodArray,...Ft(e)});Bs=class t extends Ht{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ir.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Le.object){let c=this._getOrReturnCtx(e);return Ne(c,{code:De.invalid_type,expected:Le.object,received:c.parsedType}),pt}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof rc&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let A=[];for(let c of s){let u=o[c],l=i.data[c];A.push({key:{status:"valid",value:c},value:u._parse(new Zs(i,l,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof rc){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)A.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(Ne(i,{code:De.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let l=i.data[u];A.push({key:{status:"valid",value:u},value:c._parse(new Zs(i,l,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of A){let l=await u.key,d=await u.value;c.push({key:l,value:d,alwaysSet:u.alwaysSet})}return c}).then(c=>ro.mergeObjectSync(n,c)):ro.mergeObjectSync(n,A)}get shape(){return this._def.shape()}strict(e){return je.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:je.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:st.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ir.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ir.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Lm(this)}partial(e){let r={};for(let n of ir.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ir.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wa;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return sde(ir.objectKeys(this.shape))}};Bs.create=(t,e)=>new Bs({shape:()=>t,unknownKeys:"strip",catchall:rc.create(),typeName:st.ZodObject,...Ft(e)});Bs.strictCreate=(t,e)=>new Bs({shape:()=>t,unknownKeys:"strict",catchall:rc.create(),typeName:st.ZodObject,...Ft(e)});Bs.lazycreate=(t,e)=>new Bs({shape:t,unknownKeys:"strip",catchall:rc.create(),typeName:st.ZodObject,...Ft(e)});Km=class extends Ht{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Es(a.ctx.common.issues));return Ne(r,{code:De.invalid_union,unionErrors:s}),pt}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let A of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=A._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(A=>new Es(A));return Ne(r,{code:De.invalid_union,unionErrors:a}),pt}}get options(){return this._def.options}};Km.create=(t,e)=>new Km({options:t,typeName:st.ZodUnion,...Ft(e)});Au=t=>t instanceof $m?Au(t.schema):t instanceof Za?Au(t.innerType()):t instanceof Jm?[t.value]:t instanceof jm?t.options:t instanceof Ym?ir.objectValues(t.enum):t instanceof qm?Au(t._def.innerType):t instanceof Om?[void 0]:t instanceof Gm?[null]:t instanceof Wa?[void 0,...Au(t.unwrap())]:t instanceof uu?[null,...Au(t.unwrap())]:t instanceof dS||t instanceof zm?Au(t.unwrap()):t instanceof Vm?Au(t._def.innerType):[],uG=class t extends Ht{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Le.object)return Ne(r,{code:De.invalid_type,expected:Le.object,received:r.parsedType}),pt;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Ne(r,{code:De.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=Au(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:st.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Ft(n)})}};Hm=class extends Ht{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(sG(o)||sG(s))return pt;let a=lG(o.value,s.value);return a.valid?((aG(o)||aG(s))&&r.dirty(),{status:r.value,value:a.data}):(Ne(n,{code:De.invalid_intersection_types}),pt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Hm.create=(t,e,r)=>new Hm({left:t,right:e,typeName:st.ZodIntersection,...Ft(r)});cu=class t extends Ht{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Le.array)return Ne(n,{code:De.invalid_type,expected:Le.array,received:n.parsedType}),pt;if(n.data.length<this._def.items.length)return Ne(n,{code:De.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pt;!this._def.rest&&n.data.length>this._def.items.length&&(Ne(n,{code:De.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let A=this._def.items[a]||this._def.rest;return A?A._parse(new Zs(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>ro.mergeArray(r,s)):ro.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};cu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cu({items:t,typeName:st.ZodTuple,rest:null,...Ft(e)})};gG=class t extends Ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Le.object)return Ne(n,{code:De.invalid_type,expected:Le.object,received:n.parsedType}),pt;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Zs(n,a,n.path,a)),value:s._parse(new Zs(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ro.mergeObjectAsync(r,i):ro.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ht?new t({keyType:e,valueType:r,typeName:st.ZodRecord,...Ft(n)}):new t({keyType:Um.create(),valueType:e,typeName:st.ZodRecord,...Ft(r)})}},lB=class extends Ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Le.map)return Ne(n,{code:De.invalid_type,expected:Le.map,received:n.parsedType}),pt;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,A],c)=>({key:i._parse(new Zs(n,a,n.path,[c,"key"])),value:o._parse(new Zs(n,A,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let A of s){let c=await A.key,u=await A.value;if(c.status==="aborted"||u.status==="aborted")return pt;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let A of s){let c=A.key,u=A.value;if(c.status==="aborted"||u.status==="aborted")return pt;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};lB.create=(t,e,r)=>new lB({valueType:e,keyType:t,typeName:st.ZodMap,...Ft(r)});gB=class t extends Ht{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Le.set)return Ne(n,{code:De.invalid_type,expected:Le.set,received:n.parsedType}),pt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Ne(n,{code:De.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Ne(n,{code:De.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(A){let c=new Set;for(let u of A){if(u.status==="aborted")return pt;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((A,c)=>o._parse(new Zs(n,A,n.path,c)));return n.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:je.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:je.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};gB.create=(t,e)=>new gB({valueType:t,minSize:null,maxSize:null,typeName:st.ZodSet,...Ft(e)});pG=class t extends Ht{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Le.function)return Ne(r,{code:De.invalid_type,expected:Le.function,received:r.parsedType}),pt;function n(a,A){return pS({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,rB(),Ul].filter(c=>!!c),issueData:{code:De.invalid_arguments,argumentsError:A}})}function i(a,A){return pS({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,rB(),Ul].filter(c=>!!c),issueData:{code:De.invalid_return_type,returnTypeError:A}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof $p){let a=this;return Io(async function(...A){let c=new Es([]),u=await a._def.args.parseAsync(A,o).catch(g=>{throw c.addIssue(n(A,g)),c}),l=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(l,o).catch(g=>{throw c.addIssue(i(l,g)),c})})}else{let a=this;return Io(function(...A){let c=a._def.args.safeParse(A,o);if(!c.success)throw new Es([n(A,c.error)]);let u=Reflect.apply(s,this,c.data),l=a._def.returns.safeParse(u,o);if(!l.success)throw new Es([i(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:cu.create(e).rest(Ol.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||cu.create([]).rest(Ol.create()),returns:r||Ol.create(),typeName:st.ZodFunction,...Ft(n)})}},$m=class extends Ht{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};$m.create=(t,e)=>new $m({getter:t,typeName:st.ZodLazy,...Ft(e)});Jm=class extends Ht{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Ne(r,{received:r.data,code:De.invalid_literal,expected:this._def.value}),pt}return{status:"valid",value:e.data}}get value(){return this._def.value}};Jm.create=(t,e)=>new Jm({value:t,typeName:st.ZodLiteral,...Ft(e)});jm=class t extends Ht{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Ne(r,{expected:ir.joinValues(n),received:r.parsedType,code:De.invalid_type}),pt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Ne(r,{received:r.data,code:De.invalid_enum_value,options:n}),pt}return Io(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};jm.create=sde;Ym=class extends Ht{_parse(e){let r=ir.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Le.string&&n.parsedType!==Le.number){let i=ir.objectValues(r);return Ne(n,{expected:ir.joinValues(i),received:n.parsedType,code:De.invalid_type}),pt}if(this._cache||(this._cache=new Set(ir.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ir.objectValues(r);return Ne(n,{received:n.data,code:De.invalid_enum_value,options:i}),pt}return Io(e.data)}get enum(){return this._def.values}};Ym.create=(t,e)=>new Ym({values:t,typeName:st.ZodNativeEnum,...Ft(e)});$p=class extends Ht{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Le.promise&&r.common.async===!1)return Ne(r,{code:De.invalid_type,expected:Le.promise,received:r.parsedType}),pt;let n=r.parsedType===Le.promise?r.data:Promise.resolve(r.data);return Io(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$p.create=(t,e)=>new $p({type:t,typeName:st.ZodPromise,...Ft(e)});Za=class extends Ht{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===st.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Ne(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return pt;let A=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return A.status==="aborted"?pt:A.status==="dirty"?_m(A.value):r.value==="dirty"?_m(A.value):A});{if(r.value==="aborted")return pt;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?pt:a.status==="dirty"?_m(a.value):r.value==="dirty"?_m(a.value):a}}if(i.type==="refinement"){let s=a=>{let A=i.refinement(a,o);if(n.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pt:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?pt:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Hp(s))return pt;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Hp(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):pt);ir.assertNever(i)}};Za.create=(t,e,r)=>new Za({schema:t,typeName:st.ZodEffects,effect:e,...Ft(r)});Za.createWithPreprocess=(t,e,r)=>new Za({schema:e,effect:{type:"preprocess",transform:t},typeName:st.ZodEffects,...Ft(r)});Wa=class extends Ht{_parse(e){return this._getType(e)===Le.undefined?Io(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Wa.create=(t,e)=>new Wa({innerType:t,typeName:st.ZodOptional,...Ft(e)});uu=class extends Ht{_parse(e){return this._getType(e)===Le.null?Io(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};uu.create=(t,e)=>new uu({innerType:t,typeName:st.ZodNullable,...Ft(e)});qm=class extends Ht{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Le.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};qm.create=(t,e)=>new qm({innerType:t,typeName:st.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ft(e)});Vm=class extends Ht{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return nB(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Es(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Es(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Vm.create=(t,e)=>new Vm({innerType:t,typeName:st.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ft(e)});pB=class extends Ht{_parse(e){if(this._getType(e)!==Le.nan){let n=this._getOrReturnCtx(e);return Ne(n,{code:De.invalid_type,expected:Le.nan,received:n.parsedType}),pt}return{status:"valid",value:e.data}}};pB.create=t=>new pB({typeName:st.ZodNaN,...Ft(t)});dS=class extends Ht{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},fS=class t extends Ht{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pt:o.status==="dirty"?(r.dirty(),_m(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pt:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:st.ZodPipeline})}},zm=class extends Ht{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Hp(i)&&(i.value=Object.freeze(i.value)),i);return nB(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};zm.create=(t,e)=>new zm({innerType:t,typeName:st.ZodReadonly,...Ft(e)});I7t={object:Bs.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(st||(st={}));E7t=Um.create,B7t=iB.create,y7t=pB.create,Q7t=oB.create,D7t=sB.create,w7t=aB.create,b7t=AB.create,v7t=Om.create,S7t=Gm.create,x7t=cB.create,F7t=Ol.create,k7t=rc.create,R7t=uB.create,N7t=Gl.create,vet=Bs.create,T7t=Bs.strictCreate,M7t=Km.create,P7t=uG.create,_7t=Hm.create,L7t=cu.create,U7t=gG.create,O7t=lB.create,G7t=gB.create,K7t=pG.create,H7t=$m.create,$7t=Jm.create,J7t=jm.create,j7t=Ym.create,Y7t=$p.create,q7t=Za.create,V7t=Wa.create,z7t=uu.create,W7t=Za.createWithPreprocess,Z7t=fS.create});var dG=N(()=>{m();gS();AG();tde();tB();ade();lS()});var dB=N(()=>{m();dG();dG()});function te(t,e,r){function n(a,A){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:A,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,A);let c=s.prototype,u=Object.keys(c);for(let l=0;l<u.length;l++){let d=u[l];d in a||(a[d]=c[d].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var A;let c=r?.Parent?new o:this;n(c,a),(A=c._zod).deferred??(A.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function ei(t){return t&&Object.assign(mS,t),mS}var hS,nc,Jp,mS,Wm=N(()=>{m();hS=Object.freeze({status:"aborted"});nc=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Jp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},mS={}});var we={};CA(we,{BIGINT_FORMAT_RANGES:()=>DG,Class:()=>mG,NUMBER_FORMAT_RANGES:()=>QG,aborted:()=>Jl,allowsEval:()=>IG,assert:()=>Met,assertEqual:()=>ket,assertIs:()=>Net,assertNever:()=>Tet,assertNotEqual:()=>Ret,assignProp:()=>Hl,base64ToUint8Array:()=>fde,base64urlToUint8Array:()=>jet,cached:()=>Xm,captureStackTrace:()=>IS,cleanEnum:()=>Jet,cleanRegex:()=>hB,clone:()=>Eo,cloneDef:()=>_et,createTransparentProxy:()=>Het,defineLazy:()=>Rt,esc:()=>CS,escapeRegex:()=>Xs,extend:()=>lde,finalizeIssue:()=>qo,floatSafeRemainder:()=>hG,getElementAtPath:()=>Let,getEnumValues:()=>mB,getLengthableOrigin:()=>EB,getParsedType:()=>Ket,getSizableOrigin:()=>IB,hexToUint8Array:()=>qet,isObject:()=>jp,isPlainObject:()=>$l,issue:()=>eh,joinValues:()=>ct,jsonStringifyReplacer:()=>Zm,merge:()=>$et,mergeDefs:()=>lu,normalizeParams:()=>Fe,nullish:()=>Kl,numKeys:()=>Get,objectClone:()=>Pet,omit:()=>ude,optionalKeys:()=>yG,parsedType:()=>dt,partial:()=>pde,pick:()=>cde,prefixIssues:()=>ys,primitiveTypes:()=>BG,promiseAllObject:()=>Uet,propertyKeyTypes:()=>CB,randomString:()=>Oet,required:()=>dde,safeExtend:()=>gde,shallowClone:()=>EG,slugify:()=>CG,stringifyPrimitive:()=>ut,uint8ArrayToBase64:()=>mde,uint8ArrayToBase64url:()=>Yet,uint8ArrayToHex:()=>Vet,unwrapMessage:()=>fB});function ket(t){return t}function Ret(t){return t}function Net(t){}function Tet(t){throw new Error("Unexpected value in exhaustive check")}function Met(t){}function mB(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function ct(t,e="|"){return t.map(r=>ut(r)).join(e)}function Zm(t,e){return typeof e=="bigint"?e.toString():e}function Xm(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Kl(t){return t==null}function hB(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function hG(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let A=n.match(/\d?e-(\d?)/);A?.[1]&&(i=Number.parseInt(A[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function Rt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Ade)return n===void 0&&(n=Ade,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Pet(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Hl(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function lu(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function _et(t){return lu(t._zod.def)}function Let(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Uet(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function Oet(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function CS(t){return JSON.stringify(t)}function CG(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function jp(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function $l(t){if(jp(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(jp(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function EG(t){return $l(t)?{...t}:Array.isArray(t)?[...t]:t}function Get(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function Xs(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Eo(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Fe(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Het(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function ut(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function yG(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function cde(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=lu(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return Hl(this,"shape",s),s},checks:[]});return Eo(t,o)}function ude(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=lu(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return Hl(this,"shape",s),s},checks:[]});return Eo(t,o)}function lde(t,e){if(!$l(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=lu(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Hl(this,"shape",o),o}});return Eo(t,i)}function gde(t,e){if(!$l(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=lu(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return Hl(this,"shape",n),n}});return Eo(t,r)}function $et(t,e){let r=lu(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hl(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Eo(t,r)}function pde(t,e,r){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=lu(e._zod.def,{get shape(){let a=e._zod.def.shape,A={...a};if(r)for(let c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(A[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(let c in a)A[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return Hl(this,"shape",A),A},checks:[]});return Eo(e,s)}function dde(t,e,r){let n=lu(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return Hl(this,"shape",o),o}});return Eo(e,n)}function Jl(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function ys(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function fB(t){return typeof t=="string"?t:t?.message}function qo(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=fB(t.inst?._zod.def?.error?.(t))??fB(e?.error?.(t))??fB(r.customError?.(t))??fB(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function IB(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function EB(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function dt(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function eh(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Jet(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function fde(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function mde(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function jet(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return fde(e+r)}function Yet(t){return mde(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function qet(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Vet(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Ade,IS,IG,Ket,CB,BG,QG,DG,mG,ze=N(()=>{m();Ade=Symbol("evaluating");IS="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};IG=Xm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});Ket=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},CB=new Set(["string","number","symbol"]),BG=new Set(["string","number","bigint","boolean","symbol","undefined"]);QG={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},DG={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};mG=class{constructor(...e){}}});function BS(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function yS(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let A=o.path[a];a===o.path.length-1?(s[A]=s[A]||{_errors:[]},s[A]._errors.push(e(o))):s[A]=s[A]||{_errors:[]},s=s[A],a++}}};return n(t),r}var hde,ES,BB,wG=N(()=>{m();Wm();ze();hde=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Zm,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ES=te("$ZodError",hde),BB=te("$ZodError",hde,{Parent:Error})});var yB,QB,DB,wB,bB,th,vB,SB,Cde,Ide,Ede,Bde,yde,Qde,Dde,wde,bG=N(()=>{m();Wm();wG();ze();yB=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new nc;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(A=>qo(A,o,ei())));throw IS(a,i?.callee),a}return s.value},QB=yB(BB),DB=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(A=>qo(A,o,ei())));throw IS(a,i?.callee),a}return s.value},wB=DB(BB),bB=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new nc;return o.issues.length?{success:!1,error:new(t??ES)(o.issues.map(s=>qo(s,i,ei())))}:{success:!0,data:o.value}},th=bB(BB),vB=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>qo(s,i,ei())))}:{success:!0,data:o.value}},SB=vB(BB),Cde=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return yB(t)(e,r,i)},Ide=t=>(e,r,n)=>yB(t)(e,r,n),Ede=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return DB(t)(e,r,i)},Bde=t=>async(e,r,n)=>DB(t)(e,r,n),yde=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bB(t)(e,r,i)},Qde=t=>(e,r,n)=>bB(t)(e,r,n),Dde=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return vB(t)(e,r,i)},wde=t=>async(e,r,n)=>vB(t)(e,r,n)});var ea={};CA(ea,{base64:()=>KG,base64url:()=>QS,bigint:()=>qG,boolean:()=>zG,browserEmail:()=>itt,cidrv4:()=>OG,cidrv6:()=>GG,cuid:()=>vG,cuid2:()=>SG,date:()=>$G,datetime:()=>jG,domain:()=>att,duration:()=>NG,e164:()=>HG,email:()=>MG,emoji:()=>PG,extendedDuration:()=>Wet,guid:()=>TG,hex:()=>Att,hostname:()=>stt,html5Email:()=>ttt,idnEmail:()=>ntt,integer:()=>VG,ipv4:()=>_G,ipv6:()=>LG,ksuid:()=>kG,lowercase:()=>XG,mac:()=>UG,md5_base64:()=>utt,md5_base64url:()=>ltt,md5_hex:()=>ctt,nanoid:()=>RG,null:()=>WG,number:()=>DS,rfc5322Email:()=>rtt,sha1_base64:()=>ptt,sha1_base64url:()=>dtt,sha1_hex:()=>gtt,sha256_base64:()=>mtt,sha256_base64url:()=>htt,sha256_hex:()=>ftt,sha384_base64:()=>Itt,sha384_base64url:()=>Ett,sha384_hex:()=>Ctt,sha512_base64:()=>ytt,sha512_base64url:()=>Qtt,sha512_hex:()=>Btt,string:()=>YG,time:()=>JG,ulid:()=>xG,undefined:()=>ZG,unicodeEmail:()=>bde,uppercase:()=>e8,uuid:()=>Yp,uuid4:()=>Zet,uuid6:()=>Xet,uuid7:()=>ett,xid:()=>FG});function PG(){return new RegExp(ott,"u")}function Sde(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function JG(t){return new RegExp(`^${Sde(t)}$`)}function jG(t){let e=Sde({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${vde}T(?:${n})$`)}function xB(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function FB(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var vG,SG,xG,FG,kG,RG,NG,Wet,TG,Yp,Zet,Xet,ett,MG,ttt,rtt,bde,ntt,itt,ott,_G,LG,UG,OG,GG,KG,QS,stt,att,HG,vde,$G,YG,qG,VG,DS,zG,WG,ZG,XG,e8,Att,ctt,utt,ltt,gtt,ptt,dtt,ftt,mtt,htt,Ctt,Itt,Ett,Btt,ytt,Qtt,wS=N(()=>{m();ze();vG=/^[cC][^\s-]{8,}$/,SG=/^[0-9a-z]+$/,xG=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,FG=/^[0-9a-vA-V]{20}$/,kG=/^[A-Za-z0-9]{27}$/,RG=/^[a-zA-Z0-9_-]{21}$/,NG=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wet=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TG=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Yp=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zet=Yp(4),Xet=Yp(6),ett=Yp(7),MG=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ttt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rtt=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,bde=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ntt=bde,itt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ott="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";_G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,LG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,UG=t=>{let e=Xs(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},OG=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,GG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,KG=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,QS=/^[A-Za-z0-9_-]*$/,stt=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,att=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,HG=/^\+[1-9]\d{6,14}$/,vde="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",$G=new RegExp(`^${vde}$`);YG=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},qG=/^-?\d+n?$/,VG=/^-?\d+$/,DS=/^-?\d+(?:\.\d+)?$/,zG=/^(?:true|false)$/i,WG=/^null$/i,ZG=/^undefined$/i,XG=/^[^A-Z]*$/,e8=/^[^a-z]*$/,Att=/^[0-9a-fA-F]*$/;ctt=/^[0-9a-fA-F]{32}$/,utt=xB(22,"=="),ltt=FB(22),gtt=/^[0-9a-fA-F]{40}$/,ptt=xB(27,"="),dtt=FB(27),ftt=/^[0-9a-fA-F]{64}$/,mtt=xB(43,"="),htt=FB(43),Ctt=/^[0-9a-fA-F]{96}$/,Itt=xB(64,""),Ett=FB(64),Btt=/^[0-9a-fA-F]{128}$/,ytt=xB(86,"=="),Qtt=FB(86)});function xde(t,e,r){t.issues.length&&e.issues.push(...ys(r,t.issues))}var Pr,Fde,t8,r8,kde,Rde,Nde,Tde,Mde,Pde,_de,Lde,Ude,kB,Ode,Gde,Kde,Hde,$de,Jde,jde,Yde,qde,bS=N(()=>{m();Wm();wS();ze();Pr=te("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Fde={number:"number",bigint:"bigint",object:"date"},t8=te("$ZodCheckLessThan",(t,e)=>{Pr.init(t,e);let r=Fde[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),r8=te("$ZodCheckGreaterThan",(t,e)=>{Pr.init(t,e);let r=Fde[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),kde=te("$ZodCheckMultipleOf",(t,e)=>{Pr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):hG(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Rde=te("$ZodCheckNumberFormat",(t,e)=>{Pr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=QG[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=VG)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),Nde=te("$ZodCheckBigIntFormat",(t,e)=>{Pr.init(t,e);let[r,n]=DG[e.format];t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,o.minimum=r,o.maximum=n}),t._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),Tde=te("$ZodCheckMaxSize",(t,e)=>{var r;Pr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Kl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;i.size<=e.maximum||n.issues.push({origin:IB(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Mde=te("$ZodCheckMinSize",(t,e)=>{var r;Pr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Kl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:IB(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Pde=te("$ZodCheckSizeEquals",(t,e)=>{var r;Pr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Kl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=n=>{let i=n.value,o=i.size;if(o===e.size)return;let s=o>e.size;n.issues.push({origin:IB(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),_de=te("$ZodCheckMaxLength",(t,e)=>{var r;Pr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Kl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=EB(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Lde=te("$ZodCheckMinLength",(t,e)=>{var r;Pr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Kl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=EB(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Ude=te("$ZodCheckLengthEquals",(t,e)=>{var r;Pr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Kl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=EB(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),kB=te("$ZodCheckStringFormat",(t,e)=>{var r,n;Pr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Ode=te("$ZodCheckRegex",(t,e)=>{kB.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Gde=te("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=XG),kB.init(t,e)}),Kde=te("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=e8),kB.init(t,e)}),Hde=te("$ZodCheckIncludes",(t,e)=>{Pr.init(t,e);let r=Xs(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),$de=te("$ZodCheckStartsWith",(t,e)=>{Pr.init(t,e);let r=new RegExp(`^${Xs(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Jde=te("$ZodCheckEndsWith",(t,e)=>{Pr.init(t,e);let r=new RegExp(`.*${Xs(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});jde=te("$ZodCheckProperty",(t,e)=>{Pr.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>xde(i,r,e.property));xde(n,r,e.property)}}),Yde=te("$ZodCheckMimeType",(t,e)=>{Pr.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),qde=te("$ZodCheckOverwrite",(t,e)=>{Pr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var vS,n8=N(()=>{m();vS=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
@@ -1871,7 +1871,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1871
1871
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1872
1872
|
`):void 0})}let f=p.substring(4).split(" ")[0],h=Zlt(f);p.startsWith("--- ")?(o=h,i=h,a=0,A=0,c=[],u=[],s=null,l=f==="/dev/null",d=!1):p.startsWith("+++ ")&&(d=f==="/dev/null",f==="/dev/null"?i=o:i=h);continue}else{if(p.startsWith("@@"))continue;p.startsWith("+")?(a++,c.push(p.substring(1)),s===null&&(s="update")):p.startsWith("-")?(A++,u.push(p.substring(1)),s===null&&(s="update")):(p.startsWith(" ")||p==="")&&(c.push(p.substring(1)),u.push(p.substring(1)))}}if(i&&s){let g;l?g="create":d?g="delete":g="update";let p=g==="delete"&&o?o:i;r.push({filePath:p,addedLines:a,removedLines:A,action:g,content:c.length>0?c.join(`
|
|
1873
1873
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1874
|
-
`):void 0})}return r}var $ye=N(()=>{"use strict";m()});var lg,Jye=N(()=>{"use strict";m();lg=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var egt,Gh,jye,tgt,rgt,ngt,HF,$J=N(()=>{"use strict";m();Jye();egt=()=>{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.")},Gh=egt(),jye=async()=>{let t=await Gh.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await Gh.subtle.exportKey("jwk",t);return JSON.stringify(e)},tgt=async()=>Gh.getRandomValues(new Uint8Array(16)),rgt=async(t,e,r)=>{let n=await Gh.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},ngt=async(t,e,r)=>{let n=await Gh.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},HF=async t=>{try{lg("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);lg("validateEncryptionKey: Parsed JWK");let r=await Gh.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);lg("validateEncryptionKey: Imported crypto key");let n="test",i=await tgt();lg("validateEncryptionKey: Generated test IV",i);let o=await rgt(r,i,n);lg("validateEncryptionKey: Encrypted test data",o);let s=new Uint8Array(o);lg("validateEncryptionKey: Encrypted test data array",s);let a=await ngt(r,i,s);return lg("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});function Yye(t){return t.length<=JJ?t:t.slice(0,JJ)+`... [+${t.length-JJ} chars]`}var igt,JJ,$F,qye=N(()=>{"use strict";m();un();Zr();Jr();igt=5e3,JJ=8e3,$F=class{#n;#c;#o;#t=[];#A;#i=!1;#e=Promise.resolve();constructor(e){this.#n=e.credentials,this.#c=e.replayId,this.#o=e.debug??!1;let r=setInterval(()=>{this.#E()},igt);r.unref?.(),this.#A=r}recordText(e,r=Date.now()){this.#i||this.#s({ts:r,type:"text",content:Yye(e)})}recordReasoning(e,r=Date.now()){this.#i||this.#s({ts:r,type:"thinking",content:Yye(e)})}recordCheckpoint(e=Date.now(),r="",n){this.#i||this.#s({ts:e,type:"checkpoint",label:r,imageUrl:n})}#s(e){e.type!=="checkpoint"&&!e.content||this.#t.push(e)}async#E(){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(`${Me}/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 Pe(r,{method:"POST",body:JSON.stringify({actions:e}),headers:n,keepalive:!0},this.#o)}catch{}}async flush(){await this.#E(),await this.#e.catch(()=>{})}async close(){this.#i||(this.#i=!0,this.#A&&clearInterval(this.#A),await this.flush())}}});var jJ,Vye,ogt,zye=N(()=>{m();jJ=(t,e,r)=>{let n=t instanceof RegExp?Vye(t,r):t,i=e instanceof RegExp?Vye(e,r):e,o=n!==null&&i!=null&&ogt(n,i,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+i.length)}},Vye=(t,e)=>{let r=e.match(t);return r?r[0]:null},ogt=(t,e,r)=>{let n,i,o,s,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=[],o=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<o&&(o=i,s=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&s!==void 0&&(a=[o,s])}return a}});function YJ(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function hgt(t){return t.replace(lgt,Wye).replace(ggt,Zye).replace(pgt,qJ).replace(dgt,Xye).replace(fgt,eQe)}function Cgt(t){return t.replace(sgt,"\\").replace(agt,"{").replace(Agt,"}").replace(cgt,",").replace(ugt,".")}function tQe(t){if(!t)return[""];let e=[],r=jJ("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:o}=r,s=n.split(",");s[s.length-1]+="{"+i+"}";let a=tQe(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function rQe(t,e={}){if(!t)return[];let{max:r=mgt}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),mQ(hgt(t),r,!0).map(Cgt)}function Igt(t){return"{"+t+"}"}function Egt(t){return/^-?0\d/.test(t)}function Bgt(t,e){return t<=e}function ygt(t,e){return t>=e}function mQ(t,e,r){let n=[],i=jJ("{","}",t);if(!i)return[t];let o=i.pre,s=i.post.length?mQ(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<s.length&&a<e;a++){let A=o+"{"+i.body+"}"+s[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+qJ+i.post,mQ(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=tQe(i.body),l.length===1&&l[0]!==void 0&&(l=mQ(l[0],e,!1).map(Igt),l.length===1))return s.map(g=>i.pre+l[0]+g);let d;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=YJ(l[0]),p=YJ(l[1]),f=Math.max(l[0].length,l[1].length),h=l.length===3&&l[2]!==void 0?Math.abs(YJ(l[2])):1,C=Bgt;p<g&&(h*=-1,C=ygt);let B=l.some(Egt);d=[];for(let E=g;C(E,p);E+=h){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 w=new Array(Q+1).join("0");E<0?y="-"+w+y.slice(1):y=w+y}}d.push(y)}}else{d=[];for(let g=0;g<l.length;g++)d.push.apply(d,mQ(l[g],e,!1))}for(let g=0;g<d.length;g++)for(let p=0;p<s.length&&n.length<e;p++){let f=o+d[g]+s[p];(!r||c||f)&&n.push(f)}}return n}var Wye,Zye,qJ,Xye,eQe,sgt,agt,Agt,cgt,ugt,lgt,ggt,pgt,dgt,fgt,mgt,nQe=N(()=>{m();zye();Wye="\0SLASH"+Math.random()+"\0",Zye="\0OPEN"+Math.random()+"\0",qJ="\0CLOSE"+Math.random()+"\0",Xye="\0COMMA"+Math.random()+"\0",eQe="\0PERIOD"+Math.random()+"\0",sgt=new RegExp(Wye,"g"),agt=new RegExp(Zye,"g"),Agt=new RegExp(qJ,"g"),cgt=new RegExp(Xye,"g"),ugt=new RegExp(eQe,"g"),lgt=/\\\\/g,ggt=/\\{/g,pgt=/\\}/g,dgt=/\\,/g,fgt=/\\\./g,mgt=1e5});var hQ,iQe=N(()=>{m();hQ=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var Qgt,CQ,Dgt,oQe,sQe,aQe=N(()=>{m();Qgt={"[: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]},CQ=t=>t.replace(/[[\]\\-]/g,"\\$&"),Dgt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),oQe=t=>t.join(""),sQe=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],o=r+1,s=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;o<t.length;){let f=t.charAt(o);if((f==="!"||f==="^")&&o===r+1){c=!0,o++;continue}if(f==="]"&&s&&!A){u=o+1;break}if(s=!0,f==="\\"&&!A){A=!0,o++;continue}if(f==="["&&!A){for(let[h,[C,I,B]]of Object.entries(Qgt))if(t.startsWith(h,o)){if(l)return["$.",!1,t.length-r,!0];o+=h.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(CQ(l)+"-"+CQ(f)):f===l&&n.push(CQ(f)),l="",o++;continue}if(t.startsWith("-]",o+1)){n.push(CQ(f+"-")),o+=2;continue}if(t.startsWith("-",o+1)){l=f,o+=2;continue}n.push(CQ(f)),o++}if(u<o)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[Dgt(f),!1,u-r,!1]}let d="["+(c?"^":"")+oQe(n)+"]",g="["+(c?"":"^")+oQe(i)+"]";return[n.length&&i.length?"("+d+"|"+g+")":n.length?d:g,a,u-r,!0]}});var gg,JF=N(()=>{m();gg=(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 es,wgt,VJ,AQe,bgt,vgt,Sgt,cQe,xgt,jF,Fgt,kgt,Rgt,Ngt,zJ,uQe,lQe,Tgt,md,WJ=N(()=>{m();aQe();JF();wgt=new Set(["!","?","+","*","@"]),VJ=t=>wgt.has(t),AQe=t=>VJ(t.type),bgt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),vgt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Sgt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),cQe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),xgt="(?!(?:^|/)\\.\\.?(?:$|/))",jF="(?!\\.)",Fgt=new Set(["[","."]),kgt=new Set(["..","."]),Rgt=new Set("().*{}+?[]^$\\!"),Ngt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),zJ="[^/]",uQe=zJ+"*?",lQe=zJ+"+?",Tgt=0,md=class{type;#n;#c;#o=!1;#t=[];#A;#i;#e;#s=!1;#E;#m;#M=!1;id=++Tgt;get depth(){return(this.#A?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#A?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#c=!0),this.#A=r,this.#n=this.#A?this.#A.#n:this,this.#E=this.#n===this?n:this.#n.#E,this.#e=this.#n===this?[]:this.#n.#e,e==="!"&&!this.#n.#s&&this.#e.push(this),this.#i=this.#A?this.#A.#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("")}#k(){if(this!==this.#n)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#e.pop();){if(e.type!=="!")continue;let r=e,n=r.#A;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#t.length;i++)for(let o of e.#t){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#t[i])}r=n,n=r.#A}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof es&&r.#A===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.#s&&this.#A?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#A?.isStart())return!1;if(this.#i===0)return!0;let e=this.#A;for(let r=0;r<this.#i;r++){let n=e.#t[r];if(!(n instanceof es&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#A?.type==="!")return!0;if(!this.#A?.isEnd())return!1;if(!this.type)return this.#A?.isEnd();let e=this.#A?this.#A.#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 es(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#v(e,r,n,i,o){let s=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,h="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,h+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),h+=C;continue}else if(C==="["){A=!0,c=f,u=!1,h+=C;continue}if(!i.noext&&VJ(C)&&e.charAt(f)==="("&&o<=s){r.push(h),h="";let B=new es(C,r);f=es.#v(e,B,f,i,o+1),r.push(B);continue}h+=C}return r.push(h),f}let l=n+1,d=new es(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&&VJ(f)&&e.charAt(l)==="("&&(o<=s||r&&r.#p(f))){let C=r&&r.#p(f)?0:1;d.push(p),p="";let I=new es(f,d);d.push(I),l=es.#v(e,I,l,i,o+C);continue}if(f==="|"){d.push(p),p="",g.push(d),d=new es(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,vgt)}#a(e,r=bgt){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=Sgt){return!!r.get(this.type)?.includes(e)}#r(e,r){let n=e.#t[0],i=new es(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.#A=this);this.#m=void 0}#H(e){return!!cQe.get(this.type)?.has(e)}#V(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)}#w(e){let r=cQe.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let o of this.#t)typeof o=="object"&&(o.#A=this);this.type=i,this.#m=void 0,this.#M=!1}static fromGlob(e,r={}){let n=new es(null,void 0,r);return es.#v(e,n,0,r,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[r,n,i,o]=this.toRegExpSource();if(!(i||this.#c||this.#E.nocase&&!this.#E.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#E.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#E}toRegExpSource(e){let r=e??!!this.#E.dot;if(this.#n===this&&(this.#$(),this.#k()),!AQe(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[p,f,h,C]=typeof g=="string"?es.#P(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||h,this.#o=this.#o||C,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&kgt.has(this.#t[0]))){let p=Fgt,f=r&&p.has(c.charAt(0))||c.startsWith("\\.")&&p.has(c.charAt(2))||c.startsWith("\\.\\.")&&p.has(c.charAt(4)),h=!r&&!e&&p.has(c.charAt(0));u=f?xgt:h?jF:""}let l="";return this.isEnd()&&this.#n.#s&&this.#A?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,gg(c),this.#c=!!this.#c,this.#o]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#R(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,gg(this.toString()),!1,!1]}let s=!n||e||r||!jF?"":this.#R(!0);s===o&&(s=""),s&&(o=`(?:${o})(?:${s})*?`);let a="";if(this.type==="!"&&this.#M)a=(this.isStart()&&!r?jF:"")+lQe;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?jF:"")+uQe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=i+o+A}return[a,gg(o),this.#c=!!this.#c,this.#o]}#$(){if(AQe(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.#$(),this.#a(i)?(r=!1,this.#g(i,n)):this.#S(i)?(r=!1,this.#r(i,n)):this.#V(i)&&(r=!1,this.#w(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#$();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,o,s]=r.toRegExpSource(e);return this.#o=this.#o||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#P(e,r,n=!1){let i=!1,o="",s=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,o+=(Rgt.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,o+=n&&/^[*]+$/.test(e)?lQe:uQe,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?o+="\\\\":i=!0;continue}if(c==="["){let[u,l,d,g]=sQe(e,A);if(d){o+=u,s=s||l,A+=d-1,r=r||g;continue}}if(c==="?"){o+=zJ,r=!0;continue}o+=Ngt(c)}return[o,gg(e),!!r,s]}};es=md});var ZJ,XJ=N(()=>{m();ZJ=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var Mi,Mgt,Pgt,_gt,Lgt,Ugt,Ogt,Ggt,Kgt,Hgt,$gt,Jgt,jgt,Ygt,qgt,Vgt,zgt,Wgt,Zgt,dQe,fQe,mQe,gQe,Xgt,ao,ept,tpt,rpt,npt,ipt,ca,opt,hQe,spt,apt,pQe,Apt,Kh,CQe=N(()=>{m();nQe();iQe();WJ();XJ();JF();WJ();XJ();JF();Mi=(t,e,r={})=>(hQ(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Kh(e,r).match(t)),Mgt=/^\*+([^+@!?\*\[\(]*)$/,Pgt=t=>e=>!e.startsWith(".")&&e.endsWith(t),_gt=t=>e=>e.endsWith(t),Lgt=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Ugt=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Ogt=/^\*+\.\*+$/,Ggt=t=>!t.startsWith(".")&&t.includes("."),Kgt=t=>t!=="."&&t!==".."&&t.includes("."),Hgt=/^\.\*+$/,$gt=t=>t!=="."&&t!==".."&&t.startsWith("."),Jgt=/^\*+$/,jgt=t=>t.length!==0&&!t.startsWith("."),Ygt=t=>t.length!==0&&t!=="."&&t!=="..",qgt=/^\?+([^+@!?\*\[\(]*)?$/,Vgt=([t,e=""])=>{let r=dQe([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},zgt=([t,e=""])=>{let r=fQe([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Wgt=([t,e=""])=>{let r=fQe([t]);return e?n=>r(n)&&n.endsWith(e):r},Zgt=([t,e=""])=>{let r=dQe([t]);return e?n=>r(n)&&n.endsWith(e):r},dQe=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},fQe=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},mQe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",gQe={win32:{sep:"\\"},posix:{sep:"/"}},Xgt=mQe==="win32"?gQe.win32.sep:gQe.posix.sep;Mi.sep=Xgt;ao=Symbol("globstar **");Mi.GLOBSTAR=ao;ept="[^/]",tpt=ept+"*?",rpt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",npt="(?:(?!(?:\\/|^)\\.).)*?",ipt=(t,e={})=>r=>Mi(r,t,e);Mi.filter=ipt;ca=(t,e={})=>Object.assign({},t,e),opt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Mi;let e=Mi;return Object.assign((n,i,o={})=>e(n,i,ca(t,o)),{Minimatch:class extends e.Minimatch{constructor(i,o={}){super(i,ca(t,o))}static defaults(i){return e.defaults(ca(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,o,s={}){super(i,o,ca(t,s))}static fromGlob(i,o={}){return e.AST.fromGlob(i,ca(t,o))}},unescape:(n,i={})=>e.unescape(n,ca(t,i)),escape:(n,i={})=>e.escape(n,ca(t,i)),filter:(n,i={})=>e.filter(n,ca(t,i)),defaults:n=>e.defaults(ca(t,n)),makeRe:(n,i={})=>e.makeRe(n,ca(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,ca(t,i)),match:(n,i,o={})=>e.match(n,i,ca(t,o)),sep:e.sep,GLOBSTAR:ao})};Mi.defaults=opt;hQe=(t,e={})=>(hQ(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:rQe(t,{max:e.braceExpandMax}));Mi.braceExpand=hQe;spt=(t,e={})=>new Kh(t,e).makeRe();Mi.makeRe=spt;apt=(t,e,r={})=>{let n=new Kh(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};Mi.match=apt;pQe=/[?*]|[+@!]\(.*?\)|\[|\]/,Apt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Kh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){hQ(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||mQe,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=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=o[0]===""&&o[1]===""&&(o[2]==="?"||!pQe.test(o[2]))&&!pQe.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(A)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let s=this.set[o];s[0]===""&&s[1]===""&&this.globParts[o][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[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 o=n[n.length-1];return i==="**"&&o==="**"?n:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(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 o=e[i];i===1&&o===""&&e[0]===""||(o==="."||o==="")&&(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 s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-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 s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let s=n[o-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let A=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...A),n.length===0&&n.push(""),o-=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,o=0,s=[],a="";for(;i<e.length&&o<r.length;)if(e[i]===r[o])s.push(a==="b"?r[o]:e[i]),i++,o++;else if(n&&e[i]==="**"&&r[o]===e[i+1])s.push(e[i]),i++;else if(n&&r[o]==="**"&&e[i]===r[o+1])s.push(r[o]),o++;else if(e[i]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",s.push(e[i]),i++,o++}else if(r[o]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",s.push(r[o]),i++,o++}else return!1;return e.length===r.length&&s}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,o=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,o=d,i=l)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(ao)?this.#n(e,r,n,i,o):this.#o(e,r,n,i,o)}#n(e,r,n,i,o){let s=r.indexOf(ao,o),a=r.lastIndexOf(ao),[A,c,u]=n?[r.slice(o,s),r.slice(s+1),[]]:[r.slice(o,s),r.slice(s+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#o(I,A,n,0,0))return!1;i+=A.length,o+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#o(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#o(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===ao?(f.push(p),g=[[],0],d.push(g)):(g[0].push(I),p++);let h=d.length-1,C=e.length-l;for(let I of d)I[1]=C-(f[h--]+I[0].length);return!!this.#c(e,d,i,0,n,0,!!l)}#c(e,r,n,i,o,s,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.#o(e.slice(0,n+c.length),c,o,n,0)&&s<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,o,s+1,a);if(g!==!1)return g}let d=e[n];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;n++}return o||null}#o(e,r,n,i,o){let s,a,A,c;for(s=i,a=o,c=e.length,A=r.length;s<c&&a<A;s++,a++){this.debug("matchOne loop");let u=r[a],l=e[s];if(this.debug(r,u,l),u===!1||u===ao)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(s===c&&a===A)return!0;if(s===c)return n;if(a===A)return s===c-1&&e[s]==="";throw new Error("wtf?")}braceExpand(){return hQe(this.pattern,this.options)}parse(e){hQ(e);let r=this.options;if(e==="**")return ao;if(e==="")return"";let n,i=null;(n=e.match(Jgt))?i=r.dot?Ygt:jgt:(n=e.match(Mgt))?i=(r.nocase?r.dot?Ugt:Lgt:r.dot?_gt:Pgt)(n[1]):(n=e.match(qgt))?i=(r.nocase?r.dot?zgt:Vgt:r.dot?Wgt:Zgt)(n):(n=e.match(Ogt))?i=r.dot?Kgt:Ggt:(n=e.match(Hgt))&&(i=$gt);let o=md.fromGlob(e,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}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?tpt:r.dot?rpt:npt,i=new Set(r.nocase?["i"]:[]),o=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"?Apt(l):l===ao?ao:l._src});c.forEach((l,d)=>{let g=c[d+1],p=c[d-1];l!==ao||p===ao||(p===void 0?g!==void 0&&g!==ao?c[d+1]="(?:\\/|"+n+"\\/)?"+g:c[d]=n:g===void 0?c[d-1]=p+"(?:\\/|\\/"+n+")?":g!==ao&&(c[d-1]=p+"(?:\\/|\\/"+n+"\\/)"+g,c[d+1]=ao))});let u=c.filter(l=>l!==ao);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("|"),[s,a]=e.length>1?["(?:",")"]:["",""];o="^"+s+o+a+"$",this.partial&&(o="^(?:\\/|"+s+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...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 o=this.set;this.debug(this.pattern,"set",o);let s=i[i.length-1];if(!s)for(let a=i.length-2;!s&&a>=0;a--)s=i[a];for(let a=0;a<o.length;a++){let A=o[a],c=i;if(n.matchBase&&A.length===1&&(c=[s]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Mi.defaults(e).Minimatch}};Mi.AST=md;Mi.Minimatch=Kh;Mi.escape=ZJ;Mi.unescape=gg});async function cpt(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${Me}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let o={"Content-Type":"application/json"};t.builderPrivateKey&&(o.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Pe(i,{method:"GET",headers:o,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function upt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function IQe(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function lpt(t,e){let r=new Map;for(let i of t){let o=i.category||"general";r.has(o)||r.set(o,[]),r.get(o).push(i)}if(r.size===0)return;await YF.default.mkdir(e,{recursive:!0});let n=[];for(let[i,o]of r){let s=`${upt(i)}.md`,a=EQe.default.join(e,s),A=o.filter(g=>g.glob),c=o.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)=>IQe(g).localeCompare(IQe(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(YF.default.writeFile(a,d.join(`
|
|
1874
|
+
`):void 0})}return r}var $ye=N(()=>{"use strict";m()});var lg,Jye=N(()=>{"use strict";m();lg=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var egt,Gh,jye,tgt,rgt,ngt,HF,$J=N(()=>{"use strict";m();Jye();egt=()=>{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.")},Gh=egt(),jye=async()=>{let t=await Gh.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await Gh.subtle.exportKey("jwk",t);return JSON.stringify(e)},tgt=async()=>Gh.getRandomValues(new Uint8Array(16)),rgt=async(t,e,r)=>{let n=await Gh.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},ngt=async(t,e,r)=>{let n=await Gh.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},HF=async t=>{try{lg("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);lg("validateEncryptionKey: Parsed JWK");let r=await Gh.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);lg("validateEncryptionKey: Imported crypto key");let n="test",i=await tgt();lg("validateEncryptionKey: Generated test IV",i);let o=await rgt(r,i,n);lg("validateEncryptionKey: Encrypted test data",o);let s=new Uint8Array(o);lg("validateEncryptionKey: Encrypted test data array",s);let a=await ngt(r,i,s);return lg("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});function Yye(t){return t.length<=JJ?t:t.slice(0,JJ)+`... [+${t.length-JJ} chars]`}var igt,JJ,$F,qye=N(()=>{"use strict";m();un();Zr();Jr();igt=5e3,JJ=8e3,$F=class{#n;#c;#o;#t=[];#A;#i=!1;#e=Promise.resolve();constructor(e){this.#n=e.credentials,this.#c=e.replayId,this.#o=e.debug??!1;let r=setInterval(()=>{this.#E()},igt);r.unref?.(),this.#A=r}recordText(e,r=Date.now()){this.#i||this.#s({ts:r,type:"text",content:Yye(e)})}recordReasoning(e,r=Date.now()){this.#i||this.#s({ts:r,type:"thinking",content:Yye(e)})}recordCheckpoint(e=Date.now(),r="",n){this.#i||this.#s({ts:e,type:"checkpoint",label:r,imageUrl:n})}#s(e){e.type!=="checkpoint"&&!e.content||this.#t.push(e)}async#E(){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(`${Pe}/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 Me(r,{method:"POST",body:JSON.stringify({actions:e}),headers:n,keepalive:!0},this.#o)}catch{}}async flush(){await this.#E(),await this.#e.catch(()=>{})}async close(){this.#i||(this.#i=!0,this.#A&&clearInterval(this.#A),await this.flush())}}});var jJ,Vye,ogt,zye=N(()=>{m();jJ=(t,e,r)=>{let n=t instanceof RegExp?Vye(t,r):t,i=e instanceof RegExp?Vye(e,r):e,o=n!==null&&i!=null&&ogt(n,i,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+i.length)}},Vye=(t,e)=>{let r=e.match(t);return r?r[0]:null},ogt=(t,e,r)=>{let n,i,o,s,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=[],o=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<o&&(o=i,s=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&s!==void 0&&(a=[o,s])}return a}});function YJ(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function hgt(t){return t.replace(lgt,Wye).replace(ggt,Zye).replace(pgt,qJ).replace(dgt,Xye).replace(fgt,eQe)}function Cgt(t){return t.replace(sgt,"\\").replace(agt,"{").replace(Agt,"}").replace(cgt,",").replace(ugt,".")}function tQe(t){if(!t)return[""];let e=[],r=jJ("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:o}=r,s=n.split(",");s[s.length-1]+="{"+i+"}";let a=tQe(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function rQe(t,e={}){if(!t)return[];let{max:r=mgt}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),mQ(hgt(t),r,!0).map(Cgt)}function Igt(t){return"{"+t+"}"}function Egt(t){return/^-?0\d/.test(t)}function Bgt(t,e){return t<=e}function ygt(t,e){return t>=e}function mQ(t,e,r){let n=[],i=jJ("{","}",t);if(!i)return[t];let o=i.pre,s=i.post.length?mQ(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<s.length&&a<e;a++){let A=o+"{"+i.body+"}"+s[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+qJ+i.post,mQ(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=tQe(i.body),l.length===1&&l[0]!==void 0&&(l=mQ(l[0],e,!1).map(Igt),l.length===1))return s.map(g=>i.pre+l[0]+g);let d;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=YJ(l[0]),p=YJ(l[1]),f=Math.max(l[0].length,l[1].length),h=l.length===3&&l[2]!==void 0?Math.abs(YJ(l[2])):1,C=Bgt;p<g&&(h*=-1,C=ygt);let B=l.some(Egt);d=[];for(let E=g;C(E,p);E+=h){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 w=new Array(Q+1).join("0");E<0?y="-"+w+y.slice(1):y=w+y}}d.push(y)}}else{d=[];for(let g=0;g<l.length;g++)d.push.apply(d,mQ(l[g],e,!1))}for(let g=0;g<d.length;g++)for(let p=0;p<s.length&&n.length<e;p++){let f=o+d[g]+s[p];(!r||c||f)&&n.push(f)}}return n}var Wye,Zye,qJ,Xye,eQe,sgt,agt,Agt,cgt,ugt,lgt,ggt,pgt,dgt,fgt,mgt,nQe=N(()=>{m();zye();Wye="\0SLASH"+Math.random()+"\0",Zye="\0OPEN"+Math.random()+"\0",qJ="\0CLOSE"+Math.random()+"\0",Xye="\0COMMA"+Math.random()+"\0",eQe="\0PERIOD"+Math.random()+"\0",sgt=new RegExp(Wye,"g"),agt=new RegExp(Zye,"g"),Agt=new RegExp(qJ,"g"),cgt=new RegExp(Xye,"g"),ugt=new RegExp(eQe,"g"),lgt=/\\\\/g,ggt=/\\{/g,pgt=/\\}/g,dgt=/\\,/g,fgt=/\\\./g,mgt=1e5});var hQ,iQe=N(()=>{m();hQ=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var Qgt,CQ,Dgt,oQe,sQe,aQe=N(()=>{m();Qgt={"[: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]},CQ=t=>t.replace(/[[\]\\-]/g,"\\$&"),Dgt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),oQe=t=>t.join(""),sQe=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],o=r+1,s=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;o<t.length;){let f=t.charAt(o);if((f==="!"||f==="^")&&o===r+1){c=!0,o++;continue}if(f==="]"&&s&&!A){u=o+1;break}if(s=!0,f==="\\"&&!A){A=!0,o++;continue}if(f==="["&&!A){for(let[h,[C,I,B]]of Object.entries(Qgt))if(t.startsWith(h,o)){if(l)return["$.",!1,t.length-r,!0];o+=h.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(CQ(l)+"-"+CQ(f)):f===l&&n.push(CQ(f)),l="",o++;continue}if(t.startsWith("-]",o+1)){n.push(CQ(f+"-")),o+=2;continue}if(t.startsWith("-",o+1)){l=f,o+=2;continue}n.push(CQ(f)),o++}if(u<o)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[Dgt(f),!1,u-r,!1]}let d="["+(c?"^":"")+oQe(n)+"]",g="["+(c?"":"^")+oQe(i)+"]";return[n.length&&i.length?"("+d+"|"+g+")":n.length?d:g,a,u-r,!0]}});var gg,JF=N(()=>{m();gg=(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 es,wgt,VJ,AQe,bgt,vgt,Sgt,cQe,xgt,jF,Fgt,kgt,Rgt,Ngt,zJ,uQe,lQe,Tgt,md,WJ=N(()=>{m();aQe();JF();wgt=new Set(["!","?","+","*","@"]),VJ=t=>wgt.has(t),AQe=t=>VJ(t.type),bgt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),vgt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Sgt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),cQe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),xgt="(?!(?:^|/)\\.\\.?(?:$|/))",jF="(?!\\.)",Fgt=new Set(["[","."]),kgt=new Set(["..","."]),Rgt=new Set("().*{}+?[]^$\\!"),Ngt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),zJ="[^/]",uQe=zJ+"*?",lQe=zJ+"+?",Tgt=0,md=class{type;#n;#c;#o=!1;#t=[];#A;#i;#e;#s=!1;#E;#m;#M=!1;id=++Tgt;get depth(){return(this.#A?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#A?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#c=!0),this.#A=r,this.#n=this.#A?this.#A.#n:this,this.#E=this.#n===this?n:this.#n.#E,this.#e=this.#n===this?[]:this.#n.#e,e==="!"&&!this.#n.#s&&this.#e.push(this),this.#i=this.#A?this.#A.#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("")}#k(){if(this!==this.#n)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#e.pop();){if(e.type!=="!")continue;let r=e,n=r.#A;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#t.length;i++)for(let o of e.#t){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#t[i])}r=n,n=r.#A}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof es&&r.#A===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.#s&&this.#A?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#A?.isStart())return!1;if(this.#i===0)return!0;let e=this.#A;for(let r=0;r<this.#i;r++){let n=e.#t[r];if(!(n instanceof es&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#A?.type==="!")return!0;if(!this.#A?.isEnd())return!1;if(!this.type)return this.#A?.isEnd();let e=this.#A?this.#A.#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 es(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#v(e,r,n,i,o){let s=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,h="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,h+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),h+=C;continue}else if(C==="["){A=!0,c=f,u=!1,h+=C;continue}if(!i.noext&&VJ(C)&&e.charAt(f)==="("&&o<=s){r.push(h),h="";let B=new es(C,r);f=es.#v(e,B,f,i,o+1),r.push(B);continue}h+=C}return r.push(h),f}let l=n+1,d=new es(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&&VJ(f)&&e.charAt(l)==="("&&(o<=s||r&&r.#p(f))){let C=r&&r.#p(f)?0:1;d.push(p),p="";let I=new es(f,d);d.push(I),l=es.#v(e,I,l,i,o+C);continue}if(f==="|"){d.push(p),p="",g.push(d),d=new es(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,vgt)}#a(e,r=bgt){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=Sgt){return!!r.get(this.type)?.includes(e)}#r(e,r){let n=e.#t[0],i=new es(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.#A=this);this.#m=void 0}#H(e){return!!cQe.get(this.type)?.has(e)}#V(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)}#w(e){let r=cQe.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let o of this.#t)typeof o=="object"&&(o.#A=this);this.type=i,this.#m=void 0,this.#M=!1}static fromGlob(e,r={}){let n=new es(null,void 0,r);return es.#v(e,n,0,r,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[r,n,i,o]=this.toRegExpSource();if(!(i||this.#c||this.#E.nocase&&!this.#E.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#E.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#E}toRegExpSource(e){let r=e??!!this.#E.dot;if(this.#n===this&&(this.#$(),this.#k()),!AQe(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[p,f,h,C]=typeof g=="string"?es.#P(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||h,this.#o=this.#o||C,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&kgt.has(this.#t[0]))){let p=Fgt,f=r&&p.has(c.charAt(0))||c.startsWith("\\.")&&p.has(c.charAt(2))||c.startsWith("\\.\\.")&&p.has(c.charAt(4)),h=!r&&!e&&p.has(c.charAt(0));u=f?xgt:h?jF:""}let l="";return this.isEnd()&&this.#n.#s&&this.#A?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,gg(c),this.#c=!!this.#c,this.#o]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#R(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,gg(this.toString()),!1,!1]}let s=!n||e||r||!jF?"":this.#R(!0);s===o&&(s=""),s&&(o=`(?:${o})(?:${s})*?`);let a="";if(this.type==="!"&&this.#M)a=(this.isStart()&&!r?jF:"")+lQe;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?jF:"")+uQe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=i+o+A}return[a,gg(o),this.#c=!!this.#c,this.#o]}#$(){if(AQe(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.#$(),this.#a(i)?(r=!1,this.#g(i,n)):this.#S(i)?(r=!1,this.#r(i,n)):this.#V(i)&&(r=!1,this.#w(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#$();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,o,s]=r.toRegExpSource(e);return this.#o=this.#o||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#P(e,r,n=!1){let i=!1,o="",s=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,o+=(Rgt.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,o+=n&&/^[*]+$/.test(e)?lQe:uQe,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?o+="\\\\":i=!0;continue}if(c==="["){let[u,l,d,g]=sQe(e,A);if(d){o+=u,s=s||l,A+=d-1,r=r||g;continue}}if(c==="?"){o+=zJ,r=!0;continue}o+=Ngt(c)}return[o,gg(e),!!r,s]}};es=md});var ZJ,XJ=N(()=>{m();ZJ=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var Mi,Mgt,Pgt,_gt,Lgt,Ugt,Ogt,Ggt,Kgt,Hgt,$gt,Jgt,jgt,Ygt,qgt,Vgt,zgt,Wgt,Zgt,dQe,fQe,mQe,gQe,Xgt,ao,ept,tpt,rpt,npt,ipt,ca,opt,hQe,spt,apt,pQe,Apt,Kh,CQe=N(()=>{m();nQe();iQe();WJ();XJ();JF();WJ();XJ();JF();Mi=(t,e,r={})=>(hQ(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Kh(e,r).match(t)),Mgt=/^\*+([^+@!?\*\[\(]*)$/,Pgt=t=>e=>!e.startsWith(".")&&e.endsWith(t),_gt=t=>e=>e.endsWith(t),Lgt=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Ugt=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Ogt=/^\*+\.\*+$/,Ggt=t=>!t.startsWith(".")&&t.includes("."),Kgt=t=>t!=="."&&t!==".."&&t.includes("."),Hgt=/^\.\*+$/,$gt=t=>t!=="."&&t!==".."&&t.startsWith("."),Jgt=/^\*+$/,jgt=t=>t.length!==0&&!t.startsWith("."),Ygt=t=>t.length!==0&&t!=="."&&t!=="..",qgt=/^\?+([^+@!?\*\[\(]*)?$/,Vgt=([t,e=""])=>{let r=dQe([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},zgt=([t,e=""])=>{let r=fQe([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Wgt=([t,e=""])=>{let r=fQe([t]);return e?n=>r(n)&&n.endsWith(e):r},Zgt=([t,e=""])=>{let r=dQe([t]);return e?n=>r(n)&&n.endsWith(e):r},dQe=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},fQe=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},mQe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",gQe={win32:{sep:"\\"},posix:{sep:"/"}},Xgt=mQe==="win32"?gQe.win32.sep:gQe.posix.sep;Mi.sep=Xgt;ao=Symbol("globstar **");Mi.GLOBSTAR=ao;ept="[^/]",tpt=ept+"*?",rpt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",npt="(?:(?!(?:\\/|^)\\.).)*?",ipt=(t,e={})=>r=>Mi(r,t,e);Mi.filter=ipt;ca=(t,e={})=>Object.assign({},t,e),opt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Mi;let e=Mi;return Object.assign((n,i,o={})=>e(n,i,ca(t,o)),{Minimatch:class extends e.Minimatch{constructor(i,o={}){super(i,ca(t,o))}static defaults(i){return e.defaults(ca(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,o,s={}){super(i,o,ca(t,s))}static fromGlob(i,o={}){return e.AST.fromGlob(i,ca(t,o))}},unescape:(n,i={})=>e.unescape(n,ca(t,i)),escape:(n,i={})=>e.escape(n,ca(t,i)),filter:(n,i={})=>e.filter(n,ca(t,i)),defaults:n=>e.defaults(ca(t,n)),makeRe:(n,i={})=>e.makeRe(n,ca(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,ca(t,i)),match:(n,i,o={})=>e.match(n,i,ca(t,o)),sep:e.sep,GLOBSTAR:ao})};Mi.defaults=opt;hQe=(t,e={})=>(hQ(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:rQe(t,{max:e.braceExpandMax}));Mi.braceExpand=hQe;spt=(t,e={})=>new Kh(t,e).makeRe();Mi.makeRe=spt;apt=(t,e,r={})=>{let n=new Kh(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};Mi.match=apt;pQe=/[?*]|[+@!]\(.*?\)|\[|\]/,Apt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Kh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){hQ(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||mQe,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=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=o[0]===""&&o[1]===""&&(o[2]==="?"||!pQe.test(o[2]))&&!pQe.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(A)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let s=this.set[o];s[0]===""&&s[1]===""&&this.globParts[o][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[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 o=n[n.length-1];return i==="**"&&o==="**"?n:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(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 o=e[i];i===1&&o===""&&e[0]===""||(o==="."||o==="")&&(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 s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-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 s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let s=n[o-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let A=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...A),n.length===0&&n.push(""),o-=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,o=0,s=[],a="";for(;i<e.length&&o<r.length;)if(e[i]===r[o])s.push(a==="b"?r[o]:e[i]),i++,o++;else if(n&&e[i]==="**"&&r[o]===e[i+1])s.push(e[i]),i++;else if(n&&r[o]==="**"&&e[i]===r[o+1])s.push(r[o]),o++;else if(e[i]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",s.push(e[i]),i++,o++}else if(r[o]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",s.push(r[o]),i++,o++}else return!1;return e.length===r.length&&s}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,o=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,o=d,i=l)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(ao)?this.#n(e,r,n,i,o):this.#o(e,r,n,i,o)}#n(e,r,n,i,o){let s=r.indexOf(ao,o),a=r.lastIndexOf(ao),[A,c,u]=n?[r.slice(o,s),r.slice(s+1),[]]:[r.slice(o,s),r.slice(s+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#o(I,A,n,0,0))return!1;i+=A.length,o+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#o(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#o(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===ao?(f.push(p),g=[[],0],d.push(g)):(g[0].push(I),p++);let h=d.length-1,C=e.length-l;for(let I of d)I[1]=C-(f[h--]+I[0].length);return!!this.#c(e,d,i,0,n,0,!!l)}#c(e,r,n,i,o,s,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.#o(e.slice(0,n+c.length),c,o,n,0)&&s<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,o,s+1,a);if(g!==!1)return g}let d=e[n];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;n++}return o||null}#o(e,r,n,i,o){let s,a,A,c;for(s=i,a=o,c=e.length,A=r.length;s<c&&a<A;s++,a++){this.debug("matchOne loop");let u=r[a],l=e[s];if(this.debug(r,u,l),u===!1||u===ao)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(s===c&&a===A)return!0;if(s===c)return n;if(a===A)return s===c-1&&e[s]==="";throw new Error("wtf?")}braceExpand(){return hQe(this.pattern,this.options)}parse(e){hQ(e);let r=this.options;if(e==="**")return ao;if(e==="")return"";let n,i=null;(n=e.match(Jgt))?i=r.dot?Ygt:jgt:(n=e.match(Mgt))?i=(r.nocase?r.dot?Ugt:Lgt:r.dot?_gt:Pgt)(n[1]):(n=e.match(qgt))?i=(r.nocase?r.dot?zgt:Vgt:r.dot?Wgt:Zgt)(n):(n=e.match(Ogt))?i=r.dot?Kgt:Ggt:(n=e.match(Hgt))&&(i=$gt);let o=md.fromGlob(e,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}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?tpt:r.dot?rpt:npt,i=new Set(r.nocase?["i"]:[]),o=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"?Apt(l):l===ao?ao:l._src});c.forEach((l,d)=>{let g=c[d+1],p=c[d-1];l!==ao||p===ao||(p===void 0?g!==void 0&&g!==ao?c[d+1]="(?:\\/|"+n+"\\/)?"+g:c[d]=n:g===void 0?c[d-1]=p+"(?:\\/|\\/"+n+")?":g!==ao&&(c[d-1]=p+"(?:\\/|\\/"+n+"\\/)"+g,c[d+1]=ao))});let u=c.filter(l=>l!==ao);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("|"),[s,a]=e.length>1?["(?:",")"]:["",""];o="^"+s+o+a+"$",this.partial&&(o="^(?:\\/|"+s+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...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 o=this.set;this.debug(this.pattern,"set",o);let s=i[i.length-1];if(!s)for(let a=i.length-2;!s&&a>=0;a--)s=i[a];for(let a=0;a<o.length;a++){let A=o[a],c=i;if(n.matchBase&&A.length===1&&(c=[s]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Mi.defaults(e).Minimatch}};Mi.AST=md;Mi.Minimatch=Kh;Mi.escape=ZJ;Mi.unescape=gg});async function cpt(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${Pe}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let o={"Content-Type":"application/json"};t.builderPrivateKey&&(o.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Me(i,{method:"GET",headers:o,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function upt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function IQe(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function lpt(t,e){let r=new Map;for(let i of t){let o=i.category||"general";r.has(o)||r.set(o,[]),r.get(o).push(i)}if(r.size===0)return;await YF.default.mkdir(e,{recursive:!0});let n=[];for(let[i,o]of r){let s=`${upt(i)}.md`,a=EQe.default.join(e,s),A=o.filter(g=>g.glob),c=o.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)=>IQe(g).localeCompare(IQe(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(YF.default.writeFile(a,d.join(`
|
|
1875
1875
|
`),"utf-8"))}await Promise.all(n)}function gpt(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let o=t[i];o==="{"?r++:o==="}"&&r>0?r--:o===","&&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 BQe(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?gpt(n.glob).some(o=>{try{return Mi(r,o.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function yQe(t,e,r,n){try{return await cpt(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function qF(t,e,r){try{await YF.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await lpt(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var YF,EQe,ej=N(()=>{"use strict";m();YF=W(require("node:fs/promises"),1),EQe=W(require("node:path"),1);CQe();Zr();Jr()});function ppt(){if(IQ!==void 0)return IQ;try{return IQ=require("prettier"),IQ}catch{return IQ=null,null}}function ua(t){try{return JSON.stringify(t)}catch{return String(t)}}var pg,tj,zF,DQe,XF,WF,wQe,IQ,QQe,dpt,fpt,mpt,hpt,AA,VF,Hh=N(()=>{"use strict";m();Kp();epe();un();gs();Zr();Jr();pg=W(require("node:fs"),1),tj=require("node:crypto");xO();FO();ope();Ape();qv();N2();kE();Epe();zF=W(require("node:os"),1);WO();Vi();Gt();Spe();sS();Gpe();$pe();Js();ZO();DQe=W(require("chokidar"),1);eG();Aj();Vpe();lj();Cr();XF=W(require("node:events"),1);_E();WF=require("node:crypto");vm();Xpe();_2();ME();Dp();Hye();za();$ye();wQe=require("node:fs/promises");$J();PE();$E();Zc();qye();ej();ja();Qv();vb();cS();QQe=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-other","invalid-last-message"],dpt=["initial-with-url","initial-without-url","success"],fpt=1800*1e3,mpt=2147483647,hpt=t=>{let e=Number(process.env.AGENT_TIMEOUT_OVERRIDE_MS),r=Number.isFinite(e)&&e>0?e:t&&Number.isFinite(t)&&t>0?t:fpt;return Math.min(r,mpt)},AA=class t{#n;#c;#o;#t=[];#A;#i;#e;#s;#E;#m;#M;#k;#v;#S;#a=!!(process.env.DEBUG||process.env.FUSION_DEBUG==="true");#p=!1;#r=ke("Agent",{debug:()=>this.#a});#g=new XF.default;#H=new Map;#V=new Set;#w;#$;#R;#P;#Te=[];#Xe=void 0;#It="";#ee;#Et=Promise.resolve(void 0);#z=[];#_;#J=[];#Ie;#te=new Map;#Me=[];#ie;#Ht=0;#oe;#W;#f;#h;#Bt;#et;#tt;#Pe=!1;#Ee;#Be=void 0;#rt;#_e;#Le;#se;#I;#d=[];#x;#yt;#B;#nt;#ye;#Qe=0;#ae;#D;#Qt=[];#Dt=new Set;#l;#C;#y;#Ue;#j;#Ae;#it;#Oe=!1;#wt=0;#ce=null;#ue=0;#re=!1;#Ge;#Ke;#L;#bt;#vt;#le=[];#He=[];#ot=!1;#ge=new Map;#$e=new Map;#De={};#U={};#St=!1;#Je;#st=!1;#$t=new Set;#we;#N={};#at;#At=[];#je=0;#be=null;#xt=void 0;#b=new Map;#Q={watcher:null,listeners:new Set,debounceMs:300,pendingEvents:[]};#Ft=!1;#u=null;#Ye=new Set;#qe=new Map;#ve=new Map;#Se=new Map;#xe=new Map;static#Ve=3e4;#Fe=null;#pe=[];get primaryGitPath(){return this.#d[0]?.path||this.#I}#ke(e){if(!e)return this.primaryGitPath;let r=this.#d.find(n=>n.folderName===e);if(!r)throw new Error(`Folder "${e}" not found in git-enabled folders`);return r.path}#kt(e,r){if(typeof e!="string")throw new TypeError(`#parsePathWithFolder: 'path' must be a string, received ${typeof e}: ${ua(e)}`);if(r)return{repoPath:this.#ke(r),relativePath:e};for(let n of this.#d){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.#j=e.modelOverride,this.#Ae=e.agentModelOverrides,this.#s=e.credentials,"initialUrl"in e){let n=TQe(e.initialUrl).id;n?this.#W=n:this.#E=e.initialUrl}typeof e.autoImportLocalMCPs=="boolean"&&(this.#Ft=e.autoImportLocalMCPs),"sessionOrCompletionId"in e?this.#W=e.sessionOrCompletionId:this.#W=e.fusionConfig?.sessionId;let r=e.workingDirectory??e.fusionConfig?.workingDirectory;if(this.#I=r?e.sys.resolve(e.sys.cwd(),r):e.sys.getCwdDir(),this.#M=e.skipFileDiff??!0,this.#m=e.position,this.#w=e.mode,this.#_=e.privacyMode??e.fusionConfig?.privacyMode,this.#f=e.devServerOrchestrator,this.#h=e.git??!1,this.#v=e.softContextWindow,this.#h&&(process.env.GIT_CEILING_DIRECTORIES=this.#I),this.#Bt=e.gitAutoInit??!1,this.#l=e.fusionConfig,this.#ot=e.asyncSubAgents??!1,this.#A=e.queueMode??"next-turn",this.#$=e.fusionConfig?.autoPush,this.#C=e.fusionConfig?.projectId,this.#y=e.fusionConfig?.branchName,this.#R=e.fusionConfig?.featureBranch,this.#P=e.fusionConfig?.aiBranch,this.#Ge=e.fusionConfig?.proxyOrigin,this.#Ke=e.fusionConfig?.proxyDefaultOrigin,this.#et=e.fusionStatusMonitor,process.env.FUSION_ENV_ORIGIN&&(this.#bt=process.env.FUSION_ENV_ORIGIN),this.#L=e.agentType,this.#St=e.persistSessionLocally??!1,this.#Je=e.parentSessionId,e.enabledTools)this.#D=VF(this.#l,e.enabledTools);else if(this.#w==="quality-v3"){let n=["write_file","search_replace_file","view_path","get_rule","get_style_inspiration","grep_search","web_search","find_media",process.platform==="win32"?"powershell":"bash"];this.#f&&n.push("dev_server_control"),this.#D=VF(this.#l,n)}else if(this.#w==="quality-v4"){let n=["Write","Edit","Read","MultiEdit","Grep","Glob","ReadRule","TodoRead","TodoWrite","Agent","Media","WebFetch","AskUserQuestion","ExitPlanMode","EnterPlanMode",process.platform==="win32"?"PowerShell":"Bash"],i=!!(this.#_?.enabled||this.#_?.redactUserMessages||this.#_?.redactLLMMessages);i||n.push("WebSearch"),this.#C&&!i&&this.getCommitMode()!=="commits"&&n.push("SearchMemories"),i||n.push("GetScreenshot"),n.push("NavigatePreview"),this.#f&&(n.push("DevServerLogs"),n.push("DevServerRestart"),n.push("ProposeEnvVariable")),process.env.FUSION_IDE_PORT&&n.push("IDEDiagnostics"),n.push("PullPrototype"),this.#D=VF(this.#l,n)}if(this.#yt=e.maxTokens,this.#it=e.reasoning,this.#rt=e.builtInCustomInstructions??[],this.#_e=e.builtInCustomAgents??[],this.#Le=e.builtInMCPServerConfig??{},this.#se=e.systemPromptOverride,this.#B=e.fusionConfig?.workspace,this.#nt=e.mcpServers??!1,this.#x=this.#I,this.#d=[],this.#B?.folders.length){let n=this.#B.folders.filter(i=>i.enableGit);this.#d=n.map(i=>({folderName:i.name??i.path,path:this.#e.resolve(this.#I,i.path),branchName:i.branchName||"main",repoUrl:i.repoUrl,originalRepoUrl:i.originalRepoUrl,repoName:i.repoName}));for(let i of n){let o=i.backupMetadata?.check.backup,s=i.name??i.path,a=WE({version:o?.version,originalRepoUrl:o?.repoUrl,commitHash:o?.lastCommitHash});a&&(this.#De[s]=a)}}this.#d.length===0&&(this.#d=[{folderName:this.#e.basename(this.#I),path:this.#I,branchName:"main"}]),this.#we=JQe(this.#B),this.#B?.folders[0]&&this.#T()&&(this.#x=this.#e.resolve(this.#I,this.#B.folders[0].path)),this.#g.on("idle",()=>{let n=this.#je;if(this.#je=0,this.#C==null&&this.#y==null||this.#Je)return;this.clearSessionCanHandleTools(),this.#r.debug("emitting ClientDevtoolsSessionIdleEventV1",{projectId:this.#C,branchName:this.#y});let i=this.#de;pc(this.#s,"/events/publish",{event:bue,extraData:{sessionId:this.getSessionId(),lastMessage:this.getLastMessage(),projectId:this.#C,branchName:this.#y,hasPlanToApply:i,sessionMode:this.getSessionMode(),gifId:this.#U.gif_id,planContent:this.#Jt,completionId:this.getLastCompletionId(),credits:n},extraAttributes:{projectId:this.#C,branchName:this.#y}},{debug:this.#a})})}get fusionConfig(){return this.#l}get gitEnabledFolder(){return this.#B?.folders.find(e=>e.enableGit)}get gitEnabledFolders(){return this.#B?.folders.filter(e=>e.enableGit)||[]}get gitRepoContexts(){return this.#d}get workingDirectory(){return this.#I}get bashWorkingDirectory(){return this.#x}getSessionMode(){return this.#n?.sessionMode??"normal"}get#Jt(){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 o=JSON.parse(i.content);if(typeof o.plan=="string")return o.plan}catch{}}}}get#de(){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 o=JSON.parse(i.content);if(o.hasPlanToApply||o.sessionMode==="planning")return!0}catch{}}}return!1}async switchSessionMode(e){let r=this.getSessionContext();r.sessionMode!==e&&(r.sessionMode=e,await this.#Ce())}async switchModelOverride(e){this.#j=e||void 0,await this.#Ce()}#jt(){if(!this.#L||!this.#Ae)return;let e=this.#Ae[this.#L];if(e){if(typeof e=="string")return Ll(e);if(Array.isArray(e)&&e.length){let r=this.#ge.get(this.#L)??0;return this.#ge.set(this.#L,r+1),Ll(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=BQe(this.#Qt,e).filter(n=>!this.#Dt.has(n.id));for(let n of r)this.#Dt.add(n.id);return r}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.#$=e}async setPrivacyMode(e){if(e&&e.enabled){if(!e.encryptKey&&!this.#Ie)this.#Ie=await jye();else if(e.encryptKey){if(!await HF(e.encryptKey))throw new Error("Invalid encryption key: key failed validation");this.#Ie=e.encryptKey}}else this.#Ie=void 0;this.#_=e}async initializeSession(e={}){return this.#tt||(this.#tt=this.#Vt(e)),await this.#tt}async loadHistory(){let e=this.getSessionContext(),r=await ZF(this.#e,this.#s,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=Rm(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 o=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(`
|
|
1876
1876
|
`)})).trim().split(`
|
|
1877
1877
|
`),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)}o.set(a,u)}let s=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=o.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:s}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let o=await this.loadMoreTurns();i+=o.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.#Ee||(this.#Ee=this.#Yt().then(e=>(this.#Ee=void 0,e))),this.#Ee}async#Yt(){let e=this.getSessionContext();if(e.canLoadMore){let r=e.turns[0]?.completionId,n=await ZF(this.#e,this.#s,e.sessionId,!0,this.#a,r);return n.turns.length>0&&e.turns.unshift(...n.turns),e.canLoadMore=n.canLoadMore,n.turns}return[]}async#qt(){try{let e=ppt();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.#rt=e,this.#n&&(this.#n.customInstructions=await this.#Re())}async setCustomAgents(e){this.#_e=e,this.#n&&(this.#n.customAgents=await this.#ze())}async#Re(){let r=(await Promise.all(this.#d.map(n=>uj({sys:this.#e,projectDir:this.#I,currentDir:n.path,rootDir:"/",allowedCommands:Bv(this.#l?.allowedCommands??[]),skipCommandSecurity:this.#l?.skipCommandSecurity===!0})))).flat();return rj(this.#rt??[],r)}async#ze(){if(!this.#D?.includes("Agent"))return[];let r=(await Promise.all(this.#d.map(n=>qpe({sys:this.#e,projectDir:this.#I,currentDir:n.path,rootDir:"/"})))).flat();return rj(this.#_e??[],r)}async#Vt(e){try{if(this.#Oe)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.#I}`),await this.setPrivacyMode(this.#_);let r=await this.#Wt(),n=await this.#qt();r&&(this.#N=await this.#O());let i=this.#d[0]?.repoUrl;if(this.#Ue=await rS(i),!this.#Ue)try{let c=await this.git(["remote","get-url","origin"],{cwd:this.#I});c&&(this.#Ue=await rS(c))}catch{}let o,s;this.#W||(this.#W=r?.sessionId),this.#W?e.skipSessionLoading?o=this.#W:(s=await ZF(this.#e,this.#s,this.#W,!0,this.#a,void 0,e.signal),o=s.sessionId,this.#r.debug(`Session recovered (sessionId=${o}, turnsCount=${s.turns.length})`)):o=(0,WF.randomUUID)(),this.#R||(this.#R=r?.featureBranch?.trim());let a={turns:s?.turns??[],sessionId:o,customInstructions:await this.#Re(),customAgents:await this.#ze(),title:s?.title,beforeCommit:s?.beforeCommit,createdUnixTime:s?.createdUnixTime??Date.now(),updatedUnixTime:s?.updatedUnixTime??Date.now(),userContext:await MQe(this.#e,this.primaryGitPath),prettierConfig:n,canLoadMore:s?.canLoadMore??!1,state:s?.turns.length?"success":this.#E?"initial-with-url":"initial-without-url",sessionMode:s?.sessionMode??"normal"};if(this.#U=s?.metadata??{},s){let c=gc(s.turns);c?.completionId!==s.lastCompletionId&&this.#e.Sentry?.captureException(new Error("Last completion id mismatch"),{tags:{operation:"codegen-initialize-session"},extra:{lastTurn:c,sessionMetadata:s}})}if(this.#a&&this.#g.on("step",c=>{c.type!=="delta"&&this.#r.debug(`(${c.type}): ${Cm(JSON.stringify(c),400)}`)}),await this.#Xt(a),this.#n=a,this.#L){let c=await this.getNamedAgentConfig(this.#L,this.getSessionId(),e.signal);if(c.success){if(this.#k=c.options.includeMemories,this.#D=c.options.enabledTools,this.#j=c.options.modelOverride,this.#w=c.options.mode,this.#se=c.options.systemPromptOverride,this.#m=c.options.position,this.#A=c.options.queueMode??"next-turn",this.#ot=c.options.asyncSubAgents??!1,this.#v=c.options.softContextWindow,this.#Le={...this.#Le,...c.options.builtInMCPServerConfig},c.options.builtInMCPServerConfig?.chrome&&!this.#We){let u=new VE(this.getSessionId(),{framesDir:this.#e.join(zF.default.homedir(),".builder","recordings"),debug:this.#a});this.setTimeline(u)}typeof c.options.mcpServers=="boolean"&&(this.#nt=c.options.mcpServers)}else this.#r.error(c.response)}try{let c=await Kye(this.#e,this.primaryGitPath,this.#Le,this.#Ft,e.signal);c.length>0?(this.#r.debug(`Initializing ${c.length} local MCP server(s)...`),this.#ye=await Gye(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.#h&&this.#C&&this.#D?.includes("SearchMemories")){let c=await yQe(this.#e,this.#s,this.#C,e.signal);await qF(this.#e,c,this.#e.join(this.#x,".builder","memories")),this.#Qt=c,this.#D&&c.length===0&&(this.#D=this.#D.filter(u=>u!=="SearchMemories"))}let A=this.#f;if(A){let c=()=>{this.#g.emit("step",aj(A,this.#l))},u=()=>{this.#g.emit("step",aj(A,this.#l)),this.#Ce(),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#ct(e,r){let n="reminder:health";this.removeSystemReminder(n);let i=this.#f;if(!i||!(this.#D?.includes("DevServerLogs")||this.#D?.includes("DevServerRestart")||this.#D?.includes("DevServerControl")||this.#D?.includes("ProposeEnvVariable")))return;let s=this.getSessionContext();if(s.sessionMode!=="normal")return;e&&await i.waitUntilIdle(500,500);let a=i.setupState,A=await this.#lt(),c=i.devCommand,u=i.devState,l=i.state,d=i.setupCommand,g=await i.getOpenPorts(),p=i.proxyTarget,f=i.httpServerState.state,h=i.lastServerStatus,C=f==="error-fetch",I=!1;this.#h&&(I=await this.getCurrentBranch()!==this.getAiBranch());let B=f==="error-5xx"||f==="error-4xx"&&h!==401&&h!==404,E="",y=!1,Q=!1;l==="install-failed"||l==="install-aborted"?E=i.getSetupOutput():(E=i.getCheckpoints(1,u!=="running"?"err":"all"),y=LQe(E??""));let w="",D="",x="error",v="Try to fix",S="repair-unknown";if(l==="not-installed"||l==="install-failed"||l==="install-aborted"||l==="failed"||I||C||B||y||A.length>0){if(I&&(S="repair-bad-branch",D+=`- The current git branch is not the AI branch (${this.getAiBranch()}).
|
|
@@ -1955,8 +1955,8 @@ ${L}`),Q.length>0&&(L=`<browser_automation_ui_issues>${JSON.stringify(Q,null,2)}
|
|
|
1955
1955
|
<browser_automation_timeline_id>${pe}</browser_automation_timeline_id>
|
|
1956
1956
|
<browser_automation_recorded_frames>${JSON.stringify(Ot)}</browser_automation_recorded_frames>
|
|
1957
1957
|
|
|
1958
|
-
${L}`}}this.#pt({gif_id:f.gif_id,gif_frames:Qe,timeline_id:pe,recording_id:f.recording_id,...i.replayId?{replay_id:i.replayId,replay_url:`${
|
|
1959
|
-
${jQe(r.environmentVariables)}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(o=>{n.proxyServer=o.updatedProxyServer,n.hosts=o.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(o=>n.proxyServer=o)),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(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(o=>{n.devCommand=o.status==="success",n.devResult=o??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(o=>{n.devCommand=!0,n.devResult=o??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(o=>n.proxyServer=n.proxyServer||o)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(o=>n.validateResult=o)),await Promise.allSettled(i),n.env){let o=!1;for(let s of this.#b.values())(s.state==="running"||s.state==="starting")&&(s.stale=!0,o=!0);o&&this.#me()}}return n}#mr(){for(let e of Array.from(this.#b.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#b.clear()}async#dt(){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}}#hr(){if(this.#Q.watcher)return;let e=this.#d.map(A=>A.path),r=new Map;for(let A of this.#d)r.set(A.path,cj(A.path));let n=A=>{for(let c of this.#d)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.#Kt(u))return!0;let l=r.get(c);return l?l(u):!1},o,s=!1;try{o=DQe.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.#d.length>1&&u){let g=this.#d.find(p=>p.path===u);g&&!this.#T()&&(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(h){this.#e.Sentry?.captureException(h)}},this.#Q.debounceMs)};o.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=>{s||(s=!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.#dt().catch(()=>{}))}),this.#Q.watcher=o,this.#r.debug(`Initialized global file watcher on: ${e.join(", ")}`)}subscribeToFileChanges(e){return this.#Q.listeners.size===0&&this.#hr(),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.#dt(),this.#r.debug("Closed global file watcher (no more listeners)"))}}async tsServerInit(){try{return this.#u?{ok:!0,cwd:this.#I}:(this.#u=new AS(this.#I),this.#u.setEventHandler(e=>{for(let r of this.#Ye)r(e)}),await this.#u.start(),{ok:!0,cwd:this.#I})}catch(e){return this.#u=null,{ok:!1,error:e?.message||"Failed to start tsserver"}}}async tsServerOpenFile(e,r){this.#u&&await this.#u.openFile(e,r)}async tsServerChangeFile(e,r){this.#u&&await this.#u.changeFile(e,r)}async tsServerCloseFile(e){this.#u&&await this.#u.closeFile(e)}async tsServerGetCompletions(e,r,n,i){return this.#u?this.#u.getCompletions(e,r,n,i):{success:!1,body:null}}async tsServerGetCompletionDetails(e,r,n,i){return this.#u?this.#u.getCompletionDetails(e,r,n,i):{success:!1,body:null}}async tsServerGetDefinition(e,r,n){return this.#u?this.#u.getDefinition(e,r,n):{success:!1,body:null}}async tsServerGetTypeDefinition(e,r,n){return this.#u?this.#u.getTypeDefinition(e,r,n):{success:!1,body:null}}async tsServerGetQuickInfo(e,r,n){return this.#u?this.#u.getQuickInfo(e,r,n):{success:!1,body:null}}async tsServerGetReferences(e,r,n){return this.#u?this.#u.getReferences(e,r,n):{success:!1,body:null}}async tsServerGetSignatureHelp(e,r,n){return this.#u?this.#u.getSignatureHelp(e,r,n):{success:!1,body:null}}async tsServerRequestDiagnostics(e){this.#u&&await this.#u.requestDiagnostics(e)}async tsServerGetRenameLocations(e,r,n){return this.#u?this.#u.getRenameLocations(e,r,n):{success:!1,body:null}}async tsServerGetNavTree(e){return this.#u?this.#u.getNavTree(e):{success:!1,body:null}}async tsServerOrganizeImports(e){return this.#u?this.#u.organizeImports(e):{success:!1,body:null}}async tsServerGetInlayHints(e){return this.#u?this.#u.getInlayHints(e):{success:!1,body:null}}async tsServerGetCodeFixes(e,r,n,i,o,s){return this.#u?this.#u.getCodeFixes(e,r,n,i,o,s):{success:!1,body:null}}async tsServerGetApplicableRefactors(e,r,n,i,o){return this.#u?this.#u.getApplicableRefactors(e,r,n,i,o):{success:!1,body:null}}async tsServerGetEditsForRefactor(e,r,n,i,o,s,a){return this.#u?this.#u.getEditsForRefactor(e,r,n,i,o,s,a):{success:!1,body:null}}async tsServerGetImplementation(e,r,n){return this.#u?this.#u.getImplementation(e,r,n):{success:!1,body:null}}async tsServerGetSelectionRange(e,r){return this.#u?this.#u.getSelectionRange(e,r):{success:!1,body:null}}async tsServerGetLinkedEditingRange(e,r,n){return this.#u?this.#u.getLinkedEditingRange(e,r,n):{success:!1,body:null}}async tsServerGetFormatRange(e,r,n,i,o){return this.#u?this.#u.getFormatRange(e,r,n,i,o):{success:!1,body:null}}subscribeToDiagnostics(e){return this.#Ye.add(e),()=>{this.#Ye.delete(e)}}async close(e=!1){if(!this.#Oe){if(this.#Oe=!0,this.#p&&(delete process.env.DEBUG,this.#p=!1),this.#Me.forEach(r=>r()),this.#mr(),await this.#dt(),this.#u&&(this.#u.dispose(),this.#u=null),this.#Ye.clear(),this.#ye)try{this.#r.debug("Cleaning up local MCP servers"),await this.#ye.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#F(){if(this.#d.length===0||this.#Je)return null;let r=(await this.#Y(async i=>this.#Ir(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.#Te=r,this.#K(this.#Cr(r),"updateBranchUnpushedStatus",!1),r.some(i=>i.hasMergeConflict)&&await this.#Ce(),r[0]}async#Cr(e){if(!this.#C||!this.#y||!this.#s.builderPublicKey||!this.#s.userId||!this.#s.builderPrivateKey)return;let r=e.some(n=>n.ahead>0||n.isSessionDirty);try{let n=new URL("/projects/branches",
|
|
1958
|
+
${L}`}}this.#pt({gif_id:f.gif_id,gif_frames:Qe,timeline_id:pe,recording_id:f.recording_id,...i.replayId?{replay_id:i.replayId,replay_url:`${Pe}/replay/${i.replayId}`}:{}},!1)}catch(Ae){this.#r.warn(`[${s}] Failed to generate recording (non-critical): ${Ae instanceof Error?Ae.message:String(Ae)}`),this.#e.Sentry?.captureException(Ae,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages",subagent_type:s},extra:{sessionId:a.getSessionId(),frameCount:h.getFrameCount()}})}let he={success:!0,response:L,metadata:f,sessionId:p,lastTurn:O};return l(he),he}catch(H){let O={success:!1,response:`Agent task failed: ${H instanceof Error?H.message:String(H)}`,metadata:{important_files:[]}};return l(O),O}finally{u||l(B("finally_safety_net")),clearTimeout(y),this.#$e.delete(A),g.removeEventListener("abort",$);try{await U()}catch(H){this.#r.warn(`[${s}] Cleanup failed: ${H instanceof Error?H.message:String(H)}`)}if(i.resetAfterRun&&o)try{await this.resetToCommitHash(o,!1)}catch(H){this.#r.warn(`[${s}] Failed to reset changes: ${H instanceof Error?H.message:String(H)}`)}}}getRunningSubAgents(){return Array.from(this.#$e.entries()).map(([e,r])=>({id:e,description:r.description,startedAt:r.startedAt}))}canHandleTool(e){let n=(this.#H.get(e)??0)>0,i=this.#V.has(e);return n||i}setSessionCanHandleTools(e){for(let r of e)this.#V.add(r)}clearSessionCanHandleTools(){this.#V.clear()}setProxyOrigin(e,r){if(e!==this.#Ge||r!==this.#Ke){this.#Ge=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#fr(e,r,n){let i=this.getProxyConfig();if(i.proxyOrigin&&!i.proxyDestination)return;let o=await pc(this.#s,"/codegen/get-browser-connection",{sessionId:e,projectId:this.#C,branchName:this.#y,proxyOrigin:i.proxyOrigin,proxyDefaultOrigin:i.proxyDefaultOrigin,proxyDst:i.proxyDestination,recordReplay:n?.recordReplay===!0},{signal:r,debug:this.#a});if(typeof o?.wsUrl=="string")return{wsUrl:o.wsUrl,uuid:o.uuid,disconnectUrl:o.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.#f?.runSetupCommand()}abortSetupCommand(){return this.#f?.abortSetupCommand()}abortValidateCommand(){return this.#f?.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(o=>o.id===e),i=Dn(r??"The user manually aborted the tool call.");if(n)return n.abortController.abort(i),!0;if(this.#z.length===0){let o=new AbortController;return o.abort(i),this.#z.push({id:e,abortController:o,input:{id:e},name:"bash"}),!0}return!1}async acceptCode(){if(this.#ft()){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.#je=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.#o&&this.#o()}requestRefresh(){this.#g.emit("step",{type:"builder-action",action:"refresh",metadata:{}})}async configureDevOrchestrator(e){let r=this.#f,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(([o,s])=>{r.setEnvVariable(o,s??void 0)&&(n.env=!0)}),this.queueSystemReminder({text:`The system has the following environment variables:
|
|
1959
|
+
${jQe(r.environmentVariables)}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(o=>{n.proxyServer=o.updatedProxyServer,n.hosts=o.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(o=>n.proxyServer=o)),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(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(o=>{n.devCommand=o.status==="success",n.devResult=o??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(o=>{n.devCommand=!0,n.devResult=o??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(o=>n.proxyServer=n.proxyServer||o)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(o=>n.validateResult=o)),await Promise.allSettled(i),n.env){let o=!1;for(let s of this.#b.values())(s.state==="running"||s.state==="starting")&&(s.stale=!0,o=!0);o&&this.#me()}}return n}#mr(){for(let e of Array.from(this.#b.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#b.clear()}async#dt(){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}}#hr(){if(this.#Q.watcher)return;let e=this.#d.map(A=>A.path),r=new Map;for(let A of this.#d)r.set(A.path,cj(A.path));let n=A=>{for(let c of this.#d)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.#Kt(u))return!0;let l=r.get(c);return l?l(u):!1},o,s=!1;try{o=DQe.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.#d.length>1&&u){let g=this.#d.find(p=>p.path===u);g&&!this.#T()&&(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(h){this.#e.Sentry?.captureException(h)}},this.#Q.debounceMs)};o.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=>{s||(s=!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.#dt().catch(()=>{}))}),this.#Q.watcher=o,this.#r.debug(`Initialized global file watcher on: ${e.join(", ")}`)}subscribeToFileChanges(e){return this.#Q.listeners.size===0&&this.#hr(),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.#dt(),this.#r.debug("Closed global file watcher (no more listeners)"))}}async tsServerInit(){try{return this.#u?{ok:!0,cwd:this.#I}:(this.#u=new AS(this.#I),this.#u.setEventHandler(e=>{for(let r of this.#Ye)r(e)}),await this.#u.start(),{ok:!0,cwd:this.#I})}catch(e){return this.#u=null,{ok:!1,error:e?.message||"Failed to start tsserver"}}}async tsServerOpenFile(e,r){this.#u&&await this.#u.openFile(e,r)}async tsServerChangeFile(e,r){this.#u&&await this.#u.changeFile(e,r)}async tsServerCloseFile(e){this.#u&&await this.#u.closeFile(e)}async tsServerGetCompletions(e,r,n,i){return this.#u?this.#u.getCompletions(e,r,n,i):{success:!1,body:null}}async tsServerGetCompletionDetails(e,r,n,i){return this.#u?this.#u.getCompletionDetails(e,r,n,i):{success:!1,body:null}}async tsServerGetDefinition(e,r,n){return this.#u?this.#u.getDefinition(e,r,n):{success:!1,body:null}}async tsServerGetTypeDefinition(e,r,n){return this.#u?this.#u.getTypeDefinition(e,r,n):{success:!1,body:null}}async tsServerGetQuickInfo(e,r,n){return this.#u?this.#u.getQuickInfo(e,r,n):{success:!1,body:null}}async tsServerGetReferences(e,r,n){return this.#u?this.#u.getReferences(e,r,n):{success:!1,body:null}}async tsServerGetSignatureHelp(e,r,n){return this.#u?this.#u.getSignatureHelp(e,r,n):{success:!1,body:null}}async tsServerRequestDiagnostics(e){this.#u&&await this.#u.requestDiagnostics(e)}async tsServerGetRenameLocations(e,r,n){return this.#u?this.#u.getRenameLocations(e,r,n):{success:!1,body:null}}async tsServerGetNavTree(e){return this.#u?this.#u.getNavTree(e):{success:!1,body:null}}async tsServerOrganizeImports(e){return this.#u?this.#u.organizeImports(e):{success:!1,body:null}}async tsServerGetInlayHints(e){return this.#u?this.#u.getInlayHints(e):{success:!1,body:null}}async tsServerGetCodeFixes(e,r,n,i,o,s){return this.#u?this.#u.getCodeFixes(e,r,n,i,o,s):{success:!1,body:null}}async tsServerGetApplicableRefactors(e,r,n,i,o){return this.#u?this.#u.getApplicableRefactors(e,r,n,i,o):{success:!1,body:null}}async tsServerGetEditsForRefactor(e,r,n,i,o,s,a){return this.#u?this.#u.getEditsForRefactor(e,r,n,i,o,s,a):{success:!1,body:null}}async tsServerGetImplementation(e,r,n){return this.#u?this.#u.getImplementation(e,r,n):{success:!1,body:null}}async tsServerGetSelectionRange(e,r){return this.#u?this.#u.getSelectionRange(e,r):{success:!1,body:null}}async tsServerGetLinkedEditingRange(e,r,n){return this.#u?this.#u.getLinkedEditingRange(e,r,n):{success:!1,body:null}}async tsServerGetFormatRange(e,r,n,i,o){return this.#u?this.#u.getFormatRange(e,r,n,i,o):{success:!1,body:null}}subscribeToDiagnostics(e){return this.#Ye.add(e),()=>{this.#Ye.delete(e)}}async close(e=!1){if(!this.#Oe){if(this.#Oe=!0,this.#p&&(delete process.env.DEBUG,this.#p=!1),this.#Me.forEach(r=>r()),this.#mr(),await this.#dt(),this.#u&&(this.#u.dispose(),this.#u=null),this.#Ye.clear(),this.#ye)try{this.#r.debug("Cleaning up local MCP servers"),await this.#ye.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#F(){if(this.#d.length===0||this.#Je)return null;let r=(await this.#Y(async i=>this.#Ir(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.#Te=r,this.#K(this.#Cr(r),"updateBranchUnpushedStatus",!1),r.some(i=>i.hasMergeConflict)&&await this.#Ce(),r[0]}async#Cr(e){if(!this.#C||!this.#y||!this.#s.builderPublicKey||!this.#s.userId||!this.#s.builderPrivateKey)return;let r=e.some(n=>n.ahead>0||n.isSessionDirty);try{let n=new URL("/projects/branches",Pe);n.searchParams.set("apiKey",this.#s.builderPublicKey),n.searchParams.set("userId",this.#s.userId),n.searchParams.set("projectId",this.#C),n.searchParams.set("branchName",this.#y);let i=await Me(n,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.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",Pe);this.#s.builderPublicKey&&r.searchParams.set("apiKey",this.#s.builderPublicKey),this.#s.userId&&r.searchParams.set("userId",this.#s.userId);let n=await Me(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.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.#Te.length===0||this.#L||this.#w!=="quality-v4")return;let r=this.#Te.map(n=>YQe(n,this.gitEnabledFolders,e));this.queueSystemReminder({text:r.join(`
|
|
1960
1960
|
|
|
1961
1961
|
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#h)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#O();Object.keys(n).length>0&&(r.beforeCommit=Vs(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#oe}async#Ce(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#oe=void 0,!1;let r=await this.#ct(!0,"all");return e=this.getSessionContext(),e.state!=="generating"&&e.state!=="close"?(this.#oe=r,this.#g.emit("step",{type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:e.state,suggestion:r,sessionMode:e.sessionMode,hasPlanToApply:this.#de,modelOverride:this.#j}),!0):!1}async#Ir(e){this.#Qe++;try{let r=this.getCommitMode(),n=this.#h?this.getFeatureBranch():e.branchName,i=this.#fe(e),o=e.path,s=e.folderName===this.#d[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:o});l=this.#e.join(E.trim(),"FETCH_HEAD"),pg.default.existsSync(l)&&pg.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#Qe,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:o}),A=!0}catch{A=!1}let d=await this.#e.getRepoInfo(o),g=Ml(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!s&&!e.initialCommit&&d.commit&&(e.initialCommit=d.commit),!g&&e.initialCommit&&(g=e.initialCommit);let p=this.#ft(e.folderName),f=p?1:0,h=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:o}),c=!1}catch{c=!0}else c=!0;try{let E=OQe(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:o}));f=E.ahead,h=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(o,".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.#Qe,folderName:e.folderName}})}}else!A&&r!=="commits"&&g&&g!==d.commit&&(f=Math.max(f,1));let C=await this.#Z(o),I=C.length>0,B=await this.#Sr(o);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#br(),isSessionDirty:p||!!g&&g!==d.commit,canSync:(f>0||h>0||B)&&!I,canPush:(f>0||h>0)&&!I,hasStagedChanges:B,canPull:h>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:h,currentCommit:d.commit,currentBranch:d.currentBranch,pendingValidation:this.#re,remoteBranch:i,unmergedFiles:C}}finally{this.#Qe--}}#Ut(){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:Pv(this.#l),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.#de}}#Ot(){let e=this.getSessionContext(),r=e.turns,n=[];n.push(this.#Ut()),Object.keys(this.#U).length>0&&n.push({type:"metadata",...this.#U}),this.#t.length>0&&n.push({type:"message-queue",queue:this.#t.map(o=>({idempotencyKey:o.idempotencyKey,displayPrompt:o.displayPrompt,user:o.user}))});let i;for(let o of r){n.push({type:"user",previousId:i,displayPrompt:o.userMessage?o.userMessage.displayPrompt??o.userMessage.userPrompt:void 0,attachments:o.userMessage?.attachments,id:o.completionId,user:o.user,role:o.user.role,compacting:!1,idempotencyKey:o.userMessage?.idempotencyKey??"",sessionMode:e.sessionMode}),i=o.completionId;for(let s of o.actions)if(s.type==="tool"||s.type==="text"||s.type==="thinking")if(n.push({type:"start",name:s.type,content:"",id:s.id??"",filePath:s.filePath??"",title:s.actionTitle??s.artifactTitle??s.filePath??""}),n.push({type:"delta",name:s.type,delta:s.content}),s.type==="tool"){if(n.push({type:s.type,id:s.id,name:s.filePath,content:s.content}),s.filePath==="UpdateSetupValue"||s.filePath==="ProposeConfig")try{let a=JSON.parse(s.content);if(s.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 s.type==="thinking"?n.push({type:"thinking",content:s.content}):s.type==="text"&&n.push({type:"text",content:s.content})}return n}connectToEventLoop(e,r,n){let i=n?.canHandleTools??[];if(e){let o=[],s=this.getSessionContext();o.push({type:"state",newState:"replay",abortable:!1,previousState:s.state}),this.#Xe&&o.push(this.#Xe),o.push(...this.#Te),o.push(...this.#Ot()),this.#te.forEach(c=>{o.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#Be?gc(this.#Be):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":o.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),o.push({type:"delta",name:a.type,delta:a.content});break}o.push({type:"terminals",terminals:this.#gt()});let A=this.#f;A?(o.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.#l?.isLocal,validateState:A.validateCommandState}),A.setupState!=="installed"&&o.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),o.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.#l?.devCommand,setupCommand:this.#l?.setupCommand,proxyServer:this.#l?.serverUrl,proxyServerSelection:"hardcoded",remoteAddress:void 0,remotePort:void 0,proxyServerReachable:!!this.#l?.isLocal,validateState:"unset"}),o.push({type:"state",newState:s.state,abortable:s.state==="generating",previousState:"replay"}),this.#ie&&s.state!=="generating"&&o.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:s.state,suggestion:this.#oe,sessionMode:s.sessionMode,hasPlanToApply:this.#de}),r({type:"batch",steps:o})}this.#g.on("step",r);for(let o of i)this.#H.set(o,(this.#H.get(o)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let o of i)this.#H.set(o,(this.#H.get(o)??0)-1)}}waitUntilPendingPromises(e){let r=aA();return this.#r.debug(`(waitUntilPendingPromises-${r}): started`),tu(Promise.allSettled(this.#le),e).then(()=>Tl()).then(()=>{this.#r.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=aA();return this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): started`),tu(Promise.allSettled(this.#He),e).then(()=>Tl()).then(()=>{this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=aA();return this.waitForEventLoop(),this.#r.debug(`(waitUntilIdle-${r}): started`),tu(Tl().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#r.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,XF.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#Gt(e){let r=this.#f;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.#h&&(await this.#lt()).length===0&&(await this.#mt()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#ie?this.#ie:this.#ie=this.#Er()}async#Er(){if(this.#ie||this.#S)throw new Error("Event loop already started");this.#r.debug("(eventLoop): started");let e=UQe(),r=c=>{if(c.type==="error"&&this.#ue>0&&(QQe.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,RQe(this.#e,this.#s,o.sessionId,c.restoreCredits).catch(u=>{this.#e.Sentry?.captureException(u)}))),c.type==="tool_result"&&(c.result.tool_name==="ExitPlanMode"||c.result.tool_name==="TodoWrite")&&(this.#r.debug("emitting ClientDevtoolsToolResultV1",{toolName:c.result.tool_name,projectId:this.#C,branchName:this.#y}),pc(this.#s,"/events/publish",{event:xue,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:o.sessionId,projectId:this.#C,branchName:this.#y},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#C,branchName:this.#y}},{debug:this.#a})),c.type==="tool"&&c.name==="Agent"){let u;try{u=JSON.parse(c.content)?.description}catch{}let l=JSON.stringify({description:u});this.#r.debug("emitting ClientDevtoolsToolCallV1",{toolName:c.name,projectId:this.#C,branchName:this.#y}),pc(this.#s,"/events/publish",{event:Sue,extraData:{toolUseId:c.id,toolName:c.name,content:l,sessionId:o.sessionId,projectId:this.#C,branchName:this.#y},extraAttributes:{toolName:c.name,projectId:this.#C,branchName:this.#y}},{debug:this.#a})}this.#g.emit("step",c)};this.#S=new AbortController;let n=this.#S.signal,i=this.#f,o=this.getSessionContext(),s=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:o.sessionId,get completionId(){return s()}}),await this.#K(this.#F(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#Qe>0||this.#F().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Me.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{ole().then(u=>{let l=JSON.stringify(u);l!==this.#It&&(this.#It=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?ale(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.#dr();if(this.#r.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#_t();let g=await this.#Ce();if(n.aborted)break;g&&HQe(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=$n([n,this.#c.signal]);try{if(this.#oe=void 0,l.logsCheckpoint&&i?.addCheckpoint(),d?.aborted)throw Dn(d.reason);this.#q("generating"),i?.abortValidateCommand(),l.syncChanges&&(this.#r.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(l.syncChanges),await this.#ct(!1,"critical")),l.sessionMode&&l.sessionMode!==o.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#Br(l,d,r),this.#q("success");let g=l.autoPush??this.#$??"none";if(g!=="none"&&this.#h&&(this.#r.debug(`(eventLoop-${c}): autoPush: ${g}`),await this.waitUntilBlockingPendingPromises(),(await this.#lt()).length===0)){let f=(()=>{switch(g){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.#d.length>1)for(let h of this.#d)await this.#Ne({...f,folderName:h.folderName});else await this.#Ne(f)}this.#oe=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#q("abort")):g instanceof tt?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#q("error")):g instanceof zt?(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.#q("error")):g instanceof wi?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),QQe.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#q("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.#q("error")):this.#q("error")}this.#Ht++}}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.#q("close")}async#Br(e,r,n){this.#ue=0,this.#re=!1;let i=this.getSessionContext(),o=e.displayPrompt||e.userPrompt||"";o&&this.#At.push(o);let s;if(e.agentType&&e.agentType!==this.#L){let Q=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);Q.success&&(s={enabledTools:this.#D,modelOverride:this.#j,mode:this.#w,systemPromptOverride:this.#se,position:this.#m,includeMemories:this.#k},this.#D=Q.options.enabledTools,this.#j=Q.options.modelOverride,this.#w=Q.options.mode,this.#se=Q.options.systemPromptOverride,this.#m=Q.options.position,this.#k=Q.options.includeMemories)}let a=e.maxCompletions??this.#l?.maxAgentCompletions,A=a??ek,c=a??SQe,u=0,l=0,d=!0,g=!1,p=!1,f=!1,h,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 Dn(r.reason);try{if(this.cancelAllPendingToolFulfilments(),h||(h=await this.#Dr(e,d,r,n),h.modelOverride=e.modelOverride,h.reasoning=e.reasoning,h.agentModelOverrides=e.agentModelOverrides),h.user.role==="user"){let w=h.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"&&w.push({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:h.userMessage?.displayPrompt??h.userPrompt,files:w})}try{let w=await this.#yr(i,h,r,n),{shouldContinue:D,completions:x,filesChanged:v}=w;if(this.#a&&this.#r.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(w)}`),d=!1,h=void 0,u=0,g||=v,p||=v,f||=w.navigatePreviewCalled,l+=x,this.#re||=v,this.#i=void 0,v&&this.#f?.addCheckpoint(),r?.aborted)throw Dn(r.reason);let{hasHealthIssue:S}=await this.#zt();if(!D){if(r?.aborted)throw Dn(r.reason);let P=this.getSessionMode();if((P==="planning"||P==="auto-planning")&&!this.#de&&!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(S&&I<3){this.#r.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let Y=this.#pr();if(Y?.syncChanges&&await this.syncChangesFromRemote(Y.syncChanges),Y){this.#r.debug(`(agentCompletion-${E}): consumed queued messages`),d=!0,e=Y,l=0;continue}let K=this.#f,M=e.runValidateCommand??!0;if(K?.validateCommand&&M&&C<2&&this.#re){p=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let U=e.autoPush;this.#r.debug(`(agentCompletion-${E}): running validate command`),this.#Gt(r).then($=>{if(this.#r.debug(`(validate-command): result status ${$.status}`),$.status==="failure"&&$.code){let H=$.output?zA($.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${$.code}):
|
|
1962
1962
|
<validate_command>
|
|
@@ -1984,7 +1984,7 @@ ${l}`):r.push(l))}catch(a){this.#e.Sentry?.captureException(a,{tags:{operation:"
|
|
|
1984
1984
|
`;else{let i=this.gitEnabledFolder;i&&(n=`Notice that all the relative paths, are inside "${i.name}/", remember that when using Read/Write/Edit tools:
|
|
1985
1985
|
`)}return{files:e,diff:Cm(`${n}${r.join(`
|
|
1986
1986
|
`)}`,1e4)}}catch(e){this.#e.Sentry?.captureException(e,{tags:{operation:"codegen-git"}});return}}#vr(){return["status","--porcelain=v1","-z","--ignore-submodules=dirty"]}async#mt(e){try{let r=this.#vr();return(await this.git(r,{cwd:e})).trim().length===0}catch{return!1}}async#Sr(e){try{return await this.git(["diff","--cached","--quiet"],{cwd:e}),!1}catch{return!0}}async#xr(e,r){let n=r.applyResults;for(let o of n)this.#Pt(o.filePath);let i=[];for(let o of n)try{if(o.action==="delete"){let s=await this.deleteFile(o.filePath);s&&i.push(s)}else if(o.content){let s=await this.writeFile(o.filePath,o.content);s&&(this.#$t.add(s),i.push(s))}}catch(s){e.Sentry?.captureException(s)}return i}#T(){return this.#B?.folders?.length===1||!this.#B?.folders?.length}resolveWorkspacePath(e,r){if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${ua(e)}`);return zpe({filePath:e,forceWorkspace:r,workspace:this.#B,workingDirectory:this.#I,sys:this.#e,canCollapseWorkspace:this.#T()})}#X(){try{let e=this.getSessionContext();return gc(e.turns)?.user.principals}catch{return}}absolutePathToWorkspaceUrl(e){return Wpe({absolutePath:e,workspace:this.#B,workingDirectory:this.#I,sys:this.#e,canCollapseWorkspace:this.#T()})}async launchEditor(e={}){let r,n,i;return e.filePath?(r=this.resolveWorkspacePath(e.filePath,!1).resolvedPath,n=e.line??void 0,i=e.column??void 0):r=this.primaryGitPath,await this.#e.exists(r)?await this.#e.launchEditor({filePath:r,line:n,column:i}):{success:!1,message:`File not found: ${r}`}}async readFile(e,r){if(typeof e!="string")throw new TypeError(`readFile: 'filePath' must be a string, received ${typeof e}: ${ua(e)}`);if(!r){let n=Ya(e,"read",this.#l?.accessControl,this.#X());if(!n.allowed)throw new zt(`ACL denied: ${n.message}`)}try{if(e==="AGENTS.md"&&this.#B?.agentsMD)return this.#B.agentsMD;let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r),i=await this.#e.readFile(n);return i!==null?i:({resolvedPath:n}=this.resolveWorkspacePath(e,!0),await this.#e.readFile(n))}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async readFileWithChecksum(e){let r=await this.readFile(e.filePath,e.skipAclCheck);if(r===null)return{content:null,checksum:null};let n=(0,tj.createHash)("md5").update(r).digest("hex");return e.previousChecksum&&n===e.previousChecksum?{content:null,checksum:n,notModified:!0}:{content:r,checksum:n}}async readBinaryFile(e){let r=Ya(e,"read",this.#l?.accessControl,this.#X());if(!r.allowed)throw new zt(`ACL denied: ${r.message}`);try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!1),i=await this.#e.readBinaryFile(n);if(i===null&&({resolvedPath:n}=this.resolveWorkspacePath(e,!0),i=await this.#e.readBinaryFile(n)),i)return Buffer.from(i).toString("base64")}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async#ht(e){let r;e?r=this.#d.find(o=>o.path===e)?.branchName:r=this.gitEnabledFolder?.branchName;let n=r?r.startsWith("origin/")?r:`origin/${r}`:await this.getDefaultBranch(e);if(!n)throw new Error("Could not find parent branch");return n}async#Ct(e){let r=this.#ve.get(e);if(r&&Date.now()-r.timestamp<t.#Ve)return r.promise;let n=(async()=>{let i=await this.#ht(e);try{return(await this.git(["merge-base",i,"HEAD"],{cwd:e})).trim()}catch{return i}})().catch(i=>{throw this.#ve.get(e)?.promise===n&&this.#ve.delete(e),i});return this.#ve.set(e,{promise:n,timestamp:Date.now()}),n}async getFileAtRef(e,r,n){if(!this.#h)return null;try{let i,o;if(n)i=n,e.startsWith(i)?(o=e.substring(i.length),o.startsWith("/")&&(o=o.substring(1))):o=e;else{let{resolvedPath:u,workspaceFolder:l}=this.resolveWorkspacePath(e,!0);i=l?.path||this.#I,o=e,i&&u.startsWith(i)&&(o=u.substring(i.length),o.startsWith("/")&&(o=o.substring(1)))}let s=r??await this.#Ct(i),a=`${i}:${s}:${o}`,A=this.#xe.get(a);if(A&&Date.now()-A.timestamp<t.#Ve)return A.promise;let c=this.git(["show",`${s}:${o}`],{cwd:i}).catch(u=>{let l=u instanceof Error?u.message:String(u);return l.includes("does not exist")||l.includes("exists on disk")||this.#xe.get(a)?.promise===c&&this.#xe.delete(a),null});return this.#xe.set(a,{promise:c,timestamp:Date.now()}),c}catch{return null}}async#Fr(e){let r=this.#Se.get(e);if(r&&Date.now()-r.timestamp<t.#Ve)return r.promise;let n=(async()=>{try{let i=(await this.git(["branch","--show-current"],{cwd:e})).trim();if(i&&(await this.git(["ls-remote","--heads","origin",i],{cwd:e})).trim().length>0)return`origin/${i}`}catch{}return this.#Ct(e)})().catch(i=>{throw this.#Se.get(e)?.promise===n&&this.#Se.delete(e),i});return this.#Se.set(e,{promise:n,timestamp:Date.now()}),n}async#kr(e,r){return r==="remote-current-branch"?this.#Fr(e):this.#Ct(e)}async getSingleFileDiff(e){if(e===null||typeof e!="string"&&typeof e!="object")throw new TypeError(`getSingleFileDiff: 'args' must be a string or object, received ${e===null?"null":typeof e}: ${ua(e)}`);let r=typeof e=="string"?{path:e}:e;if(typeof r.path!="string")throw new TypeError(`getSingleFileDiff: 'path' must be a string, received ${typeof r.path}: ${ua(r.path)}`);let n=typeof e=="object"?e.previousChecksum:void 0,i=typeof e=="object"&&e.mode?e.mode:"remote-parent-branch",{repoPath:o,relativePath:s}=this.#kt(r.path,r.folderName),a=this.#e.join(o,s),A=this.#h?await this.#kr(o,i).catch(()=>null):null,[c,u]=await Promise.all([this.#e.readFile(a).catch(()=>null),A===null?Promise.resolve(null):this.getFileAtRef(s,A,o)]),l=u===null?"":`${u}`,d=c===null?"":`${c}`,g=(0,tj.createHash)("md5").update(`${l}\0${d}`).digest("hex"),p=u===null&&c!==null?"create":u!==null&&c===null?"delete":"update";return n===g?{oldContent:null,newContent:null,action:p,checksum:g,notModified:!0}:{oldContent:u,newContent:c,action:p,checksum:g}}async discardFileChanges(e){let r=typeof e=="string"?{filePath:e}:e;if(!this.#h)return{success:!1,error:"Git not configured"};try{let{repoPath:n,relativePath:i}=this.#kt(r.filePath,r.folderName),o=this.#e.join(n,i),s=await this.#ht(n),a;try{a=(await this.git(["merge-base",s,"HEAD"],{cwd:n})).trim()}catch{a=s}let A=await this.getFileAtRef(i,a,n),u=(await this.git(["--no-pager","diff",`${a}`,"HEAD","--",i],{cwd:n})).trim().length>0,d=(await this.git(["status","--porcelain","--",i],{cwd:n})).trim().length>0;if(!u&&!d)return{success:!0};if(A===null){try{await this.#e.exists(o)&&await this.#e.unlink(o)}catch{}let f=this.#e.dirname(i);if(f&&f!==".")try{await this.git(["clean","-fd",f],{cwd:n})}catch{}}else try{await this.git(["restore",`--source=${a}`,"--",i],{cwd:n})}catch(f){return{success:!1,error:`Failed to restore file: ${f}`}}await this.git(["add","--",i],{cwd:n});let g=`Discard changes to ${i}`;await this.git(["commit","--no-gpg-sign","-m",g],{cwd:n});let p=(await this.git(["rev-parse","HEAD"],{cwd:n})).trim();try{await this.#F()}catch(f){this.#e.Sentry?.captureException(f,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!0,commitHash:p}}catch(n){try{await this.#F()}catch(i){this.#e.Sentry?.captureException(i,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!1,error:n instanceof Error?n.message:String(n)}}}async revertDiscard(e){let{commitHash:r,folderName:n}=e;if(!this.#h)return{success:!1,error:"Git not configured"};try{let i=this.#ke(n);await this.git(["revert","--no-edit",r],{cwd:i});try{await this.#F()}catch(o){this.#e.Sentry?.captureException(o,{tags:{operation:"revert-discard",step:"emit-git-status"}})}return{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async fileExists(e){if(typeof e!="string")throw new TypeError(`fileExists: 'filePath' must be a string, received ${typeof e}: ${ua(e)}`);let r=n=>n.startsWith(this.#I)?this.#e.relative(this.#I,n):n;try{if(e==="AGENTS.md"&&this.#B?.agentsMD)return{absolutePath:e,recommendedPath:void 0,workspaceFolder:void 0,virtual:!0};let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);return await this.#e.exists(n)?{absolutePath:n,recommendedPath:void 0,workspaceFolder:i,virtual:!1}:i?{absolutePath:void 0,recommendedPath:void 0,workspaceFolder:i,virtual:!1}:({resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!0),await this.#e.exists(n)?{absolutePath:n,recommendedPath:r(n),workspaceFolder:i,virtual:!1}:{absolutePath:void 0,recommendedPath:r(n),workspaceFolder:i,virtual:!1})}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return{absolutePath:void 0,recommendedPath:void 0,workspaceFolder:void 0,virtual:!1}}readFileSync(e,r){if(!r){let n=Ya(e,"read",this.#l?.accessControl,this.#X());if(!n.allowed)throw new zt(`ACL denied: ${n.message}`)}try{if(e==="AGENTS.md"&&this.#B?.agentsMD)return this.#B.agentsMD;let{resolvedPath:n}=this.resolveWorkspacePath(e,!1);if(this.#e.existsSync(n))return this.#e.readFileSync(n);if({resolvedPath:n}=this.resolveWorkspacePath(e,!0),this.#e.existsSync(n))return this.#e.readFileSync(n)}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async writeFile(e,r,n){if(typeof e!="string")throw new TypeError(`writeFile: 'filePath' must be a string, received ${typeof e}: ${ua(e)}`);if(!n){let i=Ya(e,"write",this.#l?.accessControl,this.#X());if(!i.allowed)throw new zt(`ACL denied: ${i.message}`)}try{let{resolvedPath:i}=this.resolveWorkspacePath(e,!!n);return await this.#e.writeFile(i,r),i}catch(i){return this.#e.Sentry?.captureException(i,{extra:{filePath:e}}),null}}async listDir(e){if(typeof e!="string")throw new TypeError(`listDir: 'dirPath' must be a string, received ${typeof e}: ${ua(e)}`);let r=Ya(e,"list",this.#l?.accessControl,this.#X());if(!r.allowed)throw new zt(`ACL denied: ${r.message}`);try{let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);if(!Zpe({resolvedPath:n,workingDirectory:this.#I,workspace:this.#B,sys:this.#e}))throw new zt("Access denied: path outside working directory");if(!await this.#e.exists(n))return[];let A=(await(0,wQe.readdir)(n,{withFileTypes:!0})).map(c=>c.name+(c.isDirectory()?"/":""));if(this.#T()){let c=A.map(u=>vi(this.#e.join(e,u)));return Im({files:c,policy:this.#l?.accessControl,getDotFiles:!0})}if(i&&this.#B?.folders){let c=i.name||i.path,u=e;e.startsWith(c+"/")?u=e.substring(c.length+1):e===c&&(u="");let l=A.map(d=>{let g=u?this.#e.join(u,d):d,p=vi(g);return`${c}/${p}`});return Im({files:l,policy:this.#l?.accessControl,getDotFiles:!0})}return Im({files:A,policy:this.#l?.accessControl,getDotFiles:!0})}catch(n){return this.#e.Sentry?.captureException(n,{extra:{dirPath:e}}),[]}}async listCustomInstructions(){return(await this.#Re()).filter(r=>!r.hideUI).map(r=>({id:r.id,name:r.name,description:r.description,type:r.type,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,disableModelInvocation:r.disableModelInvocation,userInvocable:r.userInvocable}))}async stat(e,r){if(typeof e!="string")throw new TypeError(`stat: 'filePath' must be a string, received ${typeof e}: ${ua(e)}`);if(!r){let n=Ya(e,"read",this.#l?.accessControl,this.#X());if(!n.allowed)throw new zt(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!1);if(await this.#e.exists(n))return await this.#e.stat(n)}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async deleteFile(e,r){if(typeof e!="string")throw new TypeError(`deleteFile: 'filePath' must be a string, received ${typeof e}: ${ua(e)}`);if(!r){let n=Ya(e,"write",this.#l?.accessControl,this.#X());if(!n.allowed)throw new zt(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r);return await this.#e.exists(n)?(await this.#e.unlink(n),n):null}catch(n){return this.#e.Sentry?.captureException(n,{extra:{filePath:e}}),null}}getLinesStats(){let e=this.#n?.turns.reduce((r,n)=>{let i=n.applyResults.reduce((o,s)=>({added:o.added+s.addedLines,removed:o.removed+s.removedLines}),{added:0,removed:0});return{added:r.added+i.added,removed:r.removed+i.removed}},{added:0,removed:0})??{added:0,removed:0};return{...e,net:e.added-e.removed}}async getDiffFromRemote({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){if(!this.#h)return[];let o=this.#ke(i);try{let s=(await this.git(["branch","--show-current"],{cwd:o})).trim();if(!s)throw new Error("Could not determine current branch");let a=!1;try{a=(await this.git(["remote"],{cwd:o})).includes("origin")}catch(d){throw this.#r.warn("No git remotes configured, cannot get diff from remote"),d}if(!a){this.#r.warn("Origin remote not found, trying to get diff from main branch");try{return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(d){throw this.#r.warn("Failed to get diff from main branch:",d),d}}let A=!1,c;try{let d=`origin/${s}`;if(A=(await this.git(["ls-remote","--heads","origin",s],{cwd:o})).trim().length>0,A)c=d;else return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(d){throw this.#r.warn("Failed to check remote branches:",d),d}let u=["diff",c];r?u.push("--raw","--numstat","--no-renames"):e!==void 0&&u.push(`-U${e}`),u.push("--"),n&&n.length>0&&u.push(...n);let l=await this.git(u,{cwd:o});return!l||l.trim()===""?[]:HJ(l,r)}catch(s){throw s instanceof Cd||this.#r.error("getDiffFromRemote error:",s),s}}async getDiff({mode:e="remote-parent-branch",numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o}){if(!this.#h)return{state:"error",error:new Error("Git not configured")};try{switch(e){case"remote-parent-branch":return{state:"success",diff:await this.getDiffFromParentBranch({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o})};case"remote-current-branch":return{state:"success",diff:await this.getDiffFromRemote({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o})};default:throw new Error(`Unknown diff mode: ${e}`)}}catch(s){return s instanceof Cd?{state:"error",error:s}:(this.#r.error(`getDiff error for mode '${e}':`,s),this.#e.Sentry?.captureException(s),{state:"error",error:s instanceof Error?s:new Error(String(s))})}}async getDefaultBranch(e){let r=e??"__primary__",n=this.#qe.get(r);if(n)return n;let i=this.#Rr(e).catch(o=>{throw this.#qe.get(r)===i&&this.#qe.delete(r),o});return this.#qe.set(r,i),i}async#Rr(e){try{let n=(await this.git(["remote","show","origin"],{cwd:e})).match(/HEAD branch: (.+)/);if(n)return`origin/${n[1].trim()}`}catch{}try{if((await this.git(["ls-remote","--heads","origin","main"],{cwd:e})).trim().length>0)return"origin/main"}catch{}try{if((await this.git(["ls-remote","--heads","origin","master"],{cwd:e})).trim().length>0)return"origin/master"}catch{}try{let n=(await this.git(["ls-remote","--heads","origin"],{cwd:e})).trim().split(`
|
|
1987
|
-
`).map(i=>i.split(" ")[1]).filter(i=>i&&!i.includes("HEAD"));if(n.length>0)return`origin/${n[0].replace("refs/heads/","")}`}catch{}throw new Error("Could not determine default branch. No remote branches found.")}async getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){let o=this.#ke(i);try{if(!(await this.git(["branch","--show-current"],{cwd:o})).trim())throw new Error("Could not determine current branch");let a=await this.#ht(o),A;try{A=(await this.git(["merge-base",a,"HEAD"],{cwd:o})).trim()}catch(l){throw l instanceof la&&l.code===128?new Cd(a,{cause:l}):l}let c=["--no-pager","diff",A];r?c.push("--raw","--numstat","--no-renames"):e!==void 0&&c.push(`-U${e}`),c.push("--"),n&&n.length>0&&c.push(...n);let u=await this.git(c,{cwd:o});return!u||u.trim()===""?[]:HJ(u,r)}catch(s){throw s instanceof Cd||this.#r.error("getDiffFromParentBranch error:",s),s}}},VF=(t,e)=>e.filter(r=>!t?.disabledTools?.includes(r))});function qQe(t){return t instanceof Error?t.message:String(t)}function BQ(t,e){if(dj(e).test(t))return!0;if(e.toLowerCase().includes("localhost")){let n=e.replace(/localhost/gi,"127.0.0.1");if(dj(n).test(t))return!0}else if(e.includes("127.0.0.1")){let n=e.replace(/127\.0\.0\.1/g,"localhost");if(dj(n).test(t))return!0}return!1}function dj(t){return t=String(t).replace(/\./g,"\\.").replace(/\?/g,".").replace(/\*/g,".*"),new RegExp(`^${t}$`,"i")}var rk,VQe=N(()=>{"use strict";m();rk=class{logger;currentOrigin=null;currentOriginPattern=null;currentDestination=null;currentOriginHost=null;constructor(e){this.logger=e}getCurrentOrigin(){return this.currentOrigin}getCurrentDestination(){return this.currentDestination}clearMapping(){this.currentOrigin=null,this.currentOriginPattern=null,this.currentDestination=null,this.currentOriginHost=null,this.logger?.info("[UrlMapper] Mapping cleared")}setMapping(e,r){if(e.includes("*")||!e.startsWith("https://")&&!e.startsWith("http://")){this.currentOriginPattern=e,this.currentOriginHost=null,this.currentOrigin=e;try{let i=new URL(r);this.currentDestination=`${i.protocol}//${i.hostname}${i.port?":"+i.port:""}`}catch(i){this.logger?.error(`[UrlMapper] Failed to parse destination URL: ${qQe(i)}`),this.currentDestination=r}this.logger?.info(`[UrlMapper] Set mapping (PATTERN): ${e} \u2192 ${r}`)}else{this.currentOriginPattern=null;try{let i=new URL(e),o=i.protocol==="https:"?"443":"80",s=i.port||o;this.currentOriginHost=`${i.hostname}:${s}`,this.currentOrigin=`${i.protocol}//${i.hostname}${i.port?":"+i.port:""}`;let a=new URL(r);this.currentDestination=`${a.protocol}//${a.hostname}${a.port?":"+a.port:""}`,this.logger?.info(`[UrlMapper] Set mapping (EXACT): ${e} \u2192 ${r}`),this.logger?.debug(`[UrlMapper] Normalized origin: ${this.currentOrigin} (host: ${this.currentOriginHost})`),this.logger?.debug(`[UrlMapper] Normalized destination: ${this.currentDestination}`)}catch(i){this.logger?.error(`[UrlMapper] Failed to parse origin/destination URL: ${qQe(i)}`),this.currentOriginHost=null,this.currentOrigin=e,this.currentDestination=r}}}getUpstream(e){if(!this.currentDestination)return null;if(this.currentOriginPattern){let r=this.currentOriginPattern.replace(/^https?:\/\//g,""),n=r.split(":")[0],i=e.split(":")[0];return BQ(i,n)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched hostname: ${n} -> ${this.currentDestination}`),this.currentDestination):BQ(e,r)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched host: ${r} -> ${this.currentDestination}`),this.currentDestination):(this.logger?.debug(`[UrlMapper] NO PATTERN MATCH getUpstream(${e}) !== ${r}`),null)}return this.currentOriginHost?BQ(e,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) -> ${this.currentDestination}`),this.currentDestination):BQ(`${e}:80`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (HTTP) -> ${this.currentDestination}`),this.currentDestination):BQ(`${e}:443`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (TLS) -> ${this.currentDestination}`),this.currentDestination):(this.logger?.debug(`[UrlMapper] NO MATCH getUpstream(${e}) !== ${this.currentOriginHost}`),null):null}buildUpstreamUrl(e,r="/"){let n=r||"/";n=n.replace(/^\/+/,"/");let i=new URL(n,e),o=new URL(e);return o.pathname=i.pathname.replace(/\/+/g,"/"),o.search=i.search,o.hash=i.hash,o}mapUrl(e){let r=e.host,n=this.getUpstream(r);if(!n)return e;let i=e.pathname+e.search+e.hash;return this.buildUpstreamUrl(n,i)}isOriginHttps(e=443){let r=this.currentOrigin?.split("://")[0];return r==="http"||r==="https"?r==="https":e===443}}});var zQe,Ipt,fj,WQe=N(()=>{"use strict";m();zQe=W(require("node:os"),1);Gt();Ipt=ke("Priority"),fj=(t,e)=>{try{zQe.default.setPriority(t,e)}catch(r){Ipt.error(`Failed to set priority to ${e}: ${r}`)}}});function ZQe(t){Cj=t}async function $h(){if(Cj){if(mj){hj=!0;return}mj=!0;try{await Cj()}finally{mj=!1,hj&&(hj=!1,$h())}}}var Cj,mj,hj,Ij=N(()=>{"use strict";m();mj=!1,hj=!1});async function*Ept(t){for await(let e of rm(t.body))if(e.length)try{yield JSON.parse(e)}catch{}}function Bpt(t){t.toolContext.session.sendMessage({userPrompt:Kue({originChannelId:t.originChannelId,senderDisplayName:t.senderDisplayName,projectId:t.projectId,branchName:t.branchName,content:t.content}),category:"background-subagent",user:{...t.toolContext.user,role:"agent",source:"builder.io"},queue:!0})}function ypt(t,e){return e??("builderUserId"in t.user?t.user.builderUserId:t.user.source==="builder.io"?t.user.userId:t.credentials.userId)}function XQe(t,e){let{credentials:r}=t,{project_id:n,message:i}=e,o,s=new Promise(g=>o=g),a=!1,A,c,u,l;return(async()=>{let g=new URL("/projects/branch",
|
|
1987
|
+
`).map(i=>i.split(" ")[1]).filter(i=>i&&!i.includes("HEAD"));if(n.length>0)return`origin/${n[0].replace("refs/heads/","")}`}catch{}throw new Error("Could not determine default branch. No remote branches found.")}async getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){let o=this.#ke(i);try{if(!(await this.git(["branch","--show-current"],{cwd:o})).trim())throw new Error("Could not determine current branch");let a=await this.#ht(o),A;try{A=(await this.git(["merge-base",a,"HEAD"],{cwd:o})).trim()}catch(l){throw l instanceof la&&l.code===128?new Cd(a,{cause:l}):l}let c=["--no-pager","diff",A];r?c.push("--raw","--numstat","--no-renames"):e!==void 0&&c.push(`-U${e}`),c.push("--"),n&&n.length>0&&c.push(...n);let u=await this.git(c,{cwd:o});return!u||u.trim()===""?[]:HJ(u,r)}catch(s){throw s instanceof Cd||this.#r.error("getDiffFromParentBranch error:",s),s}}},VF=(t,e)=>e.filter(r=>!t?.disabledTools?.includes(r))});function qQe(t){return t instanceof Error?t.message:String(t)}function BQ(t,e){if(dj(e).test(t))return!0;if(e.toLowerCase().includes("localhost")){let n=e.replace(/localhost/gi,"127.0.0.1");if(dj(n).test(t))return!0}else if(e.includes("127.0.0.1")){let n=e.replace(/127\.0\.0\.1/g,"localhost");if(dj(n).test(t))return!0}return!1}function dj(t){return t=String(t).replace(/\./g,"\\.").replace(/\?/g,".").replace(/\*/g,".*"),new RegExp(`^${t}$`,"i")}var rk,VQe=N(()=>{"use strict";m();rk=class{logger;currentOrigin=null;currentOriginPattern=null;currentDestination=null;currentOriginHost=null;constructor(e){this.logger=e}getCurrentOrigin(){return this.currentOrigin}getCurrentDestination(){return this.currentDestination}clearMapping(){this.currentOrigin=null,this.currentOriginPattern=null,this.currentDestination=null,this.currentOriginHost=null,this.logger?.info("[UrlMapper] Mapping cleared")}setMapping(e,r){if(e.includes("*")||!e.startsWith("https://")&&!e.startsWith("http://")){this.currentOriginPattern=e,this.currentOriginHost=null,this.currentOrigin=e;try{let i=new URL(r);this.currentDestination=`${i.protocol}//${i.hostname}${i.port?":"+i.port:""}`}catch(i){this.logger?.error(`[UrlMapper] Failed to parse destination URL: ${qQe(i)}`),this.currentDestination=r}this.logger?.info(`[UrlMapper] Set mapping (PATTERN): ${e} \u2192 ${r}`)}else{this.currentOriginPattern=null;try{let i=new URL(e),o=i.protocol==="https:"?"443":"80",s=i.port||o;this.currentOriginHost=`${i.hostname}:${s}`,this.currentOrigin=`${i.protocol}//${i.hostname}${i.port?":"+i.port:""}`;let a=new URL(r);this.currentDestination=`${a.protocol}//${a.hostname}${a.port?":"+a.port:""}`,this.logger?.info(`[UrlMapper] Set mapping (EXACT): ${e} \u2192 ${r}`),this.logger?.debug(`[UrlMapper] Normalized origin: ${this.currentOrigin} (host: ${this.currentOriginHost})`),this.logger?.debug(`[UrlMapper] Normalized destination: ${this.currentDestination}`)}catch(i){this.logger?.error(`[UrlMapper] Failed to parse origin/destination URL: ${qQe(i)}`),this.currentOriginHost=null,this.currentOrigin=e,this.currentDestination=r}}}getUpstream(e){if(!this.currentDestination)return null;if(this.currentOriginPattern){let r=this.currentOriginPattern.replace(/^https?:\/\//g,""),n=r.split(":")[0],i=e.split(":")[0];return BQ(i,n)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched hostname: ${n} -> ${this.currentDestination}`),this.currentDestination):BQ(e,r)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched host: ${r} -> ${this.currentDestination}`),this.currentDestination):(this.logger?.debug(`[UrlMapper] NO PATTERN MATCH getUpstream(${e}) !== ${r}`),null)}return this.currentOriginHost?BQ(e,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) -> ${this.currentDestination}`),this.currentDestination):BQ(`${e}:80`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (HTTP) -> ${this.currentDestination}`),this.currentDestination):BQ(`${e}:443`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (TLS) -> ${this.currentDestination}`),this.currentDestination):(this.logger?.debug(`[UrlMapper] NO MATCH getUpstream(${e}) !== ${this.currentOriginHost}`),null):null}buildUpstreamUrl(e,r="/"){let n=r||"/";n=n.replace(/^\/+/,"/");let i=new URL(n,e),o=new URL(e);return o.pathname=i.pathname.replace(/\/+/g,"/"),o.search=i.search,o.hash=i.hash,o}mapUrl(e){let r=e.host,n=this.getUpstream(r);if(!n)return e;let i=e.pathname+e.search+e.hash;return this.buildUpstreamUrl(n,i)}isOriginHttps(e=443){let r=this.currentOrigin?.split("://")[0];return r==="http"||r==="https"?r==="https":e===443}}});var zQe,Ipt,fj,WQe=N(()=>{"use strict";m();zQe=W(require("node:os"),1);Gt();Ipt=ke("Priority"),fj=(t,e)=>{try{zQe.default.setPriority(t,e)}catch(r){Ipt.error(`Failed to set priority to ${e}: ${r}`)}}});function ZQe(t){Cj=t}async function $h(){if(Cj){if(mj){hj=!0;return}mj=!0;try{await Cj()}finally{mj=!1,hj&&(hj=!1,$h())}}}var Cj,mj,hj,Ij=N(()=>{"use strict";m();mj=!1,hj=!1});async function*Ept(t){for await(let e of rm(t.body))if(e.length)try{yield JSON.parse(e)}catch{}}function Bpt(t){t.toolContext.session.sendMessage({userPrompt:Kue({originChannelId:t.originChannelId,senderDisplayName:t.senderDisplayName,projectId:t.projectId,branchName:t.branchName,content:t.content}),category:"background-subagent",user:{...t.toolContext.user,role:"agent",source:"builder.io"},queue:!0})}function ypt(t,e){return e??("builderUserId"in t.user?t.user.builderUserId:t.user.source==="builder.io"?t.user.userId:t.credentials.userId)}function XQe(t,e){let{credentials:r}=t,{project_id:n,message:i}=e,o,s=new Promise(g=>o=g),a=!1,A,c,u,l;return(async()=>{let g=new URL("/projects/branch",Pe);g.searchParams.set("apiKey",r.builderPublicKey);let p=ypt(t,e.builder_user_id);p&&g.searchParams.set("userId",p);let f=e.model&&e.model!=="auto"?Ll(e.model):void 0,h=e.attachment_urls?.map(y=>({type:"url",value:y})),C=e.origin_channel_id??t.user.channelId,I={projectId:n,userMessage:{userPrompt:i,user:{...t.user,channelId:C,role:"user"},...e.session_mode&&{sessionMode:e.session_mode},...f&&{modelOverride:f},...h?.length&&{attachments:h}},hidden:e.hidden,actor:"org-agent",metadata:{origin_channel_id:C}},B=await Me(g,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.builderPrivateKey}`},body:JSON.stringify(I)},t.debug);if(!B.ok){let y=await B.text();throw new Error(`Failed to spawn branch: ${y}`)}let E;for await(let y of Ept(B))if(y.type==="branch-created")E=y;else if(y.type==="error")E=y;else if(!a&&y.type==="setting-up-container")a=!0,c||(c=y.projectName),u||(u=y.branchFriendlyName??void 0),l||(l=y.branchName),o(y);else{let Q=Mue(y);Q&&(A=Q.plan)}if(!E)throw new Error("Stream ended unexpectedly");return E})().then(g=>{a||o(null);let p=c??g.projectName??n,f=u??l??g.branchName,h=`https://builder.io/app/projects/${n}/${l??g.branchName}`;if(g.type!=="error"){let C=`Branch \`${f}\` in \`${p}\` completed.
|
|
1988
1988
|
- Url: \`${h}\`
|
|
1989
1989
|
|
|
1990
1990
|
==================
|
|
@@ -2229,9 +2229,9 @@ Could not open browser automatically.`),console.log(`Please open this URL manual
|
|
|
2229
2229
|
${t}
|
|
2230
2230
|
`)}}var bQ=N(()=>{"use strict";m();xDe()});async function uk(t,e,r){let n=t.isAbsolute(e)?e:t.resolve(t.cwd(),e),i=await t.readFile(n);if(!i)throw new Error(`Failed to read ${r} file: ${n}`);return j.info(`\u{1F4C4} Loaded ${r} from file: ${n}`),i}async function Gpt(t,e,r){let n=r.httpsServerFiles?.key,i=r.httpsServerFiles?.cert,o=r.httpsServerFiles?.ca,s={...r.httpsServerOptions,key:n?await uk(t,n,"key"):r.httpsServerOptions?.key,cert:i?await uk(t,i,"cert"):r.httpsServerOptions?.cert,ca:o?await uk(t,o,"ca"):r.httpsServerOptions?.ca},a=Object.fromEntries(Object.entries(s).filter(([A,c])=>c!==void 0));if(Object.keys(a).length!==0)return a}async function Cg(t,e){let r=t.cwd(),n=!!e.local||!e.projectId,i={workingDirectory:r,projectId:e.projectId,branchName:e.branchName,commitMode:"commits",mode:"init-and-launch",isLocal:n,allowedCommands:["npm *","pnpm *","yarn *","yarn","bun *","bun","gh *","wc *","gradle *","gradle","rg *","./gradlew *","./gradlew","vp *","vp","git *","export *","rails *","gem *","bundle *","rake *","echo *","cd *","find *","ls *","rm *","cp *","mv *","pwd","curl *","npx tsc *","head *","lsof *","kill *","ps *","tr *","awk *","cat *","grep *","sed *","tail *","touch *","mkdir *","tee *","true","uniq *","test *","false","npx *","sort *","env","dirname","basename *","realpath *","readlink *","stat *","file *","diff *","xargs *","chmod *","which *","whoami","uname *","uname","date","date *","printenv *","sleep *","netlify *","node *","tsx *","builderio *","builder *","open *","xcrun *","xcodebuild *","xcode-select *","xed *","agvtool *"]};if(e.configJson)try{let l=JSON.parse(e.configJson);i=Object.assign({},i,l),i.isLocal?n=!0:i.projectId&&(n=!1,i.isLocal=!1)}catch(l){t.Sentry?.captureException(l)}else{let l=await FDe(t,e);if(l&&await t.exists(l))try{let d=await t.readFile(l);if(d){let g=JSON.parse(d);i=Object.assign({},i,g)}}catch(d){t.Sentry?.captureException(d)}}i.command&&(i.devCommand||(i.devCommand=i.command),delete i.command);let o=e.c||e.command,s=e.p||e.port,a=e.installCommand,A=e.serverUrl,c=e.interactive&&!e.configJson&&!e.fusionInit&&n&&!e.chat;if(A)c=!1,i.serverUrl=A,o||(i.devCommand="");else if(o&&s){c=!1;let l="http://localhost";if(i.serverUrl)try{let d=new URL(i.serverUrl);l=`${d.protocol}//${d.hostname}`}catch{l="http://localhost"}i.serverUrl=`${l}:${s}`,i.devCommand=o}else o&&i.autoDetectDevServer&&(c=!1,i.devCommand=o);if(o&&s&&(c=!1),s&&!A&&(i.serverUrl=`http://localhost:${s}`),a&&(i.setupCommand=a),o&&(i.devCommand=o),o&&!i.serverUrl&&(i.autoDetectDevServer=!0,i.autoSuggestPort=!0),typeof e.authenticateProxy=="boolean"&&(i.authenticateProxy=e.authenticateProxy),typeof e.privacyMode=="boolean"&&e.privacyMode&&(i.privacyMode=Object.assign({},i.privacyMode,{enabled:!0})),typeof e.autoDetectDevServer=="boolean"&&(i.autoDetectDevServer=e.autoDetectDevServer),typeof e.https=="boolean"&&(i.https=e.https),e.localHttpsDomain&&(i.localHttpsDomain=e.localHttpsDomain),typeof e.nativeApp=="boolean"&&(i.nativeApp=e.nativeApp),e.disabledTools){let l=e.disabledTools.split(",").map(d=>d.trim());i.disabledTools=l}if(i.httpsServerOptions=await Gpt(t,e,i),c&&!e.chat){if(!i.devCommand){let l=await xr({message:"Enter the command to run for the dev server (e.g. 'npm run dev')",placeholder:"npm run dev",validate:d=>{if(d.trim()===""||d.length===0)return"Command cannot be empty"}});if(Xe(l))return qe("Goodbye! \u{1F44B}"),await(0,$j.exit)(1);i.devCommand=l}if(!i.serverUrl){let l=await xr({message:"Enter the dev server URL to proxy to (e.g. http://localhost:3000)",placeholder:"http://localhost:3000",validate:g=>{let p=g.trim();if(!p)return"Dev server URL cannot be empty";if(/^\d+$/.test(p)){let f=Number(p);return f<0||f>65535?"Invalid port number, must be between 0 and 65535":void 0}try{new URL(p)}catch{return"Enter a valid URL or port number"}}});if(Xe(l))return qe("Goodbye! \u{1F44B}"),await(0,$j.exit)(1);let d=l.trim();/^\d+$/.test(d)?i.serverUrl=`http://localhost:${d}`:i.serverUrl=new URL(d).href}await Jj(t,i,e)}if(e.sessionId&&(i.sessionId=e.sessionId),typeof i.fusionServerPort=="string"){let l=parseInt(i.fusionServerPort);if(!isNaN(l))i.fusionServerPort=l;else throw new Error(`Invalid fusionServerPort: ${i.fusionServerPort}. Expected a number between 0 and 65535, got "${i.fusionServerPort}".`)}let u=i.privacyMode?.encryptionKeyPath;if(u&&i.privacyMode)try{let d=(await uk(t,u,"encryption key")).trim();i.privacyMode.encryptKey=d,delete i.privacyMode.encryptionKeyPath}catch(l){let d=new Error(`Failed to load encryption key from path: ${u}`,{cause:l});throw t.Sentry?.captureException(d),j.warn(d.message),d}return i}async function Jj(t,e,r){let n=await FDe(t,r);await t.writeFile(n,JSON.stringify(Kpt(e,"workingDirectory","projectId","authenticateProxy","privacyMode"),null,2))}function kDe(t,e){let r=Pv(e);t.Sentry?.setTag("isLocal",r.isLocal),t.Sentry?.setTag("commitMode",r.commitMode),t.Sentry?.setTag("pvcCreationSource",r.pvcCreationSource??"unknown"),t.Sentry?.setTag("snapshot",r.syncBranch?"true":"false");let n=r.workspace?.folders.find(i=>i.enableGit)?.originalRepoUrl;if(n){let i=FE.some(o=>n.endsWith(o))?n:"custom-repo";t.Sentry?.setTag("repoUrl",i)}t.Sentry?.setContext("fusionConfig",{...r}),t.Sentry?.getCurrentScope().setContext("fusionConfig",{...r})}var $j,FDe,Kpt,vQ=N(()=>{"use strict";m();Js();Cr();$j=require("process");vm();FDe=async(t,e)=>{if(e.configPath){let A=t.resolve(t.cwd(),e.configPath);if(await t.exists(A))return A;throw new Error(`Fusion config file not found: ${A}`)}let r=["builder.config.json","fusion.config.json"],n=t.cwd(),i=t.join(n,r[0]),o=t.join(n,r[1]),s=await t.exists(i),a=await t.exists(o);if(s&&a)throw new Error(`Both builder.config.json and fusion.config.json were found in your project.
|
|
2231
2231
|
Please use only builder.config.json and remove fusion.config.json.
|
|
2232
|
-
You can migrate any settings from fusion.config.json to builder.config.json before removing it.`);for(let A of r){let c=t.join(n,A);if(await t.exists(c))return c}return t.join(n,r[0])},Kpt=(t,...e)=>{let r={};if(t&&typeof t=="object")for(let n in t)(!t.hasOwnProperty||t.hasOwnProperty(n))&&(e.includes(n)||(r[n]=t[n]));return r}});async function qh(t,e={}){let r=new URL("/design-systems/v1",
|
|
2232
|
+
You can migrate any settings from fusion.config.json to builder.config.json before removing it.`);for(let A of r){let c=t.join(n,A);if(await t.exists(c))return c}return t.join(n,r[0])},Kpt=(t,...e)=>{let r={};if(t&&typeof t=="object")for(let n in t)(!t.hasOwnProperty||t.hasOwnProperty(n))&&(e.includes(n)||(r[n]=t[n]));return r}});async function qh(t,e={}){let r=new URL("/design-systems/v1",Pe);r.searchParams.set("apiKey",t.builderPublicKey),r.searchParams.set("userId",t.userId),e.includeGlobalScopeDesignSystems&&r.searchParams.set("includeGlobalScopeDesignSystems","true"),e.includeDocumentCount&&r.searchParams.set("includeDocumentCount","true");let n=await Me(r,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`}});if(!n.ok)return[];let i=await n.json()??[];return e.onlyEditAccess?i.filter(o=>o.spaceId===t.builderPublicKey):i}var jj,RDe,Yj,qj,Yh,SQ,lk,Vj,Hpt,$pt,Jpt,zj,NDe,ts,ga,jpt,TDe,MDe,PDe,Wj,_De,dc=N(()=>{"use strict";m();ji();Hh();jj=W(require("@sentry/node"),1);Gt();un();Zr();Jr();Vi();Cr();RDe=require("node:path"),Yj=ke("RepoIndexing"),qj="AGENTS.md",Yh="icons.mdx",SQ="tokens.mdx",lk="installation.md",Vj="repo-indexing",Hpt=[{value:"space",label:"Space",hint:"Available to all applications in your current space"}],$pt=[{value:"organization",label:"Organization",hint:"Available to all applications in your organization"}],Jpt=[{value:"global",label:"Global",hint:"Available to all applications in the Builder platform"}],zj=async(t,e,r)=>{if(!t.userId)throw new Error("User ID is required");let i=e?.isAdminInOrganization,o=e?.email?.includes("@builder.io"),s=[...Hpt];if((i||o)&&s.push(...$pt),o&&s.push(...Jpt),s.length===1)return s[0].value;if(r){if(!s.some(c=>c.value===r))throw new Error(`You don't have permission to use the scope "${r}"`);return r}let a=await Ji({message:"What is your design system scope?",options:s});if(!Xe(a))return a},NDe=async(t,e)=>{try{let r=t.getAppRootDir(),n=await Sa(t,r);if(!n)return{name:void 0,version:void 0};let i=e??n.name,o;if(e){let s=n.dependencies?.[e]||n.devDependencies?.[e];o=s?.replace(/^[\^~>=<]+/,"")||s}else o=n.version;return{name:i,version:o}}catch(r){return Yj.error("Error parsing design system",r,{loggerOptions:{debug:!0}}),{name:void 0,version:void 0}}},ts=async(t,e,r)=>{try{let n=new URL("/mappings/store-component-docs",Pe);n.searchParams.set("apiKey",t.builderPublicKey),n.searchParams.set("userId",t.userId);let i=await Me(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e)});if(!i.ok){let o=await i.text();throw Yj.error("API request failed:",i.status,o,{loggerOptions:{debug:!0}}),new Error(`Failed to store component group: ${i.status} ${o}`)}return await i.json()}catch(n){throw n}},ga=async(t,e,r,n,i,o,s,a={},A)=>{let{maxTokens:c,retriesAllowed:u=0,expectFile:l="tool",include:d,exclude:g,instructions:p,privacyMode:f}=a,h=null,C=l==="tool"?{...t,writeFile:async(E,y)=>(h=typeof y=="string"?y:y.toString(),Promise.resolve())}:t,B={accessControl:jpt(d,g),workingDirectory:t.cwd(),...s&&{workspace:s}};o&&!(0,RDe.isAbsolute)(o)&&B.accessControl?.entries?.push({action:"allow",resource:`**/node_modules/${o}/**/*`,permissions:["list","read"]},{action:"allow",resource:`!**/node_modules/${o}/node_modules/**/*`,permissions:["list"]},{action:"deny",resource:`**/node_modules/${o}/node_modules`,permissions:["list","read","write"]});try{let E=new AA({maxTokens:c,sys:C,credentials:e,position:"repo-indexing",mode:"quality-v4",sessionOrCompletionId:r,...o&&!o.startsWith("/")&&{workingDirectory:`node_modules/${o}`},fusionConfig:B,privacyMode:f,builtInCustomInstructions:p?[{id:"repo-indexing-instructions",name:"repo-indexing-instructions",type:"always",content:p}]:void 0,enabledTools:["Read","Write","Glob","Bash","Grep","ReadRule","TodoRead","TodoWrite"],...A&&{metadata:A}});i&&E.setDebug(i),await E.initializeSession({skipSessionLoading:!0});let y=E.connectToEventLoop(!1,async Q=>{Q.type==="error"&&Yj.error(Q.message,{loggerOptions:{debug:!0}})});try{await E.sendMessage(n),await E.waitUntilIdle()}finally{y(),await E.close()}if(l!=="tool"){let Q=t.join(t.cwd(),l);if(await t.exists(Q)){h=await t.readFile(Q);try{await t.unlink(Q)}catch(D){jj.captureException(D,{extra:{expectedFile:l,expectedFilePath:Q}})}}}if(!h){let Q=jj.captureException(new zt("Repo indexing failed: No essential files were written"),{tags:{...a?.tags,sessionId:r}});throw new zt(`Sorry, we ran into a problem when indexing your components.
|
|
2233
2233
|
Session ID: ${r}.
|
|
2234
|
-
Please try again. If the issue persists, please contact support@builder.io. and provide the error ID: ${Q}`)}return h}catch(E){if(u===0)throw E;return ga(t,e,r,n,i,o,s,{...a,retriesAllowed:u-1},A)}},jpt=(t,e)=>{let r=t?(Array.isArray(t)?t:[t]).map(s=>s.trim()).filter(s=>s.length>0):[],n=e?(Array.isArray(e)?e:[e]).map(s=>s.trim()).filter(s=>s.length>0):[],i=[];i.push({action:"deny",resource:"*.mapper.tsx",description:"Do not index mapper files.",permissions:["read","write","list"]});for(let s of n)i.push({action:"deny",resource:s,description:"Excluded by --exclude flag.",permissions:["read","write","list"]});if(r.length>0){i.push({action:"allow",resource:".",permissions:["read","list"]});for(let s of r)i.push({action:"allow",resource:s,description:"Included by --include flag.",permissions:["read","list"]})}else i.push({action:"allow",resource:".",permissions:["read","list"]}),i.push({action:"allow",resource:"**/*",permissions:["read","list"]});i.push({action:"allow",resource:qj,permissions:["write"]},{action:"allow",resource:"**/repo-indexing/*.mdx",permissions:["write"]},{action:"allow",resource:"component-groups.json",permissions:["write"]},{action:"allow",resource:".icon_discovery_staging/**/*",permissions:["write"]},{action:"allow",resource:".token_discovery_staging/**/*",permissions:["write"]},{action:"allow",resource:"installation.json",permissions:["write"]});let o="You can read all files, but you can only write AGENTS.md, component-groups.json, icons.json, installation.json, .icon_discovery_staging/**/* and repo-indexing/*.mdx.";return r.length>0&&(o=`You can only read files matching these patterns: ${r.join(", ")}. You can only write AGENTS.md, component-groups.json, icons.json, installation.json, .icon_discovery_staging/**/* and repo-indexing/*.mdx.`),n.length>0&&(o+=` Excluded patterns: ${n.join(", ")}.`),{denyDescription:o,entries:i}};TDe=(t,e)=>e.find(r=>r.designSystemName===t)||null,MDe=(t,e,r,n)=>n&&n.find(i=>i.designSystemName===e&&i.scope===r)||null,PDe=async(t,e)=>{let r=new URL("/design-systems/v1",
|
|
2234
|
+
Please try again. If the issue persists, please contact support@builder.io. and provide the error ID: ${Q}`)}return h}catch(E){if(u===0)throw E;return ga(t,e,r,n,i,o,s,{...a,retriesAllowed:u-1},A)}},jpt=(t,e)=>{let r=t?(Array.isArray(t)?t:[t]).map(s=>s.trim()).filter(s=>s.length>0):[],n=e?(Array.isArray(e)?e:[e]).map(s=>s.trim()).filter(s=>s.length>0):[],i=[];i.push({action:"deny",resource:"*.mapper.tsx",description:"Do not index mapper files.",permissions:["read","write","list"]});for(let s of n)i.push({action:"deny",resource:s,description:"Excluded by --exclude flag.",permissions:["read","write","list"]});if(r.length>0){i.push({action:"allow",resource:".",permissions:["read","list"]});for(let s of r)i.push({action:"allow",resource:s,description:"Included by --include flag.",permissions:["read","list"]})}else i.push({action:"allow",resource:".",permissions:["read","list"]}),i.push({action:"allow",resource:"**/*",permissions:["read","list"]});i.push({action:"allow",resource:qj,permissions:["write"]},{action:"allow",resource:"**/repo-indexing/*.mdx",permissions:["write"]},{action:"allow",resource:"component-groups.json",permissions:["write"]},{action:"allow",resource:".icon_discovery_staging/**/*",permissions:["write"]},{action:"allow",resource:".token_discovery_staging/**/*",permissions:["write"]},{action:"allow",resource:"installation.json",permissions:["write"]});let o="You can read all files, but you can only write AGENTS.md, component-groups.json, icons.json, installation.json, .icon_discovery_staging/**/* and repo-indexing/*.mdx.";return r.length>0&&(o=`You can only read files matching these patterns: ${r.join(", ")}. You can only write AGENTS.md, component-groups.json, icons.json, installation.json, .icon_discovery_staging/**/* and repo-indexing/*.mdx.`),n.length>0&&(o+=` Excluded patterns: ${n.join(", ")}.`),{denyDescription:o,entries:i}};TDe=(t,e)=>e.find(r=>r.designSystemName===t)||null,MDe=(t,e,r,n)=>n&&n.find(i=>i.designSystemName===e&&i.scope===r)||null,PDe=async(t,e)=>{let r=new URL("/design-systems/v1",Pe);r.searchParams.set("apiKey",t.builderPublicKey),r.searchParams.set("userId",t.userId);let n=await Me(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e)});if(!n.ok){let s=(await n.json()).message||"Failed to add design system";throw new Error(s)}return(await n.json()).id},Wj=async(t,e)=>{let r=new URL(`/design-systems/v1/${e.id}`,Pe);r.searchParams.set("apiKey",t.builderPublicKey),r.searchParams.set("userId",t.userId);let n=await Me(r,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e)});if(!n.ok)throw new Error("Failed to update design system");return await n.json()},_De=async t=>{let e=t.join(t.getAppRootDir(),Vj);try{return await t.exists(e)?(await t.readdir(e)).filter(o=>o.endsWith(".mdx")||o.endsWith(".md")).length>0:!1}catch{return!1}}});async function Ypt(t,e){let r="please, enter your own prompt",n=t.getCurrentState(),i=t.getLastApplyResultsTurn();switch(n){case"initial-with-url":{let o='e.g., "add a new contact page", "update the card component", "add a header to the layout of the app"',s=await xr({message:`Describe how the design integrates into your codebase: ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:o,validate(a){if(a.length===0||a===o)return"please, enter a detailed instruction";if(a.length<10)return"a more detailed instruction is needed"}});return Xe(s)?{command:"exit",userPrompt:void 0,feedback:void 0}:{command:void 0,userPrompt:s??"integrate design into the app, might be a new page/component/layout depending on the design",feedback:void 0}}case"initial-without-url":{let o='e.g., "add a new page", "add a new component", "update the button component"',s=await xr({message:`What do you want to do? ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:o,validate(a){if(a.length===0||a===o)return r}});return Xe(s)?{command:"exit",userPrompt:void 0,feedback:void 0}:{command:void 0,userPrompt:s??"integrate design into the app, might be a new page/component/layout depending on the design",feedback:void 0}}case"abort":{let o='e.g., "make sure to keep X, while removing Y"',s=await xr({message:`Okey! what do you want to do? ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:o,validate(a){if(a.length===0||a===o)return r}});return Xe(s)?(await t.acceptCode(),{command:"exit",userPrompt:void 0,feedback:void 0}):{command:void 0,userPrompt:s??"integrate design into the app, might be a new page/component/layout depending on the design",feedback:void 0}}case"error":{let o="Press Enter to retry or prompt how to proceed",s=await xr({message:`Mmmh! something went wrong, let's try again: ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:o,validate:void 0});if(Xe(s))return await t.acceptCode(),{command:"exit",userPrompt:void 0,feedback:void 0};let a=s?.trim();return!a||a.length===0||a===o?{command:void 0,userPrompt:"Retry the last failed instruction/command and continue if successful",feedback:void 0}:{command:void 0,userPrompt:a,feedback:void 0}}case"success":{let o='e.g., "Plan, search, build"';if(!i?.applyResults.length){if(e.accept)return await t.acceptCode(),{command:"exit",userPrompt:void 0,feedback:void 0};let a=await xr({message:">",placeholder:o,validate(A){if(A.length===0||A===o)return r}});return Xe(a)?(await t.acceptCode(),{command:"exit",userPrompt:void 0,feedback:void 0}):{command:void 0,userPrompt:a??"integrate design into the app, might be a new page/component/layout depending on the design",feedback:void 0}}let s=t.lastTurnHasChanges()?e.accept?"good":await Ji({message:`What do you want to do next? ${(0,ft.dim)("or Ctrl+C to exit")}`,options:[{value:"good",label:"\u{1F44D} Accept and Continue",hint:"you will be able to keep prompting for more changes"},{value:"bad",label:"\u{1F44E} Refine",hint:"something went wrong, but I wanna refine instead of a complete undo"},{value:"undo",label:"\u23EE\uFE0F Undo last changes",hint:"want to revert the last changes"}]}):"continue";if(Xe(s))return await t.acceptCode(),{command:"exit",userPrompt:void 0,feedback:void 0};if(s==="continue"){let a='e.g., "implement the new page"',A=await xr({message:`What else can I do for you? ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:a,validate(c){if(!c||c===a)return"Ctrl+C to exit"}});return Xe(A)?(await t.acceptCode(),{feedback:void 0,command:"exit",userPrompt:void 0}):{command:void 0,userPrompt:A,feedback:void 0}}if(s==="good"){if(t.sendFeedback({feedbackSentiment:"positive"}),e.accept)return await t.acceptCode(),{feedback:"positive",command:"exit",userPrompt:void 0};let a='e.g., "Make it mobile-friendly", "Add form validation", "add docs"',A=await xr({message:`Describe any additional improvements: ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:a,validate(c){if(!c||c===a)return"Ctrl+C to exit"}});return Xe(A)?(await t.acceptCode(),{feedback:"positive",command:"exit",userPrompt:void 0}):{userPrompt:A,feedback:"positive",command:void 0}}if(s==="bad"){t.sendFeedback({feedbackSentiment:"negative"});let a=`e.g., "code seems to be broken", "i can't see the page"`,A=await xr({message:`What went wrong? Please be more detailed this time ${(0,ft.dim)("or Ctrl+C to exit")}`,placeholder:a,validate(c){if(!c||c===a)return"Ctrl+C to exit"}});return Xe(A)?(await t.acceptCode(),{command:"exit",userPrompt:void 0,feedback:void 0}):(t.sendFeedback({feedbackSentiment:"negative",feedbackText:A}),{feedback:"negative",userPrompt:`Last changes were not good, here's my feedback:
|
|
2235
2235
|
${A}
|
|
2236
2236
|
Notice that previously changes were already applied, any patch goes on top the previous changes.`,command:void 0})}if(s==="undo"){t.sendFeedback({feedbackSentiment:"undo"});let{undone:a}=await t.undoLastUserMessage();a&&a.length>0&&j.warn(`Restored files to previous state:
|
|
2237
2237
|
|
|
@@ -2272,7 +2272,7 @@ ${Zj(v2(I.result.content).trim(),ft.red,"")}`):j.info(`${I.result.title?I.result
|
|
|
2272
2272
|
|
|
2273
2273
|
${Zj(v2(I.result.content).trim(),ft.green,"",15)}`);break}case"error":{if(I.stopReason==="limit"){await Wt("code generation",{spaceId:r.builderPublicKey,cli:!0,error:"rate limit reached"});let B=I.message??"The request was cancelled because it reached the account limits. Please upgrade your plan.";j.error((0,ft.red)("\u{1F6A8} "+B));let E=new URL("https://builder.io/account/subscription");E.searchParams.set("space_id",r.builderPublicKey),await Vr({message:(0,ft.dim)(E.href),active:"Open subscription page",inactive:"Exit"})&&await hg(E.href),await Ke(1)}else if(I.code==="ask-to-continue")if(g&&(g.stop(),g=void 0),await Vr({message:I.message||"The agent has been working for a while. Do you want to continue?",active:"Yes, continue",inactive:"No, stop here"}))await a.sendMessage({userPrompt:"",displayPrompt:"Continue!",isManualContinue:!0,user:{source:"agent",role:"agent"},queue:!0});else{j.info("Code generation stopped by user.");break}else await Wt("code generation",{spaceId:r.builderPublicKey,cli:!0,error:I.message}),j.error(I.message),await Ke(1);break}case"done":{p&&(p[1](`
|
|
2274
2274
|
`),p[2](),p=void 0),g&&(g.stop(),g=void 0),I.usage&&I.usage.total/I.usage.limits.aiGeneration>.5&&j.info(Wpt(I.usage.total,I.usage.limits.aiGeneration)),I.applyResults.length>0&&j.success(Zpt(I.applyResults));break}case"continue":{g&&(g.stop("All changes applied"),g=void 0);break}default:if(g){if(I.type==="stdio")break;g.stop(),g=void 0}}});await a.waitForEventLoop(),C(),d(),await zpt(a),await Ke(0)};LDe=`
|
|
2275
|
-
`+(0,ft.dim)("ESC to interrupt"),GDe=/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g});function tdt(t){let e=t.match(/\/app\/projects\/([^/]+)\/([^/]+)/);return e?{projectId:e[1],branchName:e[2]}:null}function xu(t){if(!t.includes("://")&&!t.startsWith("http"))return null;let e;try{e=new URL(t)}catch{return null}if(!e.hostname.endsWith("builder.io"))return null;let r=tdt(e.pathname);if(!r)throw new Error(`Malformed Builder URL: "${t}". Expected format: https://builder.io/app/projects/<projectId>/<branchName>`);return r}var xQ=N(()=>{"use strict";m()});function odt(t){let e=t.split("/");for(let i of e)if(rdt.has(i))return!1;let r=e[e.length-1];if(ndt.has(r))return!1;let n=r.includes(".")?"."+r.split(".").pop():"";return idt.has(n.toLowerCase())}async function kQ(t){let{projectId:e,branchName:r,apiKey:n,authHeaders:i,userId:o}=t,s=await
|
|
2275
|
+
`+(0,ft.dim)("ESC to interrupt"),GDe=/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g});function tdt(t){let e=t.match(/\/app\/projects\/([^/]+)\/([^/]+)/);return e?{projectId:e[1],branchName:e[2]}:null}function xu(t){if(!t.includes("://")&&!t.startsWith("http"))return null;let e;try{e=new URL(t)}catch{return null}if(!e.hostname.endsWith("builder.io"))return null;let r=tdt(e.pathname);if(!r)throw new Error(`Malformed Builder URL: "${t}". Expected format: https://builder.io/app/projects/<projectId>/<branchName>`);return r}var xQ=N(()=>{"use strict";m()});function odt(t){let e=t.split("/");for(let i of e)if(rdt.has(i))return!1;let r=e[e.length-1];if(ndt.has(r))return!1;let n=r.includes(".")?"."+r.split(".").pop():"";return idt.has(n.toLowerCase())}async function kQ(t){let{projectId:e,branchName:r,apiKey:n,authHeaders:i,userId:o}=t,s=await Me(new URL(`${Pe}/projects/branch/chat-history?apiKey=${n}&userId=${o??""}`),{method:"POST",headers:i,body:JSON.stringify({projectId:e,branchName:r})});return s.ok?(await s.json()).conversation:[]}async function RQ(t){let{projectId:e,branchName:r,apiKey:n,authHeaders:i,userId:o,showLogs:s=!0}=t,a=r.replace(/[/\\]/g,"-"),A=vi(cA.default.join(process.cwd(),".builder","prototypes")),c=vi(cA.default.join(A,`${e}:${a}`)),u=vi(cA.default.join(c,"code")),l;s&&(l=To()),s&&l.start("Fetching bundle...");let[d,g]=await Promise.all([Me(new URL(`${Pe}/projects/branch/bundle-download-url?apiKey=${n}&userId=${o??""}`),{method:"POST",headers:i,body:JSON.stringify({projectId:e,branchName:r})}),Me(new URL(`${Pe}/projects/branches?apiKey=${n}&projectId=${e}&branchName=${encodeURIComponent(r)}`),{method:"GET",headers:i})]);if(!d.ok){s&&(l.stop("Failed to get bundle URL"),j.error(await d.text().catch(()=>d.statusText)));return}if(!g.ok){s&&(l.stop("Failed to resolve branch"),j.error(await g.text().catch(()=>g.statusText)));return}let{signedUrl:p,partial:f}=await d.json(),C=(await g.json()).branch,I=C.gitAiBranch??C.backup?.gitBranchName??Object.values(C.backups??{})[0]?.gitBranchName,B;try{B=await Me(p)}catch(S){s&&(l.stop("Failed to download bundle"),j.error(`Bundle download failed: ${S instanceof Error?S.message:String(S)}`));return}if(!B.ok){s&&(l.stop("Failed to download bundle"),j.error(`Bundle download failed: ${B.statusText}`));return}let E=Fu.default.mkdtempSync(cA.default.join(YDe.default.tmpdir(),"builder-prototype-")),y=cA.default.join(E,"repo.bundle"),Q=cA.default.join(E,"repo"),w=await B.arrayBuffer();if(!Buffer.from(w.slice(0,20)).toString("utf8").startsWith("# v")){s&&(l.stop("Invalid bundle"),j.error("Downloaded file is not a git bundle. The backup may not exist yet for this branch."));return}Fu.default.writeFileSync(y,new Uint8Array(w));let x=I??"main";try{if(f){await FQ("git",["init",Q],{cwd:E});let{stdout:S}=await FQ("git",["-C",Q,"bundle","unbundle",y],{cwd:E}),P=S.trim().split(/\s+/)[0];if(P)await FQ("git",["-C",Q,"checkout",P],{cwd:E});else throw new Error("Bundle produced no refs \u2014 it may be empty or corrupt")}else await FQ("git",["clone","--branch",x,y,Q],{cwd:E})}catch(S){s&&(l.stop("Failed to extract bundle"),j.error(`Could not extract git bundle: ${S}`)),Fu.default.rmSync(E,{recursive:!0,force:!0});return}let{stdout:v}=await FQ("git",["ls-files"],{cwd:Q});Fu.default.mkdirSync(u,{recursive:!0});for(let S of v.trim().split(`
|
|
2276
2276
|
`).filter(Boolean))if(odt(S))try{let P=cA.default.join(Q,S),Y=cA.default.join(u,S);Fu.default.mkdirSync(cA.default.dirname(Y),{recursive:!0}),Fu.default.copyFileSync(P,Y)}catch{}return s&&l.stop(`Files saved to ${u}`),Fu.default.rmSync(E,{recursive:!0,force:!0}),{projectDir:u,prototypesRoot:A,apiKey:n}}async function HDe(t,e){let r=e.prototype;if(!r){j.error("Please provide a prototype URL: --prototype https://builder.io/app/projects/<projectId>/<branchName>");return}let n=xu(r);if(!n){j.error(`Invalid prototype URL: ${r}
|
|
2277
2277
|
Expected format: https://builder.io/app/projects/<projectId>/<branchName>`);return}console.log(""),Br((0,Ig.bgCyan)((0,Ig.bold)((0,Ig.white)(" prototype ")))+" "+(0,Ig.dim)(xt));let{projectId:i,branchName:o}=n,s=await mr(t,e,{builderPrivateKey:!0,builderPublicKey:!0});if(!s.builderPublicKey){j.error("No space ID found. Run 'builder login' first.");return}let a=s.builderPublicKey,A={"Content-Type":"application/json",Authorization:`Bearer ${s.builderPrivateKey}`},[c,u]=await Promise.all([RQ({projectId:i,branchName:o,apiKey:a,authHeaders:A,userId:s.userId}),kQ({projectId:i,branchName:o,apiKey:a,authHeaders:A,userId:s.userId}).catch(()=>[])]);if(!c)return;let l=e.prompt?.trim()||await adt();if(!l)return;let d=cA.default.relative(process.cwd(),c.projectDir);e.prompt=sdt(d,u,l),e.spaceId=a;let g=()=>Fu.default.rmSync(c.prototypesRoot,{recursive:!0,force:!0});process.on("exit",g),process.on("SIGINT",g),process.on("SIGTERM",g),process.on("uncaughtException",g),process.on("unhandledRejection",g),await pk(t,e)}function t6(t){return t.length===0?"No conversation history available.":t.map((e,r)=>`### ${e.title?`**${e.title}**`:`Message ${r+1}`}
|
|
2278
2278
|
${e.userPrompt}`).join(`
|
|
@@ -2395,7 +2395,7 @@ ${zA(r??"",500)}
|
|
|
2395
2395
|
|
|
2396
2396
|
${n||""}`,title:"Configuration Proposed"}}async function Ddt(t,e){let{field:r,value:n,reason:i}=e;if(!r)return{isError:!0,toolResult:"UpdateSetupValue requires a field",title:"UpdateSetupValue Error"};if(r==="environmentVariables"){if(!n?.environmentVariables||n.environmentVariables.length===0)return{isError:!0,toolResult:"UpdateSetupValue with field 'environmentVariables' requires a non-empty environmentVariables array in value",title:"UpdateSetupValue Error"};if(n.environmentVariables.some(s=>!s.key?.trim()))return{isError:!0,toolResult:"Each environment variable must have a non-empty 'key' field",title:"UpdateSetupValue Error"}}else if(!n?.command)return{isError:!0,toolResult:"UpdateSetupValue requires value.command for this field",title:"UpdateSetupValue Error"};return t.emitter.emit("step",{type:"update_setup_value",field:r,value:n,reason:i}),{isError:!1,toolResult:`${r==="environmentVariables"?`Updated ${r} with ${n.environmentVariables.length} variable(s)`:`Updated ${r} to: ${n.command}`}${i?` (${i})`:""}. The value will be automatically applied and validation will re-run.`,title:"Setup Value Updated"}}async function wdt(t,e){let{state:r,summary:n,questions:i}=e,{devServerOrchestrator:o,credentials:s,sys:a}=t;if(!r)return{isError:!0,toolResult:"Exit requires a 'state' parameter (verified | no-frontend | empty-project | user-question | other)",title:"Exit Error"};if(!n)return{isError:!0,toolResult:"Exit requires a summary parameter",title:"Exit Error"};let A=!o?.setupCommand&&(o?.setupDependencies?.length??0)===0,c={setupCommand:{value:void 0,verified:!1},setupDependencies:{value:void 0,verified:!1},devCommand:{value:void 0,verified:!1},devServer:{value:void 0,verified:!1},validateCommand:{value:void 0,verified:!1},appOrigin:{value:void 0,verified:!1},defaultOrigin:{value:void 0,verified:!1},environmentVariables:{value:void 0,verified:!1},autoDetectDevServer:{value:void 0,verified:!1},autoDetectDevServerPatterns:{value:void 0,verified:!1},hasHotModuleReload:{value:void 0,reason:void 0}},u={setupState:"not-installed",devState:"unset",httpServerState:"stopped",validateState:"unset"},l=t.session.getMetadata();if(o){let C=o.setupState,I=o.devState,B=o.httpServerState.state,E=o.validateCommandState;u={setupState:C,devState:I,httpServerState:B,validateState:E};let y=A||C==="installed";c.setupCommand={value:o.setupCommand,verified:y,elapsed:l._setup_command_elapsed_ms},c.setupDependencies={value:o.setupDependencies,verified:y},c.devCommand={value:o.devCommand,verified:I==="running",elapsed:l._setup_dev_elapsed_ms},c.devServer={value:o.serverUrl?.href,verified:B==="ok-2xx"||B==="error-4xx"||B==="error-5xx",elapsed:l._setup_http_elapsed_ms},c.validateCommand={value:o.validateCommand,verified:E==="success",elapsed:l._setup_validation_elapsed_ms};let Q=l._setup_app_origin,w=l._setup_default_origin;c.appOrigin={value:Q||o.serverUrl?.origin,verified:B==="ok-2xx"&&!!Q},c.defaultOrigin={value:w,verified:!!w},c.environmentVariables={value:o.environmentVariables,verified:I==="running"},c.autoDetectDevServer={value:o.autoDetectDevServer,verified:!0},c.autoDetectDevServerPatterns={value:o.autoDetectDevServerPatterns,verified:!0}}let d=l._setup_has_hmr,g=l._setup_has_hmr_reason;if((d!==void 0||g!==void 0)&&(c.hasHotModuleReload={value:d,reason:g}),r==="verified"){let C=!c.setupCommand.value,I=c.setupCommand.verified||C,B=c.devCommand.verified,E=c.devServer.verified,y=c.validateCommand.verified,Q=[],w=[];if(I||(Q.push("Setup command is not verified"),w.push("Run VerifySetupCommand to verify the dependency installation works correctly")),B||(Q.push("Dev command is not verified"),w.push("Run VerifyDevCommand to verify the dev server starts successfully")),E||(Q.push("Dev server URL is not verified"),w.push("Run VerifyDevServer to verify the dev server URL is accessible")),Q.length>0)return{isError:!0,toolResult:["\u274C Cannot exit with 'verified' state - required verifications are missing:","",...Q.map(x=>` \u2022 ${x}`),"","\u{1F4CB} NEXT STEPS:",...w.map((x,v)=>` ${v+1}. ${x}`),"","Once all verifications pass, call Exit again with state='verified'.",y?"":"Tip: Run VerifyValidateCommand (optional but recommended) before exiting.","Or, if you're stuck and need user input, call Exit with state='user-question' and include specific questions."].join(`
|
|
2397
2397
|
`),title:"Exit Validation Failed"}}if(r==="no-frontend"){let C=c.setupCommand.verified,I=c.validateCommand.verified;if(!C||!I){let B=[],E=[];return C||(B.push(" \u2022 Setup command is not verified"),E.push("Run VerifySetupCommand to verify dependency installation works correctly")),I||(B.push(" \u2022 Validate command is not verified"),E.push("Run VerifyValidateCommand to verify the project builds/tests correctly")),{isError:!0,toolResult:["\u274C Cannot exit with 'no-frontend' state - required verifications missing:","",...B,"","\u{1F4CB} NEXT STEPS:",...E.map((Q,w)=>` ${w+1}. ${Q}`),"","Once all verifications pass, call Exit again with state='no-frontend'.","Note: If there is nothing at all to verify, exit with state='empty-project'."].join(`
|
|
2398
|
-
`),title:"Exit Validation Failed"}}}try{let C=t.fusionConfig?.projectId,I=t.fusionConfig?.branchName,B=t.fusionConfig?.sessionId;if(C&&I&&B){let E=t.fusionStatusMonitor?.getPeakUsage(),y={projectId:C,branchName:I,state:r,summary:n,questions:i||[],configuration:c,sessionId:B,orchestratorStates:u,peakDiskUsage:E?.peakDiskUsage,peakMemoryUsage:E?.peakMemoryUsage,screenshotUrl:l._setup_screenshot_url,isMonorepo:e.isMonorepo,isMicrofrontend:e.isMicrofrontend,setupNeedsCredentials:e.setupNeedsCredentials,devServerNeedsCredentials:e.devServerNeedsCredentials,projectDescription:e.projectDescription,needsVPN:e.needsVPN,autoReload:e.autoReload},Q=new URL(`${
|
|
2398
|
+
`),title:"Exit Validation Failed"}}}try{let C=t.fusionConfig?.projectId,I=t.fusionConfig?.branchName,B=t.fusionConfig?.sessionId;if(C&&I&&B){let E=t.fusionStatusMonitor?.getPeakUsage(),y={projectId:C,branchName:I,state:r,summary:n,questions:i||[],configuration:c,sessionId:B,orchestratorStates:u,peakDiskUsage:E?.peakDiskUsage,peakMemoryUsage:E?.peakMemoryUsage,screenshotUrl:l._setup_screenshot_url,isMonorepo:e.isMonorepo,isMicrofrontend:e.isMicrofrontend,setupNeedsCredentials:e.setupNeedsCredentials,devServerNeedsCredentials:e.devServerNeedsCredentials,projectDescription:e.projectDescription,needsVPN:e.needsVPN,autoReload:e.autoReload},Q=new URL(`${Pe}/projects/propose-config`);s.builderPublicKey&&Q.searchParams.set("apiKey",s.builderPublicKey),s.userId&&Q.searchParams.set("userId",s.userId);let w=await fetch(Q,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s?.builderPrivateKey||""}`},body:JSON.stringify(y)});if(!w.ok){let x=await w.text();throw new Error(`Failed to save configuration: ${x}`)}let D=await w.json();a.Sentry?.addBreadcrumb({message:"Proposed config saved",data:{proposedConfigId:D.proposedConfigId}})}}catch(C){a.Sentry?.captureException(C)}let p,f;switch(r){case"verified":p=A?`\u2705 Configuration complete! No dependencies need to be installed \u2014 dev server verified.
|
|
2399
2399
|
|
|
2400
2400
|
Summary: ${n}`:`\u2705 Configuration complete! All setup values verified.
|
|
2401
2401
|
|
|
@@ -2424,7 +2424,7 @@ ${c.question}`}).join(`
|
|
|
2424
2424
|
`),s=t.user,a=`I am currently waiting for user's input, however the user left the chat. Wonder if you can help me reach the right person to get an answer, here are the questions:
|
|
2425
2425
|
${o}
|
|
2426
2426
|
|
|
2427
|
-
${Zdt(s,r,n)}`;if((await t.session.sendMessageToOrgAgent({content:a,channelId:t.user.channelId,senderDisplayName:`Branch Agent (${t.projectId}/${t.branchName})`,senderType:"sub-agent",agentProjectId:t.projectId,agentBranchName:t.branchName,userSource:t.user})).status==="success")return{isError:!1,toolResult:"The user is not available right now. The question has been forwarded to the org agent who will try to reach the right person. Proceed with your best judgment for now."}}return{isError:!0,toolResult:"The user is currently not present in the chat and the org agent could not be reached. Try to proceed with your best judgment or wait and try again later."}}}async function xdt(t,e){let{session:r,signal:n,credentials:i}=t,o=e.input,s=await r.waitForDevServer(n);if(!s.shouldProceed)return{isError:!0,toolResult:s.message,title:"Get Screenshot Error"};let a,A=r.getProxyConfig();if(o.href)try{a=new URL(o.href,A.proxyDefaultOrigin)}catch(f){Ru.captureException(f)}let c=new rk;A.proxyOrigin&&A.proxyDestination&&c.setMapping(A.proxyOrigin,A.proxyDestination);let u=a?c.mapUrl(a):void 0;if(!o.href||!o.href.startsWith("https://")&&!o.href.startsWith("http://")||a?.origin===A.proxyDefaultOrigin||a&&VA(a.hostname)||u&&VA(u.hostname))try{let f=$n([t.signal,AbortSignal.timeout(15e3)]);return await t.passThrough(e,{signal:f})}catch{}if(!u)return{isError:!0,toolResult:"The href can not be resolved a fully qualified URL.",title:"Get Screenshot Error"};let d=new URL(`${
|
|
2427
|
+
${Zdt(s,r,n)}`;if((await t.session.sendMessageToOrgAgent({content:a,channelId:t.user.channelId,senderDisplayName:`Branch Agent (${t.projectId}/${t.branchName})`,senderType:"sub-agent",agentProjectId:t.projectId,agentBranchName:t.branchName,userSource:t.user})).status==="success")return{isError:!1,toolResult:"The user is not available right now. The question has been forwarded to the org agent who will try to reach the right person. Proceed with your best judgment for now."}}return{isError:!0,toolResult:"The user is currently not present in the chat and the org agent could not be reached. Try to proceed with your best judgment or wait and try again later."}}}async function xdt(t,e){let{session:r,signal:n,credentials:i}=t,o=e.input,s=await r.waitForDevServer(n);if(!s.shouldProceed)return{isError:!0,toolResult:s.message,title:"Get Screenshot Error"};let a,A=r.getProxyConfig();if(o.href)try{a=new URL(o.href,A.proxyDefaultOrigin)}catch(f){Ru.captureException(f)}let c=new rk;A.proxyOrigin&&A.proxyDestination&&c.setMapping(A.proxyOrigin,A.proxyDestination);let u=a?c.mapUrl(a):void 0;if(!o.href||!o.href.startsWith("https://")&&!o.href.startsWith("http://")||a?.origin===A.proxyDefaultOrigin||a&&VA(a.hostname)||u&&VA(u.hostname))try{let f=$n([t.signal,AbortSignal.timeout(15e3)]);return await t.passThrough(e,{signal:f})}catch{}if(!u)return{isError:!0,toolResult:"The href can not be resolved a fully qualified URL.",title:"Get Screenshot Error"};let d=new URL(`${Pe}/codegen/tools/GetScreenshot`);i.builderPublicKey&&d.searchParams.set("apiKey",i.builderPublicKey),i.userId&&d.searchParams.set("userId",i.userId);let g=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i.builderPrivateKey}`},body:JSON.stringify({...o,href:u.href}),signal:n});return g.ok?await g.json():{isError:!0,toolResult:`Failed to capture screenshot: ${g.statusText}`,title:"Get Screenshot Error"}}async function EQ(t){let e=process.platform==="win32"?"rg.exe":"rg";try{if(process.pkg){let r=ku.dirname(process.execPath),n=ku.join(r,"bin",e);if(t.existsSync(n))return n}}catch{}try{let r=ku.dirname(process.execPath),n=ku.join(r,e);if(t.existsSync(n))return n}catch{}try{let r=process.platform==="win32"?"win32-x64":`${process.platform}-${process.arch}`,n=ku.join(__dirname,"..","vendors",r,e);if(t.existsSync(n))return n}catch{}return"rg"}async function Rdt(t,e){let{signal:r,bashWorkingDirectory:n,sys:i,filterText:o,fusionConfig:s,user:a}=t,A=await EQ(i),c=["--path-separator","/","-A","1","-B","1","--max-columns","500","--max-count","100","--max-filesize","3M","--json","--multiline","--multiline-dotall","--hidden","--line-number",...e.case_sensitive?[]:["-i"]],u=n,l=`Grepping codebase with "${e.query}"`,d="";e.include_glob&&(d+=` (including: ${e.include_glob})`),e.exclude_glob&&(d+=` (excluding: ${e.exclude_glob})`,c.push("--glob",`!${e.exclude_glob}`)),Fdt.forEach(p=>{c.push("--glob",p)}),l+=d,kdt(e.query)&&c.push("--fixed-strings"),c.push("--",e.query);let g=await Ndt(A,c,u,r,e.query,d,l);if(!g.isError&&g.toolResult)try{let p=await ple(g.toolResult,s?.accessControl,a.principals,e.include_glob??void 0);if(p)return{...g,toolResult:zA(o(p),200,300)};if(e.include_glob){let f=await XDe(t,{pattern:e.include_glob});if(f.isError){let h=e.include_glob.startsWith("**/")?"Try a wider Grep without include_glob.":`Try a wider Grep with **/${e.include_glob}`;return{isError:!0,toolResult:`Zero files read, include_glob: "${e.include_glob}" is too restrictive. ${h}`,title:f.title}}else return{isError:!0,toolResult:`No matches found for pattern: "${e.query}" ${d||""}`,title:f.title}}return{isError:!0,toolResult:`No matches found for pattern: "${e.query}" ${d||""}`,title:g.title}}catch(p){return{isError:!0,toolResult:`Error processing search results: ${p instanceof Error?p.message:String(p)}`,title:g.title}}return g}async function Ndt(t,e,r,n,i,o,s){return new Promise(a=>{let A=new eo(1e4),c=Wc({command:t,args:e,options:{env:process.env,cwd:r,stdio:["ignore","pipe","pipe"],signal:n}});c.on("spawn",()=>{c.pid&&fj(c.pid,10)}),c.stdout.on("data",u=>{A.write(u.toString())}),c.stderr.on("data",u=>{A.write(u.toString())}),c.on("error",u=>{a({isError:!0,toolResult:`Failed to start ripgrep process: ${u.message}`,title:s})}),c.on("close",u=>{let l=A.getContent();u==null?a({isError:!0,toolResult:`The process was aborted while grepping for pattern: "${i}" ${o||""}`,title:s}):u===0?a({isError:!1,toolResult:l,title:s}):u===1?a({isError:!0,toolResult:`No matches found for pattern: "${i}" ${o||""}`,title:s}):(Ru.captureException(new zt("Fatal ripgrep error",{cause:new zt(l)}),{contexts:{ripgrep:{exitCode:u,cwd:r,rgPath:t,args:e}}}),a({isError:!0,toolResult:`There was a fatal error when grepping for pattern: "${i}"
|
|
2428
2428
|
|
|
2429
2429
|
${l}
|
|
2430
2430
|
(remember it needs to be a string encoded regex)`,title:s}))})})}function Tdt(t){return t.includes("npm i")||t==="yarn"||t.includes("pnpm i")}function Mdt(t){return NE(t).some(r=>r.startsWith("git ")||r.startsWith("gh "))}async function ewe(t,e,r,n,i){let{sys:o,signal:s,allowedCommands:a,bashWorkingDirectory:A,emitter:c,devServerOrchestrator:u,filterText:l,enabledTools:d}=t,g=i==="bash"?"Bash":"PowerShell";if(e&&u&&u.devCommand&&(d.includes("DevServerRestart")||d.includes("DevServerControl"))&&e.includes(u.devCommand))return{isError:!0,toolResult:`Seems like you tried to execute "${u.devCommand}", however "${g}" tool is not the right tool to use, use "DevServerRestart" tool instead.`,title:`${g} command "${e}"`};if(!(t.fusionConfig?.skipCommandSecurity===!0)){let E=Ev(),y=TE(e,E);if(y)return{isError:!0,toolResult:`ACL policy: Security policy violation (${y.policy}): ${y.message}.
|
|
@@ -2501,7 +2501,7 @@ HTTP Status: ${u}`});if(l){let f=t.session.getMetadata()._setup_dev_elapsed_ms??
|
|
|
2501
2501
|
`,a&&(B+=`Default Origin: ${a}
|
|
2502
2502
|
`),B+=`
|
|
2503
2503
|
HTTP Status: ${h}
|
|
2504
|
-
Dev State: ${C}`;let E=h==="ok-2xx"||h==="error-4xx"||h==="error-5xx",y,Q;if(E)try{let v=c.getProxyConfig().proxyDestination||I?.href,S=jo(v);if(r.debug(`Dev Server URL: ${v}`),S&&VA(S)){r.info(`Trying passthrough for localhost URL: ${S.href}`);try{let P=new AbortController,Y=$n([u,AbortSignal.timeout(15e3),P.signal]),K={name:"GetScreenshot",id:"verify-dev-server-screenshot",input:{href:S.href},abortController:P};y=await d(K,{signal:Y}),y&&!y.isError&&y.structuredResult&&y.structuredResult.screenshotUrl&&(Q=y.structuredResult.screenshotUrl)}catch(P){Ru.captureMessage(`[verifyDevServer] Screenshot passthrough failed for localhost URL: ${S.href}`,{level:"warning",extra:{url:S.href,reason:P instanceof Error?P.message:String(P)}}),r.info("Screenshot passthrough failed, user may not have Builder.io UI open:",P)}}else if(S){r.info(`Using server-side screenshot for non-localhost URL: ${S.href}`);let P=new URL(`${
|
|
2504
|
+
Dev State: ${C}`;let E=h==="ok-2xx"||h==="error-4xx"||h==="error-5xx",y,Q;if(E)try{let v=c.getProxyConfig().proxyDestination||I?.href,S=jo(v);if(r.debug(`Dev Server URL: ${v}`),S&&VA(S)){r.info(`Trying passthrough for localhost URL: ${S.href}`);try{let P=new AbortController,Y=$n([u,AbortSignal.timeout(15e3),P.signal]),K={name:"GetScreenshot",id:"verify-dev-server-screenshot",input:{href:S.href},abortController:P};y=await d(K,{signal:Y}),y&&!y.isError&&y.structuredResult&&y.structuredResult.screenshotUrl&&(Q=y.structuredResult.screenshotUrl)}catch(P){Ru.captureMessage(`[verifyDevServer] Screenshot passthrough failed for localhost URL: ${S.href}`,{level:"warning",extra:{url:S.href,reason:P instanceof Error?P.message:String(P)}}),r.info("Screenshot passthrough failed, user may not have Builder.io UI open:",P)}}else if(S){r.info(`Using server-side screenshot for non-localhost URL: ${S.href}`);let P=new URL(`${Pe}/codegen/tools/GetScreenshot`);l.builderPublicKey&&P.searchParams.set("apiKey",l.builderPublicKey),l.userId&&P.searchParams.set("userId",l.userId);let Y=await fetch(P,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${l.builderPrivateKey}`},body:JSON.stringify({href:S.href}),signal:AbortSignal.timeout(6e4)});if(Y.ok)y=await Y.json(),r.info("Server-side screenshot result:",y),y.structuredResult&&y.structuredResult.screenshotUrl&&(Q=y.structuredResult.screenshotUrl);else{let K=`Server-side screenshot failed: ${Y.status} ${Y.statusText}`;r.error(K,{loggerOptions:{debug:!0}}),Ru.captureMessage(`[verifyDevServer] ${K}`,{level:"error",extra:{url:S.href,status:Y.status}})}}else{let P=`Invalid or missing URL for screenshot capture: ${v}`;r.error(P,{loggerOptions:{debug:!0}}),Ru.captureMessage(`[verifyDevServer] ${P}`,{level:"warning",extra:{applicationUrl:v}})}}catch(x){r.error("Error capturing screenshot:",x,{loggerOptions:{debug:!0}}),Ru.captureException(x,{extra:{context:"verifyDevServer screenshot capture"}})}let w=NQ({stage:"server",state:h,success:E,error:E?void 0:`HTTP Status: ${h}. The dev server is not responding with a successful status code.`,additionalInfo:B}),D;if(y){let x={type:"text",text:`${w}
|
|
2505
2505
|
|
|
2506
2506
|
Screenshot of the page:`};Array.isArray(y.toolResult)?D=[x,...y.toolResult]:D=w}else D=w;if(E){let x=c.getMetadata()._setup_http_elapsed_ms??0;c.updateMetadata({_setup_app_origin:s,_setup_default_origin:a,...Q?{_setup_screenshot_url:Q}:{},_setup_http_elapsed_ms:Math.max(x,f)})}return{isError:!E,toolResult:D,title:E?"VerifyDevServer: Success":`VerifyDevServer: Failed (${h})`}}async function jdt(t,e){let{command:r,timeout:n=3e5}=e;if(!r)return{isError:!0,toolResult:"VerifyValidateCommand requires a command parameter",title:"VerifyValidateCommand Error"};let{devServerOrchestrator:i,signal:o,filterText:s}=t;if(!i)return{isError:!0,toolResult:"Dev server orchestrator not available",title:"VerifyValidateCommand Error"};let a=Date.now(),A=AbortSignal.timeout(n),c=$n([o,A]),u=await i.runValidateCommand(r,c),l=Date.now()-a,d=u.status==="success",g=s(i.getValidateOutput().slice(0,5e3)),p=d?0:u.status==="failure"?u.code??null:null,f=d||u.status==="aborted"?void 0:u.status==="failure"?u.output:void 0,h={success:d,exitCode:p,output:g,duration:l,error:f},C=i.validateCommandState,I=NQ({stage:"validate",state:C,success:d,output:g,error:f,duration:l,additionalInfo:`Command: ${r}
|
|
2507
2507
|
Exit Code: ${p??"N/A"}
|
|
@@ -2525,11 +2525,11 @@ And here's some extra context about the branch at hand:
|
|
|
2525
2525
|
The ReadBranch tool can be used to get more context about the branch.
|
|
2526
2526
|
Make sure you put humans in context when forwarding information.
|
|
2527
2527
|
`}var ku,Ru,zDe,WDe,Fdt,kdt,Aj=N(()=>{"use strict";m();Js();kE();N2();ME();ME();PE();dle();ja();mle();ku=W(require("node:path"),1);Dp();Qv();$E();Hh();Ru=W(require("@sentry/node"),1);_E();Vi();VQe();Zr();WQe();eDe();fk();xQ();FO();zDe=5e4;WDe=new Set(["mcp__chrome__click","mcp__chrome__hover","mcp__chrome__fill","mcp__chrome__type","mcp__chrome__select_option","mcp__chrome__press_key"]);Fdt=["!**/.git/**","!**/.hg/**","!**/.svn/**","!**/.DS_Store","!**/.idea/**","!**/.vscode/**","!**/.cache/**","!**/coverage/**","!**/node_modules/**","!**/dist/**","!**/*.tsbuildinfo","!**/package-lock.json","!**/yarn.lock","!**/pnpm-lock.yaml","!**/*.min.js","!**/*.min.css","!**/*.bundle.js","!**/*.chunk.js","!**/builder-registry.*","!**/*.bundle.css","!**/*.map","!**/vendor/**","!**/target/**","!**/__pycache__/**","!**/*.pyc","!**/*.pyo","!**/*.class","!**/*.jar","!**/build/**/*.gradle","!**/*.lock","!**/*.log","!**/*.o","!**/*.a","!**/*.so","!**/*.dylib","!**/*.dll","!**/*.exe","!**/*.zip","!**/*.tar","!**/*.tar.gz","!**/*.tgz","!**/*.7z","!**/*.rar","!**/*.png","!**/*.jpg","!**/*.jpeg","!**/*.gif","!**/*.svg","!**/*.ico","!**/*.webp","!**/*.mp4","!**/*.mp3"],kdt=t=>{let e=["{","(","["],r=["}",")","]"],n=[],i=[],o=new Map([["{","}"],["(",")"],["[","]"]]);for(let s=0;s<=t.length-1;s++){let a=t[s];t[s-1]==="\\"&&t[s-2]!=="\\"||(e.includes(a)?n.push({location:s,value:a}):r.includes(a)&&i.push({location:s,value:a}))}for(let s of n){let{location:a,value:A}=s,c=i.findIndex(u=>u.location>a&&u.value===o.get(A));if(c>-1)i.splice(c,1);else return!0}return i.length>0}});function iwe(t){let e=t.match(/builder\.io\/content\/([^?]+)\?codeSession=([^&]+)&sid=([^\s]+)/);return e?{contentId:e[1],sessionKey:e[2],snippetId:e[3]}:{}}async function _l(t){let e={...t,globPattern:t.globPattern??"**/*",deep:t.deep??12,onlyFiles:t.onlyFiles??!0,gitignore:t.gitignore??!0};if(t.sys&&Xdt)try{return await eft(e)}catch(p){t.sys?.Sentry?.captureException(p)}let{basePath:r,globPattern:n,extraIgnorePatterns:i,dot:o,deep:s,gitignore:a,sys:A,onlyFiles:c,maxFiles:u}=e,l=Array.isArray(n)?[...n]:[n],d=[...TQ,...i||[]],g=l.findIndex(p=>p.includes("node_modules"));g>-1?l.splice(g,0,"!**/node_modules"):d.push("**/node_modules");try{if(!c){let h=(await uv(l,{cwd:r,ignoreFiles:zh,ignore:d,absolute:!1,onlyFiles:c,dot:o,gitignore:a,suppressErrors:!0,deep:s,objectMode:!0})).map(C=>C.dirent?.isDirectory()?`${C.path}/`:C.path);return u!==void 0&&h.length>u?h.slice(0,u):h}let p=await uv(l,{cwd:r,ignoreFiles:zh,ignore:d,absolute:!1,onlyFiles:c,dot:o,gitignore:a,suppressErrors:!0,deep:s});return u!==void 0&&p.length>u?p.slice(0,u):p}catch(p){throw A?.Sentry?.captureException(p,{tags:{errorType:"filesystem_permission",component:"getAllProjectFiles"},extra:{basePath:r,patterns:l,errorCode:p.code}}),p}}async function eft({basePath:t,globPattern:e,extraIgnorePatterns:r,dot:n,deep:i,gitignore:o,sys:s,onlyFiles:a,maxFiles:A}){if(!s)throw new Error("sys is required");let c=await EQ(s),u=["--files","--path-separator","/"];n&&u.push("--hidden"),o||u.push("--no-ignore"),i!==void 0&&u.push("--max-depth",String(i));let l=e?Array.isArray(e)?e:[e]:[],d=l.findIndex(p=>p.includes("node_modules"));for(let p of l)p.startsWith("!")||p!=="**/*"&&u.push("--glob",p);let g=[...TQ,...r||[]];d===-1&&g.push("**/node_modules/**");for(let p of g)u.push("--glob",`!${p}`);for(let p of zh){let f=(0,Ao.resolve)(t,p);(0,So.existsSync)(f)&&u.push("--ignore-file",p)}return new Promise((p,f)=>{let h=Wc({command:c,args:u,options:{env:process.env,cwd:t,stdio:["ignore","pipe","pipe"]}}),C=[],I="",B="",E=!1;h.stdout.on("data",y=>{if(E)return;I+=y.toString();let Q=I.split(`
|
|
2528
|
-
`);I=Q.pop()||"";for(let w of Q){let D=w.trim();if(D.length>0&&(C.push(D),A!==void 0&&C.length>=A)){E=!0,h.kill("SIGTERM");return}}}),h.stderr.on("data",y=>{B+=y.toString()}),h.on("error",y=>{s?.Sentry?.captureException(y,{tags:{errorType:"ripgrep_spawn_error",component:"getAllProjectFilesRipgrep"},extra:{basePath:t,patterns:l,errorMessage:y.message}}),f(y)}),h.on("close",y=>{if(I.trim().length>0&&!E&&(A===void 0||C.length<A)&&C.push(I.trim()),E){p(C);return}if(y!==null&&y>1){s?.Sentry?.captureException(new Error(`ripgrep exited with code ${y}`),{tags:{errorType:"ripgrep_error",component:"getAllProjectFilesRipgrep"},extra:{basePath:t,patterns:l,stderr:B,exitCode:y}}),f(new Error(`ripgrep failed: ${B}`));return}if(!a){let Q=new Set;for(let D of C){let x=D.split("/");for(let v=1;v<x.length;v++)Q.add(x.slice(0,v).join("/")+"/")}let w=[...C,...Q].sort();p(w);return}p(C)})})}async function tft(t,e,r){let n=await uv("**/*",{cwd:t,ignoreFiles:zh,ignore:TQ}),i=[];for(let o of n){let s=(0,Ao.resolve)(t,o);try{let a=(0,So.readFileSync)(s,"utf-8");if(a.includes("This code was generated by Builder.io")){let A=iwe(a);if(e&&r&&(A.contentId!==e||A.sessionKey!==r))continue;i.push({path:o,code:mk(a),name:o.split("/").pop()||"",timestamp:(0,So.statSync)(s).mtime.getTime(),snippetId:A.snippetId})}}catch(a){Vh.error(`Error reading file ${s}:`,a)}}return i}function rft(t,e){let r=iwe(t);return r.contentId===e.contentId&&r.sessionKey===e.sessionKey}function vQe(t){return t.filter(e=>(e=e.toLowerCase(),!e.endsWith(".png")&&!e.endsWith(".jpg")&&!e.endsWith(".jpeg")&&!e.endsWith(".gif")&&!e.endsWith(".ico")&&!e.endsWith(".webp")&&!e.includes(".mapper.")))}function cj(t){let e=(0,r6.default)().add(TQ);function r(n){try{let i=(0,Ao.resolve)(t,n);if((0,So.existsSync)(i)){let o=(0,So.readFileSync)(i,"utf8");e.add(o)}}catch(i){Vh.debug(`No ${n} found or error reading it:`,i)}}for(let n of zh)r(n);return n=>{let i=n.split(Ao.sep).join("/");return e.ignores(i)}}async function uS(t,e){let r=(0,r6.default)().add(TQ);async function n(i){try{let o=e.resolve(t,i);if(await e.exists(o)){let s=await e.readFile(o);s&&r.add(s)}}catch(o){Vh.debug(`No ${i} found or error reading it:`,o)}}for(let i of zh)await n(i);return i=>{let o=i.split(Ao.sep).join("/");return r.ignores(o)}}function twe(t,e,r){let n=cj(t),i=nwe.default.watch(t,{ignored:n,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500,pollInterval:600},ignorePermissionErrors:!0,followSymlinks:!1,atomic:600}),o=async a=>{let A=(0,Ao.relative)(t,a);try{let c=(0,So.readFileSync)(a,"utf-8");if(rft(c,e.snippet)){let u=e.writtenFiles.find(l=>l.path===A);u?(u.code=mk(c),u.timestamp=Date.now()):e.writtenFiles.push({path:A,code:mk(c),timestamp:Date.now(),name:A.split("/").pop()||""}),e.timeStamp=Date.now(),r(e)}}catch(c){Vh.debug(`Error reading file ${a}:`,c)}};i.on("add",async a=>{j.info(`File added: ${a}`),await o(a)}).on("change",async a=>{j.info(`File changed: ${a}`),await o(a)}).on("unlink",a=>{j.info(`File deleted: ${a}`);let A=(0,Ao.relative)(t,a);e.writtenFiles=e.writtenFiles.filter(c=>c.path!==A),e.timeStamp=Date.now(),r(e)}).on("unlinkDir",a=>{j.info(`Folder deleted: ${a}`);let A=(0,Ao.relative)(t,a);e.writtenFiles=e.writtenFiles.filter(c=>!c.path.startsWith(A)),e.timeStamp=Date.now(),r(e)}).on("ready",()=>{Vh.debug("Initial scan complete. Ready for changes.")}).on("error",a=>{Vh.error(`Watcher error: ${a}`)}),i.on("raw",async(a,A,c)=>{if(a==="rename"){j.info(`File renamed: ${c?.oldPath} -> ${A}`);let u=c?.oldPath?(0,Ao.relative)(t,c.oldPath):void 0,l=A?(0,Ao.relative)(t,A):void 0;if(u&&l){let d=e.writtenFiles.find(g=>g.path===u);d&&(d.path=l,e.timeStamp=Date.now(),r(e))}}});let s=async()=>{await i.close()};return process.on("SIGINT",s),process.on("SIGTERM",s),s}async function owe(t,e){console.log(""),Br((0,Eg.bgMagenta)((0,Eg.bold)((0,Eg.white)(" sync server ")))+" "+(0,Eg.dim)(xt)),t.debug("builder sync server init");let r=await hf(t),n=e,i=()=>Promise.resolve();n&&setTimeout(()=>{i=twe(t.getAppRootDir(),n,o=>{n=o})},1e3),await h2({...r,ensureFigmaImportPage:()=>Promise.reject("Not supported"),getPastSyncInfo:({sessionKey:o,since:s})=>!n||o!==n.snippet.sessionKey?null:{...n,hasChanged:n.timeStamp>s},resyncSnippet:async o=>{await i();let s=await n6({path:n?.pathInput,snippet:o.snippet,cwd:t.getAppRootDir()});return s&&(n=s,i=twe(t.getAppRootDir(),n,a=>{n=a})),n},getClientId:()=>"builder-sync-cli",closeAppServer:async()=>{await i()},restartAppServer:async()=>{t.debug("restart server")},enableAppWatch:async o=>o,...t})}async function n6(t){let e=t.snippetId,r=t.snippet||null;if(!r&&e&&(r=await I2(e)),!r)return qe(`No snippet found for id ${e}`),await Ke(1);let n=process.cwd(),i=nE(n)??n,o=await tft(i,r.contentId,r.sessionKey),s=o.filter(l=>l.snippetId===r.id);if(j.info(`Found ${s.length} matching files for snippet ${r.id} in existing files ${o.length}`),s.length>0){let l=Math.max(...s.map(d=>d.timestamp||0));return{snippet:r,writtenFiles:s,pathInput:rwe(s.map(d=>d.path)),timeStamp:l}}let a=E2(i,r.framework||"react"),A=t.path||rwe(o.map(l=>l.path))||await xr({message:"Where should we copy the files?",initialValue:a,validate(l){if(l.length===0)return"File path is required!";if(l[0]!==".")return"Please enter a relative path."}});Xe(A)&&(qe("Cancelled sync"),process.exit(0));for(let l of o){let d=(0,Ao.resolve)(i,l.path);try{(0,So.unlinkSync)(d),j.info(`Deleted old file: ${d}`);let g=(0,Ao.dirname)(d);(0,So.readdirSync)(g).length===0&&((0,So.rmdirSync)(g),j.info(`Deleted empty folder: ${g}`))}catch(g){j.error(`Error cleaning up file ${d}: ${g}`)}}let c=await gv(i,r,r.files,A,!0);j.success("All files have been written successfully.");let u=Math.max(...c.map(l=>l.timestamp||0));return{snippet:r,writtenFiles:c.map(l=>({...l,code:mk(l.code)})),pathInput:A,timeStamp:u||Date.now()}}function mk(t){if(!t)return t;let e=/<!--\s*This code was generated by Builder\.io\s*-->\s*(?:<!--\s*https:\/\/builder\.io\/content\/[a-f0-9]+\?codeSession=[a-f0-9]+&sid=[a-f0-9]+\s*-->\s*)?/,r=/\/\*\*\s*\n\s*\* This code was generated by Builder\.io\s*\n\s*\* https:\/\/builder\.io\/content\/[a-f0-9]+\?codeSession=[a-f0-9]+&sid=[a-f0-9]+\s*\n\s*\*\/\s*/,n=t.replace(e,"").replace(r,"");return n=n.replace(/^\n+/,""),n}function rwe(t){if(t.length===0)return"";if(t.length===1)return`./${t[0].slice(0,t[0].lastIndexOf("/")+1)}`;let e=t.map(i=>i.split("/")),r=Math.min(...e.map(i=>i.length)),n=[];for(let i=0;i<r;i++){let o=e[0][i];if(e.every(s=>s[i]===o))n.push(o);else break}return`./${n.join("/")}`}var Ao,So,Eg,nwe,r6,Vh,Xdt,zh,TQ,Kp=N(()=>{"use strict";m();Ao=require("node:path");Gt();So=require("node:fs"),Eg=W(Gr(),1);Nce();kw();C2();B2();Cr();nwe=W(require("chokidar"),1),r6=W(require("ignore"),1);Ta();iE();vn();ja();Aj();Vh=ke("Sync");Xdt=!1;zh=[".gitignore",".ignore",".builderignore"],TQ=["**/*.snap","**/*.liquid","**/.git","**/dist","**/*.pyc","**/.DS_Store","**/.vscode","**/__pycache__","**/coverage","**/.next","**/coverage","**/example","**/__snapshots__","**/.gradle","**/xcuserdata","**/.build","**/*.zip","**/*.pem","**/*.key","**/*.p12","**/*.pfx","**/*.cer","**/*.crt","**/*.der","**/*.p7b","**/*.p7c","**/*.jks","**/*.keystore","**/id_rsa","**/id_rsa.*","**/id_dsa","**/id_dsa.*","**/id_ecdsa","**/id_ecdsa.*","**/id_ed25519","**/id_ed25519.*","**/.ssh/**","**/known_hosts","**/authorized_keys","**/.aws/**","**/credentials","**/.gcp/**","**/.azure/**","**/gcloud/**","**/google-credentials.json","**/gcp-key.json","**/service-account*.json","**/.pypirc","**/.dockercfg","**/.docker/config.json","**/token.json","**/tokens.json","**/secrets.json","**/secret.json","**/api-keys.json","**/apikeys.json","**/*.sql","**/*.sqlite","**/*.sqlite3","**/*.db","**/*.dump","**/*.bak","**/passwd","**/.htpasswd","**/shadow","**/.git-credentials","**/.gitconfig","**/.netrc","**/kubeconfig","**/.kube/**","**/k8s-secrets.yaml","**/k8s-secrets.yml","**/*.tfstate","**/*.tfstate.*","**/.terraform/**","**/.history","**/.bash_history","**/.zsh_history","**/wallet.dat","**/.gnupg/**","**/private.xml","**/signing.properties","**/*.ovpn","**/wp-config.php","**/config.inc.php","**/local_settings.py","**/database.yml","**/secrets.yml","**/.tox/**","**/firebase-adminsdk*.json","**/firebaseConfig.json","**/google-services.json","**/GoogleService-Info.plist"]});async function o6(t,e,r,n="",i,o){let s=[];try{if(!await t.exists(e))return s;let a=await t.readdir(e);for(let A of a){let c=t.join(e,A);if(i&&o){let l=t.relative(o,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 o6(t,c,r,l,i,o);s.push(...d)}else s.push(c)}}catch{}return s}async function i6(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 o=t.relative(r,e);return ese(i,o)}catch(n){return t.Sentry?.captureException(n),null}}async function uj({sys:t,projectDir:e,currentDir:r,rootDir:n,allowedCommands:i,skipCommandSecurity:o}){let s=[],a=[".cursor/rules",".builder/rules",".agents/rules"],A=[".claude/skills",".builder/skills",".cursor/skills",".agents/skills"],c=[".cursorrules",".builderrules",".windsurfrules",".github/copilot-instructions.md"],u=await uS(e,t),l;do{try{for(let g of a){let p=t.resolve(r,g);if(await t.exists(p)){let h=(await o6(t,p,p,"",u,e)).filter(C=>{let I=t.basename(C);return I.toLowerCase().endsWith(".mdc")||I.toUpperCase()==="RULE.MD"});for(let C of h){let I=await i6(t,C,e);I&&s.push(I)}}}for(let g of A){let p=t.resolve(r,g);if(await t.exists(p)){let h=(await o6(t,p,p,"",u,e)).filter(C=>t.basename(C).toUpperCase()==="SKILL.MD");for(let C of h){let I=await i6(t,C,e);I&&s.push({...I,isSkill:!0})}}}for(let g of c){let p=t.resolve(r,g),f=t.relative(e,p);if(!f.startsWith("..")&&!f.startsWith("/")&&u(f))continue;let h=await i6(t,p,e);h&&s.push(h)}}catch(g){nft.debug(`Error reading ${r}:`,g)}if(l=r,r=t.dirname(r),r===l)break}while(l!==n);let d=process.env;return s.map(g=>g.isSkill?{...g,content:Kv(g.content,{cwd:e,env:d,allowedCommands:i,skipCommandSecurity:o})}:g)}var nft,lj=N(()=>{"use strict";m();tse();Kp();xO();Gt();nft=ke("RulesDiscovery")});function rj(t,e){let r=new Map;for(let n of t)r.set(n.name,n);for(let n of e)r.set(n.name,n);return Array.from(r.values())}function nj(t){for(let e=t.turns.length-1;e>=0;e--){let r=t.turns[e];if(r.state==="done"&&r.nextUrl)return r}}function xQe(t){for(let e=t.turns.length-1;e>=0;e--){let r=t.turns[e];if(r.user.role==="user"&&r.completionId)return r}}function FQe(t){for(let e=t.turns.length-1;e>=0;e--){let r=t.turns[e];if(r.nextUrl&&(r.applyResults.length>0||r.user.role==="user"))return r}}function gc(t){return t[t.length-1]}function kQe(t){for(let e=t.length-1;e>=0;e--)t[e].state!=="done"&&t.splice(e,1)}async function RQe(t,e,r,n){let i=new URL(`${Me}/codegen/restore-consumed-credit`);e.builderPublicKey&&i.searchParams.set("apiKey",e.builderPublicKey),e.userId&&i.searchParams.set("userId",e.userId);let o={"Content-Type":"application/json"};e.builderPrivateKey&&(o.Authorization=`Bearer ${e.builderPrivateKey}`);try{await Pe(i,{method:"POST",body:JSON.stringify({sessionId:r,restoreCredits:n}),headers:o,signal:AbortSignal.timeout(3e4)})}catch(s){let a=s&&s.name==="AbortError"||typeof s?.code=="string"&&s.code==="ABORT_ERR"||typeof s?.timeout=="boolean"&&s.timeout||/timeout|abort/i.test(s?.message??"");t.Sentry?.captureException(s,{level:"warning",tags:{operation:"restore-consumed-credit",timeout:a}})}}function swe(t,e){let r={totalSize:e.length,totalSizeMB:(e.length/1048576).toFixed(2)};if(t.attachments?.length){let i=t.attachments.map(s=>JSON.stringify(s).length),o={};t.attachments.forEach((s,a)=>{let A=s.type||"unknown",c=i[a];o[A]||(o[A]={count:0,totalSize:0}),o[A].count++,o[A].totalSize+=c}),r.attachments={count:t.attachments.length,totalSize:i.reduce((s,a)=>s+a,0),totalSizeMB:(i.reduce((s,a)=>s+a,0)/(1024*1024)).toFixed(2),byType:Object.entries(o).map(([s,a])=>({type:s,count:a.count,sizeMB:(a.totalSize/(1024*1024)).toFixed(2)})),largestAttachments:t.attachments.map((s,a)=>({type:s.type,size:i[a],sizeMB:(i[a]/(1024*1024)).toFixed(2)})).sort((s,a)=>a.size-s.size).slice(0,5)}}if(t.files?.length){let i={},o=0,s=0,a=0;t.files.forEach(c=>{let u=c.filePath?.split(".").pop()||"no-ext";i[u]||(i[u]={count:0,withContent:0,totalContentSize:0}),i[u].count++,c.content?(i[u].withContent++,i[u].totalContentSize+=c.content.length,o++,a+=c.content.length):s++});let A=Object.entries(i).sort((c,u)=>u[1].totalContentSize-c[1].totalContentSize).slice(0,10).map(([c,u])=>({ext:c,count:u.count,withContent:u.withContent,contentSizeMB:(u.totalContentSize/(1024*1024)).toFixed(2)}));r.files={totalCount:t.files.length,withContent:o,withoutContent:s,totalContentSize:a,totalContentSizeMB:(a/(1024*1024)).toFixed(2),topExtensionsBySize:A}}let n={};if(t.userPrompt&&(n.userPrompt={size:t.userPrompt.length,sizeMB:(t.userPrompt.length/(1024*1024)).toFixed(2),hasGitDiff:t.userPrompt.includes("<modified-files-context>")},n.userPrompt.hasGitDiff)){let i=t.userPrompt.match(/<modified-files-context>([\s\S]*?)<\/modified-files-context>/);i&&(n.gitDiffInPrompt={size:i[1].length,sizeMB:(i[1].length/(1024*1024)).toFixed(2)})}if(t.uiContextPrompt&&(n.uiContextPrompt={size:t.uiContextPrompt.length,sizeMB:(t.uiContextPrompt.length/(1024*1024)).toFixed(2)}),Object.keys(n).length>0&&(r.prompts=n),t.toolResults?.length){let i=JSON.stringify(t.toolResults).length;r.toolResults={count:t.toolResults.length,totalSize:i,totalSizeMB:(i/(1024*1024)).toFixed(2)}}return r}async function*NQe(t,e,r,n,i){if(!e.builderPrivateKey)throw new Error("Missing builder public key during completion stream");let o=new AbortController,s=JSON.stringify(r),a=new URL(`${Me}/codegen/completion`);e.builderPublicKey&&a.searchParams.set("apiKey",e.builderPublicKey),e.userId&&a.searchParams.set("userId",e.userId);let A=performance.now(),c=A,u,l=!1,d=0,g=[];try{let p=await Pe(a,{method:"POST",body:s,keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.builderPrivateKey}`},signal:$n([n,o.signal])},i);if(!p.ok){let h=await p.text(),C=`Bad Status: ${p.status}: ${h}`;if(p.status===413){let B=swe(r,s),E=[];B.attachments?.totalSizeMB&&E.push(`Attachments: ${B.attachments.totalSizeMB}MB (${B.attachments.count} files)`),B.files?.totalContentSizeMB&&E.push(`File content: ${B.files.totalContentSizeMB}MB (${B.files.withContent} files)`),B.prompts?.gitDiffInPrompt?.sizeMB&&E.push(`Git diff: ${B.prompts.gitDiffInPrompt.sizeMB}MB`),B.prompts?.uiContextPrompt?.sizeMB&&E.push(`UI context: ${B.prompts.uiContextPrompt.sizeMB}MB`),B.toolResults?.totalSizeMB&&E.push(`Tool results: ${B.toolResults.totalSizeMB}MB`),E.length>0&&(C+=`
|
|
2528
|
+
`);I=Q.pop()||"";for(let w of Q){let D=w.trim();if(D.length>0&&(C.push(D),A!==void 0&&C.length>=A)){E=!0,h.kill("SIGTERM");return}}}),h.stderr.on("data",y=>{B+=y.toString()}),h.on("error",y=>{s?.Sentry?.captureException(y,{tags:{errorType:"ripgrep_spawn_error",component:"getAllProjectFilesRipgrep"},extra:{basePath:t,patterns:l,errorMessage:y.message}}),f(y)}),h.on("close",y=>{if(I.trim().length>0&&!E&&(A===void 0||C.length<A)&&C.push(I.trim()),E){p(C);return}if(y!==null&&y>1){s?.Sentry?.captureException(new Error(`ripgrep exited with code ${y}`),{tags:{errorType:"ripgrep_error",component:"getAllProjectFilesRipgrep"},extra:{basePath:t,patterns:l,stderr:B,exitCode:y}}),f(new Error(`ripgrep failed: ${B}`));return}if(!a){let Q=new Set;for(let D of C){let x=D.split("/");for(let v=1;v<x.length;v++)Q.add(x.slice(0,v).join("/")+"/")}let w=[...C,...Q].sort();p(w);return}p(C)})})}async function tft(t,e,r){let n=await uv("**/*",{cwd:t,ignoreFiles:zh,ignore:TQ}),i=[];for(let o of n){let s=(0,Ao.resolve)(t,o);try{let a=(0,So.readFileSync)(s,"utf-8");if(a.includes("This code was generated by Builder.io")){let A=iwe(a);if(e&&r&&(A.contentId!==e||A.sessionKey!==r))continue;i.push({path:o,code:mk(a),name:o.split("/").pop()||"",timestamp:(0,So.statSync)(s).mtime.getTime(),snippetId:A.snippetId})}}catch(a){Vh.error(`Error reading file ${s}:`,a)}}return i}function rft(t,e){let r=iwe(t);return r.contentId===e.contentId&&r.sessionKey===e.sessionKey}function vQe(t){return t.filter(e=>(e=e.toLowerCase(),!e.endsWith(".png")&&!e.endsWith(".jpg")&&!e.endsWith(".jpeg")&&!e.endsWith(".gif")&&!e.endsWith(".ico")&&!e.endsWith(".webp")&&!e.includes(".mapper.")))}function cj(t){let e=(0,r6.default)().add(TQ);function r(n){try{let i=(0,Ao.resolve)(t,n);if((0,So.existsSync)(i)){let o=(0,So.readFileSync)(i,"utf8");e.add(o)}}catch(i){Vh.debug(`No ${n} found or error reading it:`,i)}}for(let n of zh)r(n);return n=>{let i=n.split(Ao.sep).join("/");return e.ignores(i)}}async function uS(t,e){let r=(0,r6.default)().add(TQ);async function n(i){try{let o=e.resolve(t,i);if(await e.exists(o)){let s=await e.readFile(o);s&&r.add(s)}}catch(o){Vh.debug(`No ${i} found or error reading it:`,o)}}for(let i of zh)await n(i);return i=>{let o=i.split(Ao.sep).join("/");return r.ignores(o)}}function twe(t,e,r){let n=cj(t),i=nwe.default.watch(t,{ignored:n,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500,pollInterval:600},ignorePermissionErrors:!0,followSymlinks:!1,atomic:600}),o=async a=>{let A=(0,Ao.relative)(t,a);try{let c=(0,So.readFileSync)(a,"utf-8");if(rft(c,e.snippet)){let u=e.writtenFiles.find(l=>l.path===A);u?(u.code=mk(c),u.timestamp=Date.now()):e.writtenFiles.push({path:A,code:mk(c),timestamp:Date.now(),name:A.split("/").pop()||""}),e.timeStamp=Date.now(),r(e)}}catch(c){Vh.debug(`Error reading file ${a}:`,c)}};i.on("add",async a=>{j.info(`File added: ${a}`),await o(a)}).on("change",async a=>{j.info(`File changed: ${a}`),await o(a)}).on("unlink",a=>{j.info(`File deleted: ${a}`);let A=(0,Ao.relative)(t,a);e.writtenFiles=e.writtenFiles.filter(c=>c.path!==A),e.timeStamp=Date.now(),r(e)}).on("unlinkDir",a=>{j.info(`Folder deleted: ${a}`);let A=(0,Ao.relative)(t,a);e.writtenFiles=e.writtenFiles.filter(c=>!c.path.startsWith(A)),e.timeStamp=Date.now(),r(e)}).on("ready",()=>{Vh.debug("Initial scan complete. Ready for changes.")}).on("error",a=>{Vh.error(`Watcher error: ${a}`)}),i.on("raw",async(a,A,c)=>{if(a==="rename"){j.info(`File renamed: ${c?.oldPath} -> ${A}`);let u=c?.oldPath?(0,Ao.relative)(t,c.oldPath):void 0,l=A?(0,Ao.relative)(t,A):void 0;if(u&&l){let d=e.writtenFiles.find(g=>g.path===u);d&&(d.path=l,e.timeStamp=Date.now(),r(e))}}});let s=async()=>{await i.close()};return process.on("SIGINT",s),process.on("SIGTERM",s),s}async function owe(t,e){console.log(""),Br((0,Eg.bgMagenta)((0,Eg.bold)((0,Eg.white)(" sync server ")))+" "+(0,Eg.dim)(xt)),t.debug("builder sync server init");let r=await hf(t),n=e,i=()=>Promise.resolve();n&&setTimeout(()=>{i=twe(t.getAppRootDir(),n,o=>{n=o})},1e3),await h2({...r,ensureFigmaImportPage:()=>Promise.reject("Not supported"),getPastSyncInfo:({sessionKey:o,since:s})=>!n||o!==n.snippet.sessionKey?null:{...n,hasChanged:n.timeStamp>s},resyncSnippet:async o=>{await i();let s=await n6({path:n?.pathInput,snippet:o.snippet,cwd:t.getAppRootDir()});return s&&(n=s,i=twe(t.getAppRootDir(),n,a=>{n=a})),n},getClientId:()=>"builder-sync-cli",closeAppServer:async()=>{await i()},restartAppServer:async()=>{t.debug("restart server")},enableAppWatch:async o=>o,...t})}async function n6(t){let e=t.snippetId,r=t.snippet||null;if(!r&&e&&(r=await I2(e)),!r)return qe(`No snippet found for id ${e}`),await Ke(1);let n=process.cwd(),i=nE(n)??n,o=await tft(i,r.contentId,r.sessionKey),s=o.filter(l=>l.snippetId===r.id);if(j.info(`Found ${s.length} matching files for snippet ${r.id} in existing files ${o.length}`),s.length>0){let l=Math.max(...s.map(d=>d.timestamp||0));return{snippet:r,writtenFiles:s,pathInput:rwe(s.map(d=>d.path)),timeStamp:l}}let a=E2(i,r.framework||"react"),A=t.path||rwe(o.map(l=>l.path))||await xr({message:"Where should we copy the files?",initialValue:a,validate(l){if(l.length===0)return"File path is required!";if(l[0]!==".")return"Please enter a relative path."}});Xe(A)&&(qe("Cancelled sync"),process.exit(0));for(let l of o){let d=(0,Ao.resolve)(i,l.path);try{(0,So.unlinkSync)(d),j.info(`Deleted old file: ${d}`);let g=(0,Ao.dirname)(d);(0,So.readdirSync)(g).length===0&&((0,So.rmdirSync)(g),j.info(`Deleted empty folder: ${g}`))}catch(g){j.error(`Error cleaning up file ${d}: ${g}`)}}let c=await gv(i,r,r.files,A,!0);j.success("All files have been written successfully.");let u=Math.max(...c.map(l=>l.timestamp||0));return{snippet:r,writtenFiles:c.map(l=>({...l,code:mk(l.code)})),pathInput:A,timeStamp:u||Date.now()}}function mk(t){if(!t)return t;let e=/<!--\s*This code was generated by Builder\.io\s*-->\s*(?:<!--\s*https:\/\/builder\.io\/content\/[a-f0-9]+\?codeSession=[a-f0-9]+&sid=[a-f0-9]+\s*-->\s*)?/,r=/\/\*\*\s*\n\s*\* This code was generated by Builder\.io\s*\n\s*\* https:\/\/builder\.io\/content\/[a-f0-9]+\?codeSession=[a-f0-9]+&sid=[a-f0-9]+\s*\n\s*\*\/\s*/,n=t.replace(e,"").replace(r,"");return n=n.replace(/^\n+/,""),n}function rwe(t){if(t.length===0)return"";if(t.length===1)return`./${t[0].slice(0,t[0].lastIndexOf("/")+1)}`;let e=t.map(i=>i.split("/")),r=Math.min(...e.map(i=>i.length)),n=[];for(let i=0;i<r;i++){let o=e[0][i];if(e.every(s=>s[i]===o))n.push(o);else break}return`./${n.join("/")}`}var Ao,So,Eg,nwe,r6,Vh,Xdt,zh,TQ,Kp=N(()=>{"use strict";m();Ao=require("node:path");Gt();So=require("node:fs"),Eg=W(Gr(),1);Nce();kw();C2();B2();Cr();nwe=W(require("chokidar"),1),r6=W(require("ignore"),1);Ta();iE();vn();ja();Aj();Vh=ke("Sync");Xdt=!1;zh=[".gitignore",".ignore",".builderignore"],TQ=["**/*.snap","**/*.liquid","**/.git","**/dist","**/*.pyc","**/.DS_Store","**/.vscode","**/__pycache__","**/coverage","**/.next","**/coverage","**/example","**/__snapshots__","**/.gradle","**/xcuserdata","**/.build","**/*.zip","**/*.pem","**/*.key","**/*.p12","**/*.pfx","**/*.cer","**/*.crt","**/*.der","**/*.p7b","**/*.p7c","**/*.jks","**/*.keystore","**/id_rsa","**/id_rsa.*","**/id_dsa","**/id_dsa.*","**/id_ecdsa","**/id_ecdsa.*","**/id_ed25519","**/id_ed25519.*","**/.ssh/**","**/known_hosts","**/authorized_keys","**/.aws/**","**/credentials","**/.gcp/**","**/.azure/**","**/gcloud/**","**/google-credentials.json","**/gcp-key.json","**/service-account*.json","**/.pypirc","**/.dockercfg","**/.docker/config.json","**/token.json","**/tokens.json","**/secrets.json","**/secret.json","**/api-keys.json","**/apikeys.json","**/*.sql","**/*.sqlite","**/*.sqlite3","**/*.db","**/*.dump","**/*.bak","**/passwd","**/.htpasswd","**/shadow","**/.git-credentials","**/.gitconfig","**/.netrc","**/kubeconfig","**/.kube/**","**/k8s-secrets.yaml","**/k8s-secrets.yml","**/*.tfstate","**/*.tfstate.*","**/.terraform/**","**/.history","**/.bash_history","**/.zsh_history","**/wallet.dat","**/.gnupg/**","**/private.xml","**/signing.properties","**/*.ovpn","**/wp-config.php","**/config.inc.php","**/local_settings.py","**/database.yml","**/secrets.yml","**/.tox/**","**/firebase-adminsdk*.json","**/firebaseConfig.json","**/google-services.json","**/GoogleService-Info.plist"]});async function o6(t,e,r,n="",i,o){let s=[];try{if(!await t.exists(e))return s;let a=await t.readdir(e);for(let A of a){let c=t.join(e,A);if(i&&o){let l=t.relative(o,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 o6(t,c,r,l,i,o);s.push(...d)}else s.push(c)}}catch{}return s}async function i6(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 o=t.relative(r,e);return ese(i,o)}catch(n){return t.Sentry?.captureException(n),null}}async function uj({sys:t,projectDir:e,currentDir:r,rootDir:n,allowedCommands:i,skipCommandSecurity:o}){let s=[],a=[".cursor/rules",".builder/rules",".agents/rules"],A=[".claude/skills",".builder/skills",".cursor/skills",".agents/skills"],c=[".cursorrules",".builderrules",".windsurfrules",".github/copilot-instructions.md"],u=await uS(e,t),l;do{try{for(let g of a){let p=t.resolve(r,g);if(await t.exists(p)){let h=(await o6(t,p,p,"",u,e)).filter(C=>{let I=t.basename(C);return I.toLowerCase().endsWith(".mdc")||I.toUpperCase()==="RULE.MD"});for(let C of h){let I=await i6(t,C,e);I&&s.push(I)}}}for(let g of A){let p=t.resolve(r,g);if(await t.exists(p)){let h=(await o6(t,p,p,"",u,e)).filter(C=>t.basename(C).toUpperCase()==="SKILL.MD");for(let C of h){let I=await i6(t,C,e);I&&s.push({...I,isSkill:!0})}}}for(let g of c){let p=t.resolve(r,g),f=t.relative(e,p);if(!f.startsWith("..")&&!f.startsWith("/")&&u(f))continue;let h=await i6(t,p,e);h&&s.push(h)}}catch(g){nft.debug(`Error reading ${r}:`,g)}if(l=r,r=t.dirname(r),r===l)break}while(l!==n);let d=process.env;return s.map(g=>g.isSkill?{...g,content:Kv(g.content,{cwd:e,env:d,allowedCommands:i,skipCommandSecurity:o})}:g)}var nft,lj=N(()=>{"use strict";m();tse();Kp();xO();Gt();nft=ke("RulesDiscovery")});function rj(t,e){let r=new Map;for(let n of t)r.set(n.name,n);for(let n of e)r.set(n.name,n);return Array.from(r.values())}function nj(t){for(let e=t.turns.length-1;e>=0;e--){let r=t.turns[e];if(r.state==="done"&&r.nextUrl)return r}}function xQe(t){for(let e=t.turns.length-1;e>=0;e--){let r=t.turns[e];if(r.user.role==="user"&&r.completionId)return r}}function FQe(t){for(let e=t.turns.length-1;e>=0;e--){let r=t.turns[e];if(r.nextUrl&&(r.applyResults.length>0||r.user.role==="user"))return r}}function gc(t){return t[t.length-1]}function kQe(t){for(let e=t.length-1;e>=0;e--)t[e].state!=="done"&&t.splice(e,1)}async function RQe(t,e,r,n){let i=new URL(`${Pe}/codegen/restore-consumed-credit`);e.builderPublicKey&&i.searchParams.set("apiKey",e.builderPublicKey),e.userId&&i.searchParams.set("userId",e.userId);let o={"Content-Type":"application/json"};e.builderPrivateKey&&(o.Authorization=`Bearer ${e.builderPrivateKey}`);try{await Me(i,{method:"POST",body:JSON.stringify({sessionId:r,restoreCredits:n}),headers:o,signal:AbortSignal.timeout(3e4)})}catch(s){let a=s&&s.name==="AbortError"||typeof s?.code=="string"&&s.code==="ABORT_ERR"||typeof s?.timeout=="boolean"&&s.timeout||/timeout|abort/i.test(s?.message??"");t.Sentry?.captureException(s,{level:"warning",tags:{operation:"restore-consumed-credit",timeout:a}})}}function swe(t,e){let r={totalSize:e.length,totalSizeMB:(e.length/1048576).toFixed(2)};if(t.attachments?.length){let i=t.attachments.map(s=>JSON.stringify(s).length),o={};t.attachments.forEach((s,a)=>{let A=s.type||"unknown",c=i[a];o[A]||(o[A]={count:0,totalSize:0}),o[A].count++,o[A].totalSize+=c}),r.attachments={count:t.attachments.length,totalSize:i.reduce((s,a)=>s+a,0),totalSizeMB:(i.reduce((s,a)=>s+a,0)/(1024*1024)).toFixed(2),byType:Object.entries(o).map(([s,a])=>({type:s,count:a.count,sizeMB:(a.totalSize/(1024*1024)).toFixed(2)})),largestAttachments:t.attachments.map((s,a)=>({type:s.type,size:i[a],sizeMB:(i[a]/(1024*1024)).toFixed(2)})).sort((s,a)=>a.size-s.size).slice(0,5)}}if(t.files?.length){let i={},o=0,s=0,a=0;t.files.forEach(c=>{let u=c.filePath?.split(".").pop()||"no-ext";i[u]||(i[u]={count:0,withContent:0,totalContentSize:0}),i[u].count++,c.content?(i[u].withContent++,i[u].totalContentSize+=c.content.length,o++,a+=c.content.length):s++});let A=Object.entries(i).sort((c,u)=>u[1].totalContentSize-c[1].totalContentSize).slice(0,10).map(([c,u])=>({ext:c,count:u.count,withContent:u.withContent,contentSizeMB:(u.totalContentSize/(1024*1024)).toFixed(2)}));r.files={totalCount:t.files.length,withContent:o,withoutContent:s,totalContentSize:a,totalContentSizeMB:(a/(1024*1024)).toFixed(2),topExtensionsBySize:A}}let n={};if(t.userPrompt&&(n.userPrompt={size:t.userPrompt.length,sizeMB:(t.userPrompt.length/(1024*1024)).toFixed(2),hasGitDiff:t.userPrompt.includes("<modified-files-context>")},n.userPrompt.hasGitDiff)){let i=t.userPrompt.match(/<modified-files-context>([\s\S]*?)<\/modified-files-context>/);i&&(n.gitDiffInPrompt={size:i[1].length,sizeMB:(i[1].length/(1024*1024)).toFixed(2)})}if(t.uiContextPrompt&&(n.uiContextPrompt={size:t.uiContextPrompt.length,sizeMB:(t.uiContextPrompt.length/(1024*1024)).toFixed(2)}),Object.keys(n).length>0&&(r.prompts=n),t.toolResults?.length){let i=JSON.stringify(t.toolResults).length;r.toolResults={count:t.toolResults.length,totalSize:i,totalSizeMB:(i/(1024*1024)).toFixed(2)}}return r}async function*NQe(t,e,r,n,i){if(!e.builderPrivateKey)throw new Error("Missing builder public key during completion stream");let o=new AbortController,s=JSON.stringify(r),a=new URL(`${Pe}/codegen/completion`);e.builderPublicKey&&a.searchParams.set("apiKey",e.builderPublicKey),e.userId&&a.searchParams.set("userId",e.userId);let A=performance.now(),c=A,u,l=!1,d=0,g=[];try{let p=await Me(a,{method:"POST",body:s,keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.builderPrivateKey}`},signal:$n([n,o.signal])},i);if(!p.ok){let h=await p.text(),C=`Bad Status: ${p.status}: ${h}`;if(p.status===413){let B=swe(r,s),E=[];B.attachments?.totalSizeMB&&E.push(`Attachments: ${B.attachments.totalSizeMB}MB (${B.attachments.count} files)`),B.files?.totalContentSizeMB&&E.push(`File content: ${B.files.totalContentSizeMB}MB (${B.files.withContent} files)`),B.prompts?.gitDiffInPrompt?.sizeMB&&E.push(`Git diff: ${B.prompts.gitDiffInPrompt.sizeMB}MB`),B.prompts?.uiContextPrompt?.sizeMB&&E.push(`UI context: ${B.prompts.uiContextPrompt.sizeMB}MB`),B.toolResults?.totalSizeMB&&E.push(`Tool results: ${B.toolResults.totalSizeMB}MB`),E.length>0&&(C+=`
|
|
2529
2529
|
|
|
2530
2530
|
Payload size: ${B.totalSizeMB}MB. Top contributors:
|
|
2531
2531
|
${E.join(`
|
|
2532
|
-
`)}`)}let I=new Error(C);throw I.name=`BadStatus${p.status}`,I}let f=rm(p.body);for await(let h of f)if(c=performance.now(),d+=h.length,h.length!==0){g.push(h),g=g.slice(-10);try{let C=JSON.parse(h);C.type==="ping"&&(u=performance.now()),l=!0,yield C}catch(C){t.Sentry?.captureException(C,{extra:{value:h,valueLength:h.length},tags:{operation:"codegen-stream"}})}}}catch(p){let f=performance.now();if(p instanceof Error&&p.name==="AbortError"||p instanceof Error&&p.name==="HTTPStreamBroke"||p instanceof Error&&p.name==="BadStatus403"||p instanceof wi){if(p instanceof Error&&p.name==="HTTPStreamBroke"){n.aborted||o.abort(p);let B=new Blob([s]).size,E=u!==void 0?f-u:void 0;t.Sentry?.setContext("brokenStreamInfo",{timeSinceLastPing:E,lastMessageElapsed:f-c,totalElapsed:f-A,responseSize:d,requestSize:B,didStream:l,lastEvents:g});let y=20*1024*1024,Q=B>y;t.Sentry?.getCurrentScope().addAttachment({filename:Q?"truncated-body.json":"body.json",data:Q?s.slice(0,2e5):s})}throw p}if(p instanceof tt)throw p;let h=p instanceof Error?p.name:"UnknownError",C=new zt(`codegen/completion endpoint: ${h}`,{cause:p}),I=swe(r,s);throw t.Sentry?.captureException(C,{tags:{operation:"codegen-stream"},extra:{bodySize:s.length,responseSize:d,attachments:r.attachments?.length??0,files:r.files?.length??0,toolResults:r.toolResults?.length??0,didStream:l,lastMessageElapsed:f-c,totalElapsed:f-A,lastEvents:g,payloadBreakdown:I}}),C}}async function ij(t,e,r,n,i){let o,a=JSON.stringify(n);for(let A=0;A<3;A++){try{let c=new URL(`${
|
|
2532
|
+
`)}`)}let I=new Error(C);throw I.name=`BadStatus${p.status}`,I}let f=rm(p.body);for await(let h of f)if(c=performance.now(),d+=h.length,h.length!==0){g.push(h),g=g.slice(-10);try{let C=JSON.parse(h);C.type==="ping"&&(u=performance.now()),l=!0,yield C}catch(C){t.Sentry?.captureException(C,{extra:{value:h,valueLength:h.length},tags:{operation:"codegen-stream"}})}}}catch(p){let f=performance.now();if(p instanceof Error&&p.name==="AbortError"||p instanceof Error&&p.name==="HTTPStreamBroke"||p instanceof Error&&p.name==="BadStatus403"||p instanceof wi){if(p instanceof Error&&p.name==="HTTPStreamBroke"){n.aborted||o.abort(p);let B=new Blob([s]).size,E=u!==void 0?f-u:void 0;t.Sentry?.setContext("brokenStreamInfo",{timeSinceLastPing:E,lastMessageElapsed:f-c,totalElapsed:f-A,responseSize:d,requestSize:B,didStream:l,lastEvents:g});let y=20*1024*1024,Q=B>y;t.Sentry?.getCurrentScope().addAttachment({filename:Q?"truncated-body.json":"body.json",data:Q?s.slice(0,2e5):s})}throw p}if(p instanceof tt)throw p;let h=p instanceof Error?p.name:"UnknownError",C=new zt(`codegen/completion endpoint: ${h}`,{cause:p}),I=swe(r,s);throw t.Sentry?.captureException(C,{tags:{operation:"codegen-stream"},extra:{bodySize:s.length,responseSize:d,attachments:r.attachments?.length??0,files:r.files?.length??0,toolResults:r.toolResults?.length??0,didStream:l,lastMessageElapsed:f-c,totalElapsed:f-A,lastEvents:g,payloadBreakdown:I}}),C}}async function ij(t,e,r,n,i){let o,a=JSON.stringify(n);for(let A=0;A<3;A++){try{let c=new URL(`${Pe}${r}`);e.builderPublicKey&&c.searchParams.set("apiKey",e.builderPublicKey),e.userId&&c.searchParams.set("userId",e.userId);let u={"Content-Type":"application/json"};e.builderPrivateKey&&(u.Authorization=`Bearer ${e.builderPrivateKey}`);let l=AbortSignal.timeout(3e4),d=await Me(c,{method:"POST",body:a,keepalive:!0,headers:u,signal:l},i);if(d.ok)return!0;throw new Error(`Bad Status: ${d.status}`)}catch(c){c instanceof tt&&Bn(c),o=c}A<2&&await wp(A)}return o&&t.Sentry?.captureException(o),!1}async function pc(t,e,r,n){try{if(n?.signal?.aborted)return;let i=new URL(`${Pe}${e}`);t.builderPublicKey&&i.searchParams.set("apiKey",t.builderPublicKey),t.userId&&i.searchParams.set("userId",t.userId);let o={"Content-Type":"application/json"};t.builderPrivateKey&&(o.Authorization=`Bearer ${t.builderPrivateKey}`);let s=n?.timeoutMs??3e4,a=AbortSignal.timeout(s),A=n?.signal?$n([n.signal,a]):a,c=await Me(i,{method:"POST",body:JSON.stringify(r),keepalive:!0,headers:o,signal:A},n?.debug??!1);return c.ok?await c.json():void 0}catch{return}}async function oj(t,e,r,n){let i,s=JSON.stringify(r);for(let a=0;a<2;a++){try{let A=new URL(`${Pe}/codegen/sessions/set-last-completion`);e.builderPublicKey&&A.searchParams.set("apiKey",e.builderPublicKey),e.userId&&A.searchParams.set("userId",e.userId);let c={"Content-Type":"application/json"};e.builderPrivateKey&&(c.Authorization=`Bearer ${e.builderPrivateKey}`);let u=await Me(A,{method:"POST",body:s,keepalive:!0,headers:c,signal:AbortSignal.timeout(3e4)},n);if(u.ok)return!0;throw new Error(`Bad Status: ${u.status}`)}catch(A){A instanceof tt&&Bn(A),i=A}a<1&&await wp(a)}return i&&t.Sentry?.captureException(i),!1}async function ZF(t,e,r,n,i,o,s){try{let a=new URL(`${Pe}/codegen/sessions/${r}/turns`);e.builderPublicKey&&a.searchParams.set("apiKey",e.builderPublicKey),e.userId&&a.searchParams.set("userId",e.userId),a.searchParams.set("linear",String(n)),o&&a.searchParams.set("completionIdCursor",o);let A={"Content-Type":"application/json"};return e.builderPrivateKey&&(A.Authorization=`Bearer ${e.builderPrivateKey}`),await(await Me(a,{method:"GET",headers:A,keepalive:!0,signal:$n([s,AbortSignal.timeout(1e4)])},i)).json()}catch(a){return a instanceof tt&&Bn(a),t.Sentry?.captureException(a),{turns:[],sessionId:r,initialUrl:void 0,beforeCommit:void 0,title:void 0,createdUnixTime:void 0,updatedUnixTime:void 0,allIds:[],lastCompletionId:void 0,canLoadMore:!1}}}async function MQe(t,e){let r=await t.getRepoInfo(e),n={client:"@builder.io/dev-tools",clientVersion:t.version,nodeVersion:process.version,frameworks:t.getFrameworks().map(i=>i.name),systemPlatform:process.platform,systemEOL:hk.default.EOL,systemArch:hk.default.arch(),inGitRepo:!!r.remoteUrl};try{let i=hk.default.userInfo();n.systemShell=i.shell??void 0}catch{}return n}function $De(){let t=!1,e=[],r,n;i();function i(){n=new Promise(A=>r=A)}async function*o(){await n;let A=e.shift();A&&(yield A),t||(yield*o())}function s(A){e.push(A),r(),i()}function a(){t=!0,r()}return[o(),s,a]}function Awe(t,e){return t.split(e).length-1}function gj(t){return t=t.toLowerCase(),t.endsWith("claude.md")||t.endsWith("agent.md")||t.endsWith("agents.md")}function PQe(t,e){if(!t.startsWith(e))return!1;t=t.slice(e.length);let n=Awe(t,"/");return n<2&&t.endsWith("package.json")||t.endsWith("Podfile")||t.endsWith("Cartfile")||n<2&&t.endsWith("global.css")||n<2&&t.endsWith("tailwind.config.ts")||n<2&&t.endsWith("tailwind.config.js")||t.endsWith("libraries.toml")}function _Qe(t,e){return gj(t)?(t.startsWith(e)&&(t=t.slice(e.length)),Awe(t,"/")===0):!1}function LQe(t){return t?[/ERROR[ ]in\b/i,/Module not found: Can't resolve\b/i,/(\b|^)failed to compile\b/i,/(\b|^)Internal server error\b/i,/(\b|^)Error when evaluating SSR module virtual\b/i,/(\b|^)ReferenceError: \w* is not defined\b/i,/(\b|^)Found \d+ errors?\./i,/(\b|^)error TS\d+\b/i,/(\b|^)SyntaxError: Unexpected token\b/i,/(\b|^)Error processing file\b.*SyntaxError\b/i,/(\b|^)Module build failed\b/i,/(\b|^)Build failed\b/i,/(\b|^)\[Error:.*\]/i,/(\b|^)uncaughtException: /i].some(r=>r.test(t)):!1}async function JDe(t,e){try{let r=t.resolve(t.cwd(),e);if(!await t.exists(r))throw new Error(`Workspace file not found: ${e}`);let n=await t.readFile(r);if(!n)throw new Error(`Failed to read workspace file: ${e}`);let i=JSON.parse(n);if(!i.folders||!Array.isArray(i.folders))throw new Error('Invalid workspace configuration: missing "folders" array');let o=t.dirname(r);return{workspace:i,workingDirectory:o}}catch(r){throw ift.error(`Error loading workspace: ${r instanceof Error?r.message:String(r)}`),r}}function sj(t){let e=t[0];for(let r=1;r<t.length;r++)e=pj(e,t[r]);return e}function pj(t,e){let r=`${t.displayPrompt??t.userPrompt}
|
|
2533
2533
|
|
|
2534
2534
|
${e.displayPrompt??e.userPrompt}`;return{...e,displayPrompt:r,softContextWindow:e.softContextWindow??t.softContextWindow,idempotencyKey:t.idempotencyKey??e.idempotencyKey,syncChanges:e.syncChanges??t.syncChanges,autoPush:e.autoPush??t.autoPush,runValidateCommand:!!(e.runValidateCommand||t.runValidateCommand),maxCompletions:t.maxCompletions||e.maxCompletions?Math.max(t.maxCompletions??ek,e.maxCompletions??ek):void 0,userPrompt:t.userPrompt+`
|
|
2535
2535
|
|
|
@@ -2545,10 +2545,10 @@ ${i}`,o),this.name="BashError",this.command=e,this.code=r,this.stdout=n,this.std
|
|
|
2545
2545
|
`;return e+=`</environment_variables>
|
|
2546
2546
|
`,e}});function Aft(t){return t.replace(/(https?:\/\/)([^@\s]+@)?([^\/\s]+)/g,(e,r,n,i)=>n?`${r}***@${i}`:e)}async function Va(t,e,r){let n=Math.max(r.retry??0,0)+1,i;for(let o=0;o<n;o++)try{return await cft(t,e,r)}catch(s){i=s,o<n-1&&await wp(o)}throw i}function aA(){let t=cwe;return cwe++,t.toString()}function cft(t,e,r){let n=`${t} ${e.join(" ")}`,i=performance.now(),o=aA();r.skipLogging||s6.debug(`(id=${o}): starting (cwd: ${r.cwd||"NOT SET"}): ${Aft(n)}`);let s=new Promise((a,A)=>{let c="",u="",l=(0,uwe.spawn)(t,e,{cwd:r.cwd,stdio:[r.stdin?"pipe":"ignore","pipe","pipe"],shell:!1});r.stdin&&(l.stdin.write(r.stdin),l.stdin.end());let d=r.timeout?setTimeout(()=>{ms(r.sys,l).then(()=>{A(new la(n,void 0,c,u,{cause:new Error(`${t} command timed out`)}))})},r.timeout):void 0;l.on("error",g=>{clearTimeout(d),A(new la(n,void 0,c,u,{cause:g}))}),l.stdout?.on("data",g=>{let p=g.toString();c+=p}),l.stderr?.on("data",g=>{let p=g.toString();u+=p}),l.on("close",g=>{if(clearTimeout(d),g===0)a(u&&!c?u:c);else{if(g===128&&uft(c,u)&&r.sys.Sentry?.captureException(new Error("Git repo is corrupted"),{tags:{operation:"codegen-git"},extra:{stdout:c,stderr:u,command:n,exitCode:g}}),g===128&&lft(c,u)){r.sys.Sentry?.captureException(new Error("Git repo not found or inaccessible"),{tags:{operation:"codegen-git"},extra:{stdout:c,stderr:u,command:n,exitCode:g}}),A(new Error("Your connected Git repository is no longer accessible. Please verify the repo exists and you have permission to access it.",{cause:new la(n,g,c,u)}));return}A(new la(n,g??void 0,c,u))}})});return r.skipLogging?s:s.then(a=>{let A=Math.round(performance.now()-i);return s6.debug(`(id=${o}): success (code: 0) [${A}ms] ${a.replaceAll(`
|
|
2547
2547
|
`," ").trim()}`),a}).catch(a=>{let A=a instanceof la?a:a?.cause instanceof la?a.cause:null;if(A){let c=Math.round(performance.now()-i),u=`${A.stdout.trim()} ${A.stderr.trim()}`.replaceAll(`
|
|
2548
|
-
`," ").trim();s6.debug(`[GIT](id=${o}): error (code: ${A.code}) [${c}ms] ${u}`)}throw a})}async function ou(t,e){try{return(await Va("git",["status","--porcelain=v1","-z","--ignore-submodules=dirty"],{cwd:t,sys:e})).trim().length===0}catch{return!1}}function Bg(t){return t&&typeof t=="object"&&"stderr"in t&&t.stderr?String(t.stderr):t instanceof Error?t.message:String(t)}async function Nm(t,e,r){try{let n=new URL(`${
|
|
2548
|
+
`," ").trim();s6.debug(`[GIT](id=${o}): error (code: ${A.code}) [${c}ms] ${u}`)}throw a})}async function ou(t,e){try{return(await Va("git",["status","--porcelain=v1","-z","--ignore-submodules=dirty"],{cwd:t,sys:e})).trim().length===0}catch{return!1}}function Bg(t){return t&&typeof t=="object"&&"stderr"in t&&t.stderr?String(t.stderr):t instanceof Error?t.message:String(t)}async function Nm(t,e,r){try{let n=new URL(`${Pe}/projects/git-configs`);n.searchParams.set("projectId",e),t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Me(n,{keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},signal:AbortSignal.timeout(1e4)},r);if(i.status===404)return{success:!1,error:new Error("Failed to fetch git configs",{cause:new Error("Project not found")})};if(!i.ok){let s,a=`Failed to fetch git configs. HTTP ${i.status}: ${i.statusText}`;try{let A=await i.json();A.message&&(a=A.message),A.gitDiagnostics&&(s=A.gitDiagnostics)}catch{}return{success:!1,error:new Error(a),gitDiagnostics:s}}return{success:!0,gitConfigs:(await i.json()).gitConfigs}}catch(n){return{success:!1,error:new Error("Failed to fetch git configs",{cause:n instanceof Error?n:new Error(String(n))})}}}var uwe,s6,cwe,uft,lft,za=N(()=>{"use strict";m();Zc();ja();uwe=require("node:child_process");Zr();Jr();vb();Gt();s6=ke("Git");cwe=0;uft=(t,e)=>{let r=[/fatal:\s*bad\s+object/i,/fatal:\s*loose\s+object.*is\s+corrupt/i,/fatal:\s*index\s+file.*is\s+corrupt/i,/fatal:\s*corrupt\s+loose\s+object/i,/fatal:\s*object\s+file.*is\s+corrupt/i,/fatal:\s*packfile.*is\s+truncated/i,/corrupted\s+pack/i,/invalid\s+pack\s+checksum/i,/error:\s*inflate:\s+data\s+stream\s+error/i,/error:\s*missing\s+blob/i,/error:\s*missing\s+commit/i,/error:\s*broken\s+link/i,/unable\s+to\s+read\s+.*object/i,/repository\s+corruption/i,/index.*is\s+corrupt/i],n=`${t}
|
|
2549
2549
|
${e}`.toLowerCase();return r.some(i=>i.test(n))},lft=(t,e)=>{let r=[/remote:\s*repository\s+not\s+found/i,/fatal:\s*repository\s+'[^']*'\s+not\s+found/i,/error:\s*repository\s+not\s+found/i,/the\s+requested\s+repository\s+does\s+not\s+exist/i,/access\s+denied\s+or\s+repository\s+not\s+found/i],n=`${t}
|
|
2550
|
-
${e}`;return r.some(i=>i.test(n))}});function dwe(){if(yg!==void 0)return yg;if(fc.default.platform!=="darwin")return yg=null,null;try{let t=(0,Ck.execSync)("scutil --nwi | grep 'Network interfaces:' | awk '{print $3}'",{encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();if(!t)return yg=null,null;let e=(0,Ck.execSync)("networksetup -listnetworkserviceorder",{encoding:"utf8",stdio:["pipe","pipe","ignore"]}),r=o=>{try{let s=(0,Ck.execSync)(`networksetup -getautoproxyurl "${o}"`,{encoding:"utf8",stdio:["pipe","pipe","ignore"]}),a=s.match(/Enabled: (Yes|No)/i),A=a&&a[1].toLowerCase()==="yes",c=s.match(/URL: (.*)/),u=c?c[1].trim():null;if(A){if(!u||u==="(null)")return null}else return null;let l=A&&u&&u!=="(null)"?u:null;return l&&c6.info(`Detected PAC URL from service "${o}": ${l}`),l}catch{return null}},n=new RegExp(`\\(Hardware Port: (.*), Device: ${t}\\)`,"i"),i=e.match(n);if(i&&i[1]){let o=i[1],s=r(o);if(s)return yg=s,s}else if(t.match(/^(utun|ipsec|ppp|gif|stf|lo)\d*/)){let o=["Wi-Fi","Ethernet","Thunderbolt Ethernet"];for(let s of o)if(e.includes(s)){let a=r(s);if(a)return yg=a,a}}}catch(t){let e=t instanceof Error?t.message:String(t);c6.warn(`Error detecting PAC URL: ${e}`),yg=null}return yg=null,null}async function gft(t){if(Zh===void 0){let e=dwe();if(!e){Zh=null;return}try{let r=fc.default.env.FUSION_REJECT_UNAUTHORIZED!=="0",n=new mc.Agent({connect:{rejectUnauthorized:r}}),o=await(await(0,mc.fetch)(e,{dispatcher:n})).text(),s=await(0,gwe.getQuickJS)();Zh=await(0,lwe.createPacResolver)(s,o)}catch{Zh=null;return}}if(Zh!==null)try{let e=await Zh(t);if(!e||e==="DIRECT")return;let r=e.match(/PROXY\s+([^\s;]+)/i);if(r){let n=r[1];return n.startsWith("http")?n:`http://${n}`}}catch(e){c6.info(`PAC resolution failed for ${t}: ${e instanceof Error?e.message:String(e)}`)}}async function pft(t){let e=fc.default.env.FUSION_REJECT_UNAUTHORIZED!=="0",r=fc.default.env.HTTPS_PROXY||fc.default.env.https_proxy||fc.default.env.HTTP_PROXY||fc.default.env.http_proxy;if(r)return Wh||(Wh=new mc.ProxyAgent({uri:r,connect:{rejectUnauthorized:e},requestTls:{rejectUnauthorized:e}})),Wh;if(t){let n=await gft(t);if(n)return new mc.ProxyAgent({uri:n,connect:{rejectUnauthorized:e},requestTls:{rejectUnauthorized:e}})}return Wh||dwe()||(Wh=new mc.Agent({connect:{rejectUnauthorized:e}})),Wh||new mc.Agent({connect:{rejectUnauthorized:e}})}function dft(){let e={darwin:"Macintosh",win32:"Windows NT",linux:"Linux",android:"Android",ios:"iPhone"}[fc.default.platform]||"Unknown",r=fc.default.platform==="win32"?"10.0":"";return{"User-Agent":`Mozilla/5.0 (${e}${r?"; "+r:""}) builder-cli/${Hoe}`,"Sec-Ch-Ua-Platform":e}}async function fwe(t=1e3){let r=new URL("/codegen/health",
|
|
2551
|
-
\u274C Not a Figma URL - hostname check failed`),null;let n=r.searchParams.get("node-id")?.replaceAll("-",":"),i=r.pathname.split("/")[2];return n&&i?{fileID:i,nodeId:n}:null}catch{return null}},mft="https://api.figma.com/v1/",Nu=async(t,e,r,{auth:n,params:i})=>{let o=new URL(`${mft}${r}`),s={};if(n.oauth?s.Authorization=`Bearer ${n.access_token}`:s["X-FIGMA-TOKEN"]=n.access_token,i)for(let A in i)i[A]!=null&&o.searchParams.set(A,i[A].toString());let a=await
|
|
2550
|
+
${e}`;return r.some(i=>i.test(n))}});function dwe(){if(yg!==void 0)return yg;if(fc.default.platform!=="darwin")return yg=null,null;try{let t=(0,Ck.execSync)("scutil --nwi | grep 'Network interfaces:' | awk '{print $3}'",{encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim();if(!t)return yg=null,null;let e=(0,Ck.execSync)("networksetup -listnetworkserviceorder",{encoding:"utf8",stdio:["pipe","pipe","ignore"]}),r=o=>{try{let s=(0,Ck.execSync)(`networksetup -getautoproxyurl "${o}"`,{encoding:"utf8",stdio:["pipe","pipe","ignore"]}),a=s.match(/Enabled: (Yes|No)/i),A=a&&a[1].toLowerCase()==="yes",c=s.match(/URL: (.*)/),u=c?c[1].trim():null;if(A){if(!u||u==="(null)")return null}else return null;let l=A&&u&&u!=="(null)"?u:null;return l&&c6.info(`Detected PAC URL from service "${o}": ${l}`),l}catch{return null}},n=new RegExp(`\\(Hardware Port: (.*), Device: ${t}\\)`,"i"),i=e.match(n);if(i&&i[1]){let o=i[1],s=r(o);if(s)return yg=s,s}else if(t.match(/^(utun|ipsec|ppp|gif|stf|lo)\d*/)){let o=["Wi-Fi","Ethernet","Thunderbolt Ethernet"];for(let s of o)if(e.includes(s)){let a=r(s);if(a)return yg=a,a}}}catch(t){let e=t instanceof Error?t.message:String(t);c6.warn(`Error detecting PAC URL: ${e}`),yg=null}return yg=null,null}async function gft(t){if(Zh===void 0){let e=dwe();if(!e){Zh=null;return}try{let r=fc.default.env.FUSION_REJECT_UNAUTHORIZED!=="0",n=new mc.Agent({connect:{rejectUnauthorized:r}}),o=await(await(0,mc.fetch)(e,{dispatcher:n})).text(),s=await(0,gwe.getQuickJS)();Zh=await(0,lwe.createPacResolver)(s,o)}catch{Zh=null;return}}if(Zh!==null)try{let e=await Zh(t);if(!e||e==="DIRECT")return;let r=e.match(/PROXY\s+([^\s;]+)/i);if(r){let n=r[1];return n.startsWith("http")?n:`http://${n}`}}catch(e){c6.info(`PAC resolution failed for ${t}: ${e instanceof Error?e.message:String(e)}`)}}async function pft(t){let e=fc.default.env.FUSION_REJECT_UNAUTHORIZED!=="0",r=fc.default.env.HTTPS_PROXY||fc.default.env.https_proxy||fc.default.env.HTTP_PROXY||fc.default.env.http_proxy;if(r)return Wh||(Wh=new mc.ProxyAgent({uri:r,connect:{rejectUnauthorized:e},requestTls:{rejectUnauthorized:e}})),Wh;if(t){let n=await gft(t);if(n)return new mc.ProxyAgent({uri:n,connect:{rejectUnauthorized:e},requestTls:{rejectUnauthorized:e}})}return Wh||dwe()||(Wh=new mc.Agent({connect:{rejectUnauthorized:e}})),Wh||new mc.Agent({connect:{rejectUnauthorized:e}})}function dft(){let e={darwin:"Macintosh",win32:"Windows NT",linux:"Linux",android:"Android",ios:"iPhone"}[fc.default.platform]||"Unknown",r=fc.default.platform==="win32"?"10.0":"";return{"User-Agent":`Mozilla/5.0 (${e}${r?"; "+r:""}) builder-cli/${Hoe}`,"Sec-Ch-Ua-Platform":e}}async function fwe(t=1e3){let r=new URL("/codegen/health",Pe);for(let n=1;n<=3;n++)try{let i=await Me(r);return i.ok?void 0:new tt({type:"server_error",statusCode:i.status,hostname:r.hostname,cause:new Error(`Builder.io API is not healthy (HTTP ${i.status})`),message:`Builder.io API is not healthy (HTTP ${i.status})`,suggestions:["Try again in a few minutes - this may be a temporary issue","Contact support if the problem persists"]})}catch(i){if(n===3)return i instanceof tt?i:new tt({type:"connection_refused",cause:i instanceof Error?i:new Error(String(i)),message:"Failed to connect to Builder.io API after 3 attempts",suggestions:["Check your internet connection",`Verify that ${r.hostname} is accessible from your network`,"Try again in a few minutes"],hostname:r.hostname});await new Promise(o=>setTimeout(o,t))}}var mc,lwe,gwe,Ck,fc,pwe,c6,a6,Wh,yg,Zh,A6,Me,Jr=N(()=>{"use strict";m();mc=require("undici"),lwe=W(Ioe(),1),gwe=W(iL(),1),Ck=require("node:child_process");Koe();fc=W(require("node:process"),1),pwe=W(require("@sentry/node"),1);Vi();Gt();Dp();Zr();za();c6=ke("Proxy"),a6=ke("Fetch");Me=async(t,e,r)=>{let n=new URL(t),i=n.hostname,o=n.port?parseInt(n.port):void 0,s=aA(),a=performance.now(),A="";try{let c=pwe.getTraceData(),u=await pft(n.toString());r&&a6.info(`(${s}): ${n.href}`);let l=n.hostname==="api.builder.io",d=await(0,mc.fetch)(n,{...e,dispatcher:u,headers:{...e?.headers,...dft(),...c,...A6&&l?{Cookie:A6.join("; ")}:{}}});if(l&&(A6=d.headers.getSetCookie()),A=`status: ${d.status}`,!d.ok){if(d.status===402){let g=await d.json(),p=g.code??"credits-limit-daily",f=g.message??"You've reached the DAY AI credits limit for your current plan.";throw new wi(f,p)}else if(d.status===429){let g=await d.json(),p=g.code??"credits-limit-other",f=g.message??"Rate limit exceeded. Please try again later.";throw new wi(f,p)}if(d.status>=500){let g;try{let p=await d.text();if(p)try{let f=JSON.parse(p);g=f.message||f.error||p}catch{g=p}}catch{}throw new tt({type:"server_error",cause:g?new Error(g):void 0,message:`Server error from ${i} (HTTP ${d.status}). The server encountered an internal error.`,suggestions:["Try again in a few minutes - this may be a temporary issue","Contact support if the problem persists"],hostname:i,statusCode:d.status})}}return d}catch(c){if(A=A||"fetch error",c instanceof tt||c instanceof wi||c instanceof Error&&c.name==="AbortError")throw c;if(c instanceof Error){if(c.name==="TypeError"&&c.cause instanceof Error){let g=c.cause;if(g.code)throw N_(g,i,o)}if(c.code)throw N_(c,i,o);if(c.message?.includes("SSL")||c.message?.includes("TLS")||c.message?.includes("certificate")||c.message?.includes("CERT"))throw new tt({type:"ssl_certificate_invalid",cause:c,message:`SSL/TLS error connecting to ${i}. The connection could not be secured.`,suggestions:["If behind a corporate proxy with custom CA certificates:"," \u2192 Try: export NODE_USE_SYSTEM_CA=1 (recommended if CA is in system trust store)"," \u2192 Or: export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem"," \u2192 Or use the --acceptSelfSigned CLI flag","For Node.js 22+, you can also use --use-system-ca flag","Contact your IT department to get the corporate root CA certificate","Try again in a few minutes","Contact support@builder.io if the issue persists"],hostname:i})}let u=e?.method||"GET",l=c instanceof Error?c.message:String(c);throw new tt({type:"unknown",cause:c instanceof Error?c:new Error(String(c)),message:`Network error for ${u} ${n.toString()}: ${l}`,suggestions:["Check your internet connection","Try again in a few minutes","Contact support if the issue persists"],hostname:i,port:o})}finally{let c=Math.round(performance.now()-a);A==="fetch error"||/^status: [45]/.test(A)?a6.warn(`(${s}): ${e?.method??"GET"} ${n.pathname} ${A} [${c}ms]`):r&&a6.info(`(${s}): ${A} [${c}ms]`)}}});async function mwe(t,e,r,n,i){if(i.length>0){let o=await Cft(t,e,r,i);for(let s of n)if(s.figmaUrl&&!s.figmaKey){let a=o[s.figmaUrl];a&&(s.figmaKey=a)}}}var fft,u6,mft,Nu,hft,Cft,l6=N(()=>{"use strict";m();Cr();Jr();Ta();fft=W(require("@sentry/node"),1);Zr();un();Oh();u6=t=>{try{let e=t.replace(/\\\(/g,"(").replace(/\\\)/g,")").replace(/\\\=/g,"=").replace(/\\\?/g,"?").replace(/\\\&/g,"&"),r=new URL(e);if(!r.hostname.includes("figma.com"))return console.log(`
|
|
2551
|
+
\u274C Not a Figma URL - hostname check failed`),null;let n=r.searchParams.get("node-id")?.replaceAll("-",":"),i=r.pathname.split("/")[2];return n&&i?{fileID:i,nodeId:n}:null}catch{return null}},mft="https://api.figma.com/v1/",Nu=async(t,e,r,{auth:n,params:i})=>{let o=new URL(`${mft}${r}`),s={};if(n.oauth?s.Authorization=`Bearer ${n.access_token}`:s["X-FIGMA-TOKEN"]=n.access_token,i)for(let A in i)i[A]!=null&&o.searchParams.set(A,i[A].toString());let a=await Me(o,{headers:s});if(!a.ok){if(a.status===401){j.error("Seems like figma auth is expired or it's invalid, let's try to");let A=await mr(t,e,{force:!0,requireFigmaAuth:"always"});return Nu(t,e,r,{auth:A.figmaAuth,params:i})}throw new Error(`Figma REST ${a.statusText}: ${await a.text()}`)}return a.json()},hft=async(t,e,r,n,i,o)=>(await Nu(t,e,`files/${n}/nodes`,{auth:r,params:{ids:i,depth:o}})).nodes;Cft=async(t,e,r,n)=>{if(!r)return{};let i=new Map,o={};return n.forEach(s=>{let a=u6(s);if(!a){t.Sentry?.captureException(new Error("Invalid Figma URL, use Cmd+L while selecting a figma component to get a link to selection"),{extra:{figmaUrl:s},level:"warning"});return}let A=i.get(a.fileID);A||(A=[],i.set(a.fileID,A)),A.includes(a.nodeId)||A.push(a.nodeId),o[s]=`${a.fileID}/${a.nodeId}`}),await Promise.all(Array.from(i.entries()).map(async([s,a])=>{let A=await hft(t,e,r,s,a.join(","),0);for(let c of a){let u=A[c],l=u.components[c]?.key??u.componentSets[c]?.key;l||t.Sentry?.withScope(g=>{g.addAttachment({data:JSON.stringify(A,null,2),filename:`${s}.json`}),t.Sentry?.captureException(new Error("Cannot resolve figma component key for NodeID"),{extra:{nodeId:c,fileID:s},level:"warning"})});let d=`${s}/${c}`;for(let g of n)o[g]===d&&(o[g]=l)}})),o}});function g6(t){return!(t.category!==pa.DiagnosticCategory.Error||!t.file||t.code===6133||t.code===6138||t.code===6305||t.code===6196||t.code===6192||t.code===6198||t.code===6199||t.code===6205||t.code===1449||t.code===2578||t.code===7006||t.code===5074||t.code===7026||t.code===2503||t.code===2695||t.code===2322)}var pa,hwe=N(()=>{"use strict";m();pa=W(require("typescript"),1)});async function Ift(t,e,r){let n=[],i=[e],o=t.relative(t.getAppRootDir(),e.fileName);for(;i.length>0;){let s=i.shift();if(Dft(s,e)){let a=Bft(t,s,e,r),{line:A,character:c}=e.getLineAndCharacterOfPosition(s.getStart());a&&(a.loc=`${o}:${A+1}:${c+1}`,n.push(a))}i.push(...s.getChildren(e))}return n}function Bft(t,e,r,n){let[i]=e.arguments;if(!i)throw new Error("Invalid figmaMapping call, no arguments found");if(!kt.default.isObjectLiteralExpression(i))throw new Error("Invalid figmaMapping call, argument is not an object literal");let o=i.properties;if(!o)throw new Error("Invalid figmaMapping call, argument has no properties");let s="",a,A,c,u="-",l=t.basename(r.fileName).replace(/\.mapper\.[tsxjm]+$/,""),d,g,p,f,h;if(e.typeArguments&&e.typeArguments.length>0){let w=Cwe(e.typeArguments[0].getText(r));w&&(l=w)}for(let w of o){let D=w.name?.getText(r);if(!D)throw new Error("Invalid figmaMapping call, property has no name");switch(D){case"componentName":{if(!("initializer"in w))throw new Error("Invalid figmaMapping call, componentName has no initializer");let x=w.initializer;if(!kt.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentName is not a string literal");a=x.text;break}case"url":{if(!("initializer"in w))throw new Error("Invalid figmaMapping call, url has no initializer");let x=w.initializer;if(!kt.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, url is not a string literal");f=x.text;break}case"componentKey":{if(!("initializer"in w))throw new Error("Invalid figmaMapping call, componentKey has no initializer");let x=w.initializer;if(!kt.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");s=x.text;break}case"meta":{if(!("initializer"in w))throw new Error("Invalid figmaMapping call, meta has no initializer");let x=w.initializer;if(kt.default.isObjectLiteralExpression(x)){h={imports:[]};for(let v of x.properties)kt.default.isPropertyAssignment(v)&&kt.default.isIdentifier(v.name)&&v.name.text==="imports"&&kt.default.isArrayLiteralExpression(v.initializer)&&(h.imports=v.initializer.elements.map(P=>{if(kt.default.isStringLiteral(P))return P.text;if(kt.default.isObjectLiteralExpression(P)){let Y={};for(let K of P.properties)if(kt.default.isPropertyAssignment(K)&&kt.default.isIdentifier(K.name)){let M=K.name.text;kt.default.isStringLiteral(K.initializer)&&(Y[M]=K.initializer.text)}return Y}return null}).filter(Boolean))}break}case"mapper":if(kt.default.isMethodDeclaration(w)){let x=function(S){let Y=n.getSymbolAtLocation(S)?.getDeclarations()?.[0];if(Y){let K=Qft(Y);if(K?.importClause){let M=K.importClause.name?.getText(r);return M===u?(d="default",g=M):K.importClause.namedBindings&&kt.default.isNamedImports(K.importClause.namedBindings)&&(d="named",K.importClause.namedBindings.elements.forEach(U=>{U.name.getText(r)===u&&(g=U.name.getText(r))})),g&&kt.default.isStringLiteral(K.moduleSpecifier)&&(p=K.moduleSpecifier.text),!0}}return!1},v=function(S){if((kt.default.isJsxOpeningElement(S)||kt.default.isJsxSelfClosingElement(S))&&kt.default.isIdentifier(S.tagName)){u=S.tagName.getText(r),x(S.tagName);return}else if(kt.default.isTaggedTemplateExpression(S)&&kt.default.isIdentifier(S.tag)&&(S.tag.escapedText==="html"||S.tag.escapedText==="tmpl")){if(kt.default.isTemplateExpression(S.template)){let Y=S.template.templateSpans.find(K=>kt.default.isIdentifier(K.expression)&&yft(K.expression.text)&&x(K.expression));if(Y&&kt.default.isIdentifier(Y.expression)){u=Y.expression.text;return}}let P=S.template.getText(r).match(/^`\s*<([^\s]+)/);if(P){u=P[1];return}if(P=S.template.getText(r).match(/^`\s*([^\s]+)/),P){u=P[1];return}}else kt.default.forEachChild(S,v)};var y=x,Q=v;if(w.parameters&&w.parameters.length>0&&w.parameters[0]&&w.parameters[0].type){let S=w.parameters[0].type.getText(r),P=Cwe(S);P&&(l=P)}kt.default.forEachChild(w,v),c=w.getText(r).replace(/^mapper/,"function Mapper"),A=p6(c);break}case"designTokenMapper":if(kt.default.isMethodDeclaration(w)){c=w.getText(r).replace(/^designTokenMapper/,"function Mapper"),A=p6(c),s="design-tokens";break}case"genericMapper":if(kt.default.isMethodDeclaration(w)){c=w.getText(r).replace(/^genericMapper/,"function Mapper"),A=p6(c),s="*";break}}}if(!s&&!f)throw new Error("Invalid figmaMapping call, no componentKey or url found");if(!s&&!A)throw new Error("Invalid figmaMapping call, no mapper found");if(!s&&!c)throw new Error("Invalid figmaMapping call, no original mapper found");let C=xft(r),I=h?.imports??[],B=[],E=[];B.push(...C);for(let w of I)typeof w=="string"?E.push(w):B.push(w);return{builderName:u,figmaName:a??l,figmaKey:s,figmaUrl:f,inputMapper:A,exportType:d,importName:g,importPath:p,originalInputMapper:c,imports:B,importStrings:E.length>0?E:void 0,source:"cli"}}function yft(t){return t.charAt(0)===t.charAt(0).toUpperCase()}function p6(t){return kt.default.transpile(t,{target:kt.default.ScriptTarget.Latest,allowNonTsExtensions:!0,moduleResolution:kt.default.ModuleResolutionKind.NodeJs,module:kt.default.ModuleKind.CommonJS,noImplicitAny:!1,esModuleInterop:!0,noUnusedLocals:!1,noUnusedParameters:!1,jsx:kt.default.JsxEmit.React,jsxFactory:"React.createElement",jsxFragmentFactory:"React.Fragment",allowJs:!0,checkJs:!0,strict:!0,suppressImplicitAnyIndexErrors:!0,typeRoots:["node_modules/@types"],inlineSources:!0,inlineSourceMap:!0})}function Qft(t){let e=t;for(;e;){if(kt.default.isImportDeclaration(e))return e;e=e.parent}}function Dft(t,e){return kt.default.isCallExpression(t)&&t.expression.getText(e)===Eft}async function bE(t){let e=["node_modules","dist","build","public"];return(await t.readdirRecursive(t.getAppRootDir(),e)).filter(n=>ks(n))}function Cwe(t){let e=t.match(/^Figma(\w+)Props$/);if(e&&typeof e[1]=="string")return e[1]}async function d6(t,e,r,n=!1){try{return r||(r=await hf(t)),(await r.setPublicApiKey({publicApiKey:e})).modifiedType==="permission-error"?{success:!1,error:"permission-error"}:(n&&await r.ensureFigmaImportPage(),{success:!0})}catch(i){let o="unknown-error";return i instanceof Error?o=i.message:typeof i=="string"&&(o=i),{success:!1,error:o}}}function vft(t){return kt.default.formatDiagnosticsWithColorAndContext(t,bft)}async function m2({sys:t,mappingFiles:e,typeCheck:r}){if(t.Sentry?.setContext("findMappings",{mappingFiles:e}),!e.length)return{mapperFiles:[],figmaBuilderLinks:[],figmaLinksToResolve:[],diagnostics:[]};let n=[],i=[],o=[],s=await Yn(t,e),a=s.getTypeChecker(),A=s.getSyntacticDiagnostics().filter(g6).filter(l=>l.file?.fileName?e.includes(l.file.fileName):!1);if(A.length>0)return j.error(`At least one of the mappings contain syntactic errors:
|
|
2552
2552
|
|
|
2553
2553
|
${vft(A)}`),Ke(1);let c=[...r?s.getSemanticDiagnostics():[]].filter(g6);for(let l of e)try{let d=s.getSourceFile(l);if(!d){t.Sentry?.captureException(new Error("Could not find source file"),{extra:{file:l,sourceFiles:s.getSourceFiles().map(f=>f.fileName)},level:"warning"});continue}let g=d?.fileName;if(i.push({filePath:l,content:d.getText()}),g){let f=c.filter(h=>h.file?.fileName===g);f.length>0&&o.push(...f)}let p=await Ift(t,d,a);n.push(...p)}catch(d){return t.Sentry?.captureException(d),await Ke(1)}let u=n.filter(l=>l.figmaUrl&&!l.figmaKey).map(l=>l.figmaUrl);return{mapperFiles:i,figmaBuilderLinks:n,figmaLinksToResolve:u,diagnostics:o}}function Sft(t){let e=new Set,r=[],n=[];for(let i of t){let o=!1;if(!i.figmaKey){n.push([i,"no-key"]);continue}i.figmaKey?(o||=e.has(i.figmaKey),e.add(i.figmaKey)):i.figmaUrl&&(o||=e.has(i.figmaUrl),e.add(i.figmaUrl)),o?n.push([i,"duplicate"]):r.push(i)}if(r.length>0){let i=`Found ${r.length} mappings:
|
|
2554
2554
|
`+r.map(o=>{let s=!1;o.figmaKey?(s||=e.has(o.figmaKey),e.add(o.figmaKey)):o.figmaUrl&&(s||=e.has(o.figmaUrl),e.add(o.figmaUrl));let a="";switch(o.figmaKey){case"design-tokens":a=" "+(0,bt.cyan)("\u2747\uFE0E Design tokens mapper");break;case"*":a=" "+(0,bt.yellow)("\u25CF Generic mapper");break;default:a=` ${(0,bt.magenta)("\u2756 "+Aa(o.figmaName))} ${(0,bt.dim)("\u2192")} ${o.builderName==="-"?"-":"<"+o.builderName+">"}`;break}return o.loc&&(a=`${a} in ${(0,bt.dim)(o.loc)}`),a}).join(`
|
|
@@ -2569,7 +2569,7 @@ See: https://www.builder.io/c/docs/component-mapping-publishing
|
|
|
2569
2569
|
|
|
2570
2570
|
`)+(0,bt.bgBlack)((0,bt.white)((0,bt.bold)(` ${w} `)))+`
|
|
2571
2571
|
|
|
2572
|
-
`+(0,bt.dim)("Then, go back to Figma and generate code again to see your mapped components.")),await Wt("figma publish success",{spaceId:d,mappingFiles:o.length,figmaBuilderLinks:c.length})};Eft="figmaMapping";wft=async(t,e,r,n,i)=>{let o=new URL(`${
|
|
2572
|
+
`+(0,bt.dim)("Then, go back to Figma and generate code again to see your mapped components.")),await Wt("figma publish success",{spaceId:d,mappingFiles:o.length,figmaBuilderLinks:c.length})};Eft="figmaMapping";wft=async(t,e,r,n,i)=>{let o=new URL(`${Pe}/mappings/publish`);o.searchParams.set("apiKey",e),o.searchParams.set("userId",n);let a=await(await Me(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify(i)})).json();if(typeof a=="object"&&typeof a.id=="string")return a.id;throw new Error("Figma Publish Response is not valid")},bft={getCanonicalFileName:t=>t,getCurrentDirectory:()=>kt.default.sys.getCurrentDirectory(),getNewLine:()=>kt.default.sys.newLine}});function m6(){return(0,Mn.join)((0,Bk.homedir)(),".builder","config","data.json")}async function Nft(t,e){let r=(0,Bwe.randomUUID)();return Dwe({sys:t,name:"Figma",initialPort:Fft,requestListener:async(n,i,o,s,a)=>{let A=new URL(i.url||"",`http://localhost:${n}`);if(A.pathname==="/figma-connect"){let c=A.searchParams.get("code"),u=A.searchParams.get("state"),l="nrGCqw6TLl95QJhVDi097A",d=Rft,p=`Basic ${Buffer.from(`${l}:${d}`).toString("base64")}`;if(c&&r===u){let h=await(await Me("https://api.figma.com/v1/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:p},body:new URLSearchParams({redirect_uri:`http://localhost:${n}/figma-connect`,code:c,grant_type:"authorization_code"}).toString()})).json();o.end(`<!doctype html>
|
|
2573
2573
|
<html lang="en" dir="ltr">
|
|
2574
2574
|
<head>
|
|
2575
2575
|
<meta charset="utf-8" />
|
|
@@ -2849,13 +2849,13 @@ return fn.apply(this, arguments)
|
|
|
2849
2849
|
`)+`\r
|
|
2850
2850
|
\r
|
|
2851
2851
|
`+r)}function Td(t,e,r,n,i,o){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Td),t.emit("wsClientError",s,r,e)}else gD(r,n,i,o)}});var yNe=k((Vbr,BNe)=>{m();var hq=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],o=this.timeBuffer[r-1]-this.timeBuffer[r-n],s=i/o;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/s/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};BNe.exports=hq});var Iq=k((Wbr,QNe)=>{m();var Pd=require("readline"),Cq=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&&Pd.cursorTo(this.stream,e,r)}cursorRelative(e=null,r=null){this.stream.isTTY&&(this.dy=this.dy+r,Pd.moveCursor(this.stream,e,r))}cursorRelativeReset(){this.stream.isTTY&&(Pd.moveCursor(this.stream,0,-this.dy),Pd.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&Pd.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&Pd.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&Pd.clearScreenDown(this.stream)}newline(){this.stream.write(`
|
|
2852
|
-
`),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)}};QNe.exports=Cq});var wNe=k((Xbr,Eq)=>{"use strict";m();var DNe=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);Eq.exports=DNe;Eq.exports.default=DNe});var vNe=k((tvr,bNe)=>{"use strict";m();bNe.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 xNe=k((nvr,Bq)=>{"use strict";m();var ivt=O2(),ovt=wNe(),svt=vNe(),SNe=t=>{if(typeof t!="string"||t.length===0||(t=ivt(t),t.length===0))return 0;t=t.replace(svt()," ");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+=ovt(n)?2:1)}return e};Bq.exports=SNe;Bq.exports.default=SNe});var yq=k((ovr,FNe)=>{m();FNe.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(o,s){return(r.autopaddingChar+o).slice(-s)}return n==="percentage"?i(e,3):e}});var Qq=k((avr,kNe)=>{m();kNe.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 Dq=k((cvr,RNe)=>{m();RNe.exports=function(e,r,n){function i(s){return n?n*Math.round(s/n):s}function o(s){return(r.autopaddingChar+s).slice(-2)}return e>3600?o(Math.floor(e/3600))+"h"+o(i(e%3600/60))+"m":e>60?o(Math.floor(e/60))+"m"+o(i(e%60))+"s":e>10?o(i(e))+"s":o(e)+"s"}});var wq=k((lvr,NNe)=>{m();var avt=xNe(),Avt=yq(),cvt=Qq(),uvt=Dq();NNe.exports=function(e,r,n){let i=e.format,o=e.formatTime||uvt,s=e.formatValue||Avt,a=e.formatBar||cvt,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:s(A,e,"percentage"),total:s(r.total,e,"total"),value:s(r.value,e,"value"),eta:s(r.eta,e,"eta"),eta_formatted:o(r.eta,e,5),duration:s(u,e,"duration"),duration_formatted:o(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-avt(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 YR=k((pvr,TNe)=>{m();function Or(t,e){return typeof t>"u"||t===null?e:t}TNe.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/Or(i.fps,10),n.stream=Or(i.stream,process.stderr),n.terminal=Or(i.terminal,null),n.clearOnComplete=Or(i.clearOnComplete,!1),n.stopOnComplete=Or(i.stopOnComplete,!1),n.barsize=Or(i.barsize,40),n.align=Or(i.align,"left"),n.hideCursor=Or(i.hideCursor,!1),n.linewrap=Or(i.linewrap,!1),n.barGlue=Or(i.barGlue,""),n.barCompleteChar=Or(i.barCompleteChar,"="),n.barIncompleteChar=Or(i.barIncompleteChar,"-"),n.format=Or(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=Or(i.formatTime,null),n.formatValue=Or(i.formatValue,null),n.formatBar=Or(i.formatBar,null),n.etaBufferLength=Or(i.etaBuffer,10),n.etaAsynchronousUpdate=Or(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=Or(i.progressCalculationRelative,!1),n.synchronousUpdate=Or(i.synchronousUpdate,!0),n.noTTYOutput=Or(i.noTTYOutput,!1),n.notTTYSchedule=Or(i.notTTYSchedule,2e3),n.emptyOnZero=Or(i.emptyOnZero,!1),n.forceRedraw=Or(i.forceRedraw,!1),n.autopadding=Or(i.autopadding,!1),n.gracefulExit=Or(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?Or(e.autopaddingChar," "):"",e}}});var bq=k((mvr,PNe)=>{m();var MNe=yNe(),lvt=Iq(),gvt=wq(),pvt=YR(),dvt=require("events");PNe.exports=class extends dvt{constructor(e){super(),this.options=pvt.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new lvt(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 MNe(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:gvt}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 MNe(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 LNe=k((Ivr,_Ne)=>{m();var fvt=bq(),mvt=YR();_Ne.exports=class extends fvt{constructor(e,r){super(mvt.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 ONe=k((yvr,UNe)=>{m();var hvt=Iq(),Cvt=bq(),Ivt=YR(),Evt=require("events");UNe.exports=class extends Evt{constructor(e,r){super(),this.bars=[],this.options=Ivt.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new hvt(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 o=new Cvt(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(o),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,o.start(e,r,n),this.emit("start")),o}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 KNe=k((Dvr,GNe)=>{m();GNe.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var $Ne=k((bvr,HNe)=>{m();HNe.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var jNe=k((Svr,JNe)=>{m();JNe.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var qNe=k((Fvr,YNe)=>{m();YNe.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var zNe=k((Rvr,VNe)=>{m();var Bvt=KNe(),yvt=$Ne(),Qvt=jNe(),Dvt=qNe();VNe.exports={legacy:Bvt,shades_classic:yvt,shades_grey:Qvt,rect:Dvt}});var XNe=k((Tvr,ZNe)=>{m();var WNe=LNe(),wvt=ONe(),bvt=zNe(),vvt=wq(),Svt=yq(),xvt=Qq(),Fvt=Dq();ZNe.exports={Bar:WNe,SingleBar:WNe,MultiBar:wvt,Presets:bvt,Format:{Formatter:vvt,BarFormat:xvt,ValueFormat:Svt,TimeFormat:Fvt}}});var sTe=k((nSr,oTe)=>{m();oTe.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 LTt={};CA(LTt,{default:()=>_Tt});module.exports=In(LTt);m();m();(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]="34eb5651-023c-4cfa-bd8d-35f53398dc9c",t._sentryDebugIdIdentifier="sentry-dbid-34eb5651-023c-4cfa-bd8d-35f53398dc9c")}catch{}})();m();var _Ue=require("../core/index.cjs"),LUe=require("../node/index.cjs"),UUe=require("../server/index.cjs"),OUe=W(RV(),1);m();m();var yk=require("fs/promises");TT();un();vE();Cr();var pn=W(Gr(),1),Xh=require("node:path");Ta();gs();Jr();vn();Oh();var Pft="https://cdn.builder.io",bwe=async(t,e)=>{console.log(""),Br((0,pn.bgCyan)((0,pn.bold)((0,pn.white)(" figma migrate ")))+" "+(0,pn.dim)(xt));let{builderPrivateKey:r,builderPublicKey:n}=await mr(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await Wt("figma publish started",{spaceId:n});let i=await bE(t);if(i.length>0){await Wt("figma migrate with existing files",{spaceId:n}),j.warning(`${(0,pn.yellow)("This repo already has figma mappings in:")}
|
|
2852
|
+
`),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)}};QNe.exports=Cq});var wNe=k((Xbr,Eq)=>{"use strict";m();var DNe=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);Eq.exports=DNe;Eq.exports.default=DNe});var vNe=k((tvr,bNe)=>{"use strict";m();bNe.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 xNe=k((nvr,Bq)=>{"use strict";m();var ivt=O2(),ovt=wNe(),svt=vNe(),SNe=t=>{if(typeof t!="string"||t.length===0||(t=ivt(t),t.length===0))return 0;t=t.replace(svt()," ");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+=ovt(n)?2:1)}return e};Bq.exports=SNe;Bq.exports.default=SNe});var yq=k((ovr,FNe)=>{m();FNe.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(o,s){return(r.autopaddingChar+o).slice(-s)}return n==="percentage"?i(e,3):e}});var Qq=k((avr,kNe)=>{m();kNe.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 Dq=k((cvr,RNe)=>{m();RNe.exports=function(e,r,n){function i(s){return n?n*Math.round(s/n):s}function o(s){return(r.autopaddingChar+s).slice(-2)}return e>3600?o(Math.floor(e/3600))+"h"+o(i(e%3600/60))+"m":e>60?o(Math.floor(e/60))+"m"+o(i(e%60))+"s":e>10?o(i(e))+"s":o(e)+"s"}});var wq=k((lvr,NNe)=>{m();var avt=xNe(),Avt=yq(),cvt=Qq(),uvt=Dq();NNe.exports=function(e,r,n){let i=e.format,o=e.formatTime||uvt,s=e.formatValue||Avt,a=e.formatBar||cvt,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:s(A,e,"percentage"),total:s(r.total,e,"total"),value:s(r.value,e,"value"),eta:s(r.eta,e,"eta"),eta_formatted:o(r.eta,e,5),duration:s(u,e,"duration"),duration_formatted:o(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-avt(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 YR=k((pvr,TNe)=>{m();function Or(t,e){return typeof t>"u"||t===null?e:t}TNe.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/Or(i.fps,10),n.stream=Or(i.stream,process.stderr),n.terminal=Or(i.terminal,null),n.clearOnComplete=Or(i.clearOnComplete,!1),n.stopOnComplete=Or(i.stopOnComplete,!1),n.barsize=Or(i.barsize,40),n.align=Or(i.align,"left"),n.hideCursor=Or(i.hideCursor,!1),n.linewrap=Or(i.linewrap,!1),n.barGlue=Or(i.barGlue,""),n.barCompleteChar=Or(i.barCompleteChar,"="),n.barIncompleteChar=Or(i.barIncompleteChar,"-"),n.format=Or(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=Or(i.formatTime,null),n.formatValue=Or(i.formatValue,null),n.formatBar=Or(i.formatBar,null),n.etaBufferLength=Or(i.etaBuffer,10),n.etaAsynchronousUpdate=Or(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=Or(i.progressCalculationRelative,!1),n.synchronousUpdate=Or(i.synchronousUpdate,!0),n.noTTYOutput=Or(i.noTTYOutput,!1),n.notTTYSchedule=Or(i.notTTYSchedule,2e3),n.emptyOnZero=Or(i.emptyOnZero,!1),n.forceRedraw=Or(i.forceRedraw,!1),n.autopadding=Or(i.autopadding,!1),n.gracefulExit=Or(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?Or(e.autopaddingChar," "):"",e}}});var bq=k((mvr,PNe)=>{m();var MNe=yNe(),lvt=Iq(),gvt=wq(),pvt=YR(),dvt=require("events");PNe.exports=class extends dvt{constructor(e){super(),this.options=pvt.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new lvt(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 MNe(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:gvt}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 MNe(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 LNe=k((Ivr,_Ne)=>{m();var fvt=bq(),mvt=YR();_Ne.exports=class extends fvt{constructor(e,r){super(mvt.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 ONe=k((yvr,UNe)=>{m();var hvt=Iq(),Cvt=bq(),Ivt=YR(),Evt=require("events");UNe.exports=class extends Evt{constructor(e,r){super(),this.bars=[],this.options=Ivt.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new hvt(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 o=new Cvt(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(o),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,o.start(e,r,n),this.emit("start")),o}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 KNe=k((Dvr,GNe)=>{m();GNe.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var $Ne=k((bvr,HNe)=>{m();HNe.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var jNe=k((Svr,JNe)=>{m();JNe.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var qNe=k((Fvr,YNe)=>{m();YNe.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var zNe=k((Rvr,VNe)=>{m();var Bvt=KNe(),yvt=$Ne(),Qvt=jNe(),Dvt=qNe();VNe.exports={legacy:Bvt,shades_classic:yvt,shades_grey:Qvt,rect:Dvt}});var XNe=k((Tvr,ZNe)=>{m();var WNe=LNe(),wvt=ONe(),bvt=zNe(),vvt=wq(),Svt=yq(),xvt=Qq(),Fvt=Dq();ZNe.exports={Bar:WNe,SingleBar:WNe,MultiBar:wvt,Presets:bvt,Format:{Formatter:vvt,BarFormat:xvt,ValueFormat:Svt,TimeFormat:Fvt}}});var sTe=k((nSr,oTe)=>{m();oTe.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 LTt={};CA(LTt,{default:()=>_Tt});module.exports=In(LTt);m();m();(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]="84c6124f-4749-4494-9f1f-3c576b475355",t._sentryDebugIdIdentifier="sentry-dbid-84c6124f-4749-4494-9f1f-3c576b475355")}catch{}})();m();var _Ue=require("../core/index.cjs"),LUe=require("../node/index.cjs"),UUe=require("../server/index.cjs"),OUe=W(RV(),1);m();m();var yk=require("fs/promises");TT();un();vE();Cr();var pn=W(Gr(),1),Xh=require("node:path");Ta();gs();Jr();vn();Oh();var Pft="https://cdn.builder.io",bwe=async(t,e)=>{console.log(""),Br((0,pn.bgCyan)((0,pn.bold)((0,pn.white)(" figma migrate ")))+" "+(0,pn.dim)(xt));let{builderPrivateKey:r,builderPublicKey:n}=await mr(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await Wt("figma publish started",{spaceId:n});let i=await bE(t);if(i.length>0){await Wt("figma migrate with existing files",{spaceId:n}),j.warning(`${(0,pn.yellow)("This repo already has figma mappings in:")}
|
|
2853
2853
|
|
|
2854
2854
|
${i.map(c=>` - ${(0,Xh.relative)(t.getAppRootDir(),c)}`).join(`
|
|
2855
2855
|
`)}
|
|
2856
2856
|
|
|
2857
2857
|
Migration is going to create new files, possibly duplicates.`);let A=await Vr({message:"Do you want to continue?",initialValue:!1});if(!A||Xe(A))return qe("Migration cancelled"),await Ke(1)}j.message("We are about to import your existing figma mappings into this local repo.");let o=To();o.start("Fetching figma mappings");let s=await _ft({privateKey:r,spaceId:n});o.stop(`Fetched ${s.length} figma mappings:`),j.message(s.map(A=>{switch(A.figmaKey){case"design-tokens":return(0,pn.cyan)("\u2747\uFE0E Design tokens mapper");case"*":return(0,pn.yellow)("\u25CF Generic mapper");default:return`${(0,pn.magenta)("\u2756 "+Aa(A.figmaName))} ${(0,pn.dim)("\u2192")} ${A.builderName}`}}).join(`
|
|
2858
|
-
`));let a=await xr({message:`Where do you want to save the figma mappings? ${(0,pn.dim)("(Ctrl+C to exit)")}`,initialValue:"./src/mappings",defaultValue:"./src/mappings",placeholder:"./src/mappings",validate:A=>{if((0,Xh.extname)(A)!=="")return"It must be a valid directory path, not a file";if((0,Xh.isAbsolute)(A))return"It must be a relative path"}});if(Xe(a))return qe("Migration cancelled"),await Ke(1);await(0,yk.mkdir)(a,{recursive:!0}),await Promise.all(s.map(async A=>{let c=await Lft(t,A),u;switch(A.figmaKey){case"design-tokens":u="design-tokens";break;case"*":u="generic";break;default:u=Aa(A.figmaName)}let l=a+"/"+u+".mapper.tsx";return j.info((0,pn.green)("created ")+(0,pn.dim)(l)),(0,yk.writeFile)(l,c)})),j.info("Check out the docs for following steps: https://builder.io/docs/figma/figma-mappings"),Un((0,pn.bgGreen)((0,pn.bold)((0,pn.white)(" Done! \u{1F389} ")))+` ${s.length} mappings imported`),await Wt("figma migrate success",{spaceId:n,mappingFiles:s.length})};async function _ft(t){let e=await
|
|
2858
|
+
`));let a=await xr({message:`Where do you want to save the figma mappings? ${(0,pn.dim)("(Ctrl+C to exit)")}`,initialValue:"./src/mappings",defaultValue:"./src/mappings",placeholder:"./src/mappings",validate:A=>{if((0,Xh.extname)(A)!=="")return"It must be a valid directory path, not a file";if((0,Xh.isAbsolute)(A))return"It must be a relative path"}});if(Xe(a))return qe("Migration cancelled"),await Ke(1);await(0,yk.mkdir)(a,{recursive:!0}),await Promise.all(s.map(async A=>{let c=await Lft(t,A),u;switch(A.figmaKey){case"design-tokens":u="design-tokens";break;case"*":u="generic";break;default:u=Aa(A.figmaName)}let l=a+"/"+u+".mapper.tsx";return j.info((0,pn.green)("created ")+(0,pn.dim)(l)),(0,yk.writeFile)(l,c)})),j.info("Check out the docs for following steps: https://builder.io/docs/figma/figma-mappings"),Un((0,pn.bgGreen)((0,pn.bold)((0,pn.white)(" Done! \u{1F389} ")))+` ${s.length} mappings imported`),await Wt("figma migrate success",{spaceId:n,mappingFiles:s.length})};async function _ft(t){let e=await Me(`${Pft}/api/internal/kv/${t.spaceId}/figma-builder?apiKey=${t.spaceId}`,{headers:{Authorization:`Bearer ${t.privateKey}`}});if(!e.ok)throw new Error(`Failed to fetch figma-builder links: ${e.statusText}`);let r=await e.json();if(!(r instanceof Object&&"figmaBuilderLinks"in r))throw new Error("Invalid response");return r.figmaBuilderLinks}async function Lft(t,e){let r="figmaMapping",n=e.originalInputMapper?.match(/function Mapper\(\s*([a-zA-Z0-9_$]+)\s*(?::[^)])?\s*\)/)?.[1],i=e.originalInputMapper?.match(/function Mapper\([^)]*\)(\s*{([^]*))$/)?.[1],o;switch(e.figmaKey){case"design-tokens":o=`${r}({
|
|
2859
2859
|
designTokenMapper(${n||"designToken"})${i}
|
|
2860
2860
|
})`;break;case"*":o=`${r}({
|
|
2861
2861
|
genericMapper(${n||"figma"})${i}
|
|
@@ -4553,7 +4553,7 @@ Skipped ${h} components
|
|
|
4553
4553
|
- ${p.length} hidden (name starts with _ or .)`:""}`)};function rmt(t){return t.name.startsWith("_")||t.name.startsWith(".")}function nmt(t){return t?t.inputs.length===0&&t.jsx==="":!0}var Rwe=async(t,e,r)=>{if(e==="migrate")await bwe(t,r);else if(e==="publish"||e==="p")await Iwe(t,r);else{if(e==="add"||e==="generate"||e==="gen"||e==="g")return qe(`The 'figma generate' command has been removed. You can create mapper files manually.
|
|
4554
4554
|
See: https://www.builder.io/c/docs/mapping-functions`),await Ke(1);if(e==="report")await kwe(t,r);else if(e==="auth"){console.log(""),Br((0,fa.bgCyan)((0,fa.bold)((0,fa.white)(" figma auth ")))+" "+(0,fa.dim)(xt));let{builderPublicKey:n}=await mr(t,r,{requireFigmaAuth:"always",builderPrivateKey:!0,builderPublicKey:!0,force:!0});await Wt("figma auth",{spaceId:n}),Un((0,fa.bgGreen)((0,fa.bold)((0,fa.white)(" Done! \u{1F389} "))))}else e==="help"&&Su(r._[2]||"figma")}};Cr();Vi();jt();B2();m();function h6(t,e){return{cwd:t,command:e[0],snippetId:e[1],path:e[2]}}Kp();Ta();gs();yQ();dk();m();var fD=W(oke(),1),fNe=W(require("node:http"),1),mNe=W(require("node:https"),1),jR=W(require("net"),1),mq=W(require("node:fs"),1),hNe=W(require("node:os"),1),CNe=W(require("node:path"),1),INe=W(require("@amplitude/analytics-node"),1),pD=W(Gr(),1);un();Ta();gs();m();var kRe=W(require("node:stream"),1),RRe=require("node:crypto");m();var P0t=W(yRe(),1),_0t=W(kR(),1),L0t=W(yC(),1),U0t=W(qY(),1),O0t=W(WY(),1),G0t=W(nq(),1),K0t=W(MR(),1),oq=W(FRe(),1);function NRe(t){let e=!1,r="2.0",n=new oq.default(t),i=new kRe.default.EventEmitter,o={clients:new Map,events:new Map,methods:new Map},s=new Map([["rpc.on",d],["rpc.off",g]]);function a(E){return JSON.stringify({jsonrpc:r,id:E?.id,notification:E?.notification,result:E?.result,params:E?.params,error:E?.error})}function A(){n.on("listening",()=>{e=!0,i.emit("listening"),n.on("connection",(E,y)=>{let Q=y.url||"/",w=(0,RRe.randomUUID)();o.clients.set(w,E),i.emit("connection",E,w),u(E,w,Q),E.on("error",D=>i.emit("socket-error",w,D)),E.on("close",()=>{o.clients.delete(w),i.emit("disconnection",w)})}),n.on("error",E=>i.emit("error",E))})}function c(E){return!!E.params&&Array.isArray(E.params)&&E.params.length>0}function u(E,y,Q="/"){E.on("message",async w=>{let D={};try{w instanceof ArrayBuffer&&(D.binary=!0,w=Buffer.from(w).toString())}catch{return E.send(a({id:null,error:{code:-32700,message:"Parse error"}}))}let x;try{x=JSON.parse(w)}catch{return E.send(a({id:null,error:{code:-32700,message:"Parse error"}}))}try{let v=o;if(s.has(x.method)){let S=s.get(x.method);return E.send(S(v,x,y),D)}if(!v.methods.has(x.method))return E.send(a({id:x.id,error:{code:-32601,message:"Method not found"}}),D);try{let P=await v.methods.get(x.method)(x.params,y);return E.send(a({id:x.id,result:P||void 0}),D)}catch(S){return E.send(a({id:x.id,error:{code:-32e3,message:S?.message||"Internal error",data:S?.data}}),D)}}catch{return E.send(a({id:x?.id||null,error:{code:-32603,message:"Internal error"}}),D)}})}function l(E,y,...Q){let D=[...o.clients.entries()].filter(([x])=>y.has(x)).map(([x,v])=>v);for(let x of D)x.send(a({notification:E,params:Q}))}function d(E,y,Q){if(!c(y))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});if(!E.events.has(y.params[0]))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});let w=y.params[0];return E.events.get(w).add(Q),a({id:y.id,result:{[w]:!0}})}function g(E,y,Q){if(!c(y))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});if(!E.events.has(y.params[0]))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});let w=y.params[0];return E.events.get(w).delete(Q),a({id:y.id,result:{[w]:!1}})}function p(E,y,Q="/"){o.methods.set(E,y)}function f(E,y){i.on(E,y)}function h(E,y="/"){let Q=o;Q.events.has(E)||Q.events.set(E,new Set)}function C(E,y="/",...Q){let w=o;if(!w.events.has(E))return;let D=w.events.get(E);l(E,D,y,...Q)}async function I(E,y,Q,w){n.handleUpgrade(E,y,Q,D=>{e||n.emit("listening"),n.emit("connection",D,E),w&&w(D,E)})}function B(){return new Promise((E,y)=>{try{n.close(),i.emit("close"),E(null)}catch(Q){y(Q)}})}return A(),{on:f,event:E=>h(E),handleUpgrade:I,clients:()=>o.clients||new Map,register:(E,y)=>p(E,y),emit:(E,...y)=>C(E,"/",...y),notify:(E,y,...Q)=>l(E,new Set([y]),...Q),close:B}}Hh();Cr();Gt();CO();bQ();Js();vQ();m();var Ci=W(require("node:fs"),1),Ii=W(require("fs/promises"),1),Oi=W(require("node:path"),1);ja();Zc();Js();var sq=W(require("dns/promises"),1);Gt();var MRe=W(require("net"),1),_R=require("undici");sS();za();vm();za();var aq=ke("Init"),H0t=t=>!!(t.name&&t.path),TRe=t=>!!(t.name&&t.path&&t.repoName&&t.repoUrl),SC=class{logIdCounter=0;initStatusLogs=[];sys;config;debug=!0;#n=aq;initState={isRunning:!1,isComplete:!1,success:!1,currentStep:"initial",error:void 0,repos:[]};constructor(e){this.sys=e.sys,this.config=e,this.debug=e.debug??!0}async checkout(e,r,n){let i=r?["checkout","-B",e,r]:["checkout","-B",e];await this.git(i,n)}async execAsync(e,r,n,i){return Va(e,r,{cwd:n,sys:this.sys,retry:i})}async git(e,r,n,i,o){return Va("git",e,{cwd:r,sys:this.sys,retry:n,skipLogging:o,timeout:i??(e[0].includes("clone")?600*1e3:60*1e3)})}async performBackup({sys:e,credentials:r,fusionConfig:n,volumePath:i,repositories:o,isConnectedToProvider:s,forcedFullBackup:a}){try{this.#n.info("Performing backup operation");let A=o.filter(p=>p.enableGit);if(A.length===0)throw new Error("No repository with git enabled found for backup");if(!n.branchName)throw new Error("Backup mode: No branch name found");if(!n.projectId)throw new Error("Backup mode: No project ID found");let c=[];for(let p of A){let f=Oi.join(i,p.path);if(!Ci.existsSync(f))throw new Error(`Backup mode: Repository directory does not exist at ${f}`);if(!Ci.existsSync(Oi.join(f,".git")))throw new Error(`Backup mode: Git repository not initialized at ${f}`);let{featureBranch:h,currentBranch:C}=await Lv({sys:e,gitWorkingDirectory:f,strict:!a});c.push({repo:p,repoPath:f,featureBranch:h,currentBranch:C})}let u={};for(let{repo:p,repoPath:f}of c)try{let h=await Va("git",["rev-parse","HEAD"],{cwd:f,sys:e,skipLogging:!0});h.trim()&&(u[p.name||p.path]=h.trim())}catch{}await oS(e,r,{commits:u,projectId:n.projectId,branchName:n.branchName},this.debug);let l=performance.now(),d=[];for(let{repo:p,repoPath:f,featureBranch:h,currentBranch:C}of c){this.#n.info(`Creating backup for AI branch: ${C} (${p.name||p.path})`);let I=await nS({sys:e,credentials:r,projectId:n.projectId,branchName:n.branchName,repoPath:f,aiBranch:C,featureBranch:h,workspace:n.workspace,isConnectedToProvider:s,forcedFullBackup:a,debug:!0,canAbortMerge:!1,folderName:p.name||p.path,repoUrl:p.originalRepoUrl??p.repoUrl});if(!I.success)throw new Error(`Backup upload failed for ${p.name||p.path}: ${I.reason||"Unknown error"}`);this.#n.info(`Backup uploaded successfully for ${p.name||p.path}`),d.push(I.backupEntry)}let g=performance.now()-l;await iS(r,d,g,this.debug)}catch(A){let c=new Error("Failed to perform git backup",{cause:A});throw this.config.sys.Sentry?.captureException(c,{tags:{launchMode:this.config.fusionConfig.mode,forcedFullBackup:a,isConnectedToProvider:s}}),c}}async performRegularBackup(e){await this.performBackup({...e,isConnectedToProvider:!0,forcedFullBackup:!1})}async performOfflineBackup(e){await this.performBackup({...e,isConnectedToProvider:!1,forcedFullBackup:!1})}async performForcedFullBackup(e){await this.performBackup({...e,isConnectedToProvider:!1,forcedFullBackup:!0})}async init(){let e=this.config;this.clearInitLogs(),this.initState.isRunning=!0,this.initState.isComplete=!1;let r=e.fusionConfig.workspace?.folders?.filter(H0t)??[];this.addInitLog("log",`Starting initialization with ${r.length} repositories`,{step:"init"});try{if(!r.length){let i="At least one repository must be configured";throw new Error(i)}if(!e.sys){let i="DevToolsSys is required in config";throw this.addInitLog("error",i,{step:"validation",error:i}),new Error(i)}let n=_v(e.fusionConfig);switch(e.fusionConfig.mode){case"backup":{try{await this.performRegularBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(i){this.#n.info(`Online backup failed: ${i}. Attempting offline backup...`),await this.performOfflineBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}break}case"backup-force-full":{try{await this.performRegularBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(i){this.#n.info(`Online backup failed: ${i}. Attempting offline backup...`);try{await this.performOfflineBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(o){this.#n.info(`Offline backup failed: ${o}. Attempting forced full offline backup...`),await this.performForcedFullBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}}break}case"init-and-launch":{await this.step1CheckDirectories(n,r),this.addInitLog("log","Directories checked",{step:"check-directories"}),await this.step2ConfigureGitRepositories(n,r),this.addInitLog("log","Git repositories configured",{step:"configure-git-repos"}),await this.step3ConfigureGitUser(n,r),this.addInitLog("log","Git user configured",{step:"configure-git-user"}),await this.step4CollectRepoInfo(e,n,r),this.addInitLog("log","Repo info collected",{step:"collect-repo-info"});break}default:throw new Error(`Invalid mode: ${e.fusionConfig.mode}`)}return this.addInitLog("complete","Initialization completed successfully",{step:"init-success",success:!0}),!0}catch(n){let i=n instanceof Error?n.message:String(n),o=this.initStatusLogs.some(s=>s.type==="error"&&s.step&&s.step!=="init-failed");return this.addInitLog("complete",`Initialization failed with error: ${i}`,{step:o?void 0:"init-failed",success:!1,error:i}),e.sys.Sentry?.captureException(n,{tags:{operation:"init",...e.sentryTags}}),!1}}addInitLog(e,r,n){let i={id:++this.logIdCounter,timestamp:new Date().toISOString(),type:e,message:r,step:n?.step,error:n?.error,success:n?.success};this.#n.debug(`${i.timestamp} ${i.type} ${i.message}`),this.initStatusLogs.push(i),this.initStatusLogs.length>1e3&&this.initStatusLogs.splice(0,this.initStatusLogs.length-1e3),n?.step&&(this.initState.currentStep=n.step),e==="complete"&&(this.initState.isComplete=!0,this.initState.isRunning=!1,this.initState.success=n?.success??!1,this.initState.error=n?.error??this.initState.error,n?.gitDiagnostics&&(this.initState.gitDiagnostics=n.gitDiagnostics)),e==="error"&&n?.error&&(this.initState.error=n.error,n?.gitDiagnostics&&(this.initState.gitDiagnostics=n.gitDiagnostics))}clearInitLogs(){this.initStatusLogs.length=0,this.logIdCounter=0,this.initState.isRunning=!1,this.initState.isComplete=!1,this.initState.success=!1,this.initState.currentStep="initial",this.initState.error=void 0,this.initState.gitDiagnostics=void 0}async hasFilesButNoGit(e){if(Ci.existsSync(e))try{let n=(await Ii.readdir(e)).length>0,i=Ci.existsSync(Oi.join(e,".git"));return n&&!i}catch{return!1}return!1}async step1CheckDirectories(e,r){this.addInitLog("log","Checking directories",{step:"check-directories"}),Ci.existsSync(e)||await Ii.mkdir(e,{recursive:!0}),e.startsWith("/root")&&$0t("root"),this.addInitLog("log",`Volume directory exists: ${e}`,{step:"check-directories"});for(let n of r){let i=Oi.join(e,n.path);if(Ci.existsSync(i))this.addInitLog("log",`Directory already exists: ${i}`,{step:"check-directories"});else{this.addInitLog("log",`Creating directory: ${i}`,{step:"create-directories"});try{await Ii.mkdir(i,{recursive:!0})}catch(o){let s=`Failed to create directory for ${n.repoName} at ${i}: ${o}`;throw this.addInitLog("error",s,{step:"create-directories",error:s}),new Error(s,{cause:o})}}}}async step2ConfigureGitRepositories(e,r){this.addInitLog("log","Configuring git repositories",{step:"configure-git-repos"});let n=Oi.join(e,"temp-cloning"),i=async()=>{Ci.existsSync(n)&&(this.addInitLog("log",`Removing temp cloning directory: ${n}`,{step:"configure-git-repos"}),await Ii.rm(n,{recursive:!0,force:!0}))};await i(),this.addInitLog("log",`Creating temp cloning path: ${n}`,{step:"configure-git-repos"}),await Ii.mkdir(n,{recursive:!0});let o=await this.fetchGitConfigsOnce(),s=r.find(a=>a.enableGit);try{for(let a of r){let A=Oi.join(e,a.path),c=a===s;this.addInitLog("log",`Processing repository: ${a.repoName}`,{step:"configure-git-repos"});let u=await this.isGitConfigured(A),l=!u;if(this.config.fusionConfig.rebuildGit&&u&&(this.addInitLog("log",`rebuildGit flag set, removing existing repo for ${a.repoName} to re-clone`,{step:"check-existing-git"}),await Ii.rm(A,{recursive:!0,force:!0}),l=!0),u&&!l){if(a.enableGit&&o){let d=r.filter(g=>g.enableGit).length;this.applyGitConfig(a,o,c,d)}await this.cleanupLockFiles(A);try{a.enableGit?(this.addInitLog("log",`Git already configured for ${a.repoName}, validating repo`,{step:"check-existing-git"}),await this.validateGitRepo(A)):this.addInitLog("log",`Git already configured for ${a.repoName}, skipping validation because it's not main repo`,{step:"check-existing-git"})}catch(d){let g=`Git repo is in bad state for ${a.repoName}, will re-clone: ${d}`;this.config.sys.Sentry?.captureMessage(g,{level:"warning",tags:{operation:"init",...this.config.sentryTags},extra:{repoName:a.repoName,repoPath:A}}),this.addInitLog("error",g,{step:"check-existing-git",error:g})}if(!l){if(this.addInitLog("log","Git repo is in good state, checking remote URL",{step:"check-existing-git"}),a.initializationCommand){this.addInitLog("log","Skipping remote URL update because it has an initialization command",{step:"update-remote-url"});continue}if(!TRe(a))throw new Error("Remote URL update failed because repoUrl is undefined");if(await this.getGitRemoteUrl(A))try{await this.git(["remote","set-url","origin",a.repoUrl],A)}catch(g){let p=`Failed to update git remote URL for ${a.repoName}: ${g}`;throw this.addInitLog("error",p,{step:"update-remote-url",error:p}),new Error(p)}else{this.addInitLog("log",`Adding remote origin for ${a.repoName}`,{step:"check-existing-git"});try{await this.git(["remote","add","origin",a.repoUrl],A)}catch(g){let p=`Failed to add git remote origin for ${a.repoName}: ${g}`;throw this.addInitLog("error",p,{step:"check-existing-git",error:p}),new Error(p)}}if(this.config.fusionConfig.prNumber&&c){let g=this.config.fusionConfig.prNumber,p=this.config.fusionConfig.isFork,f=this.config.fusionConfig.featureBranch;if(!p&&!f)throw new Error(`Non-fork PR #${g} requires featureBranch in fusion config to know which branch to fetch from origin`);let h=f||`pr-${g}`,C=p?`pull/${g}/head`:h;this.addInitLog("log",`${p?"Fork ":""}PR detected on already-cloned primary - syncing PR #${g} into branch ${h}`,{step:"clone-repo"});try{await this.git(["fetch","origin",C],A);let I=(await this.git(["rev-parse","FETCH_HEAD"],A)).trim();await this.checkout(h,I,A),this.addInitLog("log",`Checked out PR #${g} on branch ${h}`,{step:"clone-repo"})}catch(I){let B=`Failed to sync PR #${g} on primary repo ${a.repoName}: ${I}`;throw this.addInitLog("error",B,{step:"clone-repo",error:B}),new Error(B,{cause:I})}}if(this.config.fusionConfig.syncBranch&&a.enableGit&&!(this.config.fusionConfig.isFork&&c)&&!(this.config.fusionConfig.prNumber&&c)){let g=a.branchName||"main";try{let p=(await this.git(["rev-parse","HEAD"],A)).trim(),h=(await this.git(["ls-remote","origin",g],A)).trim().split(/\s/)[0]||"";p===h?this.addInitLog("log",`Snapshot git is already up-to-date with origin/${g}`,{step:"snapshot-git-sync"}):(this.addInitLog("log",`Snapshot git is behind origin/${g}, syncing...`,{step:"snapshot-git-sync"}),await this.git(["pull","--ff-only","origin",g],A),this.addInitLog("log",`Git synced to origin/${g}`,{step:"snapshot-git-sync"}))}catch(p){this.addInitLog("error",`Failed to sync git from snapshot: ${p}`,{step:"snapshot-git-sync",error:String(p)})}}if(this.config.fusionConfig.pvcCreationSource==="snapshot"&&a.backupMetadata&&a.enableGit){let g=this.config.fusionConfig.aiBranch||a.backupMetadata.check.backup.gitBranchName;if(await this.isBackupAlreadyApplied(A,g,a.backupMetadata.check.backup.lastCommitHash))this.addInitLog("log",`Backup already applied for ${a.repoName} (branch ${g} exists), skipping restore`,{step:"snapshot-backup-restore"}),await this.git(["checkout",g],A);else{this.addInitLog("log",`Snapshot volume detected with backup, downloading backup for ${a.repoName}`,{step:"snapshot-backup-restore"});let f=await tG(this.config.sys,a.backupMetadata);if(f.success)try{await this.restoreFromPartialBackup({repo:a,repoPath:A,backupResult:f}),this.addInitLog("log",`Restored backup on snapshot volume for ${a.repoName}`,{step:"snapshot-backup-restore"})}catch(h){throw this.addInitLog("error",`Failed to restore backup on snapshot volume: ${h}`,{step:"snapshot-backup-restore",error:String(h)}),h}else throw this.addInitLog("error",`Failed to download backup for snapshot restore: ${f.error}`,{step:"snapshot-backup-restore",error:f.error.message}),f.error}}}}if(l){if(await this.hasFilesButNoGit(A)){let h="Code directory already exists but is not a git repo";throw this.addInitLog("error",h,{step:"check-existing-git",error:h}),new Error(h)}let g=a.backupMetadata?await tG(this.config.sys,a.backupMetadata):void 0;if(g&&!g.success)throw this.addInitLog("error",`Failed to download backup for ${a.repoName}: ${g.error}`,{step:"clone-repo",error:g.error.message}),g.error;g?.success&&this.sys.Sentry?.setTag("backup",g.partial?"partial":"full");let p=Oi.join(n,a.path),f=!1;if(a.initializationCommand){this.addInitLog("log","Running initialization command.",{step:"init-command"});let h=await this.runInitializationCommand({repo:a,tempCloningDir:n,repoPath:p,initCommand:a.initializationCommand});if(f=h.outcome,f)this.addInitLog("log",`Successfully initialized ${a.repoName}`,{step:"init-command"});else{let C=h.error?.message||"Failed to run initialization command.";throw this.addInitLog("error",C,{step:"init-command",error:C}),new Error(C)}}else{if(!TRe(a))throw new Error("repoUrl or repoName is undefined");if(this.addInitLog("log",`Cloning repository: ${a.repoName}`,{step:"clone-repo"}),f=await this.cloneRepository({repo:a,repoPath:p,backupResult:g,isPrimary:c}),f)this.addInitLog("log",`Successfully cloned ${a.repoName}`,{step:"clone-repo"});else{let h=`Failed to clone repository ${a.repoName}`;throw this.addInitLog("error",h,{step:"clone-repo",error:h}),new Error(h)}}if(g&&g.success&&g.partial)try{await this.restoreFromPartialBackup({repo:a,repoPath:p,backupResult:g})}catch(h){throw h}if(process.platform==="win32"&&Ci.existsSync(A)){if((await Ii.readdir(A)).length>0){let C=`Target directory ${A} already exists and is not empty. Cannot safely rename.`;throw this.addInitLog("error",C,{step:"configure-git-repos",error:C}),new Error(C)}this.addInitLog("log",`Removing empty directory before rename (Windows workaround): ${A}`,{step:"configure-git-repos"}),await Ii.rm(A,{recursive:!0,force:!0})}await Ii.rename(p,A),await this.markGitSafe(A)}}}catch(a){throw this.addInitLog("error",`Failed to configure git repositories: ${a}`,{step:"configure-git-repos",error:String(a)}),a}finally{await i()}}async step3ConfigureGitUser(e,r){this.addInitLog("log","Configuring git user",{step:"configure-git-user"});for(let n of r){let i=Oi.join(e,n.path);this.addInitLog("log",`Setting git user for ${n.repoName}`,{step:"configure-git-user"});try{await this.git(["config","user.email","builder-bot@builder.io"],i),await this.git(["config","user.name","Builder.io"],i)}catch(o){let s=`Failed to configure git user for ${n.repoName}: ${o}`;throw this.addInitLog("error",s,{step:"configure-git-user",error:s}),new Error(s)}}}async step4CollectRepoInfo(e,r,n){this.addInitLog("log","Collecting repo info",{step:"collect-repo-info"}),this.initState.repos=[];for(let i of n){let o=Oi.join(r,i.path);try{let s=await this.git(["rev-parse","HEAD"],o),a=await this.git(["branch","--show-current"],o),A={repoName:i.repoName||i.path,enabledGit:!!i.enableGit,lastCommitHash:s.trim(),branch:a.trim()};this.initState.repos.push(A),this.addInitLog("log",`Collected repo info: ${JSON.stringify(A)}`,{step:"collect-repo-info"})}catch(s){e.sys.Sentry?.captureException(s,{tags:{operation:"init",...e.sentryTags}})}}}async isGitConfigured(e){try{return await this.git(["rev-parse","--is-inside-work-tree"],e,void 0,void 0,!0),!0}catch{return!1}}async getGitRemoteUrl(e){try{return(await this.git(["config","--get","remote.origin.url"],e)).trim()}catch{return null}}isStandardGitHost(e){let r=["github.com","gitlab.com","bitbucket.org"];try{let n=new URL(e);return r.some(i=>n.hostname===i||n.hostname.endsWith(`.${i}`))}catch{return!1}}async checkHostConnectivity(e){try{let r=e.startsWith("git@")||e.startsWith("ssh://"),n,i;if(r){let o=e.match(/^(?:ssh:\/\/)?(?:[^@]+@)?([^/:]+)(?::|\/)/);if(!o)return{reachable:!1,error:"Invalid SSH repository URL format"};n=o[1],i=22}else{let o=e.match(/^https?:\/\/(?:[^@]+@)?([^/:?#]+)/);if(!o)return{reachable:!1,error:"Invalid repository URL format"};n=o[1],i=443}this.addInitLog("log",`Checking connectivity to host: ${n}:${i}`,{step:"clone-repo"});try{let o=[];try{o=await sq.default.resolve4(n),o.length>0&&this.addInitLog("log",`DNS resolved ${n} to IPv4: ${o.join(", ")}`,{step:"clone-repo"})}catch{o=await sq.default.resolve6(n),o.length>0&&this.addInitLog("log",`DNS resolved ${n} to IPv6: ${o.join(", ")}`,{step:"clone-repo"})}if(o.length===0)return{reachable:!1,hostname:n,error:`DNS resolution failed: no addresses found for ${n}`}}catch(o){let s=o instanceof Error?o.message:String(o);return{reachable:!1,hostname:n,error:`DNS resolution failed for ${n}: ${s}`}}try{let o=await this.checkConnectivityDirect(n,i);if(o.reachable)return o;let s=process.env.HTTP_PROXY||process.env.http_proxy;return s?(this.addInitLog("log",`Direct connection failed, trying proxy: ${s}`,{step:"clone-repo"}),await this.checkConnectivityViaProxy(n,i,s)):o}catch(o){let s=o instanceof Error?o.message:String(o);return{reachable:!1,hostname:n,error:`Connection attempt failed: ${s}`}}}catch(r){return{reachable:!1,error:`Unexpected error during connectivity check: ${r instanceof Error?r.message:String(r)}`}}}async checkConnectivityDirect(e,r){let i=MRe.default.createConnection({host:e,port:r,timeout:5e3});return await new Promise(o=>{i.on("connect",()=>{i.destroy(),this.addInitLog("log",`Successfully connected to ${e}:${r}`,{step:"clone-repo"}),o({reachable:!0,hostname:e})}),i.on("error",s=>{i.destroy(),this.addInitLog("error",`Connection failed to ${e}:${r}: ${s.message}`,{step:"clone-repo",error:s.message}),o({reachable:!1,hostname:e,error:`Cannot connect to ${e}:${r}: ${s.message}`})}),i.on("timeout",()=>{i.destroy(),this.addInitLog("error",`Connection timeout to ${e}:${r} (${5e3/1e3}s)`,{step:"clone-repo",error:`Connection timeout to ${e}:${r} after ${5e3/1e3} seconds`}),o({reachable:!1,hostname:e,error:`Connection timeout to ${e}:${r} after ${5e3/1e3} seconds`})})})}async checkConnectivityViaProxy(e,r,n){try{this.addInitLog("log",`Attempting proxy connection to ${e}:${r} via proxy`,{step:"clone-repo"});let i=new URL(n),o=`${i.protocol}//${i.host}`,s=new _R.ProxyAgent({uri:o,token:i.username&&i.password?`Basic ${Buffer.from(`${i.username}:${i.password}`).toString("base64")}`:void 0}),a=`http://${e}:${r}`;return await(0,_R.fetch)(a,{dispatcher:s,signal:AbortSignal.timeout(3e4)}),this.addInitLog("log",`Successfully connected via proxy to ${e}:${r}`,{step:"clone-repo"}),{reachable:!0,hostname:e}}catch(i){return{reachable:!1,hostname:e,error:`Proxy connection failed: ${i instanceof Error?i.message:String(i)}`}}}async ensureParentDirExists(e){let r=Oi.dirname(e);return await Ii.mkdir(r,{recursive:!0}),r}async cleanupLockFiles(e){let r=Oi.join(e,".git");try{let i=(await Ii.readdir(r)).filter(s=>s.endsWith(".lock"));if(i.length===0)return;let o=[];for(let s of i){let a=Oi.join(r,s);try{await Ii.unlink(a),o.push(s)}catch(A){this.config.sys.Sentry?.captureException(new Error(`Failed to remove ${s} for ${e}: ${A}`),{tags:{operation:"init",...this.config.sentryTags}})}}o.length>0&&this.config.sys.Sentry?.captureMessage(`Lock files found for ${e} and removed: ${o.join(", ")}`,{tags:{operation:"init",...this.config.sentryTags}})}catch(n){this.config.sys.Sentry?.captureException(new Error(`Failed to cleanup lock files for ${e}: ${n}`),{tags:{operation:"init",...this.config.sentryTags}})}}async validateGitRepo(e){try{await this.git(["fsck","--connectivity-only"],e)}catch(r){throw new Error("Git repo is in bad state",{cause:r})}}async isBackupAlreadyApplied(e,r,n){try{let i=(await this.git(["rev-parse","--verify",`refs/heads/${r}`],e)).trim();return i?(await this.git(["merge-base","--is-ancestor",n,i],e),!0):!1}catch{return!1}}async restoreFromPartialBackup({repo:e,repoPath:r,backupResult:n}){try{this.addInitLog("log",`Checking for git backup for ${e.repoName}`,{step:"apply-partial-backup"});let i=async()=>{try{await this.git(["remote","remove","backup"],r)}catch(o){this.addInitLog("error",`Failed to cleanup restore: ${o}`,{step:"apply-partial-backup",error:String(o)})}};if(!n.bundlePath){try{this.addInitLog("log",`Found empty git backup, applying it to ${e.repoName}`,{step:"apply-partial-backup"});let o=this.config.fusionConfig.aiBranch||n.gitBranchName;o&&await this.checkout(o,n.lastCommitHash||void 0,r)}catch(o){if(n.lastCommitHash)throw o;this.addInitLog("log",`Empty backup \u2014 could not create branch (repo may have no commits yet): ${o}`,{step:"apply-partial-backup"})}return}try{this.addInitLog("log",`Found git backup, applying it to ${e.repoName}`,{step:"apply-partial-backup"});try{await this.git(["remote","remove","backup"],r)}catch{}await this.git(["remote","add","backup",n.bundlePath],r),await this.git(["fetch","backup"],r);let o=n.gitBranchName,s=this.config.fusionConfig.aiBranch||o;s!==o?(this.addInitLog("log",`Creating new branch ${s} from backup/${o}`,{step:"apply-partial-backup"}),await this.git(["branch",s,`backup/${o}`],r),await this.git(["checkout",s],r)):await this.checkout(o,`backup/${o}`,r),this.addInitLog("log",`Successfully restored from backup to branch ${s}`,{step:"apply-partial-backup"}),await i(),this.addInitLog("log",`Cleaned up backup for ${e.repoName}`,{step:"apply-partial-backup"})}catch(o){throw await i(),this.addInitLog("error",String(o),{step:"apply-partial-backup",error:String(o)}),o}}catch(i){let o=new Error(`Failed to check git backup for ${e.repoName}. Cannot proceed without backup recovery.`,{cause:i});throw this.addInitLog("error",o.message,{step:"apply-partial-backup",error:String(i)}),o}}async initializeGitRepo(e,r){await this.git(["init"],e),await this.git(["add","."],e),await this.git(["branch","-M","main"],e),await this.git([...r?["-c","user.email=team@builder.io","-c","user.name=Builder.io"]:[],"commit","-m","Initial setup"],e)}async fetchGitConfigsOnce(){if(this.config.fusionConfig.projectId)try{let e=await Nm(this.config.credentials,this.config.fusionConfig.projectId,this.debug);if(e.success)return Object.keys(e.gitConfigs).length>0?e.gitConfigs:void 0;e.gitDiagnostics&&(this.initState.gitDiagnostics=e.gitDiagnostics),this.config.sys.Sentry?.captureException(e.error,{tags:{operation:"init",endpoint:"fetch-git-configs",...this.config.sentryTags},extra:{gitDiagnostics:e.gitDiagnostics}})}catch(e){this.config.sys.Sentry?.captureException(new Error("Failed to fetch git configs in InitStateMachine",{cause:e instanceof Error?e:new Error(String(e))}),{tags:{operation:"init",endpoint:"fetch-git-configs",...this.config.sentryTags}})}}applyGitConfig(e,r,n,i){if(e.initializationCommand||e.repoUrl?.startsWith("ssh://")||e.repoUrl?.startsWith("git@"))return;let o;if(e.repoName&&r[e.repoName]?o=e.repoName:n&&(o=Object.keys(r)[0]),!o)return;let s=r[o];s?.url&&(e.repoUrl=s.url,n&&(e.repoName=o),(s.provider==="github"||s.provider==="selfHostedGithub")&&s.token&&(n&&(process.env.GH_TOKEN=s.token),i>1&&(process.env[tk(e.name)]=s.token)))}async runInitializationCommand({repo:e,tempCloningDir:r,repoPath:n,initCommand:i}){this.addInitLog("log",`Init command paths args: tempCloningDir: ${r} repoPath: ${n}`,{step:"init-command"});try{this.addInitLog("log",`Executing initialization command in ${r}`,{step:"init-command"});let o=process.env.SHELL||process.env.COMSPEC||"/bin/sh";try{let s=qA(o,i,{stdio:["ignore","pipe","pipe"],cwd:r,env:{...process.env,TERM:"dumb"}},!0),a=[],A=[];s.stdout?.on("data",c=>{a.push(c);let u=c.toString().trim();u&&this.addInitLog("log",u,{step:"init-command"})}),s.stderr?.on("data",c=>{A.push(c);let u=c.toString().trim();u&&this.addInitLog("error",u,{step:"init-command"})}),await new Promise((c,u)=>{s.on("error",l=>{u(l)}),s.on("close",l=>{if(l===0)c();else{let d=Buffer.concat(a).toString().trim(),g=Buffer.concat(A).toString().trim(),p=[`Command exited with code ${l}`,g&&`stderr: ${g}`,d&&`stdout: ${d}`].filter(Boolean).join(`
|
|
4555
4555
|
`);u(new Error(p))}})})}catch(s){let a=new Error("Failed to execute initCommand.",{cause:s});return this.addInitLog("error",a.message+`: ${s}`,{step:"init-command",error:String(s)}),{outcome:!1,error:a}}return{outcome:!0}}catch(o){return this.addInitLog("error",`Failed to run initialization command: ${o}`,{step:"init-command",error:String(o)}),{outcome:!1,error:o instanceof Error?o:new Error(String(o))}}}async cloneRepository({repo:e,repoPath:r,backupResult:n,isPrimary:i}){let o=[e.branchName??"main",null,"main","master"];if(n&&n.success&&!n.partial){if(!n.bundlePath)throw new Error("Full backups must have a bundle path");this.addInitLog("log",`Downloaded full git backup, cloning it to ${r}`,{step:"clone-repo"});try{let a=await this.ensureParentDirExists(r);await this.git(["clone",n.bundlePath,r],a,void 0,600*1e3),await this.markGitSafe(r);for(let u of o)if(u)try{await this.git(["checkout",u],r)}catch{continue}await this.checkout(n.gitBranchName,n.lastCommitHash,r);let A=(await this.git(["branch","--show-current"],r)).trim(),c=(await this.git(["rev-parse","HEAD"],r)).trim();if(A!==n.gitBranchName)throw new Error(`Backup branch ${n.gitBranchName} does not match local branch ${A}`);if(c!==n.lastCommitHash)throw new Error(`Backup commit hash ${n.lastCommitHash} does not match local commit hash ${c}`);return!0}catch(a){throw this.addInitLog("error",`Failed to clone git backup for ${e.repoName}: ${a}`,{step:"clone-repo",error:String(a)}),a}}let s=process.env.TEST_NEEDS_GIT_INIT==="1";if(!this.isStandardGitHost(e.repoUrl)){this.addInitLog("log",`Non-standard git host detected, checking connectivity to ${e.repoUrl}`,{step:"clone-repo"});let a=await this.checkHostConnectivity(e.repoUrl);if(!a.reachable){let A=`Git host unreachable: ${a.hostname||"unknown host"}. ${a.error||"Network connectivity check failed"}. This host may be behind a firewall or VPN.`,c=a.error?Cv(a.error):null,u={provider:S2(e.repoUrl),hostname:a.hostname||"",sourceIp:"",repoName:e.repoName||"",issue:"network",...c&&{connectivityErrorCode:c.connectivityErrorCode,checkType:c.checkType,likelyCause:hv(c.connectivityErrorCode)}};throw this.addInitLog("error",A,{step:"clone-repo",error:A,gitDiagnostics:u}),this.config.sys.Sentry?.captureException(new Error("Git host unreachable"),{tags:{operation:"init",...this.config.sentryTags},extra:{repo:e,connectivityResult:a,gitDiagnostics:u}}),new Error(A)}this.addInitLog("log",`Host connectivity verified for ${a.hostname}`,{step:"clone-repo"})}for(let a of o)try{let A=process.env.FUSION_TEMPLATE_DIR&&process.env.FUSION_TEMPLATE_DIR.trim().length>0?process.env.FUSION_TEMPLATE_DIR:"/template";if(Ci.existsSync(A)&&e.repoName===mm){if(this.addInitLog("log",`Starting copy of template to ${r}`,{step:"clone-repo"}),await this.execAsync("rm",["-rf",r],"/"),await this.execAsync("cp",["-a",A,r],"/"),this.addInitLog("log",`Copied from template for ${e.repoName}`,{step:"clone-repo"}),s)try{await this.initializeGitRepo(r,s)}catch(c){let u=`Failed to initialize git repo for ${e.repoName} after template copy: ${c}`;throw this.addInitLog("error",u,{step:"clone-repo",error:String(c)}),new Error(u)}return!0}else{let c=S2(e.repoUrl),u=c==="github"||c==="gitlab"||c==="selfHostedGithub",l=e.resetGit!==void 0?e.resetGit:x2.includes(e.repoName),d=n&&n.success&&n.partial,g=this.config.fusionConfig.isFork&&this.config.fusionConfig.prNumber,p=l&&e.enableGit&&!d&&!g,f=!e.enableGit||p?["clone","--depth","1"]:u?["clone","--filter=blob:none"]:["clone"];a&&f.push("-b",a),f.push(e.repoUrl,r),this.addInitLog("log",`Cloning repository: ${e.repoName} with branch: ${a||"default"}`,{step:"clone-repo"});let h=await this.ensureParentDirExists(r);if(await this.git(f,h,void 0,600*1e3),await this.markGitSafe(r),this.config.fusionConfig.isFork&&this.config.fusionConfig.prNumber&&i){let C=this.config.fusionConfig.prNumber,I=this.config.fusionConfig.featureBranch||`pr-${C}`;this.addInitLog("log",`Fork PR detected - fetching PR #${C} using refs/pulls/${C}/head into branch ${I}`,{step:"clone-repo"});try{await this.git(["fetch","origin",`pull/${C}/head:${I}`],r),await this.git(["switch",I],r),this.addInitLog("log",`Successfully checked out fork PR #${C} on branch ${I}`,{step:"clone-repo"})}catch(B){let E=`Failed to fetch fork PR #${C}: ${B}`;throw this.addInitLog("error",E,{step:"clone-repo",error:String(B)}),new Error(E,{cause:B})}}return p&&(Ci.rmSync(Oi.join(r,".git"),{recursive:!0,force:!0}),await this.initializeGitRepo(r,s),this.addInitLog("log",`Cleared git history for ${e.repoName}`,{step:"clone-repo"})),!0}}catch(A){this.addInitLog("error",`Clone failed for branch ${a||"default"}: ${A}`,{step:"clone-repo",error:String(A)}),await Ii.rm(r,{recursive:!0,force:!0}).catch(()=>{});continue}return!1}async markGitSafe(e){try{let r=await this.git(["config","--global","--get-all","safe.directory"],e);if(r.trim().split(`
|
|
4556
|
-
`).includes(e))return r}catch{}return this.git(["config","--global","--add","safe.directory",e],e)}};function $0t(t){let e=[".npm",".local",".cache"];try{let r=`/${t}`,n=`/${t}-backup`;if(Ci.existsSync(n)){let i=Ci.readdirSync(n);for(let o of i)if(!e.includes(o)){let s=Oi.join(r,o);if(!Ci.existsSync(s))try{Ci.cpSync(Oi.join(n,o),s,{recursive:!0,force:!0})}catch(a){aq.error(`Failed to restore ${o} for ${t}: ${a}`)}}}}catch(r){aq.error(`Failed to restore ${t} backup: ${r}`)}}$E();EO();Zr();Jr();Zc();m();var PRe=W(require("@sentry/node"),1),_Re=W(require("@amplitude/analytics-node"),1),LR=async()=>{let t=process.env.BUILDER_DISABLE_AMPLITUDE==="true",e=[PRe.flush()];t||e.push(_Re.flush().promise),await Promise.allSettled(e),process.exit(0)};function LRe(){process.on("SIGINT",LR),process.on("SIGTERM",LR)}function URe(){process.removeListener("SIGINT",LR),process.removeListener("SIGTERM",LR)}vn();m();Zr();Jr();vm();m();Gt();var J0t=ke("EventLoopMonitor");function ORe(){let t,e=[],n=performance.now();return{consumeDelays:()=>{let i=[...e];return e.length=0,i},start:()=>{t||(n=performance.now(),t=setInterval(()=>{try{let i=performance.now(),o=i-n,s=Math.max(0,o-5e3);e.push(s),n=i}catch(i){J0t.error("Error sampling:",i)}},5e3),t.unref())},stop:()=>{t&&(clearInterval(t),t=void 0)}}}m();var GRe=W(require("v8"),1);function KRe(){let t=process.constrainedMemory?.();if(t){let{rss:r}=process.memoryUsage();return Math.min(1,r/t)}let e=GRe.getHeapStatistics();return Math.min(1,1-e.total_available_size/e.heap_size_limit)}var gA=W(require("node:os"),1),HRe=W(require("node:fs"),1),j0t="/root";function Y0t(){try{let t=HRe.statfsSync(j0t),e=t.bsize*t.blocks,r=t.bsize*t.bavail;if(e===0)return;let n=e-r,i=Math.min(1,Math.max(0,n/e));return{bytes:n,ratio:i}}catch{return}}function q0t(){try{let t=gA.totalmem(),e=gA.freemem();if(t===0)return;let r=t-e,n=Math.min(1,Math.max(0,r/t));return{bytes:r,ratio:n}}catch{return}}function $Re(t,e,r,n){let i=null,o=ORe(),s,a,A=async()=>{try{let c=new URL(`${
|
|
4556
|
+
`).includes(e))return r}catch{}return this.git(["config","--global","--add","safe.directory",e],e)}};function $0t(t){let e=[".npm",".local",".cache"];try{let r=`/${t}`,n=`/${t}-backup`;if(Ci.existsSync(n)){let i=Ci.readdirSync(n);for(let o of i)if(!e.includes(o)){let s=Oi.join(r,o);if(!Ci.existsSync(s))try{Ci.cpSync(Oi.join(n,o),s,{recursive:!0,force:!0})}catch(a){aq.error(`Failed to restore ${o} for ${t}: ${a}`)}}}}catch(r){aq.error(`Failed to restore ${t} backup: ${r}`)}}$E();EO();Zr();Jr();Zc();m();var PRe=W(require("@sentry/node"),1),_Re=W(require("@amplitude/analytics-node"),1),LR=async()=>{let t=process.env.BUILDER_DISABLE_AMPLITUDE==="true",e=[PRe.flush()];t||e.push(_Re.flush().promise),await Promise.allSettled(e),process.exit(0)};function LRe(){process.on("SIGINT",LR),process.on("SIGTERM",LR)}function URe(){process.removeListener("SIGINT",LR),process.removeListener("SIGTERM",LR)}vn();m();Zr();Jr();vm();m();Gt();var J0t=ke("EventLoopMonitor");function ORe(){let t,e=[],n=performance.now();return{consumeDelays:()=>{let i=[...e];return e.length=0,i},start:()=>{t||(n=performance.now(),t=setInterval(()=>{try{let i=performance.now(),o=i-n,s=Math.max(0,o-5e3);e.push(s),n=i}catch(i){J0t.error("Error sampling:",i)}},5e3),t.unref())},stop:()=>{t&&(clearInterval(t),t=void 0)}}}m();var GRe=W(require("v8"),1);function KRe(){let t=process.constrainedMemory?.();if(t){let{rss:r}=process.memoryUsage();return Math.min(1,r/t)}let e=GRe.getHeapStatistics();return Math.min(1,1-e.total_available_size/e.heap_size_limit)}var gA=W(require("node:os"),1),HRe=W(require("node:fs"),1),j0t="/root";function Y0t(){try{let t=HRe.statfsSync(j0t),e=t.bsize*t.blocks,r=t.bsize*t.bavail;if(e===0)return;let n=e-r,i=Math.min(1,Math.max(0,n/e));return{bytes:n,ratio:i}}catch{return}}function q0t(){try{let t=gA.totalmem(),e=gA.freemem();if(t===0)return;let r=t-e,n=Math.min(1,Math.max(0,r/t));return{bytes:r,ratio:n}}catch{return}}function $Re(t,e,r,n){let i=null,o=ORe(),s,a,A=async()=>{try{let c=new URL(`${Pe}/projects/machine-status`);e.builderPublicKey&&c.searchParams.set("apiKey",e.builderPublicKey),e.userId&&c.searchParams.set("userId",e.userId);let u=Pge(),l;u&&r.machine?l={...r.machine,environment:n.fusionEnvironment}:u||(l={cpus:gA.cpus().length,memory:Math.round(gA.totalmem()/(1024*1024*1024)),platform:gA.platform(),arch:gA.arch(),environment:"local"});let d=o.consumeDelays(),g=KRe(),p=Y0t(),f=q0t();n.diskUsage=p?.ratio,n.memoryUsage=f?.ratio,p!==void 0&&(s=s===void 0?p.bytes:Math.max(s,p.bytes)),f!==void 0&&(a=a===void 0?f.bytes:Math.max(a,f.bytes));let h={status:"ok",state:n.state,setupState:n.setupState,devState:n.devState,editorReady:n.editorReady,httpServerState:n.httpServerState,initState:n.initState,errorMessage:n.errorMessage,devToolsVersion:n.devToolsVersion,idleTime:performance.now()-n.lastRequestTime,upTime:performance.now()-n.startTime,machine:l,projectId:r.projectId,detectedServerUrl:n.detectedServerUrl,_attemptDryRunBackupOutcome:n._attemptDryRunBackupOutcome,workingDirectory:n.workingDirectory,fusionEnvironment:n.fusionEnvironment,containerState:n.containerState,containerStateTimestamp:n.containerStateTimestamp,wsClients:t.connectionTracker.getConnectionCount(),httpClients:n.httpClients,eventLoopDelays:d.length>0?d:void 0,memoryPressure:g,diskUsage:p?.ratio,memoryUsage:f?.ratio},C={"Content-Type":"application/json"};e.builderPrivateKey&&(C.Authorization=`Bearer ${e.builderPrivateKey}`),await Me(c,{method:"POST",body:JSON.stringify(h),headers:C,keepalive:!0,signal:AbortSignal.timeout(5e3)})}catch{}};return{start:()=>{if(i)return;o.start(),A();let c=30*1e3;i=setInterval(A,c)},stop:()=>{i&&(clearInterval(i),i=null),o.stop()},getPeakUsage:()=>({peakDiskUsage:s,peakMemoryUsage:a})}}WO();m();var ju=require("node:fs"),JRe=require("fs/promises");m();Zr();Jr();async function UR(t,e,r){try{let n=new URL(`${Pe}/projects/metrics`);e.builderPublicKey&&n.searchParams.set("apiKey",e.builderPublicKey),e.userId&&n.searchParams.set("userId",e.userId);let i={"Content-Type":"application/json"};e.builderPrivateKey&&(i.Authorization=`Bearer ${e.builderPrivateKey}`),await Me(n,{method:"POST",body:JSON.stringify(r),headers:i,keepalive:!0,signal:AbortSignal.timeout(5e3)})}catch(n){t.Sentry?.captureException(new Error("Failed to push metrics",{cause:n}))}}Cr();vn();Gt();var Md=ke("DryRunBackup"),OR="/app-backup-test",Aq="/app/.mark",cq={operation:"dry-run-backup-git",dryRunBackupGit:"true"},jRe=async(t,e)=>{let r=await V0t(t,e);return r&&(r.success?j.success("\u2705 Dry run backup git succeeded"):(j.error(`\u274C Dry run backup git failed: ${r.error}`),t.sys.Sentry?.captureException(new Error(`Attempted dry run backup failed: ${r.error}`),{tags:cq})),UR(t.sys,t.credentials,{counters:[{key:"projects_backup_dry_run_ended",value:1,attributes:{outcome:r.success?"success":r.error??"unknown",version:xt}}]}),r)},V0t=async({sys:t,fusionConfig:e,credentials:r},n)=>{function i(o){let s=e.workspace?.folders.find(c=>c.backupMetadata)?.backupMetadata?.check,a=n.repos.find(c=>c.enabledGit),A=o.initState.repos.find(c=>c.enabledGit);return JSON.stringify({backupCheck:s,mainRepo:a,backupMainRepo:A},null,2)}try{let o=process.env.FLY_MACHINE_ID??"unknown";if((0,ju.existsSync)(Aq)&&(0,ju.readFileSync)(Aq,"utf8")===o)return null;if((0,ju.writeFileSync)(Aq,o),j.info("Attempting dry run backup git"),n.currentStep!=="init-success")return{success:!1,error:"main-init-failed"};(0,ju.existsSync)(OR)&&await(0,JRe.rm)(OR,{recursive:!0,force:!0}),(0,ju.mkdirSync)(OR,{recursive:!0});let s=new SC({sys:t,fusionConfig:{...e,_attemptDryRunBackupGit:!1,workingDirectory:OR},debug:!0,credentials:r,sentryTags:cq}),a=await s.init(),A=i(s);if(!a)return Md.error(`\u274C Backup failed: ${s.initState.currentStep}
|
|
4557
4557
|
${A}`),{success:!1,error:`backup-failed:${s.initState.currentStep}`};let c=s.initState.repos.find(d=>d.enabledGit);if(!c)return Md.error(`\u274C Backup repo not found
|
|
4558
4558
|
${A}`),{success:!1,error:"backup-repo-not-found"};let u=n.repos.find(d=>d.enabledGit);if(!u)return Md.error(`\u274C Main repo not found
|
|
4559
4559
|
${A}`),{success:!1,error:"main-repo-not-found"};if(c.branch!==u.branch)return Md.error(`\u274C Backup branch mismatch: ${c.branch} !== ${u.branch}
|
|
@@ -6453,12 +6453,12 @@ When you encounter an obstacle, do not use destructive actions as a shortcut. In
|
|
|
6453
6453
|
`;var Fbt="org-worker",kbt=`General-purpose worker agent for org-agent branches.
|
|
6454
6454
|
Performs tasks delegated by the org-agent: web fetching, browser automation, file reading/editing, research, figuring out any question, mcps, and shell commands.
|
|
6455
6455
|
Provide clear, specific instructions for what to accomplish and what to report back.
|
|
6456
|
-
`,Rbt=["mcp:chrome","Read","Grep","Glob","Bash","Edit","Write","Media","WebFetch","WebSearch","ReadRule","ReadBranch","TodoWrite"],Nbt="gpt5-mini",cNe={name:Fbt,description:kbt,tools:Rbt,systemPrompt:ANe,model:Nbt,needDevServer:!1,mcpServers:!0,includeMemories:!1};m();var uNe=W(require("node:fs"),1);Jr();Gt();var Tbt=ke("CronChecker");function Mbt(t){try{let e=uNe.readFileSync(t,"utf-8");return JSON.parse(e).jobs??[]}catch{return[]}}function Pbt(t,e){if(t.length!==e.length)return!0;let r=new Map(t.map(n=>[n.id,n]));for(let n of e){let i=r.get(n.id);if(!i||i.cron!==n.cron||i.prompt!==n.prompt||i.enabled!==n.enabled||i.description!==n.description)return!0}return!1}async function _bt(t,e){let r=new URL("/projects/org-agent/cron-jobs/sync",e.apiHost);r.searchParams.set("apiKey",e.ownerId);let n=await
|
|
6456
|
+
`,Rbt=["mcp:chrome","Read","Grep","Glob","Bash","Edit","Write","Media","WebFetch","WebSearch","ReadRule","ReadBranch","TodoWrite"],Nbt="gpt5-mini",cNe={name:Fbt,description:kbt,tools:Rbt,systemPrompt:ANe,model:Nbt,needDevServer:!1,mcpServers:!0,includeMemories:!1};m();var uNe=W(require("node:fs"),1);Jr();Gt();var Tbt=ke("CronChecker");function Mbt(t){try{let e=uNe.readFileSync(t,"utf-8");return JSON.parse(e).jobs??[]}catch{return[]}}function Pbt(t,e){if(t.length!==e.length)return!0;let r=new Map(t.map(n=>[n.id,n]));for(let n of e){let i=r.get(n.id);if(!i||i.cron!==n.cron||i.prompt!==n.prompt||i.enabled!==n.enabled||i.description!==n.description)return!0}return!1}async function _bt(t,e){let r=new URL("/projects/org-agent/cron-jobs/sync",e.apiHost);r.searchParams.set("apiKey",e.ownerId);let n=await Me(r.toString(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.privateKey}`},body:JSON.stringify({projectId:e.projectId,branchName:e.branchName,jobs:t})});if(!n.ok)throw new Error(`Cron config sync failed: ${n.status} ${n.statusText}`)}function lNe(t){let{cronFilePath:e,syncIntervalMs:r=3e4,...n}=t,i=null;function o(){let a=Mbt(e);(i===null||Pbt(i,a))&&_bt(a,n).then(()=>{i=a}).catch(A=>{Tbt.error("Failed to sync cron configs to service:",A)})}o();let s=setInterval(o,r);return()=>{clearInterval(s)}}m();var is=W(require("node:fs"),1),ns=W(require("node:path"),1);Zr();ej();function fq(t){let e=Math.floor(t/1e3);if(e<60)return"just now";let r=Math.floor(e/60);if(r<60)return`${r} minute${r===1?"":"s"} ago`;let n=Math.floor(r/60);if(n<24)return`${n} hour${n===1?"":"s"} ago`;let i=Math.floor(n/24);if(i<30)return`${i} day${i===1?"":"s"} ago`;let o=Math.floor(i/30);return`${o} month${o===1?"":"s"} ago`}function dq(t,e){if(!t)return;let r=e.get(t);return r?.name||r?.email||t}function GR(t,e,r){if(!t)return;let n=e.get(t);if(!n)return t;if(!r?.omit?.length)return n;let i={...n};for(let o of r.omit)delete i[o];return i}var Lbt=["kubePodName","kubeNamespace","kubePvcName","kubeHostname","needsCleanup","appName","machineId","lastMachineIdRemovedAt","volumeId","secondaryVolumeId","volumeName","ipv4","ipv6","vscodeTunnelUrl","vscodeTunnelName","vscodeTunnelExpiresAt","backups","backup","lastServerVersion","lastServerStateDate","lastServerState","lastActivityAt","lastCommitDate","lastUpdatedAt","useHomeDir","useCloudHomeDir","type","legacyId","ownerId","isFork","hidden"],Ubt=["createdBy","deletedBy","lastUpdateBy","archivedBy"];function Obt(t,e){let r={...t};for(let n of Lbt)delete r[n];for(let n of Ubt){let i=r[n];typeof i=="string"&&(r[n]=GR(i,e)??i)}return r}function Gbt(t){let r=new Date(t.createdAt).toISOString().replace("T"," ").replace(/\.\d+Z$/," UTC");if(t.senderType==="user"){let n=t.senderDisplayName||t.senderId||"unknown";return`==== [USER] ${r} (${n})
|
|
6457
6457
|
${t.markdown}`}return`==== [AGENT] ${r}
|
|
6458
6458
|
${t.markdown}`}function Kbt(t,e){is.rmSync(e,{recursive:!0,force:!0});let r=new Map;for(let n of t){let i=n.channelId||"_no-channel";if(i.includes(".."))continue;let o=r.get(i);o||(o=[],r.set(i,o)),o.push(n)}for(let[n,i]of r){i.sort((a,A)=>a.createdAt-A.createdAt);let o=ns.join(e,n);is.mkdirSync(o,{recursive:!0});let s=i.map(Gbt).join(`
|
|
6459
6459
|
|
|
6460
6460
|
`);is.writeFileSync(ns.join(o,"thread.log"),s)}}function Hbt(t,e,r,n){let i=Date.now(),o=[];o.push(`# ${t.name}`),o.push(""),t.repoDescription&&(o.push(`> ${t.repoDescription}`),o.push("")),o.push("## Project Info"),o.push(""),o.push(`- **Project ID:** ${t.id}`),o.push(`- **Project Name:** ${t.name}`),t.repoFullName&&o.push(`- **Repository:** ${t.repoFullName}`),t.repoUrl&&o.push(`- **Repo URL:** ${t.repoUrl}`);let s=dq(t.createdBy,r);s&&o.push(`- **Created by:** ${s}`),o.push(`- **Active branches:** ${e}`),t.archived&&o.push("- **Status:** Archived");let a=t.settings?.folders;if(a&&a.length>0){o.push(""),o.push("## Connected Repositories"),o.push(""),o.push("This project has access to additional repositories. Each connected repo may be read-only or read/write depending on its git configuration."),o.push("");for(let d of a){let g=d.enableGit?"read/write":"read-only";o.push(`- **${d.name}** (${g})`),o.push(` - URL: ${d.remoteUrl}`),d.includePath&&o.push(` - Include path: ${d.includePath}`)}}t.repoFullName&&(o.push(""),o.push("## GitHub CLI"),o.push(""),o.push("This is a GitHub repository. You can use `gh` CLI for quick lookups:"),o.push(`- \`gh pr list --repo ${t.repoFullName}\` \u2014 open PRs`),o.push(`- \`gh pr list --repo ${t.repoFullName} --state merged --limit 5\` \u2014 recent merged PRs`),o.push(`- \`gh issue list --repo ${t.repoFullName}\` \u2014 open issues`)),o.push(""),o.push("## Full Project Data"),o.push(""),o.push("See `project.json` in this directory for complete project configuration and all branch details.");let A=new Map;for(let d of n)d.createdBy&&A.set(d.createdBy,(A.get(d.createdBy)??0)+1);let c=[...A.entries()].sort((d,g)=>g[1]-d[1]).slice(0,2);if(c.length>0){o.push(""),o.push("## Top Users"),o.push(""),o.push("| User | Branches |"),o.push("|------|----------|");for(let[d,g]of c){let p=dq(d,r)??d;o.push(`| ${p} | ${g} |`)}}let u=n.filter(d=>d.state==="active"&&typeof d.lastUpdatedAt=="number").sort((d,g)=>(g.lastUpdatedAt??0)-(d.lastUpdatedAt??0)).slice(0,5);if(u.length>0){o.push(""),o.push("## Recent Branches"),o.push("");for(let d of u){let g=fq(i-d.lastUpdatedAt),p=dq(d.createdBy,r),f=p?`, by ${p}`:"";o.push(`- \`${d.friendlyName??d.name}\` \u2014 "${d.name}" (${g}${f})`)}}let l=n.filter(d=>d.prStatus==="merged"&&typeof d.lastUpdatedAt=="number").sort((d,g)=>(g.lastUpdatedAt??0)-(d.lastUpdatedAt??0)).slice(0,5);if(l.length>0){o.push(""),o.push("## Recent Merged PRs"),o.push("");for(let d of l){let g=fq(i-d.lastUpdatedAt),p=d.friendlyName?` \u2014 "${d.friendlyName}"`:"";o.push(`- PR #${d.prNumber}: \`${d.name}\`${p} (merged ${g})`)}}return o.push(""),o.push("## Available Tools"),o.push(""),o.push('- **SpawnBranch** \u2014 Create a new branch for a coding task: `SpawnBranch({ projectId: "...", message: "..." })`'),o.push(""),o.join(`
|
|
6461
|
-
`)}async function KR(t){let{sys:e,ownerId:r,privateKey:n,outputDir:i}=t,o=ns.join(i,"org","projects"),s=ns.join(i,"org");is.mkdirSync(o,{recursive:!0}),is.mkdirSync(s,{recursive:!0});let a=new URL("/projects/org-tree",Me);a.searchParams.set("apiKey",r);let A=await fetch(a,{headers:{Authorization:`Bearer ${n}`}});if(!A.ok)throw new Error(`Failed to fetch org tree: ${A.status} ${A.statusText}`);let c=await A.json(),u=c.projects??[],l=c.branches??[],d=c.users??[],g=c.memories??[],p=c.messages??[];if(c.environmentVariables)for(let v of c.environmentVariables)process.env[v.key]=v.value;let f=new Map(d.map(v=>[v.userId,v])),h=new Map(u.map(v=>[v.id,v])),C=new Map;for(let v of l)v.state==="active"&&C.set(v.projectId,(C.get(v.projectId)??0)+1);function I(v){let S=v.repoFullName??v.id;return S.split("/").pop()===v.name?S:ns.join(S,v.name)}for(let v of u){let S=ns.join(o,I(v));is.mkdirSync(S,{recursive:!0});let P=l.filter(M=>M.projectId===v.id).map(M=>Obt(M,f));is.writeFileSync(ns.join(S,"project.json"),JSON.stringify({...v,branches:P},null,2));let Y=l.filter(M=>M.projectId===v.id);is.writeFileSync(ns.join(S,"AGENTS.md"),Hbt(v,C.get(v.id)??0,f,Y));let K=g.filter(M=>M.projectId===v.id);K.length>0&&await qF(e,K,ns.join(S,"memories"))}let B=Date.now();function E(v){return{branchName:v.name,friendlyName:v.friendlyName,description:v.description,url:`https://builder.io/app/projects/${v.projectId}/${v.name}`,projectId:v.projectId,projectName:h.get(v.projectId)?.name,state:v.state,createdAt:typeof v.createdAt=="number"?v.createdAt:void 0,updatedAt:v.lastUpdatedAt,metadata:v.metadata,lastUpdatedAgo:fq(B-(typeof v.lastUpdatedAt=="number"?v.lastUpdatedAt:B)),createdBy:GR(v.createdBy,f,{omit:["jobFunctions"]}),deletedBy:GR(v.deletedBy,f,{omit:["jobFunctions"]}),deletedAt:v.deletedAt,archiveReason:v.archiveReason,pr:v.prNumber&&v.prUrl?{prNumber:v.prNumber,prUrl:v.prUrl,prStatus:v.prStatus,prStatusUpdatedAt:v.prStatusUpdatedAt}:void 0,prsByFolder:v.prInfoByFolder?Object.fromEntries(Object.entries(v.prInfoByFolder).map(([S,P])=>[S,{prNumber:P.prNumber,prUrl:P.prUrl,prStatus:P.status,updatedAt:P.updatedAt}])):void 0}}let y=B-10080*60*1e3,Q=l.filter(v=>v.state==="active"&&typeof v.lastUpdatedAt=="number"&&v.lastUpdatedAt>y).map(E);is.writeFileSync(ns.join(s,"active-branches.json"),JSON.stringify(Q,null,2));let w=l.filter(v=>v.state==="deleted"||v.state==="archived").map(E);is.writeFileSync(ns.join(s,"archived-branches.json"),JSON.stringify(w,null,2));let D=new Map;for(let v of l){let S=D.get(v.projectId)??[];S.push(v),D.set(v.projectId,S)}let x=u.map(v=>{let S=D.get(v.id)??[],P=new Map;for(let K of S)K.createdBy&&P.set(K.createdBy,(P.get(K.createdBy)??0)+1);let Y=[...P.entries()].sort((K,M)=>M[1]-K[1]).map(([K,M])=>{let U=GR(K,f,{omit:["jobFunctions"]});return{...typeof U=="object"?U:{userId:U},branchCount:M}});return{projectId:v.id,projectName:v.name,repoUrl:v.repoUrl,description:v.description??v.repoDescription,branchCount:C.get(v.id)??0,url:`https://builder.io/app/projects/${v.id}`,moreInfoPath:`org/projects/${I(v)}/`,topUsers:Y}}).sort((v,S)=>S.branchCount-v.branchCount||v.projectName.localeCompare(S.projectName));if(is.writeFileSync(ns.join(s,"projects.json"),JSON.stringify(x,null,2)),p.length>0){let v=ns.join(i,"org","channels");Kbt(p,v)}}Ij();$J();Vi();kE();za();var Ue=ke("Launch"),$bt=48752;async function Jbt(t){return new Promise(e=>{let r=jR.createServer();r.listen(t,()=>{r.once("close",()=>{e(!0)}),r.close()}),r.on("error",()=>{e(!1)})})}async function gNe(t){let e=t,r=100;for(let n=0;n<r;n++){if(await Jbt(e))return e;e=Math.floor(Math.random()*16384)+49152}throw new Error(`Could not find an available port after ${r} attempts`)}async function jbt(t,e){let r=parseInt(process.env.FUSION_SERVER_PORT??""),n=isNaN(r)?$bt:r,i,o=t.fusionServerPort;if(o!==void 0)i=o,Ue.info(`\u{1F50D} Using configured HTTP port: ${i}`);else{let a=e;i=n,a&&(i=await gNe(n),i!==n&&Ue.info(`\u26A0\uFE0F Port ${n} is in use, using port ${i} instead`))}if(!t.https)return{httpPort:i};let s=t.httpsServerOptions?.port??await gNe(i+1);return{httpPort:i,httpsPort:s}}function pNe(t,e,r){if(t.jsonOutput){let n={type:"server_error",data:{error:e,details:r,timestamp:Date.now()}};console.log(JSON.stringify(n))}}var Da,Yu,JR,Rg=null,HR,$R;function Ybt(t){let r=t.state==="initial"||t.state==="init-running"||t.state==="closing"||t.setupState==="installing"||t.activeOperations>0||Yu!=null&&!Yu.isIdle()?"busy":"idle";t.containerState!==r&&(t.containerState=r,t.containerStateTimestamp=Date.now())}async function ENe({sys:t,args:e,existingSession:r}){r&&(Da=Promise.resolve(r),Yu=r);let n=process.env.FLY_APP_NAME?{flyAppName:process.env.FLY_APP_NAME,flyMachineId:process.env.FLY_MACHINE_ID,flyRegion:process.env.FLY_REGION,flyPublicIp:process.env.FLY_PUBLIC_IP,flyVmMemoryMb:process.env.FLY_VM_MEMORY_MB,flyPrimaryRegion:process.env.PRIMARY_REGION}:void 0;n&&(t.Sentry?.setContext("flyIo",n),t.Sentry?.getCurrentScope().setContext("flyIo",n));let i=await Cg(t,e);if(kDe(t,i),e.fusionInit&&WW(!0),i.privacyMode?.encryptKey&&!await HF(i.privacyMode.encryptKey))throw new Error("Invalid encryption key: key failed validation");await VRe(t,i);let o=await qbt(t,e,i),s=performance.now(),a="initial",A={status:"ok",get state(){return a},set state(y){a!==y&&i.projectId&&i.branchName&&rG(t,o,{projectId:i.projectId,branchName:i.branchName,lastServerVersion:xt,lastServerState:y},!1),a=y},isFinalState:!1,editorReady:!1,initState:void 0,setupState:void 0,devState:void 0,httpServerState:void 0,errorMessage:void 0,devToolsVersion:xt,lastRequestTime:s,startTime:s,workingDirectory:process.cwd(),httpClients:0,containerState:"busy",containerStateTimestamp:Date.now(),activeOperations:0,detectedServerUrl:i.autoDetectDevServer?void 0:i.serverUrl,fusionEnvironment:process.env.FUSION_ENVIRONMENT==="cloud"||process.env.FUSION_ENVIRONMENT==="cloud-v2"?process.env.FUSION_ENVIRONMENT:"unknown"},c,{app:u,proxyUrl:l,server:d,httpsServer:g,httpsProxyUrl:p,customHttpsProxyUrl:f}=await Vbt(o,i,A,t,e);Rg||(Rg=$Re(t,o,i,A)),Rg&&Rg.start(),setInterval(()=>{Ybt(A)},5e3);let h=tvt(t,i,n),C=!1,I=!1,B=!1,E=y=>async()=>{if(Ue.info(`Received ${y} signal`),A.state==="init-running"){Ue.info("Init is running, skipping"),B=!0;return}if(C){Ue.info("Server already closing, skipping");return}A.state="closing",C=!0,setTimeout(()=>{C=!1},1e3),Ue.info("Closing server gracefully");try{d.closeAllConnections(),g&&g.closeAllConnections(),h(),Rg&&(Rg.stop(),Rg=null);let Q=[new Promise(w=>d.close(w))];if(g&&Q.push(new Promise(w=>g.close(w))),await Promise.race([Promise.all(Q),new Promise(w=>setTimeout(w,1e3))]),c&&(await c.close(),c=void 0),!I&&A.initState?.success){I=!0;let w=await Qa();A.state="closing",w&&(Ue.info("Closing codeGenServer"),HR&&(HR(),HR=void 0),$R&&(clearInterval($R),$R=void 0),await w.close(!!i.autoBackupGit),Da=void 0)}await t.Sentry?.flush(2e3),process.env.BUILDER_DISABLE_AMPLITUDE!=="true"&&await INe.flush().promise,process.exit(0)}catch(Q){t.Sentry?.captureException(Q);let w=Q instanceof Error?Q.message:String(Q);Ue.error(`\u274C FAILED TO CLOSE SERVER: ${w}`),process.exit(1)}};if(URe(),process.on("SIGTERM",E("SIGTERM")),process.on("SIGINT",E("SIGINT")),e.fusionInit){A.state="init-running";let y={operation:"fusion-init",mode:i.mode??""},Q=new SC({sys:t,fusionConfig:i,debug:!0,credentials:o,sentryTags:y});A.initState=Q.initState,A.initStatusLogs=Q.initStatusLogs;let w=await Q.init();if(String(process.env.DEVTOOLS_SKIP_POST_INIT||"").toLowerCase().match(/^(1|true|yes)$/)&&process.exit(0),!w){Ue.error("\u274C Initialization failed"),t.Sentry?.captureException(new Error("Initialization failed"),{level:"fatal",tags:y,extra:{initState:Q.initState}}),A.state="init-error",A.isFinalState=!0,A.errorMessage=Q.initState.error,B&&await E("init-end")();return}if(Ue.info("\u2705 Initialization completed successfully"),A.state="init-complete",B){await E("init-end")();return}if(i.mode==="backup"||i.mode==="backup-force-full"){await E("init-end")();return}i._attemptDryRunBackupGit&&jRe({sys:t,fusionConfig:i,debug:!0,credentials:o},Q.initState).then(x=>{x&&(A._attemptDryRunBackupOutcome=x.success?"success":x.error)}).catch(x=>{t.Sentry?.captureException(x,{tags:{operation:"dry-run-backup-git",dryRunBackupGit:"true"}})})}if(c=await zbt(t,i,A,e,o),e.fusionInit&&c){let y=i.nativeApp?3e5:2e3;await Promise.race([c.ensureSetupCommand(),new Promise(Q=>setTimeout(Q,y))])}await Wbt({sys:t,credentials:o,args:e,fusionConfig:i,proxyUrl:l,httpsProxyUrl:p,customHttpsProxyUrl:f,server:d,httpsServer:g,app:u,devServer:c,sharedState:A}),await Wt("launch",{...i,dev:!!e.dev})}async function qbt(t,e,r){let n;try{if(n=await mr(t,e,{builderPrivateKey:!0,builderPublicKey:!0}),!n.builderPublicKey||!n.builderPrivateKey){let i="You need to be logged in to use the fusion command.";return pNe(e,i),Ue.error(i),qe("Please login first with: npx builder.io login"),await Ke(1)}if(!n.timestamp&&!r.projectId){let i=await t.getDeviceId();if(i)try{let o=new URL(`${Me}/fusion/cli-key`);o.searchParams.set("host",i),o.searchParams.set("apiKey",n.builderPublicKey);let s=await Pe(o.toString(),{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.builderPrivateKey}`},method:"GET"});if(!s.ok){let c=await s.text();throw new Error(`Failed to fetch original private key: ${c}`)}let A=(await s.json())?.key;A&&(n.builderPrivateKey=A,n.timestamp=new Date().toISOString(),Ek(t,n))}catch(o){t.Sentry?.captureException(new Error("Failed to fetch original private key, using existing credentials",{cause:o}))}}Ue.info(`Logged in as space: ${n.spaceName||n.builderPublicKey}`)}catch(i){let o="Authentication failed.";return pNe(e,o,i instanceof Error?i.message:String(i)),Ue.error(o),qe("Please login first with: npx builder.io login"),await Ke(1)}return n}async function Vbt(t,e,r,n,i){let o=!!e.isLocal||!!i?.local,{httpPort:s,httpsPort:a}=await jbt(e,o);e.nativeApp?Ue.info(`\u{1F50D} Setting up Builder.io API server on port ${s} (Native App Mode)`):Ue.info(`\u{1F50D} Setting up Builder.io server on port ${s}`);let A=(0,fD.default)();A.use((y,Q,w)=>{!o&&y.url?.startsWith(Fm)&&!y.url.includes("/status-v2")&&Ue.debug(`[HTTP]: ${y.url}`),y.query._skip_activity!=="true"&&(r.lastRequestTime=performance.now()),w()});let c=t.builderPrivateKey,u=e.authenticateProxy??!1;$ge({sys:n,app:A,validBuilderPrivateKey:c,authenticateProxy:u,isLocal:o,sharedState:r,fusionConfig:e});let l=fNe.createServer(A),d=1e3,g=60*d;l.keepAliveTimeout=1*g,l.headersTimeout=1*g+d;let p;if(e.https)try{let{port:y,...Q}=e.httpsServerOptions??{};p=mNe.createServer(Q,A),Ue.info(`\u{1F50D} Setting up HTTPS server on port ${a}`)}catch(y){Ue.error(`\u274C Failed to create HTTPS server: ${y instanceof Error?y.message:String(y)}`),p=void 0}let f=e.localHttpsDomain,h=`http://localhost:${s}`,C=a?`https://localhost:${a}`:void 0,I=f&&a?`https://${f}:${a}`:void 0,B=[new Promise((y,Q)=>{l.listen(s,async()=>{Ue.info(`\u{1F680} Builder.io HTTP server running at ${h}`),Ue.info("Available server URLs:"),Ue.info(` HTTP (localhost): ${h}`),y(!0)}),l.on("error",w=>{Ue.error(`\u274C Failed to create HTTP server: ${w instanceof Error?w.message:String(w)}`),Q(w)})})];return p&&B.push(new Promise((y,Q)=>{p.listen(a,async()=>{Ue.info(`\u{1F680} Builder.io HTTPS server running at ${C}`),Ue.info(` HTTPS (localhost): ${C}`),I&&Ue.info(` HTTPS (custom domain): ${I}`),y(!0)}),p.on("error",w=>{Ue.error(`\u274C Failed to create HTTPS server: ${w instanceof Error?w.message:String(w)}`),Q(w)})})),await Promise.all(B),{app:A,proxyUrl:I||C||h,server:l,httpsServer:p,httpsProxyUrl:C,customHttpsProxyUrl:I}}async function zbt(t,e,r,n,i){if(e.nativeApp){e.devCommand?Ue.info(`Running ${(0,pD.cyan)(e.devCommand)} in native app mode...`):Ue.info("Native app mode: No dev command specified");let o=await DO(t,e,n.fusionInit&&e.setupCommand?.trim()?"not-installed":"installed");return r.devState=o.devState,r.setupState=o.setupState,r.httpServerState="ok-2xx",o.emitter.on("devState",s=>{r.devState=s}),o.emitter.on("setupState",s=>{r.setupState=s}),o}if((n.serverUrl||n.chat)&&!n.command){n.chat||Ue.info(`Proxying to existing dev server at ${(0,pD.cyan)(e.serverUrl)}...`),r.devState="running",r.setupState="installed",r.httpServerState="ok-2xx";return}else{e.devCommand&&Ue.info(`Running ${(0,pD.cyan)(e.devCommand)} on host ${e.serverUrl?(0,pD.cyan)(e.serverUrl):"TBD"}...`);let o=await DO(t,e,n.fusionInit?"not-installed":"installed");return r.devState=o.devState,r.setupState=o.setupState,r.httpServerState=o.httpServerState.state,o.emitter.on("devState",s=>{r.devState=s}),o.emitter.on("setupState",s=>{r.setupState=s}),o.emitter.on("httpServerState",s=>{r.httpServerState=s}),o.emitter.on("urlDetected",s=>{r.detectedServerUrl=s}),o.emitter.on("metrics",s=>{if(s.durations)for(let a of s.durations)process.env.DEBUG&&Ue.debug(`[Metrics](${a.key}): ${a.ms}ms ${a.attributes?JSON.stringify(a.attributes):""}`);UR(t,i,s).catch(a=>{t.Sentry?.captureException(a,{tags:{operation:"push-metrics"}})})}),o}}async function Wbt({sys:t,credentials:e,args:r,fusionConfig:n,app:i,server:o,httpsServer:s,proxyUrl:a,httpsProxyUrl:A,customHttpsProxyUrl:c,devServer:u,sharedState:l}){async function d({force:p=!1,forcedFullBackup:f=!1}={}){Ue.info(`\u{1F4E6} Attempting backup${p?" (forced)":""}${f?" (full)":""}...`);let h=await Qa();if(!h)if(n.autoBackupGit&&l.initState?.success)h=await dD(t,e,n,u,void 0,l,void 0,n.privacyMode);else return Ue.info("\u{1F51A} No active session"),{success:!0,message:"No active session",skipped:!0,reason:"no_active_session"};if(!(p||n.autoBackupGit))return Ue.info("\u{1F51A} Auto backup git is disabled, skipping backup"),{success:!0,message:"Auto backup git is disabled, skipping backup",skipped:!0,reason:"auto_backup_git_disabled"};if(!h.isIdle())return Ue.info("\u{1F51A} Not idle, skipping backup"),{success:!1,message:"Not idle, skipping backup",skipped:!0,reason:"not_idle"};if(!f&&!await h.needsBackup())return Ue.info("\u2705 Already backed up after last request"),{success:!0,message:"Already backed up",skipped:!0,reason:"already_backed_up"};try{let B=await h.uploadBackup(f);return B.success&&Ue.info("\u2705 Backup successful"),B}catch(B){let E=`Backup error: ${B instanceof Error?B.message:String(B)}`;return Ue.error(`\u274C ${E}`),{success:!1,message:E,error:B instanceof Error?B:new Error(String(B))}}}async function g(p){Ue.info(`\u{1F504} Attempting graceful shutdown: ${p}`);let f=()=>{n.autoShutdown&&(Ue.info("\u{1F504} Shutting down process"),process.kill(process.pid,"SIGTERM"))},h=await d({force:!1});return h.success&&f(),h}try{let p=fD.default.Router();if(p.post("/generate",async(Q,w)=>{try{Ue.debug("(generate): started");let{prompt:D,userMessage:x,canHandleTools:v,fireAndForget:S,context:{featureFlags:P}}=Q.body;if(!D&&!x)return w.status(400).json({error:"No prompt/userMessage provided"});w.socket?.setNoDelay(!0),w.setHeader("Content-Type","text/event-stream; charset=utf-8"),w.setHeader("Transfer-Encoding","chunked"),w.setHeader("X-Accel-Buffering","no"),w.setHeader("Cache-Control","no-cache"),w.setHeader("Connection","keep-alive"),P&&uq(P);let Y=await dD(t,e,n,u,void 0,l,void 0,n.privacyMode);if(S){Array.isArray(v)&&v.length>0&&Y.setSessionCanHandleTools(v),Y.waitForEventLoop(),await Y.sendMessage(D?{userPrompt:D}:x),w.status(200),w.write(JSON.stringify({type:"success",message:"Message sent"})+`
|
|
6461
|
+
`)}async function KR(t){let{sys:e,ownerId:r,privateKey:n,outputDir:i}=t,o=ns.join(i,"org","projects"),s=ns.join(i,"org");is.mkdirSync(o,{recursive:!0}),is.mkdirSync(s,{recursive:!0});let a=new URL("/projects/org-tree",Pe);a.searchParams.set("apiKey",r);let A=await fetch(a,{headers:{Authorization:`Bearer ${n}`}});if(!A.ok)throw new Error(`Failed to fetch org tree: ${A.status} ${A.statusText}`);let c=await A.json(),u=c.projects??[],l=c.branches??[],d=c.users??[],g=c.memories??[],p=c.messages??[];if(c.environmentVariables)for(let v of c.environmentVariables)process.env[v.key]=v.value;let f=new Map(d.map(v=>[v.userId,v])),h=new Map(u.map(v=>[v.id,v])),C=new Map;for(let v of l)v.state==="active"&&C.set(v.projectId,(C.get(v.projectId)??0)+1);function I(v){let S=v.repoFullName??v.id;return S.split("/").pop()===v.name?S:ns.join(S,v.name)}for(let v of u){let S=ns.join(o,I(v));is.mkdirSync(S,{recursive:!0});let P=l.filter(M=>M.projectId===v.id).map(M=>Obt(M,f));is.writeFileSync(ns.join(S,"project.json"),JSON.stringify({...v,branches:P},null,2));let Y=l.filter(M=>M.projectId===v.id);is.writeFileSync(ns.join(S,"AGENTS.md"),Hbt(v,C.get(v.id)??0,f,Y));let K=g.filter(M=>M.projectId===v.id);K.length>0&&await qF(e,K,ns.join(S,"memories"))}let B=Date.now();function E(v){return{branchName:v.name,friendlyName:v.friendlyName,description:v.description,url:`https://builder.io/app/projects/${v.projectId}/${v.name}`,projectId:v.projectId,projectName:h.get(v.projectId)?.name,state:v.state,createdAt:typeof v.createdAt=="number"?v.createdAt:void 0,updatedAt:v.lastUpdatedAt,metadata:v.metadata,lastUpdatedAgo:fq(B-(typeof v.lastUpdatedAt=="number"?v.lastUpdatedAt:B)),createdBy:GR(v.createdBy,f,{omit:["jobFunctions"]}),deletedBy:GR(v.deletedBy,f,{omit:["jobFunctions"]}),deletedAt:v.deletedAt,archiveReason:v.archiveReason,pr:v.prNumber&&v.prUrl?{prNumber:v.prNumber,prUrl:v.prUrl,prStatus:v.prStatus,prStatusUpdatedAt:v.prStatusUpdatedAt}:void 0,prsByFolder:v.prInfoByFolder?Object.fromEntries(Object.entries(v.prInfoByFolder).map(([S,P])=>[S,{prNumber:P.prNumber,prUrl:P.prUrl,prStatus:P.status,updatedAt:P.updatedAt}])):void 0}}let y=B-10080*60*1e3,Q=l.filter(v=>v.state==="active"&&typeof v.lastUpdatedAt=="number"&&v.lastUpdatedAt>y).map(E);is.writeFileSync(ns.join(s,"active-branches.json"),JSON.stringify(Q,null,2));let w=l.filter(v=>v.state==="deleted"||v.state==="archived").map(E);is.writeFileSync(ns.join(s,"archived-branches.json"),JSON.stringify(w,null,2));let D=new Map;for(let v of l){let S=D.get(v.projectId)??[];S.push(v),D.set(v.projectId,S)}let x=u.map(v=>{let S=D.get(v.id)??[],P=new Map;for(let K of S)K.createdBy&&P.set(K.createdBy,(P.get(K.createdBy)??0)+1);let Y=[...P.entries()].sort((K,M)=>M[1]-K[1]).map(([K,M])=>{let U=GR(K,f,{omit:["jobFunctions"]});return{...typeof U=="object"?U:{userId:U},branchCount:M}});return{projectId:v.id,projectName:v.name,repoUrl:v.repoUrl,description:v.description??v.repoDescription,branchCount:C.get(v.id)??0,url:`https://builder.io/app/projects/${v.id}`,moreInfoPath:`org/projects/${I(v)}/`,topUsers:Y}}).sort((v,S)=>S.branchCount-v.branchCount||v.projectName.localeCompare(S.projectName));if(is.writeFileSync(ns.join(s,"projects.json"),JSON.stringify(x,null,2)),p.length>0){let v=ns.join(i,"org","channels");Kbt(p,v)}}Ij();$J();Vi();kE();za();var Ue=ke("Launch"),$bt=48752;async function Jbt(t){return new Promise(e=>{let r=jR.createServer();r.listen(t,()=>{r.once("close",()=>{e(!0)}),r.close()}),r.on("error",()=>{e(!1)})})}async function gNe(t){let e=t,r=100;for(let n=0;n<r;n++){if(await Jbt(e))return e;e=Math.floor(Math.random()*16384)+49152}throw new Error(`Could not find an available port after ${r} attempts`)}async function jbt(t,e){let r=parseInt(process.env.FUSION_SERVER_PORT??""),n=isNaN(r)?$bt:r,i,o=t.fusionServerPort;if(o!==void 0)i=o,Ue.info(`\u{1F50D} Using configured HTTP port: ${i}`);else{let a=e;i=n,a&&(i=await gNe(n),i!==n&&Ue.info(`\u26A0\uFE0F Port ${n} is in use, using port ${i} instead`))}if(!t.https)return{httpPort:i};let s=t.httpsServerOptions?.port??await gNe(i+1);return{httpPort:i,httpsPort:s}}function pNe(t,e,r){if(t.jsonOutput){let n={type:"server_error",data:{error:e,details:r,timestamp:Date.now()}};console.log(JSON.stringify(n))}}var Da,Yu,JR,Rg=null,HR,$R;function Ybt(t){let r=t.state==="initial"||t.state==="init-running"||t.state==="closing"||t.setupState==="installing"||t.activeOperations>0||Yu!=null&&!Yu.isIdle()?"busy":"idle";t.containerState!==r&&(t.containerState=r,t.containerStateTimestamp=Date.now())}async function ENe({sys:t,args:e,existingSession:r}){r&&(Da=Promise.resolve(r),Yu=r);let n=process.env.FLY_APP_NAME?{flyAppName:process.env.FLY_APP_NAME,flyMachineId:process.env.FLY_MACHINE_ID,flyRegion:process.env.FLY_REGION,flyPublicIp:process.env.FLY_PUBLIC_IP,flyVmMemoryMb:process.env.FLY_VM_MEMORY_MB,flyPrimaryRegion:process.env.PRIMARY_REGION}:void 0;n&&(t.Sentry?.setContext("flyIo",n),t.Sentry?.getCurrentScope().setContext("flyIo",n));let i=await Cg(t,e);if(kDe(t,i),e.fusionInit&&WW(!0),i.privacyMode?.encryptKey&&!await HF(i.privacyMode.encryptKey))throw new Error("Invalid encryption key: key failed validation");await VRe(t,i);let o=await qbt(t,e,i),s=performance.now(),a="initial",A={status:"ok",get state(){return a},set state(y){a!==y&&i.projectId&&i.branchName&&rG(t,o,{projectId:i.projectId,branchName:i.branchName,lastServerVersion:xt,lastServerState:y},!1),a=y},isFinalState:!1,editorReady:!1,initState:void 0,setupState:void 0,devState:void 0,httpServerState:void 0,errorMessage:void 0,devToolsVersion:xt,lastRequestTime:s,startTime:s,workingDirectory:process.cwd(),httpClients:0,containerState:"busy",containerStateTimestamp:Date.now(),activeOperations:0,detectedServerUrl:i.autoDetectDevServer?void 0:i.serverUrl,fusionEnvironment:process.env.FUSION_ENVIRONMENT==="cloud"||process.env.FUSION_ENVIRONMENT==="cloud-v2"?process.env.FUSION_ENVIRONMENT:"unknown"},c,{app:u,proxyUrl:l,server:d,httpsServer:g,httpsProxyUrl:p,customHttpsProxyUrl:f}=await Vbt(o,i,A,t,e);Rg||(Rg=$Re(t,o,i,A)),Rg&&Rg.start(),setInterval(()=>{Ybt(A)},5e3);let h=tvt(t,i,n),C=!1,I=!1,B=!1,E=y=>async()=>{if(Ue.info(`Received ${y} signal`),A.state==="init-running"){Ue.info("Init is running, skipping"),B=!0;return}if(C){Ue.info("Server already closing, skipping");return}A.state="closing",C=!0,setTimeout(()=>{C=!1},1e3),Ue.info("Closing server gracefully");try{d.closeAllConnections(),g&&g.closeAllConnections(),h(),Rg&&(Rg.stop(),Rg=null);let Q=[new Promise(w=>d.close(w))];if(g&&Q.push(new Promise(w=>g.close(w))),await Promise.race([Promise.all(Q),new Promise(w=>setTimeout(w,1e3))]),c&&(await c.close(),c=void 0),!I&&A.initState?.success){I=!0;let w=await Qa();A.state="closing",w&&(Ue.info("Closing codeGenServer"),HR&&(HR(),HR=void 0),$R&&(clearInterval($R),$R=void 0),await w.close(!!i.autoBackupGit),Da=void 0)}await t.Sentry?.flush(2e3),process.env.BUILDER_DISABLE_AMPLITUDE!=="true"&&await INe.flush().promise,process.exit(0)}catch(Q){t.Sentry?.captureException(Q);let w=Q instanceof Error?Q.message:String(Q);Ue.error(`\u274C FAILED TO CLOSE SERVER: ${w}`),process.exit(1)}};if(URe(),process.on("SIGTERM",E("SIGTERM")),process.on("SIGINT",E("SIGINT")),e.fusionInit){A.state="init-running";let y={operation:"fusion-init",mode:i.mode??""},Q=new SC({sys:t,fusionConfig:i,debug:!0,credentials:o,sentryTags:y});A.initState=Q.initState,A.initStatusLogs=Q.initStatusLogs;let w=await Q.init();if(String(process.env.DEVTOOLS_SKIP_POST_INIT||"").toLowerCase().match(/^(1|true|yes)$/)&&process.exit(0),!w){Ue.error("\u274C Initialization failed"),t.Sentry?.captureException(new Error("Initialization failed"),{level:"fatal",tags:y,extra:{initState:Q.initState}}),A.state="init-error",A.isFinalState=!0,A.errorMessage=Q.initState.error,B&&await E("init-end")();return}if(Ue.info("\u2705 Initialization completed successfully"),A.state="init-complete",B){await E("init-end")();return}if(i.mode==="backup"||i.mode==="backup-force-full"){await E("init-end")();return}i._attemptDryRunBackupGit&&jRe({sys:t,fusionConfig:i,debug:!0,credentials:o},Q.initState).then(x=>{x&&(A._attemptDryRunBackupOutcome=x.success?"success":x.error)}).catch(x=>{t.Sentry?.captureException(x,{tags:{operation:"dry-run-backup-git",dryRunBackupGit:"true"}})})}if(c=await zbt(t,i,A,e,o),e.fusionInit&&c){let y=i.nativeApp?3e5:2e3;await Promise.race([c.ensureSetupCommand(),new Promise(Q=>setTimeout(Q,y))])}await Wbt({sys:t,credentials:o,args:e,fusionConfig:i,proxyUrl:l,httpsProxyUrl:p,customHttpsProxyUrl:f,server:d,httpsServer:g,app:u,devServer:c,sharedState:A}),await Wt("launch",{...i,dev:!!e.dev})}async function qbt(t,e,r){let n;try{if(n=await mr(t,e,{builderPrivateKey:!0,builderPublicKey:!0}),!n.builderPublicKey||!n.builderPrivateKey){let i="You need to be logged in to use the fusion command.";return pNe(e,i),Ue.error(i),qe("Please login first with: npx builder.io login"),await Ke(1)}if(!n.timestamp&&!r.projectId){let i=await t.getDeviceId();if(i)try{let o=new URL(`${Pe}/fusion/cli-key`);o.searchParams.set("host",i),o.searchParams.set("apiKey",n.builderPublicKey);let s=await Me(o.toString(),{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.builderPrivateKey}`},method:"GET"});if(!s.ok){let c=await s.text();throw new Error(`Failed to fetch original private key: ${c}`)}let A=(await s.json())?.key;A&&(n.builderPrivateKey=A,n.timestamp=new Date().toISOString(),Ek(t,n))}catch(o){t.Sentry?.captureException(new Error("Failed to fetch original private key, using existing credentials",{cause:o}))}}Ue.info(`Logged in as space: ${n.spaceName||n.builderPublicKey}`)}catch(i){let o="Authentication failed.";return pNe(e,o,i instanceof Error?i.message:String(i)),Ue.error(o),qe("Please login first with: npx builder.io login"),await Ke(1)}return n}async function Vbt(t,e,r,n,i){let o=!!e.isLocal||!!i?.local,{httpPort:s,httpsPort:a}=await jbt(e,o);e.nativeApp?Ue.info(`\u{1F50D} Setting up Builder.io API server on port ${s} (Native App Mode)`):Ue.info(`\u{1F50D} Setting up Builder.io server on port ${s}`);let A=(0,fD.default)();A.use((y,Q,w)=>{!o&&y.url?.startsWith(Fm)&&!y.url.includes("/status-v2")&&Ue.debug(`[HTTP]: ${y.url}`),y.query._skip_activity!=="true"&&(r.lastRequestTime=performance.now()),w()});let c=t.builderPrivateKey,u=e.authenticateProxy??!1;$ge({sys:n,app:A,validBuilderPrivateKey:c,authenticateProxy:u,isLocal:o,sharedState:r,fusionConfig:e});let l=fNe.createServer(A),d=1e3,g=60*d;l.keepAliveTimeout=1*g,l.headersTimeout=1*g+d;let p;if(e.https)try{let{port:y,...Q}=e.httpsServerOptions??{};p=mNe.createServer(Q,A),Ue.info(`\u{1F50D} Setting up HTTPS server on port ${a}`)}catch(y){Ue.error(`\u274C Failed to create HTTPS server: ${y instanceof Error?y.message:String(y)}`),p=void 0}let f=e.localHttpsDomain,h=`http://localhost:${s}`,C=a?`https://localhost:${a}`:void 0,I=f&&a?`https://${f}:${a}`:void 0,B=[new Promise((y,Q)=>{l.listen(s,async()=>{Ue.info(`\u{1F680} Builder.io HTTP server running at ${h}`),Ue.info("Available server URLs:"),Ue.info(` HTTP (localhost): ${h}`),y(!0)}),l.on("error",w=>{Ue.error(`\u274C Failed to create HTTP server: ${w instanceof Error?w.message:String(w)}`),Q(w)})})];return p&&B.push(new Promise((y,Q)=>{p.listen(a,async()=>{Ue.info(`\u{1F680} Builder.io HTTPS server running at ${C}`),Ue.info(` HTTPS (localhost): ${C}`),I&&Ue.info(` HTTPS (custom domain): ${I}`),y(!0)}),p.on("error",w=>{Ue.error(`\u274C Failed to create HTTPS server: ${w instanceof Error?w.message:String(w)}`),Q(w)})})),await Promise.all(B),{app:A,proxyUrl:I||C||h,server:l,httpsServer:p,httpsProxyUrl:C,customHttpsProxyUrl:I}}async function zbt(t,e,r,n,i){if(e.nativeApp){e.devCommand?Ue.info(`Running ${(0,pD.cyan)(e.devCommand)} in native app mode...`):Ue.info("Native app mode: No dev command specified");let o=await DO(t,e,n.fusionInit&&e.setupCommand?.trim()?"not-installed":"installed");return r.devState=o.devState,r.setupState=o.setupState,r.httpServerState="ok-2xx",o.emitter.on("devState",s=>{r.devState=s}),o.emitter.on("setupState",s=>{r.setupState=s}),o}if((n.serverUrl||n.chat)&&!n.command){n.chat||Ue.info(`Proxying to existing dev server at ${(0,pD.cyan)(e.serverUrl)}...`),r.devState="running",r.setupState="installed",r.httpServerState="ok-2xx";return}else{e.devCommand&&Ue.info(`Running ${(0,pD.cyan)(e.devCommand)} on host ${e.serverUrl?(0,pD.cyan)(e.serverUrl):"TBD"}...`);let o=await DO(t,e,n.fusionInit?"not-installed":"installed");return r.devState=o.devState,r.setupState=o.setupState,r.httpServerState=o.httpServerState.state,o.emitter.on("devState",s=>{r.devState=s}),o.emitter.on("setupState",s=>{r.setupState=s}),o.emitter.on("httpServerState",s=>{r.httpServerState=s}),o.emitter.on("urlDetected",s=>{r.detectedServerUrl=s}),o.emitter.on("metrics",s=>{if(s.durations)for(let a of s.durations)process.env.DEBUG&&Ue.debug(`[Metrics](${a.key}): ${a.ms}ms ${a.attributes?JSON.stringify(a.attributes):""}`);UR(t,i,s).catch(a=>{t.Sentry?.captureException(a,{tags:{operation:"push-metrics"}})})}),o}}async function Wbt({sys:t,credentials:e,args:r,fusionConfig:n,app:i,server:o,httpsServer:s,proxyUrl:a,httpsProxyUrl:A,customHttpsProxyUrl:c,devServer:u,sharedState:l}){async function d({force:p=!1,forcedFullBackup:f=!1}={}){Ue.info(`\u{1F4E6} Attempting backup${p?" (forced)":""}${f?" (full)":""}...`);let h=await Qa();if(!h)if(n.autoBackupGit&&l.initState?.success)h=await dD(t,e,n,u,void 0,l,void 0,n.privacyMode);else return Ue.info("\u{1F51A} No active session"),{success:!0,message:"No active session",skipped:!0,reason:"no_active_session"};if(!(p||n.autoBackupGit))return Ue.info("\u{1F51A} Auto backup git is disabled, skipping backup"),{success:!0,message:"Auto backup git is disabled, skipping backup",skipped:!0,reason:"auto_backup_git_disabled"};if(!h.isIdle())return Ue.info("\u{1F51A} Not idle, skipping backup"),{success:!1,message:"Not idle, skipping backup",skipped:!0,reason:"not_idle"};if(!f&&!await h.needsBackup())return Ue.info("\u2705 Already backed up after last request"),{success:!0,message:"Already backed up",skipped:!0,reason:"already_backed_up"};try{let B=await h.uploadBackup(f);return B.success&&Ue.info("\u2705 Backup successful"),B}catch(B){let E=`Backup error: ${B instanceof Error?B.message:String(B)}`;return Ue.error(`\u274C ${E}`),{success:!1,message:E,error:B instanceof Error?B:new Error(String(B))}}}async function g(p){Ue.info(`\u{1F504} Attempting graceful shutdown: ${p}`);let f=()=>{n.autoShutdown&&(Ue.info("\u{1F504} Shutting down process"),process.kill(process.pid,"SIGTERM"))},h=await d({force:!1});return h.success&&f(),h}try{let p=fD.default.Router();if(p.post("/generate",async(Q,w)=>{try{Ue.debug("(generate): started");let{prompt:D,userMessage:x,canHandleTools:v,fireAndForget:S,context:{featureFlags:P}}=Q.body;if(!D&&!x)return w.status(400).json({error:"No prompt/userMessage provided"});w.socket?.setNoDelay(!0),w.setHeader("Content-Type","text/event-stream; charset=utf-8"),w.setHeader("Transfer-Encoding","chunked"),w.setHeader("X-Accel-Buffering","no"),w.setHeader("Cache-Control","no-cache"),w.setHeader("Connection","keep-alive"),P&&uq(P);let Y=await dD(t,e,n,u,void 0,l,void 0,n.privacyMode);if(S){Array.isArray(v)&&v.length>0&&Y.setSessionCanHandleTools(v),Y.waitForEventLoop(),await Y.sendMessage(D?{userPrompt:D}:x),w.status(200),w.write(JSON.stringify({type:"success",message:"Message sent"})+`
|
|
6462
6462
|
`),w.end();return}let K=setInterval(async()=>{let U={type:"ping"};w.write(JSON.stringify(U)+`
|
|
6463
6463
|
`)},5e3),M=Y.connectToEventLoop(!1,U=>{w.write(JSON.stringify(U)+`
|
|
6464
6464
|
`)},{canHandleTools:Array.isArray(v)?v:[]});try{await Y.sendMessage(D?{userPrompt:D}:x),await Y.waitUntilIdle()}catch(U){t.Sentry?.captureException(U);let $=U instanceof Error?U.message:String(U);w.write(`${JSON.stringify({type:"error",message:`Error: ${$}`})}
|
|
@@ -6476,14 +6476,14 @@ ${t.markdown}`}function Kbt(t,e){is.rmSync(e,{recursive:!0,force:!0});let r=new
|
|
|
6476
6476
|
\r
|
|
6477
6477
|
`),w.destroy();return}h.handleUpgrade(Q,w,D,function(P){P.emit("connection",P,Q)})}else if(f)f(Q,w,D);else{t.debug(`Native app mode: Rejecting WebSocket connection to: ${x}`),w.writable&&w.write(`HTTP/1.1 404 Not Found\r
|
|
6478
6478
|
\r
|
|
6479
|
-
`),w.destroy();return}};o.on("upgrade",C),s?.on("upgrade",C),Xbt({ws:h,sys:t,credentials:e,fusionConfig:n,devServer:u,sharedState:l}),l.state="ready";try{let{getTunnelManager:Q,VSCodeTunnelManager:w}=await Promise.resolve().then(()=>(xm(),HE));if(w.isEnabled()&&w.isAutoStartEnabled()){let D=w.getTunnelName(n.projectId,n.branchName),x=w.getWorkspacePath();Ue.info(`\u{1F517} Starting VS Code tunnel: ${D}`);let v=Q();v.on("error",S=>{Ue.error(`\u274C VS Code tunnel error: ${S}`),t.Sentry?.captureException(new Error(String(S)),{tags:{operation:"vscode-tunnel-error-event"}})}),v.start({name:D,workspacePath:x,acceptLicense:!0,autoRestart:!0}).then(S=>{S.status==="running"&&S.webUrl&&(Ue.info(`\u2705 VS Code tunnel ready: ${S.webUrl}`),S.vscodeUri&&Ue.info(` VS Code: ${S.vscodeUri}`),S.cursorUri&&Ue.info(` Cursor: ${S.cursorUri}`))}).catch(S=>{Ue.error(`\u274C VS Code tunnel failed: ${S.message}`),t.Sentry?.captureException(S,{tags:{operation:"vscode-tunnel-auto-start"}})})}}catch(Q){t.Sentry?.captureException(Q,{tags:{operation:"vscode-tunnel-init"}})}let I=r.app||r.nativeApp?"builder://":r.dev?"http://localhost:1234":"https://builder.io",B=new URL(`${I}/app/projects/local`);B.searchParams.set("localEditUrl",a);let E=await t.getDeviceId();if(E&&B.searchParams.set("host",E),e.builderPublicKey&&B.searchParams.set("spaceId",e.builderPublicKey),r.chat&&B.searchParams.set("chatOnly","true"),r.jsonOutput){let Q={type:"server_ready",data:{proxyUrl:a,httpsProxyUrl:A,customHttpsProxyUrl:c,fusionEditorUrl:n.nativeApp?null:B.href,urlHost:I,command:n.devCommand,serverUrl:n.serverUrl,credentials:e,nativeApp:n.nativeApp}};console.log(JSON.stringify(Q))}r.open===!1?n.isLocal&&Ue.info(`\u{1F517} Access Builder.io at: ${B.href}`):(Ue.info(`OPEN BROWSER: ${B.href}`),await hg(B.href)),setTimeout(()=>{l.editorReady=!0},100)}catch(p){l.state="init-error",l.isFinalState=!0,l.errorMessage=p instanceof Error?p.message:String(p),t.Sentry?.captureException(p,{level:"fatal"})}}var Zbt=["stopEventLoop","abort","abortToolCall","abortSetupCommand","abortValidateCommand","setPrivacyMode","clearSession","loadHistory","loadMoreTurns","getAllFiles","searchFiles","searchFileTree","sendFeedback","setCustomInstructions","setProxyOrigin","sendMessage","queueSystemReminder","clearMessageQueue","flushMessageQueue","updateMessage","configureDevOrchestrator","restoreFromCompletionId","restoreBeforeCompletionId","undoLastUserMessage","pushChanges","abortMerge","setDefaultAutoPush","syncChangesFromRemote","pushRepoV2","readFile","readFileWithChecksum","readBinaryFile","writeFile","deleteFile","fileExists","listDir","manualCommit","uploadBackup","getDiff","getSingleFileDiff","toolFullfilment","createTerminal","writeTerminal","switchSessionMode","switchModelOverride","updateTerminal","signalTerminal","disposeTerminal","restartTerminal","collectRepoMetrics","launchEditor","discardFileChanges","revertDiscard","listCustomInstructions","tsServerInit","tsServerOpenFile","tsServerChangeFile","tsServerCloseFile","tsServerGetCompletions","tsServerGetCompletionDetails","tsServerGetDefinition","tsServerGetTypeDefinition","tsServerGetQuickInfo","tsServerGetReferences","tsServerGetSignatureHelp","tsServerRequestDiagnostics","tsServerGetRenameLocations","tsServerGetNavTree","tsServerOrganizeImports","tsServerGetInlayHints","tsServerGetCodeFixes","tsServerGetApplicableRefactors","tsServerGetEditsForRefactor","tsServerGetImplementation","tsServerGetSelectionRange","tsServerGetLinkedEditingRange","tsServerGetFormatRange"];function Xbt({ws:t,sys:e,fusionConfig:r,credentials:n,devServer:i,sharedState:o}){let s=!1;t.register("initializeSession",async u=>{let l,d,g,p;if(typeof u[0]=="object"&&u[0]?{sessionId:l,customInstructions:d,privacyMode:g,forceSessionReload:p}=u[0]:typeof u[0]=="string"&&(l=u[0]),p&&r.isLocal&&l&&Yu&&Yu.getSessionId()!==l){JR?.abort(),s=!1;let h=Yu;Da=void 0,Yu=void 0,h.close(!1)}else if(p&&r.isLocal&&l&&!Yu&&Da){JR?.abort(),s=!1;let h=Da;Da=void 0,h.then(C=>C.close(!1)).catch(()=>{})}let f=await dD(e,n,r,i,l,o,d,g||r.privacyMode);return s||(s=!0,pc(n,"/events/publish",{event:wue,extraData:{sessionId:f.getSessionId(),sessionType:r.branchType??"interactive",projectId:r.projectId,branchName:r.branchName,platform:process.platform}})),f.getSessionId()}),t.register("connectToEventLoop",async(u,l)=>{let d=await Qa();if(!d)throw new Error("Server not found");let g=t.clients().get(l);if(!g)throw new Error("Client not found");let p=d.getSessionId(),f=d.connectToEventLoop(!0,h=>{t.notify(`${p}/event`,l,[JSON.stringify(h)])},{canHandleTools:["AskUserQuestion","GetScreenshot","ExitPlanMode","NavigatePreview","ProposeEnvVariable"]});g.on("close",f)}),t.register("setFeatureFlags",async u=>{uq(u[0])});function a(u){t.register(u,async([l,...d])=>{let g=aA();!r.isLocal&&process.env.DEBUG&&Ue.debug(`[WS](${u}-${g}): ${JSON.stringify(d)}`);let p=performance.now();try{let f=await Qa();if(!f)throw new Error("Server not found");let h=f[u];if(typeof h!="function")throw new Error(`Method ${u} not found on codeGenServer`);let C=await h.apply(f,d);if(!r.isLocal){let I=Math.round(performance.now()-p);Ue.info(`[WS](${u}-${g}): success [${I}ms]`)}return C}catch(f){if(!r.isLocal){let h=Math.round(performance.now()-p);Ue.warn(`[WS](${u}-${g}): error [${h}ms]`)}throw f instanceof zt||e.Sentry?.captureException(f,{tags:{functionName:u},extra:{args:d}}),f}})}Zbt.forEach(u=>{a(u)});let A=new Map;t.register("subscribeToDiagnostics",async(u,l)=>{let[d]=u,g=await Qa();if(!g)throw new Error("Server not found");let p=t.clients().get(l);if(!p)throw new Error("Client not found");let f=A.get(l);f&&(f(),A.delete(l));let h=g.subscribeToDiagnostics(C=>t.notify(`${d}/tsserver-event`,l,C));return A.set(l,h),p.once("close",()=>{h(),A.delete(l)}),{ok:!0}}),t.register("unsubscribeFromDiagnostics",async(u,l)=>{let d=A.get(l);return d&&(d(),A.delete(l)),{ok:!0}}),t.register("ping",()=>(o.lastRequestTime=performance.now(),{version:xt,supports:["customInstructions","newChat","clearSession","appCustomInstructions","fileWatcher","discardChanges","searchFileTree","listDir","listCustomInstructions","tsserver"]})),t.register("getProcessInfo",()=>r.isLocal?{pid:process.pid,cwd:process.cwd(),localMode:!0}:{error:"Process info only available in local mode"}),t.register("getBuilderRules",async()=>{let u=await Qa();if(!u){let l=e.resolve(e.getAppRootDir(),".builderrules");return await e.exists(l)?await e.readFile(l):null}try{return await u.readFile(".builderrules",!0)}catch{return null}}),t.register("setBuilderRules",async u=>{let l=await Qa(),d=u[1];if(!l){let g=e.resolve(e.getAppRootDir(),".builderrules");d?await e.writeFile(g,d):await e.exists(g)&&await e.unlink(g);return}d?await l.writeFile(".builderrules",d,!0):await l.deleteFile(".builderrules",!0)}),t.register("subscribeTerminal",async(u,l)=>{let[d,{terminalId:g}]=u,p=t.clients().get(l);if(!p)throw new Error("Client not found");let f=await Qa();if(!f)throw new Error("Server not found");let h=f.subscribeTerminal({terminalId:g,onData:C=>t.notify(`${d}/terminal/${g}`,l,[C]),onExit:C=>t.notify(`${d}/terminal/${g}/exit`,l,[C])});return h&&p.on("close",h),{ok:!0,created:!!h}});let c=new Map;t.register("subscribeToFileChanges",async(u,l)=>{let[d]=u,g=await Qa();if(!g)throw new Error("Server not found");let p=t.clients().get(l);if(!p)throw new Error("Client not found");let f=c.get(l);f&&(await f(),c.delete(l));let h=g.subscribeToFileChanges(C=>t.notify(`${d}/file-changes`,l,C));return c.set(l,h),p.once("close",async()=>{await h(),c.delete(l)}),{ok:!0}}),t.register("unsubscribeFromFileChanges",async(u,l)=>{let d=c.get(l);return d&&(await d(),c.delete(l)),{ok:!0}})}async function evt(t,e,r,n,i,o,s,a,A){let c=[],l=!A?.enabled&&r.projectId&&r.branchName&&process.env.FUSION_ENVIRONMENT?.startsWith("cloud")&&(typeof r.browserAutomationInstructions=="string"||lq("fusion-direct-browser")),d=r.branchType==="code-review",g=lq("fusion-enable-browser-agents-main-branch");l&&(d||g)&&(c.push(XRe),c.push(tNe)),d&&(c.push(gq),c.push(pq)),r.branchType==="setup-project"&&c.push(oNe),r.branchType==="org-agent"&&(c.push(aNe),c.push(cNe)),r.branchType||(c.push(nNe),r.customAgents&&c.push(...r.customAgents));let p=new AA({sys:t,credentials:e,position:"fusion",sessionOrCompletionId:r.sessionId??i,mode:"quality-v4",maxTokens:8e4,mcpServers:!0,autoImportLocalMCPs:!0,fusionConfig:r,privacyMode:A,builtInMCPServerConfig:r.mcpServers,builtInCustomInstructions:[...a??[],...r.customInstructions??[]],builtInCustomAgents:c,agentType:r.agentType,devServerOrchestrator:n,git:!!r.projectId,fusionStatusMonitor:Rg??void 0,gitAutoInit:!0,persistSessionLocally:r.isLocal});r.projectId&&p.setDebug(!0);try{if(r.isLocal){let f=await fwe();if(f)throw Bn(f),f}await p.initializeSession()}catch(f){throw s.aborted||(o.state="session-error",o.errorMessage=f instanceof Error?f.message:String(f)),f}if(s.aborted||(o.state="active-session",o.isFinalState=!0,o.sessionId=p.getSessionId()),!s.aborted&&r.branchType==="org-agent"){let f=t.join(p.primaryGitPath,"cron-jobs.json"),h=e.builderPrivateKey??e.builderPublicKey,C=e.builderPublicKey;h&&C&&r.projectId&&r.branchName&&(HR=lNe({cronFilePath:f,apiHost:Me,projectId:r.projectId,branchName:r.branchName,ownerId:C,privateKey:h}));let I=e.builderPrivateKey??e.builderPublicKey,B=e.builderPublicKey;if(I&&B){let E=p.bashWorkingDirectory,y=120*1e3;ZQe(async()=>{try{await KR({sys:t,ownerId:B,privateKey:I,outputDir:E})}catch(Q){Ue.error(`Org tree sync failed: ${Q instanceof Error?Q.message:String(Q)}`)}}),$h(),$R=setInterval($h,y)}}return p}function Qa(){return Da||Promise.resolve(void 0)}function dD(t,e,r,n,i,o,s,a){if(!Da){JR=new AbortController;let A=evt(t,e,r,n,i,o,JR.signal,s,a);Da=A,A.then(c=>{Da===A&&(Yu=c)}).catch(()=>{})}return Da}function tvt(t,e,r){if(e.isLocal)return()=>{};let o=24*(3600*1e3),s=Date.now(),a=setInterval(()=>{let A=Date.now()-s,c=Math.floor(A/o);c>1&&t.Sentry?.captureException(new Error(`Rogue devtools detected: ${c} days`),{extra:{timeSinceStart:A},contexts:{flyIo:r,fusionConfig:{...e}}})},o*2);return()=>clearInterval(a)}function dNe(t){return t==="https:"||t==="wss:"}function rvt(t){return t.startsWith("ws://")?t.replace("ws://","http://"):t.startsWith("wss://")?t.replace("wss://","https://"):t}var nvt=t=>(e,r,n)=>{t.httpClients++;let i=!0,o=()=>{i&&(i=!1,t.httpClients--)};r.once("finish",o),r.once("close",o),n()};var Gg=W(Gr(),1);vn();un();m();var Ud=W(require("@sentry/node"),1);Gt();var pA=W(Gr(),1);Cr();un();Zr();var nN=W(require("node:crypto"),1);Jr();vn();Js();Js();var Mq=W(XNe(),1);m();m();m();m();function vq({onlyFirst:t=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,t?void 0:"g")}var kvt=vq();function mD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return!t.includes("\x1B")&&!t.includes("\x9B")?t:t.replace(kvt,"")}m();m();m();var qR=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],VR=[12288,12288,65281,65376,65504,65510],Sq=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],xq=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],hD=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];m();var zR=(t,e)=>{let r=0,n=Math.floor(t.length/2)-1;for(;r<=n;){let i=Math.floor((r+n)/2),o=i*2;if(e<t[o])n=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1};var Rvt=qR[0],Nvt=qR.at(-1),Tvt=VR[0],Mvt=VR.at(-1),Yvr=Sq[0],qvr=Sq.at(-1),Vvr=xq[0],zvr=xq.at(-1),Pvt=hD[0],_vt=hD.at(-1),eTe=19968,[Lvt,Uvt]=Ovt(hD);function Ovt(t){let e=t[0],r=t[1];for(let n=0;n<t.length;n+=2){let i=t[n],o=t[n+1];if(eTe>=i&&eTe<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}var tTe=t=>t<Rvt||t>Nvt?!1:zR(qR,t),rTe=t=>t<Tvt||t>Mvt?!1:zR(VR,t);var nTe=t=>t>=Lvt&&t<=Uvt?!0:t<Pvt||t>_vt?!1:zR(hD,t);function Gvt(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function iTe(t,{ambiguousAsWide:e=!1}={}){return Gvt(t),rTe(t)||nTe(t)||e&&tTe(t)?2:1}var aTe=W(sTe(),1),Kvt=new Intl.Segmenter,Hvt=/^\p{Default_Ignorable_Code_Point}$/u;function _d(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=mD(t)),t.length===0)return 0;let i=0,o={ambiguousAsWide:!r};for(let{segment:s}of Kvt.segment(t)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!Hvt.test(s)){if((0,aTe.default)().test(s)){i+=2;continue}i+=iTe(a,o)}}return i}m();var ATe=(t=0)=>e=>`\x1B[${e+t}m`,cTe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,uTe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,fn={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},cSr=Object.keys(fn.modifier),$vt=Object.keys(fn.color),Jvt=Object.keys(fn.bgColor),uSr=[...$vt,...Jvt];function jvt(){let t=new Map;for(let[e,r]of Object.entries(fn)){for(let[n,i]of Object.entries(r))fn[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=fn[n],t.set(i[0],i[1]);Object.defineProperty(fn,e,{value:r,enumerable:!1})}return Object.defineProperty(fn,"codes",{value:t,enumerable:!1}),fn.color.close="\x1B[39m",fn.bgColor.close="\x1B[49m",fn.color.ansi=ATe(),fn.color.ansi256=cTe(),fn.color.ansi16m=uTe(),fn.bgColor.ansi=ATe(10),fn.bgColor.ansi256=cTe(10),fn.bgColor.ansi16m=uTe(10),Object.defineProperties(fn,{rgbToAnsi256:{value(e,r,n){return 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(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>fn.rgbToAnsi256(...fn.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 o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>fn.ansi256ToAnsi(fn.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>fn.ansi256ToAnsi(fn.hexToAnsi256(e)),enumerable:!1}}),fn}var Yvt=jvt(),lTe=Yvt;var ZR=new Set(["\x1B","\x9B"]),qvt=39,kq="\x07",dTe="[",Vvt="]",fTe="m",WR=`${Vvt}8;;`,gTe=t=>`${ZR.values().next().value}${dTe}${t}${fTe}`,pTe=t=>`${ZR.values().next().value}${WR}${t}${kq}`,zvt=t=>t.split(" ").map(e=>_d(e)),Fq=(t,e,r)=>{let n=[...e],i=!1,o=!1,s=_d(mD(t.at(-1)));for(let[a,A]of n.entries()){let c=_d(A);if(s+c<=r?t[t.length-1]+=A:(t.push(A),s=0),ZR.has(A)&&(i=!0,o=n.slice(a+1,a+1+WR.length).join("")===WR),i){o?A===kq&&(i=!1,o=!1):A===fTe&&(i=!1);continue}s+=c,s===r&&a<n.length-1&&(t.push(""),s=0)}!s&&t.at(-1).length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Wvt=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(_d(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Zvt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,o,s=zvt(t),a=[""];for(let[l,d]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a.at(-1).trimStart());let g=_d(a.at(-1));if(l!==0&&(g>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),g=0),(g>0||r.trim===!1)&&(a[a.length-1]+=" ",g++)),r.hard&&s[l]>e){let p=e-g,f=1+Math.floor((s[l]-p-1)/e);Math.floor((s[l]-1)/e)<f&&a.push(""),Fq(a,d,e);continue}if(g+s[l]>e&&g>0&&s[l]>0){if(r.wordWrap===!1&&g<e){Fq(a,d,e);continue}a.push("")}if(g+s[l]>e&&r.wordWrap===!1){Fq(a,d,e);continue}a[a.length-1]+=d}r.trim!==!1&&(a=a.map(l=>Wvt(l)));let A=a.join(`
|
|
6479
|
+
`),w.destroy();return}};o.on("upgrade",C),s?.on("upgrade",C),Xbt({ws:h,sys:t,credentials:e,fusionConfig:n,devServer:u,sharedState:l}),l.state="ready";try{let{getTunnelManager:Q,VSCodeTunnelManager:w}=await Promise.resolve().then(()=>(xm(),HE));if(w.isEnabled()&&w.isAutoStartEnabled()){let D=w.getTunnelName(n.projectId,n.branchName),x=w.getWorkspacePath();Ue.info(`\u{1F517} Starting VS Code tunnel: ${D}`);let v=Q();v.on("error",S=>{Ue.error(`\u274C VS Code tunnel error: ${S}`),t.Sentry?.captureException(new Error(String(S)),{tags:{operation:"vscode-tunnel-error-event"}})}),v.start({name:D,workspacePath:x,acceptLicense:!0,autoRestart:!0}).then(S=>{S.status==="running"&&S.webUrl&&(Ue.info(`\u2705 VS Code tunnel ready: ${S.webUrl}`),S.vscodeUri&&Ue.info(` VS Code: ${S.vscodeUri}`),S.cursorUri&&Ue.info(` Cursor: ${S.cursorUri}`))}).catch(S=>{Ue.error(`\u274C VS Code tunnel failed: ${S.message}`),t.Sentry?.captureException(S,{tags:{operation:"vscode-tunnel-auto-start"}})})}}catch(Q){t.Sentry?.captureException(Q,{tags:{operation:"vscode-tunnel-init"}})}let I=r.app||r.nativeApp?"builder://":r.dev?"http://localhost:1234":"https://builder.io",B=new URL(`${I}/app/projects/local`);B.searchParams.set("localEditUrl",a);let E=await t.getDeviceId();if(E&&B.searchParams.set("host",E),e.builderPublicKey&&B.searchParams.set("spaceId",e.builderPublicKey),r.chat&&B.searchParams.set("chatOnly","true"),r.jsonOutput){let Q={type:"server_ready",data:{proxyUrl:a,httpsProxyUrl:A,customHttpsProxyUrl:c,fusionEditorUrl:n.nativeApp?null:B.href,urlHost:I,command:n.devCommand,serverUrl:n.serverUrl,credentials:e,nativeApp:n.nativeApp}};console.log(JSON.stringify(Q))}r.open===!1?n.isLocal&&Ue.info(`\u{1F517} Access Builder.io at: ${B.href}`):(Ue.info(`OPEN BROWSER: ${B.href}`),await hg(B.href)),setTimeout(()=>{l.editorReady=!0},100)}catch(p){l.state="init-error",l.isFinalState=!0,l.errorMessage=p instanceof Error?p.message:String(p),t.Sentry?.captureException(p,{level:"fatal"})}}var Zbt=["stopEventLoop","abort","abortToolCall","abortSetupCommand","abortValidateCommand","setPrivacyMode","clearSession","loadHistory","loadMoreTurns","getAllFiles","searchFiles","searchFileTree","sendFeedback","setCustomInstructions","setProxyOrigin","sendMessage","queueSystemReminder","clearMessageQueue","flushMessageQueue","updateMessage","configureDevOrchestrator","restoreFromCompletionId","restoreBeforeCompletionId","undoLastUserMessage","pushChanges","abortMerge","setDefaultAutoPush","syncChangesFromRemote","pushRepoV2","readFile","readFileWithChecksum","readBinaryFile","writeFile","deleteFile","fileExists","listDir","manualCommit","uploadBackup","getDiff","getSingleFileDiff","toolFullfilment","createTerminal","writeTerminal","switchSessionMode","switchModelOverride","updateTerminal","signalTerminal","disposeTerminal","restartTerminal","collectRepoMetrics","launchEditor","discardFileChanges","revertDiscard","listCustomInstructions","tsServerInit","tsServerOpenFile","tsServerChangeFile","tsServerCloseFile","tsServerGetCompletions","tsServerGetCompletionDetails","tsServerGetDefinition","tsServerGetTypeDefinition","tsServerGetQuickInfo","tsServerGetReferences","tsServerGetSignatureHelp","tsServerRequestDiagnostics","tsServerGetRenameLocations","tsServerGetNavTree","tsServerOrganizeImports","tsServerGetInlayHints","tsServerGetCodeFixes","tsServerGetApplicableRefactors","tsServerGetEditsForRefactor","tsServerGetImplementation","tsServerGetSelectionRange","tsServerGetLinkedEditingRange","tsServerGetFormatRange"];function Xbt({ws:t,sys:e,fusionConfig:r,credentials:n,devServer:i,sharedState:o}){let s=!1;t.register("initializeSession",async u=>{let l,d,g,p;if(typeof u[0]=="object"&&u[0]?{sessionId:l,customInstructions:d,privacyMode:g,forceSessionReload:p}=u[0]:typeof u[0]=="string"&&(l=u[0]),p&&r.isLocal&&l&&Yu&&Yu.getSessionId()!==l){JR?.abort(),s=!1;let h=Yu;Da=void 0,Yu=void 0,h.close(!1)}else if(p&&r.isLocal&&l&&!Yu&&Da){JR?.abort(),s=!1;let h=Da;Da=void 0,h.then(C=>C.close(!1)).catch(()=>{})}let f=await dD(e,n,r,i,l,o,d,g||r.privacyMode);return s||(s=!0,pc(n,"/events/publish",{event:wue,extraData:{sessionId:f.getSessionId(),sessionType:r.branchType??"interactive",projectId:r.projectId,branchName:r.branchName,platform:process.platform}})),f.getSessionId()}),t.register("connectToEventLoop",async(u,l)=>{let d=await Qa();if(!d)throw new Error("Server not found");let g=t.clients().get(l);if(!g)throw new Error("Client not found");let p=d.getSessionId(),f=d.connectToEventLoop(!0,h=>{t.notify(`${p}/event`,l,[JSON.stringify(h)])},{canHandleTools:["AskUserQuestion","GetScreenshot","ExitPlanMode","NavigatePreview","ProposeEnvVariable"]});g.on("close",f)}),t.register("setFeatureFlags",async u=>{uq(u[0])});function a(u){t.register(u,async([l,...d])=>{let g=aA();!r.isLocal&&process.env.DEBUG&&Ue.debug(`[WS](${u}-${g}): ${JSON.stringify(d)}`);let p=performance.now();try{let f=await Qa();if(!f)throw new Error("Server not found");let h=f[u];if(typeof h!="function")throw new Error(`Method ${u} not found on codeGenServer`);let C=await h.apply(f,d);if(!r.isLocal){let I=Math.round(performance.now()-p);Ue.info(`[WS](${u}-${g}): success [${I}ms]`)}return C}catch(f){if(!r.isLocal){let h=Math.round(performance.now()-p);Ue.warn(`[WS](${u}-${g}): error [${h}ms]`)}throw f instanceof zt||e.Sentry?.captureException(f,{tags:{functionName:u},extra:{args:d}}),f}})}Zbt.forEach(u=>{a(u)});let A=new Map;t.register("subscribeToDiagnostics",async(u,l)=>{let[d]=u,g=await Qa();if(!g)throw new Error("Server not found");let p=t.clients().get(l);if(!p)throw new Error("Client not found");let f=A.get(l);f&&(f(),A.delete(l));let h=g.subscribeToDiagnostics(C=>t.notify(`${d}/tsserver-event`,l,C));return A.set(l,h),p.once("close",()=>{h(),A.delete(l)}),{ok:!0}}),t.register("unsubscribeFromDiagnostics",async(u,l)=>{let d=A.get(l);return d&&(d(),A.delete(l)),{ok:!0}}),t.register("ping",()=>(o.lastRequestTime=performance.now(),{version:xt,supports:["customInstructions","newChat","clearSession","appCustomInstructions","fileWatcher","discardChanges","searchFileTree","listDir","listCustomInstructions","tsserver"]})),t.register("getProcessInfo",()=>r.isLocal?{pid:process.pid,cwd:process.cwd(),localMode:!0}:{error:"Process info only available in local mode"}),t.register("getBuilderRules",async()=>{let u=await Qa();if(!u){let l=e.resolve(e.getAppRootDir(),".builderrules");return await e.exists(l)?await e.readFile(l):null}try{return await u.readFile(".builderrules",!0)}catch{return null}}),t.register("setBuilderRules",async u=>{let l=await Qa(),d=u[1];if(!l){let g=e.resolve(e.getAppRootDir(),".builderrules");d?await e.writeFile(g,d):await e.exists(g)&&await e.unlink(g);return}d?await l.writeFile(".builderrules",d,!0):await l.deleteFile(".builderrules",!0)}),t.register("subscribeTerminal",async(u,l)=>{let[d,{terminalId:g}]=u,p=t.clients().get(l);if(!p)throw new Error("Client not found");let f=await Qa();if(!f)throw new Error("Server not found");let h=f.subscribeTerminal({terminalId:g,onData:C=>t.notify(`${d}/terminal/${g}`,l,[C]),onExit:C=>t.notify(`${d}/terminal/${g}/exit`,l,[C])});return h&&p.on("close",h),{ok:!0,created:!!h}});let c=new Map;t.register("subscribeToFileChanges",async(u,l)=>{let[d]=u,g=await Qa();if(!g)throw new Error("Server not found");let p=t.clients().get(l);if(!p)throw new Error("Client not found");let f=c.get(l);f&&(await f(),c.delete(l));let h=g.subscribeToFileChanges(C=>t.notify(`${d}/file-changes`,l,C));return c.set(l,h),p.once("close",async()=>{await h(),c.delete(l)}),{ok:!0}}),t.register("unsubscribeFromFileChanges",async(u,l)=>{let d=c.get(l);return d&&(await d(),c.delete(l)),{ok:!0}})}async function evt(t,e,r,n,i,o,s,a,A){let c=[],l=!A?.enabled&&r.projectId&&r.branchName&&process.env.FUSION_ENVIRONMENT?.startsWith("cloud")&&(typeof r.browserAutomationInstructions=="string"||lq("fusion-direct-browser")),d=r.branchType==="code-review",g=lq("fusion-enable-browser-agents-main-branch");l&&(d||g)&&(c.push(XRe),c.push(tNe)),d&&(c.push(gq),c.push(pq)),r.branchType==="setup-project"&&c.push(oNe),r.branchType==="org-agent"&&(c.push(aNe),c.push(cNe)),r.branchType||(c.push(nNe),r.customAgents&&c.push(...r.customAgents));let p=new AA({sys:t,credentials:e,position:"fusion",sessionOrCompletionId:r.sessionId??i,mode:"quality-v4",maxTokens:8e4,mcpServers:!0,autoImportLocalMCPs:!0,fusionConfig:r,privacyMode:A,builtInMCPServerConfig:r.mcpServers,builtInCustomInstructions:[...a??[],...r.customInstructions??[]],builtInCustomAgents:c,agentType:r.agentType,devServerOrchestrator:n,git:!!r.projectId,fusionStatusMonitor:Rg??void 0,gitAutoInit:!0,persistSessionLocally:r.isLocal});r.projectId&&p.setDebug(!0);try{if(r.isLocal){let f=await fwe();if(f)throw Bn(f),f}await p.initializeSession()}catch(f){throw s.aborted||(o.state="session-error",o.errorMessage=f instanceof Error?f.message:String(f)),f}if(s.aborted||(o.state="active-session",o.isFinalState=!0,o.sessionId=p.getSessionId()),!s.aborted&&r.branchType==="org-agent"){let f=t.join(p.primaryGitPath,"cron-jobs.json"),h=e.builderPrivateKey??e.builderPublicKey,C=e.builderPublicKey;h&&C&&r.projectId&&r.branchName&&(HR=lNe({cronFilePath:f,apiHost:Pe,projectId:r.projectId,branchName:r.branchName,ownerId:C,privateKey:h}));let I=e.builderPrivateKey??e.builderPublicKey,B=e.builderPublicKey;if(I&&B){let E=p.bashWorkingDirectory,y=120*1e3;ZQe(async()=>{try{await KR({sys:t,ownerId:B,privateKey:I,outputDir:E})}catch(Q){Ue.error(`Org tree sync failed: ${Q instanceof Error?Q.message:String(Q)}`)}}),$h(),$R=setInterval($h,y)}}return p}function Qa(){return Da||Promise.resolve(void 0)}function dD(t,e,r,n,i,o,s,a){if(!Da){JR=new AbortController;let A=evt(t,e,r,n,i,o,JR.signal,s,a);Da=A,A.then(c=>{Da===A&&(Yu=c)}).catch(()=>{})}return Da}function tvt(t,e,r){if(e.isLocal)return()=>{};let o=24*(3600*1e3),s=Date.now(),a=setInterval(()=>{let A=Date.now()-s,c=Math.floor(A/o);c>1&&t.Sentry?.captureException(new Error(`Rogue devtools detected: ${c} days`),{extra:{timeSinceStart:A},contexts:{flyIo:r,fusionConfig:{...e}}})},o*2);return()=>clearInterval(a)}function dNe(t){return t==="https:"||t==="wss:"}function rvt(t){return t.startsWith("ws://")?t.replace("ws://","http://"):t.startsWith("wss://")?t.replace("wss://","https://"):t}var nvt=t=>(e,r,n)=>{t.httpClients++;let i=!0,o=()=>{i&&(i=!1,t.httpClients--)};r.once("finish",o),r.once("close",o),n()};var Gg=W(Gr(),1);vn();un();m();var Ud=W(require("@sentry/node"),1);Gt();var pA=W(Gr(),1);Cr();un();Zr();var nN=W(require("node:crypto"),1);Jr();vn();Js();Js();var Mq=W(XNe(),1);m();m();m();m();function vq({onlyFirst:t=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,t?void 0:"g")}var kvt=vq();function mD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return!t.includes("\x1B")&&!t.includes("\x9B")?t:t.replace(kvt,"")}m();m();m();var qR=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],VR=[12288,12288,65281,65376,65504,65510],Sq=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],xq=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],hD=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];m();var zR=(t,e)=>{let r=0,n=Math.floor(t.length/2)-1;for(;r<=n;){let i=Math.floor((r+n)/2),o=i*2;if(e<t[o])n=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1};var Rvt=qR[0],Nvt=qR.at(-1),Tvt=VR[0],Mvt=VR.at(-1),Yvr=Sq[0],qvr=Sq.at(-1),Vvr=xq[0],zvr=xq.at(-1),Pvt=hD[0],_vt=hD.at(-1),eTe=19968,[Lvt,Uvt]=Ovt(hD);function Ovt(t){let e=t[0],r=t[1];for(let n=0;n<t.length;n+=2){let i=t[n],o=t[n+1];if(eTe>=i&&eTe<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}var tTe=t=>t<Rvt||t>Nvt?!1:zR(qR,t),rTe=t=>t<Tvt||t>Mvt?!1:zR(VR,t);var nTe=t=>t>=Lvt&&t<=Uvt?!0:t<Pvt||t>_vt?!1:zR(hD,t);function Gvt(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function iTe(t,{ambiguousAsWide:e=!1}={}){return Gvt(t),rTe(t)||nTe(t)||e&&tTe(t)?2:1}var aTe=W(sTe(),1),Kvt=new Intl.Segmenter,Hvt=/^\p{Default_Ignorable_Code_Point}$/u;function _d(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=mD(t)),t.length===0)return 0;let i=0,o={ambiguousAsWide:!r};for(let{segment:s}of Kvt.segment(t)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!Hvt.test(s)){if((0,aTe.default)().test(s)){i+=2;continue}i+=iTe(a,o)}}return i}m();var ATe=(t=0)=>e=>`\x1B[${e+t}m`,cTe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,uTe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,fn={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},cSr=Object.keys(fn.modifier),$vt=Object.keys(fn.color),Jvt=Object.keys(fn.bgColor),uSr=[...$vt,...Jvt];function jvt(){let t=new Map;for(let[e,r]of Object.entries(fn)){for(let[n,i]of Object.entries(r))fn[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=fn[n],t.set(i[0],i[1]);Object.defineProperty(fn,e,{value:r,enumerable:!1})}return Object.defineProperty(fn,"codes",{value:t,enumerable:!1}),fn.color.close="\x1B[39m",fn.bgColor.close="\x1B[49m",fn.color.ansi=ATe(),fn.color.ansi256=cTe(),fn.color.ansi16m=uTe(),fn.bgColor.ansi=ATe(10),fn.bgColor.ansi256=cTe(10),fn.bgColor.ansi16m=uTe(10),Object.defineProperties(fn,{rgbToAnsi256:{value(e,r,n){return 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(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>fn.rgbToAnsi256(...fn.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 o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>fn.ansi256ToAnsi(fn.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>fn.ansi256ToAnsi(fn.hexToAnsi256(e)),enumerable:!1}}),fn}var Yvt=jvt(),lTe=Yvt;var ZR=new Set(["\x1B","\x9B"]),qvt=39,kq="\x07",dTe="[",Vvt="]",fTe="m",WR=`${Vvt}8;;`,gTe=t=>`${ZR.values().next().value}${dTe}${t}${fTe}`,pTe=t=>`${ZR.values().next().value}${WR}${t}${kq}`,zvt=t=>t.split(" ").map(e=>_d(e)),Fq=(t,e,r)=>{let n=[...e],i=!1,o=!1,s=_d(mD(t.at(-1)));for(let[a,A]of n.entries()){let c=_d(A);if(s+c<=r?t[t.length-1]+=A:(t.push(A),s=0),ZR.has(A)&&(i=!0,o=n.slice(a+1,a+1+WR.length).join("")===WR),i){o?A===kq&&(i=!1,o=!1):A===fTe&&(i=!1);continue}s+=c,s===r&&a<n.length-1&&(t.push(""),s=0)}!s&&t.at(-1).length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Wvt=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(_d(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Zvt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,o,s=zvt(t),a=[""];for(let[l,d]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a.at(-1).trimStart());let g=_d(a.at(-1));if(l!==0&&(g>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),g=0),(g>0||r.trim===!1)&&(a[a.length-1]+=" ",g++)),r.hard&&s[l]>e){let p=e-g,f=1+Math.floor((s[l]-p-1)/e);Math.floor((s[l]-1)/e)<f&&a.push(""),Fq(a,d,e);continue}if(g+s[l]>e&&g>0&&s[l]>0){if(r.wordWrap===!1&&g<e){Fq(a,d,e);continue}a.push("")}if(g+s[l]>e&&r.wordWrap===!1){Fq(a,d,e);continue}a[a.length-1]+=d}r.trim!==!1&&(a=a.map(l=>Wvt(l)));let A=a.join(`
|
|
6480
6480
|
`),c=[...A],u=0;for(let[l,d]of c.entries()){if(n+=d,ZR.has(d)){let{groups:p}=new RegExp(`(?:\\${dTe}(?<code>\\d+)m|\\${WR}(?<uri>.*)${kq})`).exec(A.slice(u))||{groups:{}};if(p.code!==void 0){let f=Number.parseFloat(p.code);i=f===qvt?void 0:f}else p.uri!==void 0&&(o=p.uri.length===0?void 0:p.uri)}let g=lTe.codes.get(Number(i));c[l+1]===`
|
|
6481
6481
|
`?(o&&(n+=pTe("")),i&&g&&(n+=gTe(g))):d===`
|
|
6482
6482
|
`&&(i&&g&&(n+=gTe(i)),o&&(n+=pTe(o))),u+=d.length}return n};function CD(t,e,r){return String(t).normalize().replaceAll(`\r
|
|
6483
6483
|
`,`
|
|
6484
6484
|
`).split(`
|
|
6485
6485
|
`).map(n=>Zvt(n,e,r)).join(`
|
|
6486
|
-
`)}dc();m();Zr();Jr();Gt();var Xvt=ke("Auth");async function mTe(t){if(!t.builderPrivateKey||!t.builderPublicKey)throw new Error("Missing authentication credentials");try{let e=new URL(`${
|
|
6486
|
+
`)}dc();m();Zr();Jr();Gt();var Xvt=ke("Auth");async function mTe(t){if(!t.builderPrivateKey||!t.builderPublicKey)throw new Error("Missing authentication credentials");try{let e=new URL(`${Pe}/users/${t.userId}/email`);e.searchParams.set("apiKey",t.builderPublicKey);let r=await Me(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`}});return!r.ok&&r.status===404?null:await r.json()}catch(e){return Xvt.warn("Failed to validate user:",e),null}}m();dc();Gt();m();var hTe=`# Component Repository Analysis and Grouping
|
|
6487
6487
|
|
|
6488
6488
|
## Objective
|
|
6489
6489
|
|
|
@@ -6924,7 +6924,7 @@ This design system provides an icon library. A list of icons available as well a
|
|
|
6924
6924
|
## Design Tokens
|
|
6925
6925
|
|
|
6926
6926
|
This design system provides design tokens. A list of tokens available as well as token usage examples can be found in \`design-system-docs/*-${SQ}\`.
|
|
6927
|
-
`,c=kTe.replaceAll("{{COMPONENTS}}",s).replaceAll("{{ICONS}}",n.hasIcons?a:"").replaceAll("{{TOKENS}}",n.hasDesignTokens?A:"");try{let u={type:"agent",name:qj,description:"Repository agent documentation",content:c,designSystemId:n.designSystemId,rawComponents:o.map(l=>({name:l.name,description:l.description})),rawTokenGroups:n.discoveredTokenGroups};await ts(e,u,i)}catch(u){throw new zt("Failed to store agent docs",{cause:u})}},TTe=async(t,e,r)=>{let n=new Set(e.map(o=>o.name)),i=r.filter(o=>!n.has(o.name));i.length>0&&await ASt(t,i.map(o=>o.id))},ASt=async(t,e)=>{let r=new URL("/mappings/deprecate-component-docs",
|
|
6927
|
+
`,c=kTe.replaceAll("{{COMPONENTS}}",s).replaceAll("{{ICONS}}",n.hasIcons?a:"").replaceAll("{{TOKENS}}",n.hasDesignTokens?A:"");try{let u={type:"agent",name:qj,description:"Repository agent documentation",content:c,designSystemId:n.designSystemId,rawComponents:o.map(l=>({name:l.name,description:l.description})),rawTokenGroups:n.discoveredTokenGroups};await ts(e,u,i)}catch(u){throw new zt("Failed to store agent docs",{cause:u})}},TTe=async(t,e,r)=>{let n=new Set(e.map(o=>o.name)),i=r.filter(o=>!n.has(o.name));i.length>0&&await ASt(t,i.map(o=>o.id))},ASt=async(t,e)=>{let r=new URL("/mappings/deprecate-component-docs",Pe);r.searchParams.set("apiKey",t.builderPublicKey),r.searchParams.set("userId",t.userId);let n=await Me(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e)});if(!n.ok){let i=await n.text();throw aSt.error("API request failed:",n.status,i),new Error(`Failed to mark component as deprecated: ${n.status} ${i}`)}};dc();var KTe=require("node:path");Vi();gs();m();var PTe=require("node:child_process"),_Te=require("util"),LTe=require("node:path"),MTe=(0,_Te.promisify)(PTe.exec);async function xC(t){let e=t.cwd(),r;try{let{stdout:a}=await MTe("git rev-parse --show-toplevel",{cwd:e});r=a.trim()}catch{return}let n=(0,LTe.relative)(r,e),i=n?`./${n}`:"./",o;try{let{stdout:a}=await MTe("git remote get-url origin",{cwd:e});o=a.trim()}catch{return}let s=cSt(o);return{gitRoot:r,recommendedRoot:i==="./"?void 0:i,originUrl:o,...s}}function cSt(t){let e=t.startsWith("git@")||t.startsWith("ssh://")?"ssh":"https",r="custom",n="",i="",o="",s=!0,a=t.replace(/^git@/,"").replace(/^https?:\/\//,"").replace(/^ssh:\/\//,"").replace(/\.git$/,"");if(a.includes("github.com")){r="github";let c=a.match(/github\.com[:/]([^/]+)\/(.+)/);c&&(i=c[1],o=c[2].replace(/\.git$/,""),n=`${i}/${o}`)}else if(a.includes("gitlab.com")){r="gitlab";let c=a.match(/gitlab\.com[:/]([^/]+)\/(.+)/);c&&(i=c[1],o=c[2].replace(/\.git$/,""),n=`${i}/${o}`)}else if(a.includes("bitbucket.org")){r="bitbucket";let c=a.match(/bitbucket\.org[:/]([^/]+)\/(.+)/);c&&(i=c[1],o=c[2].replace(/\.git$/,""),n=`${i}/${o}`)}else if(a.includes("dev.azure.com")||a.includes("visualstudio.com")){r="azure";let c=a.match(/dev\.azure\.com[:/]([^/]+)\/([^/]+)\/_git\/(.+)/);c&&(i=c[1],o=c[3].replace(/\.git$/,""),n=`${c[1]}/${c[2]}/${o}`)}else{r="custom";let c=a.split(/[:/]/);c.length>=2&&(i=c[c.length-2],o=c[c.length-1].replace(/\.git$/,""),n=`${i}/${o}`)}let A=o.replace(/[^a-zA-Z0-9-_]/g,"-");return{repoProvider:r,repoProtocol:e,repoFullName:n,repoOwner:i,repoName:o,isPrivate:s,projectName:A}}function UTe(t){let e=[];return e.push(`Repository root: ${t.gitRoot}`),t.recommendedRoot&&t.recommendedRoot!=="./"&&e.push(`Current path: ${t.recommendedRoot} (monorepo detected)`),e.push(`Git origin: ${t.originUrl}`),e.push(`Provider: ${t.repoProvider.charAt(0).toUpperCase()+t.repoProvider.slice(1)}`),e.push(`Repository: ${t.repoFullName}`),e.push(`Status: ${t.isPrivate?"Private":"Public"} repository`),e}xb();vQ();var qu=ke("RepoIndexing"),ID=8,tN="Done \u2713";async function OTe(t,e,r){let n=To();n.start("Creating fusion example project..."),await Wt("fusion example project creation started",{designSystemName:e,userId:t.userId,spaceId:t.builderPublicKey});try{let i=`${e} Example`,o={name:i,repoFullName:mm,repoProvider:"github",repoUrl:`https://github.com/${mm}`,repoPrivate:!1,isExample:!0,settings:{installCommand:"npm install",devServerCommand:"npm run dev",devServerUrl:"http://localhost:8080",designSystems:[e]}},s="main",a={name:s,friendlyName:s,createdBy:t.userId,isDefault:!0,isPublic:!1},A=new URL("/projects",Pe);A.searchParams.set("apiKey",t.builderPublicKey),A.searchParams.set("userId",t.userId);let c=await Me(A,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify({...o,branchData:a})});if(!c.ok){let I=await c.text();throw new Error(`Failed to create project: ${I}`)}let l=(await c.json()).project.id;n.stop(),j.success(`\u2713 Fusion project created: ${i}`),n.start("Spawning background agent to install design system...");let d=`Install the design system "${e}" in this project.
|
|
6928
6928
|
|
|
6929
6929
|
The design system is already attached to this project. Use the installation.md document from the attached design system to follow the installation instructions.
|
|
6930
6930
|
|
|
@@ -6935,7 +6935,7 @@ Steps:
|
|
|
6935
6935
|
4. Configure the design system according to the documentation
|
|
6936
6936
|
5. Verify the installation is complete
|
|
6937
6937
|
|
|
6938
|
-
Make sure to follow all the instructions in the installation.md document carefully.`,g=new URL("/projects/branch",
|
|
6938
|
+
Make sure to follow all the instructions in the installation.md document carefully.`,g=new URL("/projects/branch",Pe);g.searchParams.set("apiKey",t.builderPublicKey);let p=await Me(g,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify({projectId:l,userMessage:{userPrompt:d,maxCompletions:200},actor:"repo-indexing"})});if(!p.ok){let I=await p.text();j.warn(`Failed to spawn background agent: ${I}. Project created but agent not started.`),n.stop(),await Wt("fusion example project agent failed",{designSystemName:e,projectId:l,userId:t.userId,spaceId:t.builderPublicKey,success:!1,error:`Agent spawn failed: ${I}`,projectCreated:!0});return}let f;if(p.body){let I=p.body.getReader(),B=new TextDecoder,E="";try{for(;;){let{done:y,value:Q}=await I.read();if(y)break;E+=B.decode(Q,{stream:!0});let w=E.split(`
|
|
6939
6939
|
`);E=w.pop()||"";for(let D of w)if(D.trim())try{let x=JSON.parse(D.trim());switch(x.type){case"creating-branch":case"setting-up-container":case"sending-initial-message":n.message(x.message),x.branchName&&(f=x.branchName);break;case"branch-created":f=x.branchName,n.message(x.message);break;case"error":j.error(`Error: ${x.error||x.message}`);break;case"ai":x.event&&qu.info(`AI event: ${x.event.type}`,{loggerOptions:{debug:!0}});break;case"ensure-container":x.event&&qu.info(`Container event: ${x.event.type||"update"}`,{loggerOptions:{debug:!0}});break}}catch{qu.warn(`Failed to parse JSONL line: ${D}`,{loggerOptions:{debug:!0}})}}}finally{I.releaseLock()}}n.stop(),j.success("\u2713 Background agent spawned to install design system");let h=f||s,C=`https://builder.io/app/projects/${l}/${h}`;j.info(`Project URL: ${(0,pA.cyan)(C)}`),await Wt("fusion example project creation completed",{designSystemName:e,projectId:l,branchName:h,userId:t.userId,spaceId:t.builderPublicKey,success:!0})}catch(i){n.stop();let o=i instanceof Error?i.message:String(i);j.error(`Failed to create fusion example project: ${o}`),qu.error(i,{loggerOptions:{debug:!0}}),await Wt("fusion example project creation error",{designSystemName:e,userId:t.userId,spaceId:t.builderPublicKey,success:!1,error:o})}}var uSt=t=>t?t.split(",").map(e=>e.trim()).filter(e=>e.length>0):[],lSt=(t,e,r,n=[],i=!1,o,s,a=0,A=[],c=[],u=[])=>{let d=Date.now()-r,g=Math.floor(d/6e4),p=Math.floor(d%6e4/1e3),f=`${g}m ${p}s`,h=c.length-u.length,C=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),I=i||e.length<t.length||a>0||h>0,B=I?"Component Library updated":"Component Library created",E=I?"Updated on":"Created On";if(e.length===0&&t.length>0&&n.length===0&&!i&&a===0&&h===0){j.info(`
|
|
6940
6940
|
\u{1F4CB} This Repository is already fully indexed, if you want to overwrite use --force.`);return}if(j.info(`\u{1F4CB} ${B}
|
|
6941
6941
|
${E}: ${C}
|
|
@@ -6954,14 +6954,14 @@ Learn more at https://www.builder.io/c/docs/component-indexing#generating-code.
|
|
|
6954
6954
|
`)},Pq=async(t,e)=>{let{designSystemPackage:r,skipDetailedGrouping:n,force:i,skipHeader:o,listIndexedRepos:s,components:a,include:A,exclude:c,instructions:u,uploadCustomDocs:l}=e,{designSystemName:d}=e,g=K=>!t.existsSync(K)||!t.statSync(K).isDirectory()?(j.error(`Directory ${K} does not exist. Please provide a valid directory.`),!1):!0,p=Date.now();Ud.getCurrentScope().setTag("operation","repo-indexing"),Ud.getCurrentScope().setTag("designSystemPackage",r||"none"),o||(console.log(),Br((0,pA.bgCyan)((0,pA.bold)((0,pA.white)(" repository indexing ")))+" "+(0,pA.dim)(xt)));let f=await mr(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0}),h=await Cg(t,e),C=await mTe(f);if(s){let K=await qh(f);if(K.length===0){console.log("No indexed repositories found");return}console.log("Indexed repositories:"),K.forEach((M,U)=>{console.log(`${U+1}. ${M.designSystemName}`)});return}if(e.testFusionExample){let K=d;if(!K){let M=await qh(f);if(M.length===0){j.error("No indexed design systems found. Please index a design system first.");return}let U=await Ji({message:"Select a design system to test fusion example project creation:",options:M.map($=>({value:$.designSystemName,label:$.designSystemName}))});if(Xe(U)){qe("Test cancelled");return}K=U}await OTe(f,K,e);return}let I=nN.default.randomUUID().slice(0,8);Ud.getCurrentScope().setTag("sessionId",I);try{let K=await fSt(f,e.debug);K.isAllowed||(j.error(`Error: ${K.reason||"Access denied for repository indexing"}`),process.exit(1))}catch(K){if(K instanceof tt){Bn(K);return}j.error("Error: We were unable to determine if your subscription is an enterprise subscription. Contact support@builder.io for more information."),process.exit(1)}let B={folders:[{path:t.getCwdDir()}]};e.includeDirectories&&e.includeDirectories.split(",").forEach(M=>{let U=M.trim();U.length>0&&(g(U)||process.exit(1),B.folders.push({path:U}))}),e.addDirectory&&(Array.isArray(e.addDirectory)?e.addDirectory:[e.addDirectory]).forEach(M=>{let U=M.trim();U.length>0&&(g(U)||process.exit(1),B.folders.push({path:U}))});let E=await NDe(t,r),y=E.version,Q=E.name,w=await qh(f,{onlyEditAccess:!0}),D,x;try{if(d===void 0){let K=[...w.map(U=>({value:U.id,label:U.designSystemName+" ("+U.scope+")"+(e.debug?` - ${U.id}`:"")}))],M="new";if(K.length>0&&(M=await Ji({message:"Which design system would you like to index? You can bypass this by re-running this command with the --designSystemName flag.",options:[...K,{value:"new",label:"Create a new design system"}]}),Xe(M)))return;if(M==="new"){let U=await zj(f,C);if(!U)return;x=U;let $=await xr({message:"What is your design system name?",initialValue:Q,validate(H){if(H.trim().length===0)return"A design system name is required"}});if(Xe($))return;if(d=$,D=MDe(f,d,x,w),D){if(x==="organization"&&D.spaceId!==f.builderPublicKey){j.warn("A design system with this name already exists within your organization, but you do not have permission to re-index it.");return}if(!e.yes){let H=await Vr({message:`A design system with the name "${d}" already exists in your ${x}. Would you like to proceed with this design system?`});if(Xe(H)||!H)return}}}else{if(D=w.find(U=>U.id===M),x=D.scope,x==="organization"&&(D.spaceId!==f.builderPublicKey||!C?.isAdminInOrganization)){j.warn("A design system with this name already exists within your organization, but you do not have permission to re-index it.");return}d=D.designSystemName}}else if(D=TDe(d,w),D){if(x=D.scope,x==="organization"&&(D.spaceId!==f.builderPublicKey||!C?.isAdminInOrganization)){j.warn("A design system with this name already exists within your organization, but you do not have permission to re-index it.");return}}else{if(!e.yes){let M=await Vr({message:`No indexed design system named "${d}" exists. Would you like to proceed with creating a new design system index?`});if(Xe(M)||!M)return}let K=await zj(f,C,e.scope);if(!K)return;x=K}}catch(K){let M=new zt("Failed to select a design system",{cause:K});Ud.captureException(M,{tags:{operation:"repo-indexing",sessionId:I,designSystemPackage:r||"none"}}),console.log("Sorry, we encountered a problem when selecting a design system to index. Please try again. If the issue persists, contact support@builder.io.");return}let v=To();if(r)if((0,KTe.isAbsolute)(r))g(r)||process.exit(1),B.folders.push({path:r});else{let K=t.join(t.getAppRootDir(),`node_modules/${r}`);await t.exists(K)||(j.error(`Design system package ${r} is not installed. Please install it first.`),process.exit(1))}qu.debug("Workspace config",B);let S=D?.id||"",P=!D&&d;if(P){let K=await xC(t);S=await PDe(f,{designSystemName:d,designSystemVersion:y,designSystemPackage:r,status:"in-progress",scope:x,gitOriginUrl:K?.originUrl,gitRelativePath:K?.recommendedRoot,cliArgs:process.argv.slice(2)})}let Y=null;try{if(l){v.start("Processing custom documentation"),await t.exists(l)||(j.error(`${l} does not exist`),process.exit(1));let{validDocs:K,invalidFiles:M}=await pSt(t,l);if(K.length===0&&(j.error(`No valid files found in ${l}`),process.exit(1)),!P){j.warn("This design system already exists");let Z=await Vr({message:"Are you sure you want to fully replace the existing files?"});(Xe(Z)||!Z)&&(j.info("Aborting..."),process.exit(1))}await Wt("repo indexing started",{sessionId:I,commandString:process.argv.slice(2).join(" "),forceBoolean:e.force||!1,currentDirectory:t.getCwdDir(),designSystemPackage:r||"none",designSystemPackageName:Q||"none",designSystemVersion:y||"none",designSystemId:S||"none",userId:f.userId,spaceId:f.builderPublicKey,source:"custom"}),v.message("Uploading custom documentation files");let U=[],$=[],H=[],O=[],L=[],G=[],ie=0;for(let Z of K)if(Rp(Z.document))U.push({name:Z.document.name,description:Z.document.description,relatedComponents:Z.document.relatedComponents,relevantFiles:Z.document.relevantFiles,hash:Z.document.hash,type:"component"});else if(kl(Z.document)){let Qe={name:Z.document.name,type:"token",relevantFiles:Z.document.relevantFiles,tokens:Z.document.rawTokens||[],hash:Z.document.hash};O.push(Qe)}for(let Z of K)try{if(await dSt(t,f,Z,{designSystemId:S,designSystemPackage:r,designSystemVersion:y,sessionId:`${I}-custom-doc-${Z.document.name}`,debug:e.debug}),Rp(Z.document))$.push({name:Z.document.name,description:Z.document.description,relatedComponents:Z.document.relatedComponents,relevantFiles:Z.document.relevantFiles,hash:Z.document.hash,type:"component"});else if(hm(Z.document))ie++;else if(kl(Z.document)){let Qe={name:Z.document.name,type:"token",relevantFiles:Z.document.relevantFiles,tokens:Z.document.rawTokens||[],hash:Z.document.hash};L.push(Qe)}}catch(Qe){Rp(Z.document)?H.push(Z.document.name):kl(Z.document)?G.push(Z.document.name):H.push(Z.document.name),qu.error(`Failed to process ${Z.document.name}:`,Qe,{loggerOptions:{debug:!0}})}if($.length>0||O.length>0||ie>0){v.message("Creating agent documentation");try{await Tq(t,f,$,{designSystemId:S,debug:e.debug,hasIcons:ie>0,hasDesignTokens:O.length>0,discoveredTokenGroups:O.map(Z=>Z.name)})}catch(Z){j.warn(`Failed to create agent documentation: ${Z instanceof Error?Z.message:String(Z)}`)}}let ge=await GTe(f,S,e.debug),he=$.map(Z=>({name:Z.name,type:"component",description:Z.description,relevantFiles:Z.relevantFiles,relatedComponents:Z.relatedComponents,hash:Z.hash}));K.forEach(Z=>{hm(Z.document)?he.push({name:Z.document.name,type:"icon"}):kl(Z.document)?he.push({name:Z.document.name,type:"token",relevantFiles:Z.document.relevantFiles,tokens:Z.document.rawTokens||[],hash:Z.document.hash}):mv(Z.document)&&he.push({name:Z.document.name,type:"installation",relevantFiles:[],hash:Z.document.hash})}),v.stop("Custom documentation collected"),await Wt("repo indexing completed",{sessionId:I,commandString:process.argv.slice(2).join(" "),forceBoolean:e.force,designSystemPackage:r||"none",designSystemId:S||"none",userId:f.userId,spaceId:f.builderPublicKey,source:"custom"});let Ae=[...M,...H];Y={componentsToCheck:he,storedComponentDocs:ge,source:"custom",summaryData:{indexedComponents:$,discoveredComponents:U,failedComponents:Ae,failedTokens:G,numIconsIndexed:ie,discoveredTokenGroups:O,tokenGroupsToIndex:L}}}else{if(await _De(t)){if(j.warn(CD(`\u26A0\uFE0F Warning: Existing ${Vj} folder found.
|
|
6955
6955
|
|
|
6956
6956
|
For best results, please delete the repo-indexing folder in your project before running this command. Indexed component documentation can be viewed at https://builder.io/app/design-system-intelligence after completion.`,(process.stdout.columns||80)-4)),!e.yes){let Ie=await Vr({message:"Continue with existing files?"});if(typeof Ie=="symbol"||!Ie){j.info("Repository indexing canceled.");return}}v=To()}v.start("Indexing repository");let M={sessionId:I,commandString:process.argv.slice(2).join(" "),forceBoolean:e.force||!1,currentDirectory:t.getCwdDir(),skipDetailedGroupingBoolean:e.skipDetailedGrouping,designSystemPackage:r||"none",designSystemPackageName:Q||"none",designSystemVersion:y||"none",designSystemId:S||"none",workspaceConfig:B,includeDirectories:e.includeDirectories||"none",addDirectory:e.addDirectory,debugBoolean:e.debug||!1,listIndexedReposBoolean:s||!1,userId:f.userId,spaceId:f.builderPublicKey,instructions:u};await Wt("repo indexing started",M),v.message("Looking for components");let U=await GTe(f,S,e.debug),$=U.find(Ie=>hm(Ie)),H=U.filter(Ie=>kl(Ie)),O=U.filter(Ie=>Rp(Ie)),L=uSt(a),G=L.length>0,[ie,ge,he,Ae]=await Promise.all([ETe(t,f,`${I}-component-discovery`,O,{designSystemPackage:r,designSystemVersion:y,workspaceConfig:B,debug:e.debug,force:i,specificComponents:L,include:A,exclude:c,instructions:u,privacyMode:h?.privacyMode}),xTe(t,f,`${I}-installation-discovery`,{designSystemId:S,designSystemPackage:r,designSystemVersion:y,workspaceConfig:B,debug:e.debug,include:A,exclude:c,instructions:u,privacyMode:h?.privacyMode}),!G&&QTe(t,f,`${I}-icon-discovery`,{designSystemPackage:r,workspaceConfig:B,debug:e.debug,include:A,exclude:c,instructions:u,privacyMode:h?.privacyMode})||void 0,!G&&bTe(t,f,`${I}-token-discovery`,H,{designSystemPackage:r,workspaceConfig:B,debug:e.debug,force:i,include:A,exclude:c,instructions:u,privacyMode:h?.privacyMode})]),{numComponentsFound:Z,componentsToIndex:Qe,discoveredComponents:We}=ie,{tokenGroupsToIndex:Ce,discoveredTokenGroups:Oe}=Ae||{tokenGroupsToIndex:[],discoveredTokenGroups:[]};if(L.length>0&&Qe.length===0){j.info("No changes detected for the specified components. Use --force to reindex anyway.");return}let pe=!G&&(i||!$||$.hash!==he?.hash),_e=!G&&Ce.length>0;if(Z===0&&!pe&&!_e&&(j.warn(CD("We were unable to index your repository because no components were found. If your components are a dependency of your project be sure to specify the package name using --designSystemPackage when re-running this command.",(process.stdout.columns||80)-4)),process.exit(1)),Qe.length===0&&!pe&&!_e){j.info(CD("Component index is up to date!",(process.stdout.columns||80)-4));return}if(n)return;let be=U.find(Ie=>F2(Ie));if(i){let Ie=O.length;if(v.stop(`${Z} new and ${Ie} existing component docs found`),Ie>0){let q=await Vr({message:"Using --force will remove existing component documents. Continue?"});if(typeof q=="symbol"||!q){v.stop("Canceled");return}}v.start("")}let at=0,mt=[];v.stop("Started indexing component docs:");let Ut=new Mq.default.MultiBar({clearOnComplete:!1,hideCursor:!0},Mq.default.Presets.shades_grey);Ut.log(""),Ut.log(`Indexing in progress with ${ID} workers...`);let or=Ut.create(Qe.length+Ce.length,at,{name:"Total"},{format:`${(0,pA.cyan)("{bar}")} | {name} | {percentage}% | (Step {value}/{total})`}),br={};for(let Ie=0;Ie<ID;Ie++)br[Ie]={statusBar:Ut.create(1,0,{name:"Starting..."},{format:"{name}"}),name:"Starting..."};let Ze=(Ie,q)=>{q?br[Ie].name=`Indexing: ${q}`:br[Ie].name=tN,or.update(at)},Dr=async(Ie,q)=>{let X=[],oe=[],me=[...Ie],Te=async lt=>{for(;me.length>0;){let er=me.shift();if(!er)break;switch(Ze(lt,er.name),er.type){case"token":try{await vTe(t,f,`${I}-${er.name}-doc`,er,{designSystemId:S,designSystemPackage:r,designSystemVersion:y,workspaceConfig:B,debug:e.debug,include:A,exclude:c,instructions:u,privacyMode:h?.privacyMode}),at++}catch{oe.push(er.name)}break;case"component":try{await NTe(t,f,`${I}-${er.name}-doc`,er,{designSystemId:S,designSystemPackage:r,designSystemVersion:y,workspaceConfig:B,debug:e.debug,include:A,exclude:c,instructions:u,privacyMode:h?.privacyMode}),v.message(`Component docs stored for ${er.name}`),mt.push(er),at++}catch{X.push(er.name)}break}}Ze(lt,"")},$e=Array.from({length:q},(lt,er)=>Te(er)),wt=0,cr=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Jt=setInterval(()=>{for(let lt=0;lt<ID;lt++)br[lt].name!==tN?br[lt].statusBar.update(0,{name:`${br[lt].name} ${cr[wt]}`}):br[lt].statusBar.update(0,{name:tN});wt=(wt+1)%cr.length},100);await Promise.all($e),clearInterval(Jt);for(let lt=0;lt<ID;lt++)br[lt].statusBar.update(0,{name:tN});return Ut.stop(),{failedComponents:X,failedTokens:oe}},Dt=We.some(Ie=>!O.find(q=>q.name===Ie.name)),[Ot,wn,ot]=await Promise.all([(async()=>!be||i||Dt||pe||_e?(v.message("Summarizing component library"),await Tq(t,f,We,{designSystemId:S,debug:e.debug,hasIcons:!G&&(he?.icons.length||0)>0,hasDesignTokens:!G&&Oe.length>0,discoveredTokenGroups:Oe.map(Ie=>Ie.name)}),v.message("Agent docs stored"),{success:!0}):{success:!0})(),he&&DTe(f,he,{designSystemId:S,debug:e.debug,sessionId:`${I}-icon-discovery`,previousHash:$?.hash,force:i}),Dr(G?Qe:[...Qe,...Ce],ID)]),{failedComponents:wr,failedTokens:He}=ot,ye=[...We,...G?[]:Oe];(he?.icons.length||0)>0&&ye.push({name:Yh,type:"icon"}),ge?.hash&&ye.push({name:lk,type:"installation",hash:ge.hash,relevantFiles:ge.relevantFiles}),Y={componentsToCheck:ye,storedComponentDocs:U,source:"auto",specificComponentNames:L,summaryData:{indexedComponents:mt,discoveredComponents:We,failedComponents:wr,failedTokens:He,numIconsIndexed:G?0:wn&&he?.icons.length||0,discoveredTokenGroups:Oe,tokenGroupsToIndex:Ce}},await Wt("repo indexing completed",{sessionId:I,commandString:process.argv.slice(2).join(" "),forceBoolean:e.force,skipDetailedGroupingBoolean:e.skipDetailedGrouping,designSystemPackage:r||"none",designSystemId:S||"none",userId:f.userId,spaceId:f.builderPublicKey}),e.createFusionExample&&await OTe(f,d,e)}}catch(K){throw j.error(K instanceof Error?K.message:String(K)),Ud.captureException(K,{tags:{operation:"repo-indexing",sessionId:I,designSystemPackage:r||"none",source:l?"custom":"auto"},extra:{skipDetailedGrouping:n,force:i,uploadCustomDocs:l}}),qu.error(`
|
|
6957
|
-
Stack trace:`,K instanceof Error?K.stack:"",{loggerOptions:{debug:!0}}),S&&await Wj(f,{id:S,designSystemName:d,designSystemPackage:r,designSystemVersion:y,status:"failed",scope:x,source:l?"custom":"auto"}),K}if(Y&&Y.summaryData){let K=Y.storedComponentDocs.filter(M=>F2(M)?!1:Y.specificComponentNames&&Y.specificComponentNames.length>0?Y.specificComponentNames.includes(M.name):!0);await TTe(f,Y.componentsToCheck,K),lSt(Y.summaryData.discoveredComponents,Y.summaryData.indexedComponents,p,Y.summaryData.failedComponents,i,d,S,Y.summaryData.numIconsIndexed,Y.summaryData.discoveredTokenGroups,Y.summaryData.tokenGroupsToIndex,Y.summaryData.failedTokens),S&&await Wj(f,{id:S,designSystemName:d,designSystemPackage:r,designSystemVersion:y,status:"completed",scope:x,source:Y.source})}},GTe=async(t,e,r)=>{let n=new URL(`/design-systems/v1/${e}/docs`,
|
|
6958
|
-
`))),{validDocs:A,invalidFiles:a}},dSt=async(t,e,r,n)=>{let{document:i,body:o}=r,{designSystemId:s,designSystemPackage:a,designSystemVersion:A,sessionId:c,debug:u}=n,l;if(Rp(i)||kl(i)){let d=i.relevantFiles||[];d.length>0?l=await Ld(t,d):l=nN.default.createHash("sha256").update(o).digest("hex")}else(hm(i)||mv(i))&&(l=nN.default.createHash("sha256").update(o).digest("hex"));try{if(Rp(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}else if(kl(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}else if(hm(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}else if(mv(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}}catch(d){throw new zt(`Failed to process custom doc: ${i.name}`,{cause:d})}},fSt=async(t,e)=>{let r=new URL("/allow-feature",
|
|
6957
|
+
Stack trace:`,K instanceof Error?K.stack:"",{loggerOptions:{debug:!0}}),S&&await Wj(f,{id:S,designSystemName:d,designSystemPackage:r,designSystemVersion:y,status:"failed",scope:x,source:l?"custom":"auto"}),K}if(Y&&Y.summaryData){let K=Y.storedComponentDocs.filter(M=>F2(M)?!1:Y.specificComponentNames&&Y.specificComponentNames.length>0?Y.specificComponentNames.includes(M.name):!0);await TTe(f,Y.componentsToCheck,K),lSt(Y.summaryData.discoveredComponents,Y.summaryData.indexedComponents,p,Y.summaryData.failedComponents,i,d,S,Y.summaryData.numIconsIndexed,Y.summaryData.discoveredTokenGroups,Y.summaryData.tokenGroupsToIndex,Y.summaryData.failedTokens),S&&await Wj(f,{id:S,designSystemName:d,designSystemPackage:r,designSystemVersion:y,status:"completed",scope:x,source:Y.source})}},GTe=async(t,e,r)=>{let n=new URL(`/design-systems/v1/${e}/docs`,Pe);n.searchParams.set("apiKey",t.builderPublicKey),n.searchParams.set("userId",t.userId);let i=await Me(n,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`}});if(!i.ok){let o=await i.text();return qu.error("API request failed:",i.status,o,{loggerOptions:{debug:!0}}),[]}return await i.json()},rN=t=>{if(Array.isArray(t))return t.map(n=>String(n).trim()).filter(n=>n.length>0);if(typeof t!="string")return[];let e=t.trim();if(e===""||e==="[]")return[];let r=e;return r=r.replace(/^\[|\]$/g,""),r=r.replace(/['"]/g,""),r.split(",").map(n=>n.trim()).filter(n=>n.length>0)},gSt=t=>{if(!t||typeof t!="object"||Array.isArray(t))return;let e={};for(let[r,n]of Object.entries(t))typeof r=="string"&&typeof n=="string"&&(e[r]=n);return Object.keys(e).length>0?e:void 0},pSt=async(t,e)=>{(await t.stat(e)).isDirectory()||(j.error(`${e} is not a valid directory`),process.exit(1));let i=(await t.readdir(e)).filter(u=>u.endsWith(".md")||u.endsWith(".mdx"));i.length===0&&(j.error(`No .md or .mdx files found in ${e}`),process.exit(1));let o=["name","description","type"],s=["token","icon","component","installation"],a=[],A=[],c=new Set;for(let u of i){let l=t.join(e,u),d=await t.readFile(l),g;try{g=nm(d||"")}catch{a.push(u);continue}let{frontmatter:p,body:f}=g;if(!p||typeof p!="object"||!o.every(B=>!!p[B])){a.push(u);continue}if(typeof p.type!="string"||!s.includes(p.type)){a.push(u);continue}let h=p.name.toLowerCase();if(c.has(h)){a.push(u);continue}if(c.add(h),!f||f.trim()===""){a.push(u);continue}let C={name:p.name,description:p.description,content:f,designSystemId:""},I;switch(p.type){case"component":{I={...C,type:"component",relatedComponents:rN(p.relatedComponents),relevantFiles:rN(p.relevantFiles),hash:""};break}case"token":{I={...C,type:"token",relevantFiles:rN(p.relevantFiles),rawTokens:rN(p.rawTokens),tokenValues:gSt(p.tokenValues),hash:""};break}case"icon":{I={...C,type:"icon",hash:""};break}case"installation":{I={...C,type:"installation",hash:""};break}default:a.push(u);continue}A.push({document:I,filePath:l,frontmatter:p,body:f||""})}return j.info(`Found ${A.length} valid files`),a.length>0&&(j.warn(`Files: [${a.join(", ")}] will be excluded because they have invalid or duplicate frontmatter`),j.warn(["---","name: example","description: example text","type: token | icon | component | installation","(optional) relevantFiles: [file1, file2]","(optional) relatedComponents: [component1, component2]","---"].join(`
|
|
6958
|
+
`))),{validDocs:A,invalidFiles:a}},dSt=async(t,e,r,n)=>{let{document:i,body:o}=r,{designSystemId:s,designSystemPackage:a,designSystemVersion:A,sessionId:c,debug:u}=n,l;if(Rp(i)||kl(i)){let d=i.relevantFiles||[];d.length>0?l=await Ld(t,d):l=nN.default.createHash("sha256").update(o).digest("hex")}else(hm(i)||mv(i))&&(l=nN.default.createHash("sha256").update(o).digest("hex"));try{if(Rp(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}else if(kl(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}else if(hm(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}else if(mv(i)){let d={...i,sessionId:c,hash:l||i.hash,designSystemId:s,...A&&{designSystemVersion:A},...a&&{designSystemPackage:a}};await ts(e,d,u)}}catch(d){throw new zt(`Failed to process custom doc: ${i.name}`,{cause:d})}},fSt=async(t,e)=>{let r=new URL("/allow-feature",Pe);r.searchParams.set("feature","repo-indexing"),r.searchParams.set("apiKey",t.builderPublicKey),r.searchParams.set("userId",t.userId);let n=await Me(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`}});if(!n.ok){let o=await n.text();return qu.error("API request failed:",n.status,o,{loggerOptions:{debug:!0}}),{isAllowed:!1,reason:o||"Unable to verify permissions"}}let i=await n.json();return{isAllowed:i.isAllowed,reason:i.reason}};m();m();un();var iN=W(Gr(),1);Cr();Vi();var HTe=(t,e)=>{try{let{builderPublicKey:r,userId:n,spaceName:i}=da(t,e);if(r===void 0){j.message((0,iN.red)("\u2717 Not Authenticated to Builder.io")),j.message('Re-run this with the "auth" command to authenticate with Builder.io.');return}j.message((0,iN.green)("\u2713 Authenticated to Builder.io")),i!==void 0&&j.message(`Space Name: ${i}`),r!==void 0&&j.message(`Space ID: ${r}`),n!==void 0&&j.message(`User ID: ${n}`)}catch(r){let n=t.Sentry?.captureException(new zt("Failed to read credentials",{cause:r}));j.error(`Sorry, we ran into a problem while checking authentication. Please try again. If this issue persists, contact support@builder.io, and provide the error ID: ${n}`)}};un();Cr();var ii=W(Gr(),1);vn();gs();var $Te=async(t,e,r)=>{if(e==="status"){HTe(t,r);return}if(r.reset){console.log(""),Br((0,ii.bgCyan)((0,ii.bold)((0,ii.white)(" auth reset ")))+" "+(0,ii.dim)(xt)),Qwe(t)?(j.success("Credentials have been cleared successfully"),await Wt("auth reset",{})):j.info("No credentials found to clear"),Un((0,ii.bgGreen)((0,ii.bold)((0,ii.white)(" Done! \u{1F389} "))));return}console.log(""),Br((0,ii.bgCyan)((0,ii.bold)((0,ii.white)(" auth ")))+" "+(0,ii.dim)(xt));let n=!1,{builderPublicKey:i}=await mr(t,r,{builderPrivateKey:!0,builderPublicKey:!0,force:!0,requireFigmaAuth:n?"always":void 0});await Wt("auth",{spaceId:i}),Un((0,ii.bgGreen)((0,ii.bold)((0,ii.white)(" Done! \u{1F389} "))))};m();Cr();var oi=W(Gr(),1);vn();dg();un();Jr();Zr();bQ();var cMe=require("node:child_process"),uMe=require("util");m();var JTe=require("node:child_process"),jTe=require("util"),FC=(0,jTe.promisify)(JTe.exec);async function YTe(){let t={};try{let{stdout:e}=await FC("node --version");t.node=e.trim().replace(/^v/,"")}catch{}try{let{stdout:e}=await FC("npm --version");t.npm=e.trim()}catch{}try{let{stdout:e}=await FC("pnpm --version");t.pnpm=e.trim()}catch{}try{let{stdout:e}=await FC("yarn --version");t.yarn=e.trim()}catch{}try{let{stdout:e}=await FC("bun --version");t.bun=e.trim()}catch{}try{let{stdout:e}=await FC("deno --version"),r=e.match(/deno (\d+\.\d+\.\d+)/);r&&(t.deno=r[1])}catch{}return t}function qTe(t){let e=[];return t.node&&e.push({key:"node",type:"mise",tool:"node",version:t.node}),t.npm&&e.push({key:"npm",type:"mise",tool:"npm",version:t.npm}),t.pnpm&&e.push({key:"pnpm",type:"mise",tool:"pnpm",version:t.pnpm}),t.yarn&&e.push({key:"yarn",type:"mise",tool:"yarn",version:t.yarn}),t.bun&&e.push({key:"bun",type:"mise",tool:"bun",version:t.bun}),t.deno&&e.push({key:"deno",type:"mise",tool:"deno",version:t.deno}),e}function VTe(t){let e=[];return t.node&&e.push(`node v${t.node}`),t.npm&&e.push(`npm ${t.npm}`),t.pnpm&&e.push(`pnpm ${t.pnpm}`),t.yarn&&e.push(`yarn ${t.yarn}`),t.bun&&e.push(`bun ${t.bun}`),t.deno&&e.push(`deno ${t.deno}`),e.join(", ")}m();Cr();var XTe=W(KJ(),1),eMe=require("node:path"),tMe=require("node:fs"),mSt=new Set(["PATH","HOME","SHELL","USER","LOGNAME","TMPDIR","TEMP","TMP","PWD","OLDPWD","TERM","TERM_PROGRAM","TERM_PROGRAM_VERSION","TERM_SESSION_ID","LANG","LC_ALL","LC_CTYPE","LC_COLLATE","LC_TIME","LC_NUMERIC","LC_MONETARY","LC_MESSAGES","SHLVL","_","DISPLAY","COLORTERM","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_CACHE_HOME","XDG_RUNTIME_DIR","SSH_AUTH_SOCK","SSH_AGENT_PID","MANPATH","INFOPATH","HOMEBREW_PREFIX","HOMEBREW_CELLAR","HOMEBREW_REPOSITORY","COMMAND_MODE","__CFBundleIdentifier","__CF_USER_TEXT_ENCODING","Apple_PubSub_Socket_Render","SUDO_COMMAND","SUDO_USER","SUDO_UID","SUDO_GID","ORIGINAL_XDG_CURRENT_DESKTOP","EDITOR","VISUAL","PAGER","LESS","LESSOPEN","NODE","NODE_PATH","NODE_OPTIONS","CLAUDE_CODE_SSE_PORT","COLOR","CURSOR_TRACE_ID","ENABLE_IDE_INTEGRATION","GIT_ASKPASS","VSCODE_GIT_ASKPASS_EXTRA_ARGS","VSCODE_GIT_ASKPASS_MAIN","VSCODE_GIT_ASKPASS_NODE","VSCODE_GIT_IPC_HANDLE","VSCODE_INJECTION","VSCODE_INSPECTOR_OPTIONS","INIT_CWD","MallocNanoZone","OSLogRateLimit","XPC_FLAGS","XPC_SERVICE_NAME","PNPM_HOME"]),hSt=[/^npm_config_/,/^npm_command$/,/^npm_execpath$/,/^npm_lifecycle_/,/^npm_node_execpath$/,/^npm_package_/];function zTe(t){return mSt.has(t)?!0:hSt.some(e=>e.test(t))}var WTe={"Build & Development":[/^NODE_ENV$/,/^CI$/,/^NODE_OPTIONS$/,/^DEBUG$/,/^PORT$/,/^HOST$/,/^ENVIRONMENT$/,/^ENV$/,/^BUILD_/,/^DEV_/],"NPM & Package Managers":[/^NPM_/,/^YARN_/,/^PNPM_/,/^BUN_/],"Framework Specific":[/^NEXT_/,/^REACT_/,/^VITE_/,/^NUXT_/,/^VUE_/,/^ANGULAR_/,/^SVELTE_/,/^GATSBY_/,/^REMIX_/],"Public Variables":[/^PUBLIC_/,/^NEXT_PUBLIC_/,/^REACT_APP_/,/^VITE_/],"API & Services":[/^API_/,/^DATABASE_/,/^DB_/,/^REDIS_/,/^AWS_/,/^GCP_/,/^AZURE_/,/^STRIPE_/,/^SENTRY_/,/^VERCEL_/,/^NETLIFY_/],Custom:[]},ZTe=[/TOKEN/i,/KEY/i,/SECRET/i,/PASSWORD/i,/PASS/i,/AUTH/i,/PRIVATE/i,/CREDENTIAL/i],CSt=new Set(["NODE_ENV","CI","PORT","HOST","ENVIRONMENT"]);async function ISt(t,e){let r=[".env",".env.local",".env.development",".env.development.local"],n={};for(let i of r){let o=(0,eMe.join)(e,i);if((0,tMe.existsSync)(o))try{let s=(0,XTe.config)({path:o});s.parsed&&Object.assign(n,s.parsed)}catch{}}return n}function ESt(t){let e=[];if(t)for(let[n,i]of Object.entries(t)){if(!i||zTe(n))continue;let o="Custom";for(let[a,A]of Object.entries(WTe))if(A.some(c=>c.test(n))){o=a;break}let s=ZTe.some(a=>a.test(n));e.push({key:n,value:i,category:o==="Custom"?".env Variables":o,isSecret:s,shouldPreselect:!0,fromDotEnv:!0})}let r=new Set(t?Object.keys(t):[]);for(let[n,i]of Object.entries(process.env)){if(r.has(n)||zTe(n)||i===void 0)continue;let o="Custom";for(let[A,c]of Object.entries(WTe))if(c.some(u=>u.test(n))){o=A;break}let s=ZTe.some(A=>A.test(n)),a=CSt.has(n)||n.startsWith("NEXT_PUBLIC_")||n.startsWith("REACT_APP_")||n.startsWith("VITE_")||n.startsWith("PUBLIC_")||n==="NODE_ENV"||n==="CI";e.push({key:n,value:i,category:o,isSecret:s,shouldPreselect:a})}return e.sort((n,i)=>n.category!==i.category?n.category.localeCompare(i.category):n.key.localeCompare(i.key)),e}async function rMe(t,e){let r=await ISt(t,e),n=ESt(r);if(n.length===0)return[];let i=new Map;for(let p of n)i.has(p.category)||i.set(p.category,[]),i.get(p.category).push(p);let o=[];for(let[p,f]of i){o.push({value:`__category_${p}__`,label:`
|
|
6959
6959
|
${p} (${f.length})`,hint:""});for(let h of f){let C=h.isSecret?"***":h.value.length>50?`${h.value.substring(0,47)}...`:h.value;o.push({value:h.key,label:` ${h.key}`,hint:C})}}let s=n.filter(p=>p.shouldPreselect).map(p=>p.key),a=s.length,A=n.length,c=n.filter(p=>p.fromDotEnv).length,u=c>0?`Select environment variables (${c} from .env, ${a} pre-selected)`:`Select environment variables (${a} of ${A} pre-selected)`,l=await Zd({message:u,options:o.filter(p=>!p.value.startsWith("__category_")),initialValues:s,required:!1});if(Xe(l))return null;let d=new Set(l),g=[];for(let p of n)d.has(p.key)&&g.push({key:p.key,value:p.value,isSecret:p.isSecret});return g}function nMe(t){let e=t.filter(n=>n.isSecret).length,r=t.length-e;return{total:t.length,secrets:e,public:r}}m();var _q=require("node:path"),iMe=require("node:os");Cr();async function oMe(t,e){let r={},n=(0,_q.join)(e,".npmrc");try{let s=await t.readFile(n);s&&(r.projectNpmrc={path:n,content:s})}catch{}let i=(0,_q.join)((0,iMe.homedir)(),".npmrc");try{let s=await t.readFile(i);s&&(r.userNpmrc={path:i,content:s})}catch{}let o="/etc/hosts";try{let s=await t.readFile(o);s&&(r.etcHosts={path:o,content:s})}catch{}return r}async function sMe(t){let e=[];if(t.projectNpmrc&&e.push({key:"projectNpmrc",displayName:".npmrc (project)",path:"./.npmrc",content:t.projectNpmrc.content,hint:"NPM configuration for project"}),t.userNpmrc&&e.push({key:"userNpmrc",displayName:".npmrc (user)",path:"~/.npmrc",content:t.userNpmrc.content,hint:"Your user NPM configuration"}),t.etcHosts&&e.push({key:"etcHosts",displayName:"/etc/hosts",path:"/etc/hosts",content:t.etcHosts.content,hint:"System hosts file"}),e.length===0)return[];let r=e.map(a=>({value:a.key,label:a.displayName,hint:a.hint})),n=e.map(a=>a.key),i=await Zd({message:`Select configuration files to include (${e.length} found)`,options:r,initialValues:n,required:!1});if(Xe(i))return null;let o=new Set(i),s=[];for(let a of e)o.has(a.key)&&s.push({path:a.path,content:a.content});return s}m();var aMe=require("node:child_process");Cr();var Od=W(Gr(),1);async function AMe(t,e){let n=0,i=e;for(;n<3;){if(n++,i)j.info(`Working directory: ${t}`);else{j.info(`Working directory: ${t}`);let s=await xr({message:"Enter install command",placeholder:"npm install",defaultValue:"npm install",validate:a=>{if(!a||a.trim().length===0)return"Command cannot be empty"}});if(Xe(s))return{success:!1,command:"",skipped:!0};i=s}let o=await BSt(i,t);if(o.success)return j.success((0,Od.green)("\u2713 Install completed successfully!")),{success:!0,command:i,exitCode:0,skipped:!1};if(j.error((0,Od.red)(`\u2717 Install failed with exit code ${o.exitCode}`)),n<3){let s=await Ji({message:"Try again with a different command?",options:[{value:"retry",label:"Yes, try again"},{value:"skip",label:"No, skip and continue anyway"}]});if(Xe(s)||s==="skip")return j.warn((0,Od.yellow)("\u26A0 Skipping install step")),{success:!1,command:i,exitCode:o.exitCode,skipped:!0};i=void 0}else{j.warn((0,Od.yellow)("\u26A0 Maximum retry attempts reached"));let s=await Ji({message:"Continue without successful install?",options:[{value:"yes",label:"Yes, continue anyway"},{value:"no",label:"No, exit"}]});return Xe(s)||s==="no"?{success:!1,command:i,exitCode:o.exitCode,skipped:!1}:{success:!1,command:i,exitCode:o.exitCode,skipped:!0}}}return{success:!1,command:i||"",skipped:!0}}function BSt(t,e){return new Promise(r=>{let n=t.trim().split(/\s+/),i=n[0],o=n.slice(1),s=(0,aMe.spawn)(i,o,{cwd:e,stdio:"inherit",shell:!0});s.on("error",a=>{j.error(`Failed to execute command: ${a.message}`),r({success:!1,exitCode:1})}),s.on("exit",a=>{let A=a??1;r({success:A===0,exitCode:A})})})}var ySt=(0,uMe.promisify)(cMe.exec);function QSt(t){let e=t.replace(/\.git$/,"");return e.startsWith("git@")&&(e=e.replace(/^git@/,"https://").replace(/:([^/])/,"/$1")),!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`https://${e}`),e}async function lMe(t,e){console.log(""),Br((0,oi.bgCyan)((0,oi.bold)((0,oi.white)(" connect-repo ")))+" "+(0,oi.dim)(xt));try{j.step("Detecting git repository...");let r=await xC(t);if(!r){qe("No git repository detected. Please run this command from within a git repository.");return}let n=UTe(r);Yg(n.join(`
|
|
6960
6960
|
`),"Repository Detected");let i=await xr({message:"Project name",initialValue:r.projectName,validate:p=>{if(!p||p.trim().length===0)return"Project name cannot be empty"}});if(Xe(i)){qe("Project creation cancelled");return}let o=i.trim(),s=await AMe(r.gitRoot,e.installCommand);if(!s.success&&!s.skipped){qe("Installation failed. Cannot continue.");return}j.step("Collecting environment variables...");let a=await rMe(t,r.gitRoot);if(a===null){qe("Environment variable selection cancelled");return}let A=nMe(a);j.info(`\u2713 Selected ${A.total} variables (${A.secrets} secret, ${A.public} public)`),j.step("Collecting configuration files...");let c=await oMe(t,r.gitRoot),u=await sMe(c);if(u===null){qe("Configuration file selection cancelled");return}u.length>0?j.info(`\u2713 Selected ${u.length} configuration file(s)`):j.info("\u25CB No configuration files selected"),j.step("Detecting tool versions...");let l=Pi();l.start("Checking installed tools");let d=await YTe(),g=qTe(d);l.stop(),j.info(`\u2713 Detected: ${VTe(d)}`),await DSt(t,e,r,o,s.command,g,a,u)}catch(r){throw t.Sentry?.captureException(r),j.error(r instanceof Error?r.message:String(r)),qe("Command failed"),r}}async function DSt(t,e,r,n,i,o,s,a){j.step("Creating Fusion project...");let A=[`Project: ${(0,oi.bold)(n)}`,`Provider: ${r.repoProvider} (${r.isPrivate?"private":"public"})`];r.recommendedRoot&&A.push(`Recommended root: ${r.recommendedRoot}`),A.push(`Environment: ${s.length} variables`,`Config files: ${a.length} files`,`Tools: ${o.length} dependencies`),Yg(A.join(`
|
|
6961
|
-
`),"Summary");let c=Pi();c.start("Authenticating");let u=await mr(t,e,{builderPublicKey:!0,builderPrivateKey:!0});c.stop(),j.success(`\u2713 Authenticated as ${u.userId} (Space: ${u.spaceName||u.builderPublicKey})`);let l=await Ji({message:`Create project "${(0,oi.bold)(n)}" in space "${(0,oi.bold)(u.spaceName||u.builderPublicKey)}"?`,options:[{value:"confirm",label:"Confirm",hint:"Create the project"},{value:"changeSpace",label:"Choose Different Space",hint:"Switch to another space"},{value:"cancel",label:"Cancel",hint:"Cancel project creation"}]});if(Xe(l)){qe("Project creation cancelled");return}if(l==="cancel"){qe("Project creation cancelled");return}l==="changeSpace"&&(u=await mr(t,e,{builderPublicKey:!0,builderPrivateKey:!0,force:!0}));let d;try{let{stdout:I}=await ySt("git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || git remote show origin | grep 'HEAD branch' | cut -d' ' -f5",{cwd:r.gitRoot});d=I.trim().replace("refs/remotes/origin/","")}catch{j.warning("Could not determine main branch name")}let g=QSt(r.originUrl),p={name:n,repoFullName:r.repoFullName,repoProvider:r.repoProvider,repoProtocol:r.repoProvider==="github"||r.repoProvider==="selfHostedGithub"?void 0:"https",repoUrl:g,repoPrivate:r.isPrivate,needSetup:!0,settings:{installCommand:i,setupDependencies:o,recommendedRoot:r.recommendedRoot,environmentVariables:s,fileOverrides:a,mainBranchName:d}},f="happy-cli",h={name:f,createdBy:u.userId,friendlyName:f,isDefault:!0,isPublic:!1,lockedFusionEnvironment:"cloud"},C={...p,branchData:h};if(e.dryrun){c.stop(),j.info("Dry run mode - project will not be created"),Yg(`API Endpoint: POST ${
|
|
6961
|
+
`),"Summary");let c=Pi();c.start("Authenticating");let u=await mr(t,e,{builderPublicKey:!0,builderPrivateKey:!0});c.stop(),j.success(`\u2713 Authenticated as ${u.userId} (Space: ${u.spaceName||u.builderPublicKey})`);let l=await Ji({message:`Create project "${(0,oi.bold)(n)}" in space "${(0,oi.bold)(u.spaceName||u.builderPublicKey)}"?`,options:[{value:"confirm",label:"Confirm",hint:"Create the project"},{value:"changeSpace",label:"Choose Different Space",hint:"Switch to another space"},{value:"cancel",label:"Cancel",hint:"Cancel project creation"}]});if(Xe(l)){qe("Project creation cancelled");return}if(l==="cancel"){qe("Project creation cancelled");return}l==="changeSpace"&&(u=await mr(t,e,{builderPublicKey:!0,builderPrivateKey:!0,force:!0}));let d;try{let{stdout:I}=await ySt("git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || git remote show origin | grep 'HEAD branch' | cut -d' ' -f5",{cwd:r.gitRoot});d=I.trim().replace("refs/remotes/origin/","")}catch{j.warning("Could not determine main branch name")}let g=QSt(r.originUrl),p={name:n,repoFullName:r.repoFullName,repoProvider:r.repoProvider,repoProtocol:r.repoProvider==="github"||r.repoProvider==="selfHostedGithub"?void 0:"https",repoUrl:g,repoPrivate:r.isPrivate,needSetup:!0,settings:{installCommand:i,setupDependencies:o,recommendedRoot:r.recommendedRoot,environmentVariables:s,fileOverrides:a,mainBranchName:d}},f="happy-cli",h={name:f,createdBy:u.userId,friendlyName:f,isDefault:!0,isPublic:!1,lockedFusionEnvironment:"cloud"},C={...p,branchData:h};if(e.dryrun){c.stop(),j.info("Dry run mode - project will not be created"),Yg(`API Endpoint: POST ${Pe}/projects?apiKey=${u.builderPublicKey}&userId=${u.userId}
|
|
6962
6962
|
|
|
6963
6963
|
Request Body:
|
|
6964
|
-
${JSON.stringify(C,void 0,2)}`,"Dry Run Configuration"),Un((0,oi.green)("Dry run complete! \u{1F3AF}"));return}c.start("Creating project on Builder.io");try{let I=await
|
|
6964
|
+
${JSON.stringify(C,void 0,2)}`,"Dry Run Configuration"),Un((0,oi.green)("Dry run complete! \u{1F3AF}"));return}c.start("Creating project on Builder.io");try{let I=await Me(`${Pe}/projects?apiKey=${u.builderPublicKey}&userId=${u.userId}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u.builderPrivateKey}`},body:JSON.stringify(C)});if(c.stop(),!I.ok){let w=await I.text(),D;try{let x=JSON.parse(w);D=x.message||x.error||w}catch{D=w}throw new Error(`Failed to create project: ${D}`)}let B=await I.json();j.success((0,oi.green)("\u2713 Project created successfully")),j.success((0,oi.green)("\u2713 Default branch created"));let y=`${e.app||e.nativeApp?"builder://":e.dev?"http://localhost:1234":"https://builder.io"}/app/projects/${B.project.id}/${f}`;Un((0,oi.green)("\u{1F389} Project created successfully!")),Yg([`${(0,oi.cyan)(y)}`,"","Next steps:","1. Configure your dev server command in project settings","2. Set up any required secrets","3. Launch your development environment"].join(`
|
|
6965
6965
|
`),"Project URL");let Q=await Vr({message:"Open project in browser?",initialValue:!0});if(!Xe(Q)&&Q){let w=Pi();w.start("Opening browser"),await hg(y),w.stop("Browser opened")}Un((0,oi.green)("Done! \u{1F680}"))}catch(I){throw c.stop(),I}}m();m();cH();eA();rJ();WB();m();eA();var oN=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],o=Array.isArray(i.content)?i.content:[i.content],s=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,A=a?Array.isArray(a.content)?a.content:[a.content]:[],c=A.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(A.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Xp,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Zl,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};nJ();var sN=class extends lh{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Cy.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new xh,this.setRequestHandler(aK,n=>this._oninitialize(n)),this.setNotificationHandler(Sx,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(SK,async(n,i)=>{let o=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,a=Cy.safeParse(s);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new oN(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Hx(this._capabilities,e)}setRequestHandler(e,r){let i=ah(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(Yl(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(A,c)=>{let u=Do(hy,A);if(!u.success){let p=u.error instanceof Error?u.error.message:String(u.error);throw new Ve(it.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=u.data,d=await Promise.resolve(r(A,c));if(l.task){let p=Do(hu,d);if(!p.success){let f=p.error instanceof Error?p.error.message:String(p.error);throw new Ve(it.InvalidParams,`Invalid task creation result: ${f}`)}return p.data}let g=Do(Wl,d);if(!g.success){let p=g.error instanceof Error?g.error.message:String(g.error);throw new Ve(it.InvalidParams,`Invalid tools/call result: ${p}`)}return g.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){vF(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&bF(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Dx.includes(r)?r:ql,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},mu)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],o=i.some(c=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],A=a.some(c=>c.type==="tool_use");if(o){if(i.some(c=>c.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!A)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(A){let c=new Set(a.filter(l=>l.type==="tool_use").map(l=>l.id)),u=new Set(i.filter(l=>l.type==="tool_result").map(l=>l.toolUseId));if(c.size!==u.size||![...c].every(l=>u.has(l)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Iy,r):this.request({method:"sampling/createMessage",params:e},Xp,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Zl,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:i},Zl,r);if(o.action==="accept"&&o.content&&i.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(i.requestedSchema)(o.content);if(!a.valid)throw new Ve(it.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof Ve?s:new Ve(it.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},RK,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};m();var Lq=W(require("node:process"),1);dJ();var aN=class{constructor(e=Lq.default.stdin,r=Lq.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Rh,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=FF(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};eA();var bUe=W(require("node:path"),1),Og=W(require("@sentry/node"),1);m();m();m();function Ln(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}m();m();var gMe=require("node:url"),kC=(t,e)=>{let r=Oq(wSt(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},wSt=t=>Uq(t)?t.toString():t,Uq=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,Oq=t=>t instanceof URL?(0,gMe.fileURLToPath)(t):t;var AN=(t,e=[],r={})=>{let n=kC(t,"First argument"),[i,o]=Ln(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(A=>typeof A=="object"&&A!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(A=>A.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ln(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]};m();var BMe=require("node:child_process");m();var pMe=require("node:string_decoder"),{toString:dMe}=Object.prototype,fMe=t=>dMe.call(t)==="[object ArrayBuffer]",si=t=>dMe.call(t)==="[object Uint8Array]",Vu=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),bSt=new TextEncoder,mMe=t=>bSt.encode(t),vSt=new TextDecoder,cN=t=>vSt.decode(t),hMe=(t,e)=>SSt(t,e).join(""),SSt=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new pMe.StringDecoder(e),n=t.map(o=>typeof o=="string"?mMe(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},ED=t=>t.length===1&&si(t[0])?t[0]:Gq(xSt(t)),xSt=t=>t.map(e=>typeof e=="string"?mMe(e):e),Gq=t=>{let e=new Uint8Array(FSt(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},FSt=t=>{let e=0;for(let r of t)e+=r.length;return e};var yMe=t=>Array.isArray(t)&&Array.isArray(t.raw),QMe=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=kSt({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},kSt=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=RSt(i,t.raw[n]),A=IMe(r,o,s);if(n===e.length)return A;let c=e[n],u=Array.isArray(c)?c.map(l=>EMe(l)):[EMe(c)];return IMe(A,u,a)},RSt=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=CMe.has(e[0]);for(let s=0,a=0;s<t.length;s+=1,a+=1){let A=e[a];if(CMe.has(A))n!==s&&r.push(t.slice(n,s)),n=s+1;else if(A==="\\"){let c=e[a+1];c===`
|
|
6966
6966
|
`?(s-=1,a+=1):c==="u"&&e[a+2]==="{"?a=e.indexOf("}",a+3):a+=NSt[c]??1}}let o=n===t.length;return o||r.push(t.slice(n)),{nextTokens:r,leadingWhitespaces:i,trailingWhitespaces:o}},CMe=new Set([" "," ","\r",`
|
|
6967
6967
|
`]),NSt={x:3,u:5},IMe=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],EMe=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ln(t)&&("stdout"in t||"isMaxBuffer"in t))return TSt(t);throw t instanceof BMe.ChildProcess||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},TSt=({stdout:t})=>{if(typeof t=="string")return t;if(si(t))return cN(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)};m();var H1e=require("node:child_process");m();m();m();m();var wMe=require("node:util");m();var uN=W(require("node:process"),1),dA=t=>lN.includes(t),lN=[uN.default.stdin,uN.default.stdout,uN.default.stderr],wa=["stdin","stdout","stderr"],gN=t=>wa[t]??`stdio[${t}]`;var bMe=t=>{let e={...t};for(let r of $q)e[r]=Kq(t,r);return e},Kq=(t,e)=>{let r=Array.from({length:MSt(t)+1}),n=PSt(t[e],r,e);return GSt(n,e)},MSt=({stdio:t})=>Array.isArray(t)?Math.max(t.length,wa.length):wa.length,PSt=(t,e,r)=>Ln(t)?_St(t,e,r):e.fill(t),_St=(t,e,r)=>{for(let n of Object.keys(t).sort(LSt))for(let i of USt(n,r,e))e[i]=t[n];return e},LSt=(t,e)=>DMe(t)<DMe(e)?1:-1,DMe=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,USt=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=Hq(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid.
|
|
@@ -7004,7 +7004,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
7004
7004
|
`,LF:`
|
|
7005
7005
|
`,concatBytes:Q5},rRt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},nRt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:rRt};m();var Q1e=require("node:buffer");var D1e=(t,e)=>t?void 0:iRt.bind(void 0,e),iRt=function*(t,e){if(typeof e!="string"&&!si(e)&&!Q1e.Buffer.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},w1e=(t,e)=>t?oRt.bind(void 0,e):sRt.bind(void 0,e),oRt=function*(t,e){b1e(t,e),yield e},sRt=function*(t,e){if(b1e(t,e),typeof e!="string"&&!si(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},b1e=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
|
|
7006
7006
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
7007
|
-
if (condition) { yield value; }`)};m();var v1e=require("node:buffer"),S1e=require("node:string_decoder");var rT=(t,e,r)=>{if(r)return;if(t)return{transform:aRt.bind(void 0,new TextEncoder)};let n=new S1e.StringDecoder(e);return{transform:ARt.bind(void 0,n),final:cRt.bind(void 0,n)}},aRt=function*(t,e){v1e.Buffer.isBuffer(e)?yield Vu(e):typeof e=="string"?yield t.encode(e):yield e},ARt=function*(t,e){yield si(e)?t.write(e):e},cRt=function*(t){let e=t.end();e!==""&&(yield e)};m();var w5=require("node:util"),b5=(0,w5.callbackify)(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),nT=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=lRt}=e[r];for await(let i of n(t))yield*nT(i,e,r+1)},x1e=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*uRt(r,Number(e),t)},uRt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*nT(n,r,e+1)},F1e=(0,w5.callbackify)(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),lRt=function*(t){yield t};m();var v5=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},k1e=(t,e)=>[...e.flatMap(r=>[...Hd(r,t,0)]),...kD(t)],Hd=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=pRt}=e[r];for(let i of n(t))yield*Hd(i,e,r+1)},kD=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*gRt(r,Number(e),t)},gRt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Hd(n,r,e+1)},pRt=function*(t){yield t};var S5=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},A=R1e(t,s,o),c=Kd(e),u=Kd(r),l=c?b5.bind(void 0,nT,a):v5.bind(void 0,Hd),d=c||u?b5.bind(void 0,x1e,a):v5.bind(void 0,kD),g=c||u?F1e.bind(void 0,a):void 0;return{stream:new RD.Transform({writableObjectMode:n,writableHighWaterMark:(0,RD.getDefaultHighWaterMark)(n),readableObjectMode:i,readableHighWaterMark:(0,RD.getDefaultHighWaterMark)(i),transform(f,h,C){l([f,A,0],this,C)},flush(f){d([A],this,f)},destroy:g})}},iT=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let A=R1e(s,r,a);t=k1e(A,t)}return t},R1e=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let A={};return[{transform:D1e(n,a)},rT(r,s,n),tT(r,o,n,A),{transform:t,final:e},{transform:w1e(i,a)},y1e({binary:r,preserveNewlines:o,readableObjectMode:i,state:A})].filter(Boolean)};var N1e=(t,e)=>{for(let r of dRt(t))fRt(t,r,e)},dRt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),fRt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:A}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${A}\`, can be ${Pg[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>mRt(a,n));r.input=ED(s)},mRt=(t,e)=>{let r=iT(t,e,"utf8",!0);return hRt(r),ED(r)},hRt=t=>{let e=t.find(r=>typeof r!="string"&&!si(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};m();var sT=require("node:fs");m();var oT=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&NC(r,n)&&!xs.has(e)&&CRt(n)&&(t.some(({type:i,value:o})=>i==="native"&&IRt.has(o))||t.every(({type:i})=>ba.has(i))),CRt=t=>t===1||t===2,IRt=new Set(["pipe","overlapped"]),T1e=async(t,e,r,n)=>{for await(let i of t)ERt(e)||P1e(i,r,n)},M1e=(t,e,r)=>{for(let n of t)P1e(n,e,r)},ERt=t=>t._readableState.pipes.length>0,P1e=(t,e,r)=>{let n=CN(t);wc({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var _1e=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((A,c)=>BRt({result:A,fileDescriptors:t,fdNumber:c,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},BRt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:A,lines:c,stripFinalNewline:u,maxBuffer:l})=>{if(t===null)return;let d=M_e(t,o,l),g=Vu(d),{stdioItems:p,objectMode:f}=e[r],h=yRt([g],p,A,n),{serializedResult:C,finalResult:I=C}=QRt({chunks:h,objectMode:f,encoding:A,lines:c,stripFinalNewline:u,fdNumber:r});DRt({serializedResult:C,fdNumber:r,state:n,verboseInfo:s,encoding:A,stdioItems:p,objectMode:f});let B=a[r]?I:void 0;try{return n.error===void 0&&wRt(C,p,i),B}catch(E){return n.error=E,B}},yRt=(t,e,r,n)=>{try{return iT(t,e,r,!1)}catch(i){return n.error=i,t}},QRt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:ED(t)};let s=hMe(t,r);return n[o]?{serializedResult:s,finalResult:D5(s,!i[o],e)}:{serializedResult:s}},DRt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!oT({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=D5(t,!1,s);try{M1e(a,e,n)}catch(A){r.error??=A}},wRt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>ZN.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?(0,sT.appendFileSync)(n,t):(r.add(o),(0,sT.writeFileSync)(n,t))}};m();var L1e=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Zu(e,r,"all")]:Array.isArray(e)?[Zu(t,r,"all"),...e]:si(t)&&si(e)?Gq([t,e]):`${t}${e}`};m();m();var aT=require("node:events");var U1e=async(t,e)=>{let[r,n]=await bRt(t);return e.isForcefullyTerminated??=!1,[r,n]},bRt=async t=>{let[e,r]=await Promise.allSettled([(0,aT.once)(t,"spawn"),(0,aT.once)(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?O1e(t):r.value},O1e=async t=>{try{return await(0,aT.once)(t,"exit")}catch{return O1e(t)}},G1e=async t=>{let[e,r]=await t;if(!vRt(e,r)&&x5(e,r))throw new fA;return[e,r]},vRt=(t,e)=>t===void 0&&e===void 0,x5=(t,e)=>t!==0||e!==null;var K1e=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=SRt(t,e,r),s=o?.code==="ETIMEDOUT",a=T_e(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},SRt=(t,e,r)=>t!==void 0?t:x5(e,r)?new fA:void 0;var $1e=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:A,options:c,fileDescriptors:u}=xRt(t,e,r),l=RRt({file:n,commandArguments:i,options:c,command:o,escapedCommand:s,verboseInfo:A,fileDescriptors:u,startTime:a});return GC(l,A,c)},xRt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EN(t,e,r),a=FRt(r),{file:A,commandArguments:c,options:u}=UN(t,e,a);kRt(u);let l=C1e(u,s);return{file:A,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},FRt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,kRt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&AT("ipcInput"),t&&AT("ipc: true"),r&&AT("detached: true"),n&&AT("cancelSignal")},AT=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},RRt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let A=NRt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(A.failed)return A;let{resultError:c,exitCode:u,signal:l,timedOut:d,isMaxBuffer:g}=K1e(A,r),{output:p,error:f=c}=_1e({fileDescriptors:s,syncResult:A,options:r,isMaxBuffer:g,verboseInfo:o}),h=p.map((I,B)=>Zu(I,r,B)),C=Zu(L1e(p,r),r,"all");return MRt({error:f,exitCode:u,signal:l,timedOut:d,isMaxBuffer:g,stdio:h,all:C,options:r,command:n,escapedCommand:i,startTime:a})},NRt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{N1e(o,r);let a=TRt(r);return(0,H1e.spawnSync)(...ON(t,e,a))}catch(a){return OC({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},TRt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:qN(e)}),MRt=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:A,escapedCommand:c,startTime:u})=>t===void 0?VN({command:A,escapedCommand:c,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):xD({error:t,command:A,escapedCommand:c,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});m();var ZLe=require("node:events"),XLe=require("node:child_process");m();var k5=W(require("node:process"),1);m();var HC=require("node:events");var J1e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(MC({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:RN(t)}),PRt({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),PRt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{SN(e,i);let o=Mg(t,e,r),s=new AbortController;try{return await Promise.race([_Rt(o,n,s),LRt(o,r,s),URt(o,r,s)])}catch(a){throw PC(t),a}finally{s.abort(),xN(e,i)}},_Rt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await(0,HC.once)(t,"message",{signal:r});return n}for await(let[n]of(0,HC.on)(t,"message",{signal:r}))if(e(n))return n},LRt=async(t,e,{signal:r})=>{await(0,HC.once)(t,"disconnect",{signal:r}),pPe(e)},URt=async(t,e,{signal:r})=>{let[n]=await(0,HC.once)(t,"strict:error",{signal:r});throw wN(n,e)};m();var ND=require("node:events");var Y1e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>F5({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),F5=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{MC({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:RN(t)}),SN(e,o);let s=Mg(t,e,r),a=new AbortController,A={};return ORt(t,s,a),GRt({ipcEmitter:s,isSubprocess:r,controller:a,state:A}),KRt({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:A,reference:o})},ORt=async(t,e,r)=>{try{await(0,ND.once)(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},GRt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await(0,ND.once)(t,"strict:error",{signal:r.signal});n.error=wN(i,e),r.abort()}catch{}},KRt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[A]of(0,ND.on)(r,"message",{signal:o.signal}))j1e(s),yield A}catch{j1e(s)}finally{o.abort(),xN(e,a),n||PC(t),i&&await t}},j1e=({error:t})=>{if(t)throw t};var q1e=(t,{ipc:e})=>{Object.assign(t,z1e(t,!1,e))},V1e=()=>{let t=k5.default,e=!0,r=k5.default.channel!==void 0;return{...z1e(t,e,r),getCancelSignal:YPe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},z1e=(t,e,r)=>({sendMessage:PN.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:J1e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Y1e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});m();var W1e=require("node:child_process"),_g=require("node:stream");var Z1e=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{E5(n);let a=new W1e.ChildProcess;HRt(a,n),Object.assign(a,{readable:$Rt,writable:JRt,duplex:jRt});let A=OC({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),c=YRt(A,s,i);return{subprocess:a,promise:c}},HRt=(t,e)=>{let r=TD(),n=TD(),i=TD(),o=Array.from({length:e.length-3},TD),s=TD(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},TD=()=>{let t=new _g.PassThrough;return t.end(),t},$Rt=()=>new _g.Readable({read(){}}),JRt=()=>new _g.Writable({write(){}}),jRt=()=>new _g.Duplex({read(){},write(){}}),YRt=async(t,e,r)=>GC(t,e,r);m();var $C=require("node:fs"),eLe=require("node:buffer"),Fc=require("node:stream");var tLe=(t,e)=>eT(qRt,t,e,!1),MD=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Pg[t]}.`)},X1e={fileNumber:MD,generator:S5,asyncGenerator:S5,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Fc.Duplex.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},qRt={input:{...X1e,fileUrl:({value:t})=>({stream:(0,$C.createReadStream)(t)}),filePath:({value:{file:t}})=>({stream:(0,$C.createReadStream)(t)}),webStream:({value:t})=>({stream:Fc.Readable.fromWeb(t)}),iterable:({value:t})=>({stream:Fc.Readable.from(t)}),asyncIterable:({value:t})=>({stream:Fc.Readable.from(t)}),string:({value:t})=>({stream:Fc.Readable.from(t)}),uint8Array:({value:t})=>({stream:Fc.Readable.from(eLe.Buffer.from(t))})},output:{...X1e,fileUrl:({value:t})=>({stream:(0,$C.createWriteStream)(t)}),filePath:({value:{file:t,append:e}})=>({stream:(0,$C.createWriteStream)(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Fc.Writable.fromWeb(t)}),iterable:MD,asyncIterable:MD,string:MD,uint8Array:MD}};m();m();var PD=require("node:events"),uT=require("node:stream"),T5=require("node:stream/promises");function $d(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)N5(i);let e=t.some(({readableObjectMode:i})=>i),r=VRt(t,e),n=new R5({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var VRt=(t,e)=>{if(t.length===0)return(0,uT.getDefaultHighWaterMark)(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},R5=class extends uT.PassThrough{#n=new Set([]);#c=new Set([]);#o=new Set([]);#t;#A=Symbol("unpipe");#i=new WeakMap;add(e){if(N5(e),this.#n.has(e))return;this.#n.add(e),this.#t??=zRt(this,this.#n,this.#A);let r=XRt({passThroughStream:this,stream:e,streams:this.#n,ended:this.#c,aborted:this.#o,onFinished:this.#t,unpipeEvent:this.#A});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(N5(e),!this.#n.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},zRt=async(t,e,r)=>{cT(t,rLe);let n=new AbortController;try{await Promise.race([WRt(t,n),ZRt(t,e,r,n)])}finally{n.abort(),cT(t,-rLe)}},WRt=async(t,{signal:e})=>{try{await(0,T5.finished)(t,{signal:e,cleanup:!0})}catch(r){throw iLe(t,r),r}},ZRt=async(t,e,r,{signal:n})=>{for await(let[i]of(0,PD.on)(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},N5=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},XRt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{cT(t,nLe);let a=new AbortController;try{await Promise.race([eNt(o,e,a),tNt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),rNt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),cT(t,-nLe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?M5(t):nNt(t))},eNt=async(t,e,{signal:r})=>{try{await t,r.aborted||M5(e)}catch(n){r.aborted||iLe(e,n)}},tNt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await(0,T5.finished)(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;oLe(s)?i.add(e):sLe(t,s)}},rNt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await(0,PD.once)(t,i,{signal:o}),!t.readable)return(0,PD.once)(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},nNt=t=>{t.writable&&t.end()},iLe=(t,e)=>{oLe(e)?M5(t):sLe(t,e)},oLe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",M5=t=>{(t.readable||t.writable)&&t.destroy()},sLe=(t,e)=>{t.destroyed||(t.once("error",iNt),t.destroy(e))},iNt=()=>{},cT=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},rLe=2,nLe=1;m();var P5=require("node:stream/promises");var JC=(t,e)=>{t.pipe(e),oNt(t,e),sNt(t,e)},oNt=async(t,e)=>{if(!(dA(t)||dA(e))){try{await(0,P5.finished)(t,{cleanup:!0,readable:!0,writable:!1})}catch{}_5(e)}},_5=t=>{t.writable&&t.end()},sNt=async(t,e)=>{if(!(dA(t)||dA(e))){try{await(0,P5.finished)(e,{cleanup:!0,readable:!1,writable:!0})}catch{}L5(t)}},L5=t=>{t.readable&&t.destroy()};var aLe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:A})=>ba.has(A)))aNt(t,a,s,i);for(let{stream:a}of o.filter(({type:A})=>!ba.has(A)))cNt({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:$d(o);JC(s,i)}},aNt=(t,e,r,n)=>{r==="output"?JC(t.stdio[n],e):JC(e,t.stdio[n]);let i=ANt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},ANt=["stdin","stdout","stderr"],cNt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;uNt(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],A=i.get(s)??[];i.set(s,[...A,a])},uNt=(t,{signal:e})=>{dA(t)&&Gd(t,lNt,e)},lNt=2;m();var cLe=require("node:events");m();m();var Jd=[];Jd.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Jd.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jd.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var lT=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",U5=Symbol.for("signal-exit emitter"),O5=globalThis,gNt=Object.defineProperty.bind(Object),G5=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(O5[U5])return O5[U5];gNt(O5,U5,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},gT=class{},pNt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),K5=class extends gT{onExit(){return()=>{}}load(){}unload(){}},H5=class extends gT{#n=$5.platform==="win32"?"SIGINT":"SIGHUP";#c=new G5;#o;#t;#A;#i={};#e=!1;constructor(e){super(),this.#o=e,this.#i={};for(let r of Jd)this.#i[r]=()=>{let n=this.#o.listeners(r),{count:i}=this.#c,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#c.emit("exit",null,r),a=r==="SIGHUP"?this.#n:r;s||e.kill(e.pid,a)}};this.#A=e.reallyExit,this.#t=e.emit}onExit(e,r){if(!lT(this.#o))return()=>{};this.#e===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#c.on(n,e),()=>{this.#c.removeListener(n,e),this.#c.listeners.exit.length===0&&this.#c.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#e){this.#e=!0,this.#c.count+=1;for(let e of Jd)try{let r=this.#i[e];r&&this.#o.on(e,r)}catch{}this.#o.emit=(e,...r)=>this.#E(e,...r),this.#o.reallyExit=e=>this.#s(e)}}unload(){this.#e&&(this.#e=!1,Jd.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#o.removeListener(e,r)}catch{}}),this.#o.emit=this.#t,this.#o.reallyExit=this.#A,this.#c.count-=1)}#s(e){return lT(this.#o)?(this.#o.exitCode=e||0,this.#c.emit("exit",this.#o.exitCode,null),this.#A.call(this.#o,this.#o.exitCode)):0}#E(e,...r){let n=this.#t;if(e==="exit"&&lT(this.#o)){typeof r[0]=="number"&&(this.#o.exitCode=r[0]);let i=n.call(this.#o,e,...r);return this.#c.emit("exit",this.#o.exitCode,null),i}else return n.call(this.#o,e,...r)}},$5=globalThis.process,{onExit:ALe,load:Z1r,unload:X1r}=pNt(lT($5)?new H5($5):new K5);var uLe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ALe(()=>{t.kill()});(0,cLe.addAbortListener)(n,()=>{i()})};m();m();var gLe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=IN(),{destination:s,destinationStream:a,destinationError:A,from:c,unpipeSignal:u}=dNt(r,n,i),{sourceStream:l,sourceError:d}=mNt(t,c),{options:g,fileDescriptors:p}=vc.get(t);return{sourcePromise:e,sourceStream:l,sourceOptions:g,sourceError:d,destination:s,destinationStream:a,destinationError:A,unpipeSignal:u,fileDescriptors:p,startTime:o}},dNt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=fNt(t,e,...r),a=vN(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},fNt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(lLe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||Uq(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=AN(r,...n);return{destination:e(lLe)(i,o,s),pipeOptions:s}}if(vc.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},lLe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),mNt=(t,e)=>{try{return{sourceStream:_C(t,e)}}catch(r){return{sourceError:r}}};m();var dLe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=hNt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw J5({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},hNt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return L5(t),n;if(e!==void 0)return _5(r),e},J5=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>OC({error:t,command:pLe,escapedCommand:pLe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),pLe="source.pipe(destination)";m();var fLe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};m();var mLe=require("node:stream/promises");var hLe=(t,e,r)=>{let n=pT.has(e)?INt(t,e):CNt(t,e);return Gd(t,BNt,r.signal),Gd(e,yNt,r.signal),ENt(e),n},CNt=(t,e)=>{let r=$d([t]);return JC(r,e),pT.set(e,r),r},INt=(t,e)=>{let r=pT.get(e);return r.add(t),r},ENt=async t=>{try{await(0,mLe.finished)(t,{cleanup:!0,readable:!1,writable:!0})}catch{}pT.delete(t)},pT=new WeakMap,BNt=2,yNt=1;m();var CLe=require("node:util");var ILe=(t,e)=>t===void 0?[]:[QNt(t,e)],QNt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await(0,CLe.aborted)(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw J5({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var dT=(t,...e)=>{if(Ln(e[0]))return dT.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=gLe(t,...e),i=DNt({...n,destination:r});return i.pipe=dT.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},DNt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:A,startTime:c})=>{let u=wNt(t,i);dLe({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:A,sourceOptions:r,startTime:c});let l=new AbortController;try{let d=hLe(e,o,l);return await Promise.race([fLe(u),...ILe(a,{sourceStream:e,mergedStream:d,sourceOptions:r,fileDescriptors:A,startTime:c})])}finally{l.abort()}},wNt=(t,e)=>Promise.allSettled([t,e]);m();m();m();var DLe=require("node:timers/promises");m();var BLe=require("node:events"),yLe=require("node:stream");var fT=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bNt(e,s),QLe({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bNt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},j5=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vNt(e,s,t);let a=t.readableObjectMode&&!o;return QLe({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vNt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},QLe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=(0,BLe.on)(t,"data",{signal:e.signal,highWaterMark:ELe,highWatermark:ELe});return SNt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},Y5=(0,yLe.getDefaultHighWaterMark)(!0),ELe=Y5,SNt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=xNt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[A]of t)yield*Hd(A,a,0)}catch(A){if(!e.signal.aborted)throw A}finally{yield*kD(a)}},xNt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[rT(t,r,!e),tT(t,i,!n,{})].filter(Boolean);var wLe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:A,verboseInfo:c,streamInfo:u})=>{let l=FNt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:c,streamInfo:u});if(!i){await Promise.all([kNt(t),l]);return}let d=y5(A,r),g=j5({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:d,allMixed:a}),[p]=await Promise.all([RNt({stream:t,iterable:g,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),l]);return p},FNt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!oT({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=j5({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await T1e(a,t,r,o)},kNt=async t=>{await(0,DLe.setImmediate)(),t.readableFlowing===null&&t.resume()},RNt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await $N(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await JN(r,{maxBuffer:o})):await YN(r,{maxBuffer:o})}catch(a){return bLe(k_e({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},q5=async t=>{try{return await t}catch(e){return bLe(e)}},bLe=({bufferedData:t})=>fMe(t)?new Uint8Array(t):t;m();var SLe=require("node:stream/promises"),_D=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=NNt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],(0,SLe.finished)(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||PNt(a,e,r,n)}finally{s.abort()}},NNt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&TNt(t,r,n),n},TNt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{MNt(e,r),n.call(t,...i)}},MNt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},PNt=(t,e,r,n)=>{if(!_Nt(t,e,r,n))throw t},_Nt=(t,e,r,n=!0)=>r.propagating?vLe(t)||mT(t):(r.propagating=!0,V5(r,e)===n?vLe(t):mT(t)),V5=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",mT=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",vLe=t=>t?.code==="EPIPE";var xLe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((A,c)=>z5({stream:A,fdNumber:c,encoding:e,buffer:r[c],maxBuffer:n[c],lines:i[c],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),z5=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c})=>{if(!t)return;let u=_D(t,e,c);if(V5(c,e)){await u;return}let[l]=await Promise.all([wLe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c}),u]);return l};var FLe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?$d([t,e].filter(Boolean)):void 0,kLe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>z5({...LNt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:UNt(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),LNt=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},UNt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;m();var PLe=require("node:events");m();m();var RLe=t=>NC(t,"ipc"),NLe=(t,e)=>{let r=CN(t);wc({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var TLe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=RLe(o),a=zu(e,"ipc"),A=zu(r,"ipc");for await(let c of F5({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(R_e(t,i,A),i.push(c)),s&&NLe(c,o);return i},MLe=async(t,e)=>(await Promise.allSettled([t]),e);var _Le=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,stripFinalNewline:c,ipc:u,ipcInput:l},context:d,verboseInfo:g,fileDescriptors:p,originalStreams:f,onInternalError:h,controller:C})=>{let I=U1e(t,d),B={originalStreams:f,fileDescriptors:p,subprocess:t,exitPromise:I,propagating:!1},E=xLe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),y=kLe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),Q=[],w=TLe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:Q,verboseInfo:g}),D=ONt(f,t,B),x=GNt(p,B);try{return await Promise.race([Promise.all([{},G1e(I),Promise.all(E),y,w,i_e(t,l),...D,...x]),h,KNt(t,C),...XPe(t,o,d,C),...gPe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:d,controller:C}),...zPe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,context:d,controller:C})])}catch(v){return d.terminationReason??="other",Promise.all([{error:v},I,Promise.all(E.map(S=>q5(S))),q5(y),MLe(w,Q),Promise.allSettled(D),Promise.allSettled(x)])}},ONt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:_D(n,i,r)),GNt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>hA(o,{checkOpen:!1})&&!dA(o)).map(({type:i,value:o,stream:s=o})=>_D(s,n,e,{isSameDirection:ba.has(i),stopOnExit:i==="native"}))),KNt=async(t,{signal:e})=>{let[r]=await(0,PLe.once)(t,"error",{signal:e});throw r};m();m();var LLe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),LD=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=bc();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},jC=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};m();var OLe=require("node:stream"),GLe=require("node:util");m();var W5=require("node:stream/promises");var Z5=async t=>{if(t!==void 0)try{await X5(t)}catch{}},ULe=async t=>{if(t!==void 0)try{await eV(t)}catch{}},X5=async t=>{await(0,W5.finished)(t,{cleanup:!0,readable:!1,writable:!0})},eV=async t=>{await(0,W5.finished)(t,{cleanup:!0,readable:!0,writable:!1})},hT=async(t,e)=>{if(await t,e)throw e},CT=(t,e,r)=>{r&&!mT(r)?t.destroy(r):e&&t.destroy()};var KLe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||xs.has(r),{subprocessStdout:a,waitReadableDestroy:A}=tV(t,n,e),{readableEncoding:c,readableObjectMode:u,readableHighWaterMark:l}=rV(a,s),{read:d,onStdoutDataDone:g}=nV({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),p=new OLe.Readable({read:d,destroy:(0,GLe.callbackify)(oV.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:A})),highWaterMark:l,objectMode:u,encoding:c});return iV({subprocessStdout:a,onStdoutDataDone:g,readable:p,subprocess:t}),p},tV=(t,e,r)=>{let n=_C(t,e),i=LD(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},rV=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:Y5},nV=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=bc(),s=fT({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){HNt(this,s,o)},onStdoutDataDone:o}},HNt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},iV=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await eV(t),await n,await Z5(i),await e,r.readable&&r.push(null)}catch(o){await Z5(i),HLe(r,o)}},oV=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await jC(r,e)&&(HLe(t,n),await hT(e,n))},HLe=(t,e)=>{CT(t,t.readable,e)};m();var $Le=require("node:stream"),sV=require("node:util");var JLe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=aV(t,r,e),s=new $Le.Writable({...AV(n,t,i),destroy:(0,sV.callbackify)(uV.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cV(n,s),s},aV=(t,e,r)=>{let n=vN(t,e),i=LD(r,n,"writableFinal"),o=LD(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},AV=(t,e,r)=>({write:$Nt.bind(void 0,t),final:(0,sV.callbackify)(JNt.bind(void 0,t,e,r))}),$Nt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},JNt=async(t,e,r)=>{await jC(r,e)&&(t.writable&&t.end(),await e)},cV=async(t,e,r)=>{try{await X5(t),e.writable&&e.end()}catch(n){await ULe(r),jLe(e,n)}},uV=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await jC(r,e),await jC(n,e)&&(jLe(t,i),await hT(e,i))},jLe=(t,e)=>{CT(t,t.writable,e)};m();var YLe=require("node:stream"),qLe=require("node:util");var VLe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||xs.has(r),{subprocessStdout:A,waitReadableDestroy:c}=tV(t,n,e),{subprocessStdin:u,waitWritableFinal:l,waitWritableDestroy:d}=aV(t,i,e),{readableEncoding:g,readableObjectMode:p,readableHighWaterMark:f}=rV(A,a),{read:h,onStdoutDataDone:C}=nV({subprocessStdout:A,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),I=new YLe.Duplex({read:h,...AV(u,t,l),destroy:(0,qLe.callbackify)(jNt.bind(void 0,{subprocessStdout:A,subprocessStdin:u,subprocess:t,waitReadableDestroy:c,waitWritableFinal:l,waitWritableDestroy:d})),readableHighWaterMark:f,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:p,writableObjectMode:u.writableObjectMode,encoding:g});return iV({subprocessStdout:A,onStdoutDataDone:C,readable:I,subprocess:t,subprocessStdin:u}),cV(u,I,A),I},jNt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([oV({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),uV({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};m();var lV=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||xs.has(e),s=_C(t,r),a=fT({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return YNt(a,s,t)},YNt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var zLe=(t,{encoding:e})=>{let r=LLe();t.readable=KLe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=JLe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=VLe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lV.bind(void 0,t,e),t[Symbol.asyncIterator]=lV.bind(void 0,t,e,{})};m();var WLe=(t,e)=>{for(let[r,n]of VNt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},qNt=(async()=>{})().constructor.prototype,VNt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(qNt,t)]);var eUe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:A,verboseInfo:c,options:u,fileDescriptors:l}=zNt(t,e,r),{subprocess:d,promise:g}=ZNt({file:i,commandArguments:o,options:u,startTime:A,verboseInfo:c,command:s,escapedCommand:a,fileDescriptors:l});return d.pipe=dT.bind(void 0,{source:d,sourcePromise:g,boundOptions:{},createNested:n}),WLe(d,g),vc.set(d,{options:u,fileDescriptors:l}),d},zNt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EN(t,e,r),{file:a,commandArguments:A,options:c}=UN(t,e,r),u=WNt(c),l=tLe(u,s);return{file:a,commandArguments:A,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},WNt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},ZNt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let A;try{A=(0,XLe.spawn)(...ON(t,e,r))}catch(p){return Z1e({error:p,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let c=new AbortController;(0,ZLe.setMaxListeners)(Number.POSITIVE_INFINITY,c.signal);let u=[...A.stdio];aLe(A,a,c),uLe(A,r,c);let l={},d=bc();A.kill=cPe.bind(void 0,{kill:A.kill.bind(A),options:r,onInternalError:d,context:l,controller:c}),A.all=FLe(A,r),zLe(A,r),q1e(A,r);let g=XNt({subprocess:A,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:l,onInternalError:d,controller:c});return{subprocess:A,promise:g}},XNt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:A,onInternalError:c,controller:u})=>{let[l,[d,g],p,f,h]=await _Le({subprocess:t,options:e,context:A,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:c,controller:u});u.abort(),c.resolve();let C=p.map((E,y)=>Zu(E,e,y)),I=Zu(f,e,"all"),B=eTt({errorInfo:l,exitCode:d,signal:g,stdio:C,all:I,ipcOutput:h,context:A,options:e,command:s,escapedCommand:a,startTime:r});return GC(B,n,e)},eTt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:A,escapedCommand:c,startTime:u})=>"error"in t?xD({error:t.error,command:A,escapedCommand:c,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Sc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):VN({command:A,escapedCommand:c,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});m();var IT=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,tTt(n,t[n],i)]));return{...t,...r}},tTt=(t,e,r)=>rTt.has(t)&&Ln(e)&&Ln(r)?{...e,...r}:r,rTt=new Set(["env",...$q]);var Lg=(t,e,r,n)=>{let i=(s,a,A)=>Lg(s,a,r,A),o=(...s)=>nTt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},nTt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ln(o))return i(t,IT(r,o),n);let{file:a,commandArguments:A,options:c,isSync:u}=iTt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?$1e(a,A,c):eUe(a,A,c,i)},iTt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=yMe(e)?QMe(e,r):[e,...r],[s,a,A]=AN(...o),c=IT(IT(n,i),A),{file:u=s,commandArguments:l=a,options:d=c,isSync:g=!1}=t({file:s,commandArguments:a,options:c});return{file:u,commandArguments:l,options:d,isSync:g}};m();var tUe=({file:t,commandArguments:e})=>nUe(t,e),rUe=({file:t,commandArguments:e})=>({...nUe(t,e),isSync:!0}),nUe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=oTt(t);return{file:r,commandArguments:n}},oTt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(sTt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},sTt=/ +/g;m();var iUe=(t,e,r)=>{t.sync=e(aTt,r),t.s=t.sync},oUe=({options:t})=>sUe(t),aTt=({options:t})=>({...sUe(t),isSync:!0}),sUe=t=>({options:{...ATt(t),...t}}),ATt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},aUe={preferLocal:!0};var Gi=Lg(()=>({})),eOr=Lg(()=>({isSync:!0})),tOr=Lg(tUe),rOr=Lg(rUe),nOr=Lg(e_e),iOr=Lg(oUe,{},aUe,iUe),{sendMessage:oOr,getOneMessage:sOr,getEachMessage:aOr,getCancelSignal:AOr}=V1e();Hh();var vUe=require("../node/index.cjs");un();Gt();fk();xQ();jt();m();var Xu=require("node:fs"),gV=require("node:os"),ET=require("node:path");Jr();Zr();Sb();jt();async function YC(){try{let{stdout:t}=await Gi("git",["remote","get-url","origin"]);return t.trim()}catch{return null}}function AUe(){let t=(0,ET.join)((0,gV.homedir)(),".builder","projects.json");try{if((0,Xu.existsSync)(t)){let e=(0,Xu.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return{}}function cTt(t){let e=(0,ET.join)((0,gV.homedir)(),".builder");(0,Xu.existsSync)(e)||(0,Xu.mkdirSync)(e,{recursive:!0}),(0,Xu.writeFileSync)((0,ET.join)(e,"projects.json"),JSON.stringify(t,null,2),"utf-8")}async function cUe(){let t=await YC();return t?AUe()[t]?.pinnedProjectId??null:null}async function BT(t){let e=await YC();if(!e)return;let r=AUe();r[e]={pinnedProjectId:t},cTt(r)}function qC(t){let e=t.replace(/\.git$/,"");return e.startsWith("git@")&&(e=e.replace(/^git@/,"").replace(/:([^/])/,"/$1")),e=e.replace(/^https?:\/\//,"").replace(/^[^@]+@/,""),e.toLowerCase()}function yT(t,e){return!!(t.repoUrl&&qC(t.repoUrl)===e)}function uUe(t,e){if(yT(t,e))return!0;for(let r of t.settings?.folders??[])if(r.remoteUrl&&qC(r.remoteUrl)===e)return!0;return!1}async function lUe(t,e,r){let n=new URL("/projects",Me);n.searchParams.set("apiKey",t),n.searchParams.set("userId",r),n.searchParams.set("includeBranches","false");let i=await Pe(n,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!i.ok){let s=await i.text();throw new Error(`Failed to list projects: ${s}`)}return(await i.json()).projects??[]}async function VC(t,e,r,n){let i=new URL(`/projects/${n}`,Me);i.searchParams.set("apiKey",t),i.searchParams.set("userId",r),i.searchParams.set("includeBranches","true");let o=await Pe(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!o.ok){let s=await o.text();throw new Error(`Failed to fetch project: ${s}`)}return o.json()}function pV(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r))if(i.gitAiBranch===e)return[n,i];return null}function UD(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r)){let o=i;if(n===e||o.id===e)return o.gitAiBranch??null}return null}async function dV(t,e,r,n,i,o,s=!0){let a=new URL("/projects/branch",Me);a.searchParams.set("apiKey",t),a.searchParams.set("userId",r);let A={projectId:n,gitAiBranch:i,...s&&{checkoutBranch:i},actor:"push-command"};o&&(A.branchContext=o);let c=await Pe(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(A)});if(!c.ok){let l=await c.text();throw new Error(`Failed to create Builder branch: ${l}`)}let u;for await(let l of rm(c.body))if(l.length)try{let d=JSON.parse(l);d.branchName&&(d.type==="creating-branch"||d.type==="setting-up-container"||d.type==="branch-created")&&(u=d.branchName)}catch{}if(!u)throw new Error("Branch created but could not determine the branch name from the response.");return u}async function fV(t,e,r,n,i){let o=new URL("/projects/branch/sync",Me);o.searchParams.set("apiKey",t),o.searchParams.set("userId",r);let s=await Pe(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({projectId:n,branchName:i,syncOptions:{remoteBranches:"ai",canPush:!1,requestRefresh:!0,uncommittedChanges:"stash",fastForward:"auto"}})}),a=await s.text();if(!s.ok)throw new Error(`${s.status} ${s.statusText}: ${a}`)}async function Ug(t){let{projectId:e,builderPublicKey:r,builderPrivateKey:n,userId:i,spaceName:o,onMultipleRepoMatches:s,onNoRepoMatch:a}=t;if(e)return e;let A=await cUe();if(A)return A;let c=await lUe(r,n,i);if(c.length===0){let l=o?`"${o}" (${r})`:r;throw new Error(`No Builder.io projects found in space ${l}.
|
|
7007
|
+
if (condition) { yield value; }`)};m();var v1e=require("node:buffer"),S1e=require("node:string_decoder");var rT=(t,e,r)=>{if(r)return;if(t)return{transform:aRt.bind(void 0,new TextEncoder)};let n=new S1e.StringDecoder(e);return{transform:ARt.bind(void 0,n),final:cRt.bind(void 0,n)}},aRt=function*(t,e){v1e.Buffer.isBuffer(e)?yield Vu(e):typeof e=="string"?yield t.encode(e):yield e},ARt=function*(t,e){yield si(e)?t.write(e):e},cRt=function*(t){let e=t.end();e!==""&&(yield e)};m();var w5=require("node:util"),b5=(0,w5.callbackify)(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),nT=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=lRt}=e[r];for await(let i of n(t))yield*nT(i,e,r+1)},x1e=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*uRt(r,Number(e),t)},uRt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*nT(n,r,e+1)},F1e=(0,w5.callbackify)(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),lRt=function*(t){yield t};m();var v5=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},k1e=(t,e)=>[...e.flatMap(r=>[...Hd(r,t,0)]),...kD(t)],Hd=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=pRt}=e[r];for(let i of n(t))yield*Hd(i,e,r+1)},kD=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*gRt(r,Number(e),t)},gRt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Hd(n,r,e+1)},pRt=function*(t){yield t};var S5=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},A=R1e(t,s,o),c=Kd(e),u=Kd(r),l=c?b5.bind(void 0,nT,a):v5.bind(void 0,Hd),d=c||u?b5.bind(void 0,x1e,a):v5.bind(void 0,kD),g=c||u?F1e.bind(void 0,a):void 0;return{stream:new RD.Transform({writableObjectMode:n,writableHighWaterMark:(0,RD.getDefaultHighWaterMark)(n),readableObjectMode:i,readableHighWaterMark:(0,RD.getDefaultHighWaterMark)(i),transform(f,h,C){l([f,A,0],this,C)},flush(f){d([A],this,f)},destroy:g})}},iT=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let A=R1e(s,r,a);t=k1e(A,t)}return t},R1e=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let A={};return[{transform:D1e(n,a)},rT(r,s,n),tT(r,o,n,A),{transform:t,final:e},{transform:w1e(i,a)},y1e({binary:r,preserveNewlines:o,readableObjectMode:i,state:A})].filter(Boolean)};var N1e=(t,e)=>{for(let r of dRt(t))fRt(t,r,e)},dRt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),fRt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:A}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${A}\`, can be ${Pg[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>mRt(a,n));r.input=ED(s)},mRt=(t,e)=>{let r=iT(t,e,"utf8",!0);return hRt(r),ED(r)},hRt=t=>{let e=t.find(r=>typeof r!="string"&&!si(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};m();var sT=require("node:fs");m();var oT=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&NC(r,n)&&!xs.has(e)&&CRt(n)&&(t.some(({type:i,value:o})=>i==="native"&&IRt.has(o))||t.every(({type:i})=>ba.has(i))),CRt=t=>t===1||t===2,IRt=new Set(["pipe","overlapped"]),T1e=async(t,e,r,n)=>{for await(let i of t)ERt(e)||P1e(i,r,n)},M1e=(t,e,r)=>{for(let n of t)P1e(n,e,r)},ERt=t=>t._readableState.pipes.length>0,P1e=(t,e,r)=>{let n=CN(t);wc({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var _1e=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((A,c)=>BRt({result:A,fileDescriptors:t,fdNumber:c,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},BRt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:A,lines:c,stripFinalNewline:u,maxBuffer:l})=>{if(t===null)return;let d=M_e(t,o,l),g=Vu(d),{stdioItems:p,objectMode:f}=e[r],h=yRt([g],p,A,n),{serializedResult:C,finalResult:I=C}=QRt({chunks:h,objectMode:f,encoding:A,lines:c,stripFinalNewline:u,fdNumber:r});DRt({serializedResult:C,fdNumber:r,state:n,verboseInfo:s,encoding:A,stdioItems:p,objectMode:f});let B=a[r]?I:void 0;try{return n.error===void 0&&wRt(C,p,i),B}catch(E){return n.error=E,B}},yRt=(t,e,r,n)=>{try{return iT(t,e,r,!1)}catch(i){return n.error=i,t}},QRt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:ED(t)};let s=hMe(t,r);return n[o]?{serializedResult:s,finalResult:D5(s,!i[o],e)}:{serializedResult:s}},DRt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!oT({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=D5(t,!1,s);try{M1e(a,e,n)}catch(A){r.error??=A}},wRt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>ZN.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?(0,sT.appendFileSync)(n,t):(r.add(o),(0,sT.writeFileSync)(n,t))}};m();var L1e=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Zu(e,r,"all")]:Array.isArray(e)?[Zu(t,r,"all"),...e]:si(t)&&si(e)?Gq([t,e]):`${t}${e}`};m();m();var aT=require("node:events");var U1e=async(t,e)=>{let[r,n]=await bRt(t);return e.isForcefullyTerminated??=!1,[r,n]},bRt=async t=>{let[e,r]=await Promise.allSettled([(0,aT.once)(t,"spawn"),(0,aT.once)(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?O1e(t):r.value},O1e=async t=>{try{return await(0,aT.once)(t,"exit")}catch{return O1e(t)}},G1e=async t=>{let[e,r]=await t;if(!vRt(e,r)&&x5(e,r))throw new fA;return[e,r]},vRt=(t,e)=>t===void 0&&e===void 0,x5=(t,e)=>t!==0||e!==null;var K1e=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=SRt(t,e,r),s=o?.code==="ETIMEDOUT",a=T_e(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},SRt=(t,e,r)=>t!==void 0?t:x5(e,r)?new fA:void 0;var $1e=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:A,options:c,fileDescriptors:u}=xRt(t,e,r),l=RRt({file:n,commandArguments:i,options:c,command:o,escapedCommand:s,verboseInfo:A,fileDescriptors:u,startTime:a});return GC(l,A,c)},xRt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EN(t,e,r),a=FRt(r),{file:A,commandArguments:c,options:u}=UN(t,e,a);kRt(u);let l=C1e(u,s);return{file:A,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},FRt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,kRt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&AT("ipcInput"),t&&AT("ipc: true"),r&&AT("detached: true"),n&&AT("cancelSignal")},AT=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},RRt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let A=NRt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(A.failed)return A;let{resultError:c,exitCode:u,signal:l,timedOut:d,isMaxBuffer:g}=K1e(A,r),{output:p,error:f=c}=_1e({fileDescriptors:s,syncResult:A,options:r,isMaxBuffer:g,verboseInfo:o}),h=p.map((I,B)=>Zu(I,r,B)),C=Zu(L1e(p,r),r,"all");return MRt({error:f,exitCode:u,signal:l,timedOut:d,isMaxBuffer:g,stdio:h,all:C,options:r,command:n,escapedCommand:i,startTime:a})},NRt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{N1e(o,r);let a=TRt(r);return(0,H1e.spawnSync)(...ON(t,e,a))}catch(a){return OC({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},TRt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:qN(e)}),MRt=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:A,escapedCommand:c,startTime:u})=>t===void 0?VN({command:A,escapedCommand:c,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):xD({error:t,command:A,escapedCommand:c,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});m();var ZLe=require("node:events"),XLe=require("node:child_process");m();var k5=W(require("node:process"),1);m();var HC=require("node:events");var J1e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(MC({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:RN(t)}),PRt({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),PRt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{SN(e,i);let o=Mg(t,e,r),s=new AbortController;try{return await Promise.race([_Rt(o,n,s),LRt(o,r,s),URt(o,r,s)])}catch(a){throw PC(t),a}finally{s.abort(),xN(e,i)}},_Rt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await(0,HC.once)(t,"message",{signal:r});return n}for await(let[n]of(0,HC.on)(t,"message",{signal:r}))if(e(n))return n},LRt=async(t,e,{signal:r})=>{await(0,HC.once)(t,"disconnect",{signal:r}),pPe(e)},URt=async(t,e,{signal:r})=>{let[n]=await(0,HC.once)(t,"strict:error",{signal:r});throw wN(n,e)};m();var ND=require("node:events");var Y1e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>F5({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),F5=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{MC({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:RN(t)}),SN(e,o);let s=Mg(t,e,r),a=new AbortController,A={};return ORt(t,s,a),GRt({ipcEmitter:s,isSubprocess:r,controller:a,state:A}),KRt({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:A,reference:o})},ORt=async(t,e,r)=>{try{await(0,ND.once)(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},GRt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await(0,ND.once)(t,"strict:error",{signal:r.signal});n.error=wN(i,e),r.abort()}catch{}},KRt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[A]of(0,ND.on)(r,"message",{signal:o.signal}))j1e(s),yield A}catch{j1e(s)}finally{o.abort(),xN(e,a),n||PC(t),i&&await t}},j1e=({error:t})=>{if(t)throw t};var q1e=(t,{ipc:e})=>{Object.assign(t,z1e(t,!1,e))},V1e=()=>{let t=k5.default,e=!0,r=k5.default.channel!==void 0;return{...z1e(t,e,r),getCancelSignal:YPe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},z1e=(t,e,r)=>({sendMessage:PN.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:J1e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Y1e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});m();var W1e=require("node:child_process"),_g=require("node:stream");var Z1e=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{E5(n);let a=new W1e.ChildProcess;HRt(a,n),Object.assign(a,{readable:$Rt,writable:JRt,duplex:jRt});let A=OC({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),c=YRt(A,s,i);return{subprocess:a,promise:c}},HRt=(t,e)=>{let r=TD(),n=TD(),i=TD(),o=Array.from({length:e.length-3},TD),s=TD(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},TD=()=>{let t=new _g.PassThrough;return t.end(),t},$Rt=()=>new _g.Readable({read(){}}),JRt=()=>new _g.Writable({write(){}}),jRt=()=>new _g.Duplex({read(){},write(){}}),YRt=async(t,e,r)=>GC(t,e,r);m();var $C=require("node:fs"),eLe=require("node:buffer"),Fc=require("node:stream");var tLe=(t,e)=>eT(qRt,t,e,!1),MD=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Pg[t]}.`)},X1e={fileNumber:MD,generator:S5,asyncGenerator:S5,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Fc.Duplex.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},qRt={input:{...X1e,fileUrl:({value:t})=>({stream:(0,$C.createReadStream)(t)}),filePath:({value:{file:t}})=>({stream:(0,$C.createReadStream)(t)}),webStream:({value:t})=>({stream:Fc.Readable.fromWeb(t)}),iterable:({value:t})=>({stream:Fc.Readable.from(t)}),asyncIterable:({value:t})=>({stream:Fc.Readable.from(t)}),string:({value:t})=>({stream:Fc.Readable.from(t)}),uint8Array:({value:t})=>({stream:Fc.Readable.from(eLe.Buffer.from(t))})},output:{...X1e,fileUrl:({value:t})=>({stream:(0,$C.createWriteStream)(t)}),filePath:({value:{file:t,append:e}})=>({stream:(0,$C.createWriteStream)(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Fc.Writable.fromWeb(t)}),iterable:MD,asyncIterable:MD,string:MD,uint8Array:MD}};m();m();var PD=require("node:events"),uT=require("node:stream"),T5=require("node:stream/promises");function $d(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)N5(i);let e=t.some(({readableObjectMode:i})=>i),r=VRt(t,e),n=new R5({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var VRt=(t,e)=>{if(t.length===0)return(0,uT.getDefaultHighWaterMark)(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},R5=class extends uT.PassThrough{#n=new Set([]);#c=new Set([]);#o=new Set([]);#t;#A=Symbol("unpipe");#i=new WeakMap;add(e){if(N5(e),this.#n.has(e))return;this.#n.add(e),this.#t??=zRt(this,this.#n,this.#A);let r=XRt({passThroughStream:this,stream:e,streams:this.#n,ended:this.#c,aborted:this.#o,onFinished:this.#t,unpipeEvent:this.#A});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(N5(e),!this.#n.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},zRt=async(t,e,r)=>{cT(t,rLe);let n=new AbortController;try{await Promise.race([WRt(t,n),ZRt(t,e,r,n)])}finally{n.abort(),cT(t,-rLe)}},WRt=async(t,{signal:e})=>{try{await(0,T5.finished)(t,{signal:e,cleanup:!0})}catch(r){throw iLe(t,r),r}},ZRt=async(t,e,r,{signal:n})=>{for await(let[i]of(0,PD.on)(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},N5=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},XRt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{cT(t,nLe);let a=new AbortController;try{await Promise.race([eNt(o,e,a),tNt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),rNt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),cT(t,-nLe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?M5(t):nNt(t))},eNt=async(t,e,{signal:r})=>{try{await t,r.aborted||M5(e)}catch(n){r.aborted||iLe(e,n)}},tNt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await(0,T5.finished)(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;oLe(s)?i.add(e):sLe(t,s)}},rNt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await(0,PD.once)(t,i,{signal:o}),!t.readable)return(0,PD.once)(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},nNt=t=>{t.writable&&t.end()},iLe=(t,e)=>{oLe(e)?M5(t):sLe(t,e)},oLe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",M5=t=>{(t.readable||t.writable)&&t.destroy()},sLe=(t,e)=>{t.destroyed||(t.once("error",iNt),t.destroy(e))},iNt=()=>{},cT=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},rLe=2,nLe=1;m();var P5=require("node:stream/promises");var JC=(t,e)=>{t.pipe(e),oNt(t,e),sNt(t,e)},oNt=async(t,e)=>{if(!(dA(t)||dA(e))){try{await(0,P5.finished)(t,{cleanup:!0,readable:!0,writable:!1})}catch{}_5(e)}},_5=t=>{t.writable&&t.end()},sNt=async(t,e)=>{if(!(dA(t)||dA(e))){try{await(0,P5.finished)(e,{cleanup:!0,readable:!1,writable:!0})}catch{}L5(t)}},L5=t=>{t.readable&&t.destroy()};var aLe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:A})=>ba.has(A)))aNt(t,a,s,i);for(let{stream:a}of o.filter(({type:A})=>!ba.has(A)))cNt({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:$d(o);JC(s,i)}},aNt=(t,e,r,n)=>{r==="output"?JC(t.stdio[n],e):JC(e,t.stdio[n]);let i=ANt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},ANt=["stdin","stdout","stderr"],cNt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;uNt(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],A=i.get(s)??[];i.set(s,[...A,a])},uNt=(t,{signal:e})=>{dA(t)&&Gd(t,lNt,e)},lNt=2;m();var cLe=require("node:events");m();m();var Jd=[];Jd.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Jd.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jd.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var lT=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",U5=Symbol.for("signal-exit emitter"),O5=globalThis,gNt=Object.defineProperty.bind(Object),G5=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(O5[U5])return O5[U5];gNt(O5,U5,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},gT=class{},pNt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),K5=class extends gT{onExit(){return()=>{}}load(){}unload(){}},H5=class extends gT{#n=$5.platform==="win32"?"SIGINT":"SIGHUP";#c=new G5;#o;#t;#A;#i={};#e=!1;constructor(e){super(),this.#o=e,this.#i={};for(let r of Jd)this.#i[r]=()=>{let n=this.#o.listeners(r),{count:i}=this.#c,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#c.emit("exit",null,r),a=r==="SIGHUP"?this.#n:r;s||e.kill(e.pid,a)}};this.#A=e.reallyExit,this.#t=e.emit}onExit(e,r){if(!lT(this.#o))return()=>{};this.#e===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#c.on(n,e),()=>{this.#c.removeListener(n,e),this.#c.listeners.exit.length===0&&this.#c.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#e){this.#e=!0,this.#c.count+=1;for(let e of Jd)try{let r=this.#i[e];r&&this.#o.on(e,r)}catch{}this.#o.emit=(e,...r)=>this.#E(e,...r),this.#o.reallyExit=e=>this.#s(e)}}unload(){this.#e&&(this.#e=!1,Jd.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#o.removeListener(e,r)}catch{}}),this.#o.emit=this.#t,this.#o.reallyExit=this.#A,this.#c.count-=1)}#s(e){return lT(this.#o)?(this.#o.exitCode=e||0,this.#c.emit("exit",this.#o.exitCode,null),this.#A.call(this.#o,this.#o.exitCode)):0}#E(e,...r){let n=this.#t;if(e==="exit"&&lT(this.#o)){typeof r[0]=="number"&&(this.#o.exitCode=r[0]);let i=n.call(this.#o,e,...r);return this.#c.emit("exit",this.#o.exitCode,null),i}else return n.call(this.#o,e,...r)}},$5=globalThis.process,{onExit:ALe,load:Z1r,unload:X1r}=pNt(lT($5)?new H5($5):new K5);var uLe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ALe(()=>{t.kill()});(0,cLe.addAbortListener)(n,()=>{i()})};m();m();var gLe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=IN(),{destination:s,destinationStream:a,destinationError:A,from:c,unpipeSignal:u}=dNt(r,n,i),{sourceStream:l,sourceError:d}=mNt(t,c),{options:g,fileDescriptors:p}=vc.get(t);return{sourcePromise:e,sourceStream:l,sourceOptions:g,sourceError:d,destination:s,destinationStream:a,destinationError:A,unpipeSignal:u,fileDescriptors:p,startTime:o}},dNt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=fNt(t,e,...r),a=vN(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},fNt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(lLe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||Uq(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=AN(r,...n);return{destination:e(lLe)(i,o,s),pipeOptions:s}}if(vc.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},lLe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),mNt=(t,e)=>{try{return{sourceStream:_C(t,e)}}catch(r){return{sourceError:r}}};m();var dLe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=hNt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw J5({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},hNt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return L5(t),n;if(e!==void 0)return _5(r),e},J5=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>OC({error:t,command:pLe,escapedCommand:pLe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),pLe="source.pipe(destination)";m();var fLe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};m();var mLe=require("node:stream/promises");var hLe=(t,e,r)=>{let n=pT.has(e)?INt(t,e):CNt(t,e);return Gd(t,BNt,r.signal),Gd(e,yNt,r.signal),ENt(e),n},CNt=(t,e)=>{let r=$d([t]);return JC(r,e),pT.set(e,r),r},INt=(t,e)=>{let r=pT.get(e);return r.add(t),r},ENt=async t=>{try{await(0,mLe.finished)(t,{cleanup:!0,readable:!1,writable:!0})}catch{}pT.delete(t)},pT=new WeakMap,BNt=2,yNt=1;m();var CLe=require("node:util");var ILe=(t,e)=>t===void 0?[]:[QNt(t,e)],QNt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await(0,CLe.aborted)(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw J5({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var dT=(t,...e)=>{if(Ln(e[0]))return dT.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=gLe(t,...e),i=DNt({...n,destination:r});return i.pipe=dT.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},DNt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:A,startTime:c})=>{let u=wNt(t,i);dLe({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:A,sourceOptions:r,startTime:c});let l=new AbortController;try{let d=hLe(e,o,l);return await Promise.race([fLe(u),...ILe(a,{sourceStream:e,mergedStream:d,sourceOptions:r,fileDescriptors:A,startTime:c})])}finally{l.abort()}},wNt=(t,e)=>Promise.allSettled([t,e]);m();m();m();var DLe=require("node:timers/promises");m();var BLe=require("node:events"),yLe=require("node:stream");var fT=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bNt(e,s),QLe({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bNt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},j5=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vNt(e,s,t);let a=t.readableObjectMode&&!o;return QLe({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vNt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},QLe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=(0,BLe.on)(t,"data",{signal:e.signal,highWaterMark:ELe,highWatermark:ELe});return SNt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},Y5=(0,yLe.getDefaultHighWaterMark)(!0),ELe=Y5,SNt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=xNt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[A]of t)yield*Hd(A,a,0)}catch(A){if(!e.signal.aborted)throw A}finally{yield*kD(a)}},xNt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[rT(t,r,!e),tT(t,i,!n,{})].filter(Boolean);var wLe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:A,verboseInfo:c,streamInfo:u})=>{let l=FNt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:c,streamInfo:u});if(!i){await Promise.all([kNt(t),l]);return}let d=y5(A,r),g=j5({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:d,allMixed:a}),[p]=await Promise.all([RNt({stream:t,iterable:g,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),l]);return p},FNt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!oT({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=j5({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await T1e(a,t,r,o)},kNt=async t=>{await(0,DLe.setImmediate)(),t.readableFlowing===null&&t.resume()},RNt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await $N(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await JN(r,{maxBuffer:o})):await YN(r,{maxBuffer:o})}catch(a){return bLe(k_e({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},q5=async t=>{try{return await t}catch(e){return bLe(e)}},bLe=({bufferedData:t})=>fMe(t)?new Uint8Array(t):t;m();var SLe=require("node:stream/promises"),_D=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=NNt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],(0,SLe.finished)(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||PNt(a,e,r,n)}finally{s.abort()}},NNt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&TNt(t,r,n),n},TNt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{MNt(e,r),n.call(t,...i)}},MNt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},PNt=(t,e,r,n)=>{if(!_Nt(t,e,r,n))throw t},_Nt=(t,e,r,n=!0)=>r.propagating?vLe(t)||mT(t):(r.propagating=!0,V5(r,e)===n?vLe(t):mT(t)),V5=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",mT=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",vLe=t=>t?.code==="EPIPE";var xLe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((A,c)=>z5({stream:A,fdNumber:c,encoding:e,buffer:r[c],maxBuffer:n[c],lines:i[c],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),z5=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c})=>{if(!t)return;let u=_D(t,e,c);if(V5(c,e)){await u;return}let[l]=await Promise.all([wLe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c}),u]);return l};var FLe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?$d([t,e].filter(Boolean)):void 0,kLe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>z5({...LNt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:UNt(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),LNt=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},UNt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;m();var PLe=require("node:events");m();m();var RLe=t=>NC(t,"ipc"),NLe=(t,e)=>{let r=CN(t);wc({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var TLe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=RLe(o),a=zu(e,"ipc"),A=zu(r,"ipc");for await(let c of F5({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(R_e(t,i,A),i.push(c)),s&&NLe(c,o);return i},MLe=async(t,e)=>(await Promise.allSettled([t]),e);var _Le=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,stripFinalNewline:c,ipc:u,ipcInput:l},context:d,verboseInfo:g,fileDescriptors:p,originalStreams:f,onInternalError:h,controller:C})=>{let I=U1e(t,d),B={originalStreams:f,fileDescriptors:p,subprocess:t,exitPromise:I,propagating:!1},E=xLe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),y=kLe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),Q=[],w=TLe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:Q,verboseInfo:g}),D=ONt(f,t,B),x=GNt(p,B);try{return await Promise.race([Promise.all([{},G1e(I),Promise.all(E),y,w,i_e(t,l),...D,...x]),h,KNt(t,C),...XPe(t,o,d,C),...gPe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:d,controller:C}),...zPe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,context:d,controller:C})])}catch(v){return d.terminationReason??="other",Promise.all([{error:v},I,Promise.all(E.map(S=>q5(S))),q5(y),MLe(w,Q),Promise.allSettled(D),Promise.allSettled(x)])}},ONt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:_D(n,i,r)),GNt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>hA(o,{checkOpen:!1})&&!dA(o)).map(({type:i,value:o,stream:s=o})=>_D(s,n,e,{isSameDirection:ba.has(i),stopOnExit:i==="native"}))),KNt=async(t,{signal:e})=>{let[r]=await(0,PLe.once)(t,"error",{signal:e});throw r};m();m();var LLe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),LD=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=bc();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},jC=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};m();var OLe=require("node:stream"),GLe=require("node:util");m();var W5=require("node:stream/promises");var Z5=async t=>{if(t!==void 0)try{await X5(t)}catch{}},ULe=async t=>{if(t!==void 0)try{await eV(t)}catch{}},X5=async t=>{await(0,W5.finished)(t,{cleanup:!0,readable:!1,writable:!0})},eV=async t=>{await(0,W5.finished)(t,{cleanup:!0,readable:!0,writable:!1})},hT=async(t,e)=>{if(await t,e)throw e},CT=(t,e,r)=>{r&&!mT(r)?t.destroy(r):e&&t.destroy()};var KLe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||xs.has(r),{subprocessStdout:a,waitReadableDestroy:A}=tV(t,n,e),{readableEncoding:c,readableObjectMode:u,readableHighWaterMark:l}=rV(a,s),{read:d,onStdoutDataDone:g}=nV({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),p=new OLe.Readable({read:d,destroy:(0,GLe.callbackify)(oV.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:A})),highWaterMark:l,objectMode:u,encoding:c});return iV({subprocessStdout:a,onStdoutDataDone:g,readable:p,subprocess:t}),p},tV=(t,e,r)=>{let n=_C(t,e),i=LD(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},rV=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:Y5},nV=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=bc(),s=fT({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){HNt(this,s,o)},onStdoutDataDone:o}},HNt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},iV=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await eV(t),await n,await Z5(i),await e,r.readable&&r.push(null)}catch(o){await Z5(i),HLe(r,o)}},oV=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await jC(r,e)&&(HLe(t,n),await hT(e,n))},HLe=(t,e)=>{CT(t,t.readable,e)};m();var $Le=require("node:stream"),sV=require("node:util");var JLe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=aV(t,r,e),s=new $Le.Writable({...AV(n,t,i),destroy:(0,sV.callbackify)(uV.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cV(n,s),s},aV=(t,e,r)=>{let n=vN(t,e),i=LD(r,n,"writableFinal"),o=LD(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},AV=(t,e,r)=>({write:$Nt.bind(void 0,t),final:(0,sV.callbackify)(JNt.bind(void 0,t,e,r))}),$Nt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},JNt=async(t,e,r)=>{await jC(r,e)&&(t.writable&&t.end(),await e)},cV=async(t,e,r)=>{try{await X5(t),e.writable&&e.end()}catch(n){await ULe(r),jLe(e,n)}},uV=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await jC(r,e),await jC(n,e)&&(jLe(t,i),await hT(e,i))},jLe=(t,e)=>{CT(t,t.writable,e)};m();var YLe=require("node:stream"),qLe=require("node:util");var VLe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||xs.has(r),{subprocessStdout:A,waitReadableDestroy:c}=tV(t,n,e),{subprocessStdin:u,waitWritableFinal:l,waitWritableDestroy:d}=aV(t,i,e),{readableEncoding:g,readableObjectMode:p,readableHighWaterMark:f}=rV(A,a),{read:h,onStdoutDataDone:C}=nV({subprocessStdout:A,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),I=new YLe.Duplex({read:h,...AV(u,t,l),destroy:(0,qLe.callbackify)(jNt.bind(void 0,{subprocessStdout:A,subprocessStdin:u,subprocess:t,waitReadableDestroy:c,waitWritableFinal:l,waitWritableDestroy:d})),readableHighWaterMark:f,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:p,writableObjectMode:u.writableObjectMode,encoding:g});return iV({subprocessStdout:A,onStdoutDataDone:C,readable:I,subprocess:t,subprocessStdin:u}),cV(u,I,A),I},jNt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([oV({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),uV({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};m();var lV=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||xs.has(e),s=_C(t,r),a=fT({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return YNt(a,s,t)},YNt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var zLe=(t,{encoding:e})=>{let r=LLe();t.readable=KLe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=JLe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=VLe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lV.bind(void 0,t,e),t[Symbol.asyncIterator]=lV.bind(void 0,t,e,{})};m();var WLe=(t,e)=>{for(let[r,n]of VNt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},qNt=(async()=>{})().constructor.prototype,VNt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(qNt,t)]);var eUe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:A,verboseInfo:c,options:u,fileDescriptors:l}=zNt(t,e,r),{subprocess:d,promise:g}=ZNt({file:i,commandArguments:o,options:u,startTime:A,verboseInfo:c,command:s,escapedCommand:a,fileDescriptors:l});return d.pipe=dT.bind(void 0,{source:d,sourcePromise:g,boundOptions:{},createNested:n}),WLe(d,g),vc.set(d,{options:u,fileDescriptors:l}),d},zNt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EN(t,e,r),{file:a,commandArguments:A,options:c}=UN(t,e,r),u=WNt(c),l=tLe(u,s);return{file:a,commandArguments:A,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},WNt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},ZNt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let A;try{A=(0,XLe.spawn)(...ON(t,e,r))}catch(p){return Z1e({error:p,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let c=new AbortController;(0,ZLe.setMaxListeners)(Number.POSITIVE_INFINITY,c.signal);let u=[...A.stdio];aLe(A,a,c),uLe(A,r,c);let l={},d=bc();A.kill=cPe.bind(void 0,{kill:A.kill.bind(A),options:r,onInternalError:d,context:l,controller:c}),A.all=FLe(A,r),zLe(A,r),q1e(A,r);let g=XNt({subprocess:A,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:l,onInternalError:d,controller:c});return{subprocess:A,promise:g}},XNt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:A,onInternalError:c,controller:u})=>{let[l,[d,g],p,f,h]=await _Le({subprocess:t,options:e,context:A,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:c,controller:u});u.abort(),c.resolve();let C=p.map((E,y)=>Zu(E,e,y)),I=Zu(f,e,"all"),B=eTt({errorInfo:l,exitCode:d,signal:g,stdio:C,all:I,ipcOutput:h,context:A,options:e,command:s,escapedCommand:a,startTime:r});return GC(B,n,e)},eTt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:A,escapedCommand:c,startTime:u})=>"error"in t?xD({error:t.error,command:A,escapedCommand:c,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Sc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):VN({command:A,escapedCommand:c,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});m();var IT=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,tTt(n,t[n],i)]));return{...t,...r}},tTt=(t,e,r)=>rTt.has(t)&&Ln(e)&&Ln(r)?{...e,...r}:r,rTt=new Set(["env",...$q]);var Lg=(t,e,r,n)=>{let i=(s,a,A)=>Lg(s,a,r,A),o=(...s)=>nTt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},nTt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ln(o))return i(t,IT(r,o),n);let{file:a,commandArguments:A,options:c,isSync:u}=iTt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?$1e(a,A,c):eUe(a,A,c,i)},iTt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=yMe(e)?QMe(e,r):[e,...r],[s,a,A]=AN(...o),c=IT(IT(n,i),A),{file:u=s,commandArguments:l=a,options:d=c,isSync:g=!1}=t({file:s,commandArguments:a,options:c});return{file:u,commandArguments:l,options:d,isSync:g}};m();var tUe=({file:t,commandArguments:e})=>nUe(t,e),rUe=({file:t,commandArguments:e})=>({...nUe(t,e),isSync:!0}),nUe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=oTt(t);return{file:r,commandArguments:n}},oTt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(sTt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},sTt=/ +/g;m();var iUe=(t,e,r)=>{t.sync=e(aTt,r),t.s=t.sync},oUe=({options:t})=>sUe(t),aTt=({options:t})=>({...sUe(t),isSync:!0}),sUe=t=>({options:{...ATt(t),...t}}),ATt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},aUe={preferLocal:!0};var Gi=Lg(()=>({})),eOr=Lg(()=>({isSync:!0})),tOr=Lg(tUe),rOr=Lg(rUe),nOr=Lg(e_e),iOr=Lg(oUe,{},aUe,iUe),{sendMessage:oOr,getOneMessage:sOr,getEachMessage:aOr,getCancelSignal:AOr}=V1e();Hh();var vUe=require("../node/index.cjs");un();Gt();fk();xQ();jt();m();var Xu=require("node:fs"),gV=require("node:os"),ET=require("node:path");Jr();Zr();Sb();jt();async function YC(){try{let{stdout:t}=await Gi("git",["remote","get-url","origin"]);return t.trim()}catch{return null}}function AUe(){let t=(0,ET.join)((0,gV.homedir)(),".builder","projects.json");try{if((0,Xu.existsSync)(t)){let e=(0,Xu.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return{}}function cTt(t){let e=(0,ET.join)((0,gV.homedir)(),".builder");(0,Xu.existsSync)(e)||(0,Xu.mkdirSync)(e,{recursive:!0}),(0,Xu.writeFileSync)((0,ET.join)(e,"projects.json"),JSON.stringify(t,null,2),"utf-8")}async function cUe(){let t=await YC();return t?AUe()[t]?.pinnedProjectId??null:null}async function BT(t){let e=await YC();if(!e)return;let r=AUe();r[e]={pinnedProjectId:t},cTt(r)}function qC(t){let e=t.replace(/\.git$/,"");return e.startsWith("git@")&&(e=e.replace(/^git@/,"").replace(/:([^/])/,"/$1")),e=e.replace(/^https?:\/\//,"").replace(/^[^@]+@/,""),e.toLowerCase()}function yT(t,e){return!!(t.repoUrl&&qC(t.repoUrl)===e)}function uUe(t,e){if(yT(t,e))return!0;for(let r of t.settings?.folders??[])if(r.remoteUrl&&qC(r.remoteUrl)===e)return!0;return!1}async function lUe(t,e,r){let n=new URL("/projects",Pe);n.searchParams.set("apiKey",t),n.searchParams.set("userId",r),n.searchParams.set("includeBranches","false");let i=await Me(n,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!i.ok){let s=await i.text();throw new Error(`Failed to list projects: ${s}`)}return(await i.json()).projects??[]}async function VC(t,e,r,n){let i=new URL(`/projects/${n}`,Pe);i.searchParams.set("apiKey",t),i.searchParams.set("userId",r),i.searchParams.set("includeBranches","true");let o=await Me(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!o.ok){let s=await o.text();throw new Error(`Failed to fetch project: ${s}`)}return o.json()}function pV(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r))if(i.gitAiBranch===e)return[n,i];return null}function UD(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r)){let o=i;if(n===e||o.id===e)return o.gitAiBranch??null}return null}async function dV(t,e,r,n,i,o,s=!0){let a=new URL("/projects/branch",Pe);a.searchParams.set("apiKey",t),a.searchParams.set("userId",r);let A={projectId:n,gitAiBranch:i,...s&&{checkoutBranch:i},actor:"push-command"};o&&(A.branchContext=o);let c=await Me(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(A)});if(!c.ok){let l=await c.text();throw new Error(`Failed to create Builder branch: ${l}`)}let u;for await(let l of rm(c.body))if(l.length)try{let d=JSON.parse(l);d.branchName&&(d.type==="creating-branch"||d.type==="setting-up-container"||d.type==="branch-created")&&(u=d.branchName)}catch{}if(!u)throw new Error("Branch created but could not determine the branch name from the response.");return u}async function fV(t,e,r,n,i){let o=new URL("/projects/branch/sync",Pe);o.searchParams.set("apiKey",t),o.searchParams.set("userId",r);let s=await Me(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({projectId:n,branchName:i,syncOptions:{remoteBranches:"ai",canPush:!1,requestRefresh:!0,uncommittedChanges:"stash",fastForward:"auto"}})}),a=await s.text();if(!s.ok)throw new Error(`${s.status} ${s.statusText}: ${a}`)}async function Ug(t){let{projectId:e,builderPublicKey:r,builderPrivateKey:n,userId:i,spaceName:o,onMultipleRepoMatches:s,onNoRepoMatch:a}=t;if(e)return e;let A=await cUe();if(A)return A;let c=await lUe(r,n,i);if(c.length===0){let l=o?`"${o}" (${r})`:r;throw new Error(`No Builder.io projects found in space ${l}.
|
|
7008
7008
|
|
|
7009
7009
|
Make sure you are authenticated to the correct space.
|
|
7010
7010
|
To switch spaces or re-authenticate, run:
|
|
@@ -7013,7 +7013,7 @@ To switch spaces or re-authenticate, run:
|
|
|
7013
7013
|
|
|
7014
7014
|
To create a new project, visit https://builder.io/app/projects.`)}if(c.length===1)return c[0].id;let u=await YC();if(u){let l=qC(u),d=c.filter(g=>uUe(g,l));if(d.length===1)return d[0].id;if(d.length>1)return s(d)}return a(c)}m();za();async function QT(t,e,r,n){n.onGitPushing(e);try{await Gi("git",["push","origin",e])}catch(u){throw new Error(`git push failed: ${Bg(u)}`)}n.onGitPushed(e),n.onBranchLookupStart();let i=await VC(t.builderPublicKey,t.builderPrivateKey,t.userId,r),o=await YC(),s=!o||!i.repoUrl||yT(i,qC(o)),a=pV(i,e),A;if(a)A=a[0],n.onBranchFound(A);else{n.onBranchCreating();let u;try{let{stdout:l}=await Gi("git",["remote","show","origin"]),g=l.match(/HEAD branch: (.+)/)?.[1]?.trim();if(g){let{stdout:p}=await Gi("git",["diff",`origin/${g}...HEAD`]);p.trim()&&(u=p.slice(0,1e4))}}catch{}A=await dV(t.builderPublicKey,t.builderPrivateKey,t.userId,r,e,u,s),n.onBranchCreated(A)}await BT(r);try{await fV(t.builderPublicKey,t.builderPrivateKey,t.userId,r,A),n.onSyncDone()}catch(u){let l=u instanceof Error?u.message:String(u);n.onSyncWarning(l)}let c=`https://builder.io/app/projects/${r}/${A}`;return{builderBranchName:A,projectId:r,branchUrl:c}}async function DT(t,e,r,n){n.onBranchResolving(r);let i=await VC(t.builderPublicKey,t.builderPrivateKey,t.userId,e),o=UD(i,r);if(!o)throw new Error(`No Builder branch matching "${r}" was found in project "${e}".`);n.onBranchResolved(o),n.onFetchStart(o);let s=!0;try{await Gi("git",["fetch","origin",o]),n.onFetchDone(o)}catch(A){let c=Bg(A).toLowerCase();if(!(c.includes("couldn't find remote ref")||c.includes("remote ref does not exist")||c.includes("no such ref was fetched")))throw new Error(`git fetch failed: ${Bg(A)}`);s=!1,n.onFetchFailed(o)}n.onCheckoutStart(o);try{await Gi("git",["checkout",o])}catch{let A=s?["checkout","-b",o,`origin/${o}`]:["checkout","-b",o];try{await Gi("git",A)}catch(c){throw new Error(`git checkout failed: ${Bg(c)}`)}}n.onCheckoutDone(o);let a=!1;if(s){n.onPullStart();let{stdout:A}=await Gi("git",["rev-parse","HEAD"]);try{await Gi("git",["pull","origin",o])}catch(u){throw new Error(`git pull failed: ${Bg(u)}`)}let{stdout:c}=await Gi("git",["rev-parse","HEAD"]);a=A.trim()!==c.trim(),n.onPullDone(r,a)}else n.onNoRemote(o);return await BT(e),{gitBranch:o,hadChanges:a}}za();Zr();vQ();Jr();Vi();Dp();m();m();m();var gUe={"builder.io":"https://www.builder.io","builder.codes":"https://test.projects.builder.codes/proxy-health","api.builder.io":"https://api.builder.io/codegen/health","cdn.builder.io":"https://cdn.builder.io/api/v1/image/assets/TEMP/75a212ab82b6175c9862b125e0e23db8d369a58a?width=100","health.builderio.xyz":"https://health.builderio.xyz/health","health.builderio.xyz:ws":"wss://health.builderio.xyz/ws","health.builderio.dev":"https://health.builderio.dev/health","health.builderio.dev:ws":"wss://health.builderio.dev/ws","fly.dev":"https://fly.dev"};function wT(t,e){if(t.startsWith("git-host:")){if(!e)throw new Error(`gitHost parameter is required for test "${t}"`);return e}let r=gUe[t];if(!r)throw new Error(`Unknown testId: ${t}`);return r}function zC(t){try{return new URL(t).hostname}catch{return t}}function mV(t,e){try{let r=new URL(t);if(r.port)return parseInt(r.port,10);let n=r.protocol==="https:"?443:r.protocol==="http:"?80:null,i=t.slice(t.indexOf("://")+3).split(/[/?#]/)[0];return n!==null&&i.endsWith(`:${n}`)?n:e}catch{return e}}function bT(t,e=443){try{let r=new URL(t);if(r.protocol==="http:"&&!r.port)return 80}catch{}return mV(t,e)}m();function vT(){return typeof window<"u"&&typeof window.document<"u"}function pUe(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}function hV(t){return t==="health.builderio.xyz:ws"||t==="health.builderio.dev:ws"?"websocket":t.startsWith("git-host:")?t.replace("git-host:",""):"http"}function CV(t){return t==="http"||t==="websocket"?!0:pUe()}function IV(t){return vT()?`${t.toUpperCase()} checks are not available in browser environments. Only HTTP and WebSocket checks can be performed from the browser.`:`${t.toUpperCase()} checks are not available in this environment.`}m();Rl();var uTt=3e4,lTt=5e3;async function EV(t){let{target:e,source:r,testId:n,timeout:i=uTt,fetchFn:o=fetch,dispatcher:s}=t,a=Date.now(),A=new AbortController,c=setTimeout(()=>A.abort(),i);try{let u="HEAD",l=vT()?"follow":"manual",d=A.signal,g=s?await fetch(e,{method:u,signal:d,redirect:l,dispatcher:s}):await o(e,{method:u,signal:d,redirect:l});clearTimeout(c);let p=Date.now()-a,f=p>lTt;return g.status>=500?{source:r,testId:n,target:e,passed:!1,errorCode:"http_server_error",durationMs:p,metadata:{statusCode:g.status,statusText:g.statusText}}:{source:r,testId:n,target:e,passed:!0,durationMs:p,errorCode:f?"latency_high":void 0,metadata:{statusCode:g.status,statusText:g.statusText,latencyHigh:f}}}catch(u){clearTimeout(c);let l=Date.now()-a,d=u;if(d.name==="AbortError")return{source:r,testId:n,target:e,passed:!1,errorCode:"tcp_connection_timeout",durationMs:l,metadata:{error:"Request timed out",timeoutMs:i}};let g=R2(d);return{source:r,testId:n,target:e,passed:!1,errorCode:g,durationMs:l,metadata:{error:d.message,...d.cause&&{causeCode:d.cause.code}}}}}m();async function dUe(t){let{target:e,source:r,testId:n,timeout:i=1e4}=t,o=Date.now();return new Promise(s=>{let a=!1,A=null,c=setTimeout(()=>{a||(a=!0,A?.close(),s({source:r,testId:n,target:e,passed:!1,errorCode:"tcp_connection_timeout",durationMs:Date.now()-o,metadata:{error:"WebSocket connection timed out",timeoutMs:i}}))},i);try{A=new WebSocket(e)}catch(u){clearTimeout(c),a=!0,s({source:r,testId:n,target:e,passed:!1,errorCode:"unknown_error",durationMs:Date.now()-o,metadata:{error:u instanceof Error?u.message:"Failed to create WebSocket"}});return}A.onopen=()=>{if(a)return;a=!0,clearTimeout(c);let u=Date.now()-o;A?.close(1e3),s({source:r,testId:n,target:e,passed:!0,durationMs:u,metadata:{protocol:A?.protocol||void 0}})},A.onerror=()=>{a||(a=!0,clearTimeout(c),s({source:r,testId:n,target:e,passed:!1,errorCode:"tcp_connection_refused",durationMs:Date.now()-o,metadata:{error:"WebSocket connection failed"}}))}})}m();var fUe=W(require("node:dns"),1);Rl();var{resolve4:gTt,resolve6:pTt}=fUe.default.promises,dTt=1e4;async function BV(t){let{hostname:e,source:r,testId:n,timeout:i=dTt}=t,o=Date.now(),s,a=new Promise((A,c)=>{s=setTimeout(()=>{c(new Error("DNS resolution timed out"))},i)});try{let A=[],c="IPv4";try{A=await Promise.race([gTt(e),a])}catch(l){let d=l;if(d.code==="ENODATA"||d.code==="ENOTFOUND")try{A=await Promise.race([pTt(e),a]),c="IPv6"}catch{throw l}else throw l}clearTimeout(s);let u=Date.now()-o;return A.length===0?{source:r,testId:n,target:e,passed:!1,errorCode:"dns_resolution_failed",durationMs:u,metadata:{error:"No addresses resolved"}}:{source:r,testId:n,target:e,passed:!0,durationMs:u,metadata:{addresses:A,ipVersion:c,addressCount:A.length}}}catch(A){clearTimeout(s);let c=Date.now()-o,u=A;if(u.message==="DNS resolution timed out")return{source:r,testId:n,target:e,passed:!1,errorCode:"dns_timeout",durationMs:c,metadata:{error:u.message,timeoutMs:i}};let l=hs(u);return{source:r,testId:n,target:e,passed:!1,errorCode:l,durationMs:c,metadata:{error:u.message,nodeErrorCode:u.code}}}}m();var mUe=W(require("net"),1);Rl();var fTt=5e3,mTt=443;async function yV(t){let{hostname:e,port:r=mTt,source:n,testId:i,timeout:o=fTt,connectFn:s}=t,a=`${e}:${r}`,A=Date.now();try{let c=await new Promise(d=>{if(s){let p=setTimeout(()=>{let f=new Error("Connection timed out");f.code="ETIMEDOUT",d({success:!1,error:f})},o);s(e,r).then(f=>{clearTimeout(p),f.destroy(),d({success:!0})}).catch(f=>{clearTimeout(p),d({success:!1,error:f})});return}let g=new mUe.default.Socket;g.setTimeout(o),g.on("connect",()=>{g.destroy(),d({success:!0})}),g.on("timeout",()=>{g.destroy();let p=new Error("Connection timed out");p.code="ETIMEDOUT",d({success:!1,error:p})}),g.on("error",p=>{g.destroy(),d({success:!1,error:p})}),g.connect(r,e)}),u=Date.now()-A;if(c.success)return{source:n,testId:i,target:a,passed:!0,durationMs:u,metadata:{hostname:e,port:r}};let l=c.error?hs(c.error):"tcp_connection_timeout";return{source:n,testId:i,target:a,passed:!1,errorCode:l,durationMs:u,metadata:{hostname:e,port:r,error:c.error?.message,nodeErrorCode:c.error?.code}}}catch(c){let u=Date.now()-A,l=c;return{source:n,testId:i,target:a,passed:!1,errorCode:hs(l),durationMs:u,metadata:{hostname:e,port:r,error:l.message,nodeErrorCode:l.code}}}}m();var CUe=W(require("tls"),1);Rl();var hTt=1e4,CTt=443;async function QV(t){let{hostname:e,port:r=CTt,source:n,testId:i,timeout:o=hTt,connectFn:s}=t,a=`${e}:${r}`,A=Date.now();try{let c;if(s){let g=!1,p=s(e,r);c=await new Promise((f,h)=>{let C=setTimeout(()=>{g=!0,p.then(B=>B.destroy()).catch(()=>{});let I=new Error("Proxy CONNECT timed out");I.code="ETIMEDOUT",h(I)},o);p.then(I=>{clearTimeout(C),g?I.destroy():f(I)}).catch(I=>{clearTimeout(C),h(I)})})}let u=await new Promise(g=>{let p=CUe.default.connect({host:e,port:r,servername:e,rejectUnauthorized:!0,timeout:o,...c?{socket:c}:{}},()=>{let f=p.getPeerCertificate(),h;f&&Object.keys(f).length>0&&(h={subject:hUe(f.subject),issuer:hUe(f.issuer),validFrom:f.valid_from,validTo:f.valid_to,fingerprint:f.fingerprint,serialNumber:f.serialNumber,subjectAltNames:f.subjectaltname?f.subjectaltname.split(", "):void 0}),p.end(),g({success:!0,certInfo:h})});p.on("timeout",()=>{p.destroy();let f=new Error("TLS connection timed out");f.code="ETIMEDOUT",g({success:!1,error:f})}),p.on("error",f=>{p.destroy(),g({success:!1,error:f})})}),l=Date.now()-A;if(u.success)return{source:n,testId:i,target:a,passed:!0,durationMs:l,metadata:{hostname:e,port:r,certificate:u.certInfo}};let d=u.error?hs(u.error):"tls_handshake_failed";return{source:n,testId:i,target:a,passed:!1,errorCode:d,durationMs:l,metadata:{hostname:e,port:r,error:u.error?.message,nodeErrorCode:u.error?.code}}}catch(c){let u=Date.now()-A,l=c;return{source:n,testId:i,target:a,passed:!1,errorCode:hs(l),durationMs:u,metadata:{hostname:e,port:r,error:l.message,nodeErrorCode:l.code}}}}function hUe(t){if(!t)return"";let e=[],r=["CN","O","OU","L","ST","C"];for(let n of r){let i=t[n];i&&e.push(`${n}=${i}`)}return e.join(", ")}m();var IUe=W(require("net"),1);Rl();var ITt=22,ETt=5e3,BTt="SSH-";async function DV(t){let{hostname:e,port:r=ITt,source:n,testId:i,timeout:o=ETt}=t,s=`${e}:${r}`,a=Date.now();try{let A=await new Promise(l=>{let d=new IUe.default.Socket,g="";d.setTimeout(o),d.on("connect",()=>{}),d.on("data",p=>{g+=p.toString(),(g.includes(`
|
|
7015
7015
|
`)||g.length>256)&&(d.destroy(),g=g.split(`
|
|
7016
|
-
`)[0].trim(),g.startsWith(BTt)?l({success:!0,banner:g}):l({success:!1,error:new Error("Unexpected response: not an SSH server"),banner:g}))}),d.on("timeout",()=>{d.destroy();let p=new Error("SSH connection timed out");p.code="ETIMEDOUT",l({success:!1,error:p})}),d.on("error",p=>{d.destroy(),l({success:!1,error:p})}),d.on("end",()=>{g||l({success:!1,error:new Error("Connection closed without receiving SSH banner")})}),d.connect(r,e)}),c=Date.now()-a;if(A.success)return{source:n,testId:i,target:s,passed:!0,durationMs:c,metadata:{hostname:e,port:r,banner:A.banner}};let u=A.error?hs(A.error):"tcp_connection_refused";return{source:n,testId:i,target:s,passed:!1,errorCode:u,durationMs:c,metadata:{hostname:e,port:r,error:A.error?.message,nodeErrorCode:A.error?.code,banner:A.banner}}}catch(A){let c=Date.now()-a,u=A;return{source:n,testId:i,target:s,passed:!1,errorCode:hs(u),durationMs:c,metadata:{hostname:e,port:r,error:u.message,nodeErrorCode:u.code}}}}async function OD(t){let{tests:e,gitHost:r,onProgress:n,fetchFn:i,dispatcher:o,connectFn:s}=t,a=[],A=e.length;for(let c=0;c<e.length;c++){let u=e[c];wV(n,{type:"test:start",test:u,index:c,total:A});let l=await yTt(u,r,i,o,s);a.push(l),wV(n,{type:"test:complete",result:l,index:c,total:A})}return wV(n,{type:"batch:complete",results:a}),{timestamp:new Date().toISOString(),gitHost:r,results:a}}async function yTt(t,e,r,n,i){let{source:o,testId:s}=t,a=hV(s);if(!CV(a)){let c=Date.now(),u;try{u=wT(s,e)}catch{u=e||s}return{source:o,testId:s,target:u,passed:!1,errorCode:"check_unavailable",durationMs:Date.now()-c,metadata:{reason:IV(a),checkType:a}}}let A;try{A=wT(s,e)}catch(c){return{source:o,testId:s,target:e||s,passed:!1,errorCode:"unknown_error",durationMs:0,metadata:{error:c.message}}}switch(a){case"http":return EV({target:A,source:o,testId:s,fetchFn:r,dispatcher:n});case"websocket":return dUe({target:A,source:o,testId:s});case"dns":return BV({hostname:zC(A),source:o,testId:s});case"tcp":return yV({hostname:zC(A),port:bT(A,443),source:o,testId:s,connectFn:i});case"tls":return QV({hostname:zC(A),port:bT(A,443),source:o,testId:s,connectFn:i});case"ssh":return DV({hostname:zC(A),port:mV(A,22),source:o,testId:s});default:return{source:o,testId:s,target:A,passed:!1,errorCode:"unknown_error",durationMs:0,metadata:{error:`Unknown check type: ${a}`}}}}function wV(t,e){if(t)try{t(e)}catch{}}Rl();m();Cr();var It=W(Gr(),1);vn();dg();gs();un();Jr();Zr();Vi();Dp();var ST=[{source:"local",testId:"builder.io"},{source:"local",testId:"api.builder.io"},{source:"local",testId:"cdn.builder.io"}],QTt=[{source:"local",testId:"git-host:dns"},{source:"local",testId:"git-host:tcp"},{source:"local",testId:"git-host:tls"},{source:"local",testId:"git-host:http"},{source:"local",testId:"git-host:ssh"}],bV=async(t,e)=>{try{return await
|
|
7016
|
+
`)[0].trim(),g.startsWith(BTt)?l({success:!0,banner:g}):l({success:!1,error:new Error("Unexpected response: not an SSH server"),banner:g}))}),d.on("timeout",()=>{d.destroy();let p=new Error("SSH connection timed out");p.code="ETIMEDOUT",l({success:!1,error:p})}),d.on("error",p=>{d.destroy(),l({success:!1,error:p})}),d.on("end",()=>{g||l({success:!1,error:new Error("Connection closed without receiving SSH banner")})}),d.connect(r,e)}),c=Date.now()-a;if(A.success)return{source:n,testId:i,target:s,passed:!0,durationMs:c,metadata:{hostname:e,port:r,banner:A.banner}};let u=A.error?hs(A.error):"tcp_connection_refused";return{source:n,testId:i,target:s,passed:!1,errorCode:u,durationMs:c,metadata:{hostname:e,port:r,error:A.error?.message,nodeErrorCode:A.error?.code,banner:A.banner}}}catch(A){let c=Date.now()-a,u=A;return{source:n,testId:i,target:s,passed:!1,errorCode:hs(u),durationMs:c,metadata:{hostname:e,port:r,error:u.message,nodeErrorCode:u.code}}}}async function OD(t){let{tests:e,gitHost:r,onProgress:n,fetchFn:i,dispatcher:o,connectFn:s}=t,a=[],A=e.length;for(let c=0;c<e.length;c++){let u=e[c];wV(n,{type:"test:start",test:u,index:c,total:A});let l=await yTt(u,r,i,o,s);a.push(l),wV(n,{type:"test:complete",result:l,index:c,total:A})}return wV(n,{type:"batch:complete",results:a}),{timestamp:new Date().toISOString(),gitHost:r,results:a}}async function yTt(t,e,r,n,i){let{source:o,testId:s}=t,a=hV(s);if(!CV(a)){let c=Date.now(),u;try{u=wT(s,e)}catch{u=e||s}return{source:o,testId:s,target:u,passed:!1,errorCode:"check_unavailable",durationMs:Date.now()-c,metadata:{reason:IV(a),checkType:a}}}let A;try{A=wT(s,e)}catch(c){return{source:o,testId:s,target:e||s,passed:!1,errorCode:"unknown_error",durationMs:0,metadata:{error:c.message}}}switch(a){case"http":return EV({target:A,source:o,testId:s,fetchFn:r,dispatcher:n});case"websocket":return dUe({target:A,source:o,testId:s});case"dns":return BV({hostname:zC(A),source:o,testId:s});case"tcp":return yV({hostname:zC(A),port:bT(A,443),source:o,testId:s,connectFn:i});case"tls":return QV({hostname:zC(A),port:bT(A,443),source:o,testId:s,connectFn:i});case"ssh":return DV({hostname:zC(A),port:mV(A,22),source:o,testId:s});default:return{source:o,testId:s,target:A,passed:!1,errorCode:"unknown_error",durationMs:0,metadata:{error:`Unknown check type: ${a}`}}}}function wV(t,e){if(t)try{t(e)}catch{}}Rl();m();Cr();var It=W(Gr(),1);vn();dg();gs();un();Jr();Zr();Vi();Dp();var ST=[{source:"local",testId:"builder.io"},{source:"local",testId:"api.builder.io"},{source:"local",testId:"cdn.builder.io"}],QTt=[{source:"local",testId:"git-host:dns"},{source:"local",testId:"git-host:tcp"},{source:"local",testId:"git-host:tls"},{source:"local",testId:"git-host:http"},{source:"local",testId:"git-host:ssh"}],bV=async(t,e)=>{try{return await Me(t,e)}catch(r){if(r instanceof tt&&r.statusCode)return{ok:r.statusCode>=200&&r.statusCode<300,status:r.statusCode,statusText:r.statusCode===500?"Internal Server Error":r.statusCode===502?"Bad Gateway":r.statusCode===503?"Service Unavailable":r.statusCode===504?"Gateway Timeout":"Server Error"};if(r instanceof wi)return{ok:!0,status:200,statusText:"OK"};throw r}};async function BUe(t,e,r){if(console.log(""),Br((0,It.bgCyan)((0,It.bold)((0,It.white)(" doctor ")))+" "+(0,It.dim)(xt)),r.help){STt();return}let n=await xC(t),i=n?wTt(n.originUrl):null,o=i&&!i.startsWith("https://")?`https://${i}`:i,s=o?[...ST,...QTt]:[...ST];o?j.step(`Running connectivity checks (git host: ${(0,It.cyan)(o)})`):j.step("Running connectivity checks");let a=Pi(),A=g=>{g.type==="test:start"&&a.message(`Checking ${yUe(g.test.testId,o)}...`)};a.start("Starting connectivity checks...");let c=await OD({tests:s,gitHost:o||void 0,onProgress:A,fetchFn:bV});a.stop("Connectivity checks complete"),DTt(c.results,o,r.verbose);let u=c.results.filter(g=>g.passed).length,l=c.results.filter(g=>!g.passed).length,d;o&&(d=await bTt(t,r,c.results,o),d&&vTt(d)),await Wt("doctor",{gitHost:o||void 0,passed:u,failed:l,totalTests:c.results.length,recommendation:d?.recommendation}),l>0?Un((0,It.red)((0,It.bold)(" Some checks failed "))):Un((0,It.green)((0,It.bold)(" All checks passed ")))}function DTt(t,e,r){console.log("");let n=t.filter(a=>!a.testId.startsWith("git-host:")),i=t.filter(a=>a.testId.startsWith("git-host:"));if(n.length>0){j.message((0,It.bold)("Builder.io Services"));for(let a of n)EUe(a,e,r);console.log("")}if(i.length>0){j.message((0,It.bold)(`Git Host (${e})`));for(let a of i)EUe(a,e,r);console.log("")}let o=t.filter(a=>a.passed).length,s=t.filter(a=>!a.passed).length;Yg(`${(0,It.green)(`${o} passed`)}, ${s>0?(0,It.red)(`${s} failed`):(0,It.dim)("0 failed")}`,"Summary")}function EUe(t,e,r){let n=t.passed?(0,It.green)("\u2713"):(0,It.red)("\u2717"),i=yUe(t.testId,e),o=(0,It.dim)(`${t.durationMs}ms`);t.passed?j.message(` ${n} ${i} ${o}`):(j.message(` ${n} ${(0,It.red)(i)} ${o}`),t.errorCode&&j.message(` ${(0,It.dim)("Error:")} ${(0,It.yellow)(xT(t.errorCode))}`),r&&t.metadata?.error&&j.message(` ${(0,It.dim)("Details:")} ${t.metadata.error}`))}function yUe(t,e){return t.startsWith("git-host:")&&e?`${t.replace("git-host:","").toUpperCase()} \u2192 ${e}`:t}function xT(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function wTt(t){let e=t.match(/^git@([^:]+):/);if(e)return e[1];let r=t.match(/^https?:\/\/([^/]+)/);return r?r[1]:null}async function bTt(t,e,r,n){let i=da(t,e);if(!i.builderPrivateKey||!i.builderPublicKey){j.message((0,It.dim)("Tip: Run `npx @builder.io/dev-tools auth` to enable cloud connectivity analysis."));return}let o=Pi();o.start("Analyzing connectivity with cloud checks...");try{let s=new URL("/projects/connectivity/analyze",Pe);s.searchParams.set("apiKey",i.builderPublicKey);let a=await Me(s.toString(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i.builderPrivateKey}`},body:JSON.stringify({gitHost:n,localResults:r,spaceSettings:{staticProxyEnabled:!1}})});if(!a.ok){o.stop("Could not get cloud analysis"+a.status,-1);return}let A=await a.json();return o.stop("Cloud analysis complete"),A}catch{o.stop("Could not get cloud analysis",-1);return}}function vTt(t){console.log("");let e={ready_for_cloud_dev:"Ready for Cloud Development",enable_static_ip_proxy:"Enable Static IP Proxy",whitelist_static_ip:"Whitelist Static IP",fix_local_dns:"Fix Local DNS",fix_local_tls_certs:"Fix Local TLS Certificates",fix_local_firewall:"Fix Local Firewall",use_local_development:"Use Local Development"},r=e[t.recommendation]||t.recommendation,n=t.recommendation==="ready_for_cloud_dev";if(j.message((0,It.bold)("Recommendation")),n?j.message(` ${(0,It.green)("\u2713")} ${(0,It.green)(r)}`):j.message(` ${(0,It.yellow)("!")} ${(0,It.yellow)(r)}`),j.message(` ${(0,It.dim)(t.reason)}`),t.steps.length>0&&!n){console.log(""),j.message((0,It.bold)("Next Steps"));for(let i of t.steps)j.message(` ${(0,It.blue)("\u2192")} ${i}`)}if(t.likelyCause&&(console.log(""),j.message(` ${(0,It.dim)("Likely cause:")} ${xT(t.likelyCause)}`)),t.fallback){let i=e[t.fallback]||t.fallback;j.message(` ${(0,It.dim)("Fallback:")} ${i}`)}console.log("")}function STt(){j.message(`
|
|
7017
7017
|
${(0,It.bold)("Usage:")} npx @builder.io/dev-tools doctor [options]
|
|
7018
7018
|
|
|
7019
7019
|
${(0,It.bold)("Description:")}
|
|
@@ -7036,7 +7036,7 @@ Network Connectivity Diagnostics:`];for(let n of t.results){let i=n.passed?"\u27
|
|
|
7036
7036
|
If you are on a corporate network, make sure you are connected to your VPN.`,`Run \`npx ${Bt()} doctor\` for detailed diagnostics and recommendations.`),e.join(`
|
|
7037
7037
|
`)}catch{return`
|
|
7038
7038
|
|
|
7039
|
-
Run \`npx ${Bt()} doctor\` for detailed diagnostics.`}}var Ki=null,os=null,SUe=new Map;async function QUe(){return Ki||(Ki=await(0,vUe.createDevToolsNodeSys)({cwd:process.cwd(),ignoreMissingConfig:!0})),Ki}var GD=async t=>{if(!Ki||!os)throw new Error("System and args must be initialized before calling remote MCP");let{builderPublicKey:e,builderPrivateKey:r,userId:n}=da(Ki,os);if(!e||!n||!r)throw new Error(`Missing required credentials. Please run \`npx ${Bt()} auth\` to authenticate.`);let i=new URL(`${
|
|
7039
|
+
Run \`npx ${Bt()} doctor\` for detailed diagnostics.`}}var Ki=null,os=null,SUe=new Map;async function QUe(){return Ki||(Ki=await(0,vUe.createDevToolsNodeSys)({cwd:process.cwd(),ignoreMissingConfig:!0})),Ki}var GD=async t=>{if(!Ki||!os)throw new Error("System and args must be initialized before calling remote MCP");let{builderPublicKey:e,builderPrivateKey:r,userId:n}=da(Ki,os);if(!e||!n||!r)throw new Error(`Missing required credentials. Please run \`npx ${Bt()} auth\` to authenticate.`);let i=new URL(`${Pe}/design-systems/v1/mcp`);i.searchParams.set("apiKey",e),i.searchParams.set("userId",n);try{let o=await Me(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify(t)});if(!o.ok){let a=await o.text();throw new Error(`Failed to call tool: ${o.status} ${o.statusText}. ${a}`)}let s=await o.json();if(s.error)throw new Error(s.error.message);return s}catch(o){if(o instanceof wi)throw o;if(o instanceof tt&&o.type!=="server_error"){let s=await xTt();throw new Error(o.message+s,{cause:o})}throw o}};async function DUe(t){return SUe.set(t,{uri:t,name:t,description:"Figma Quick Copy export with design implementation data",mimeType:"application/json"}),await jd.sendResourceListChanged(),`
|
|
7040
7040
|
A new resource has been created with the URI ${t}. You should read this resource from the MCP server so you know the Figma design you are implementing.`}var jd=new sN({name:"Builder.io Design System Intelligence",version:"0.0.1"},{capabilities:{tools:{},resources:{subscribe:!0,listChanged:!0}},instructions:"An important source of information to understand design systems and components. You must use this MCP server to understand how to implement a UI using the design system."});async function wUe(t,e,r,n){return Ug({projectId:t,builderPublicKey:e,builderPrivateKey:r,userId:n,onMultipleRepoMatches:async i=>{let o=i.map(s=>` - ${s.name} (${s.id})`).join(`
|
|
7041
7041
|
`);throw new Error(`Multiple Builder.io projects are connected to this repository. Please specify a projectId.
|
|
7042
7042
|
|