@webflow/webflow-cli 2.5.0-next.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,59 +1,60 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var tR=Object.create;var mp=Object.defineProperty;var rR=Object.getOwnPropertyDescriptor;var nR=Object.getOwnPropertyNames;var oR=Object.getPrototypeOf,iR=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var gp=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hp=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},sR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nR(t))!iR.call(e,o)&&o!==r&&mp(e,o,{get:()=>t[o],enumerable:!(n=rR(t,o))||n.enumerable});return e};var w=(e,t,r)=>(r=e!=null?tR(oR(e)):{},sR(t||!e||!e.__esModule?mp(r,"default",{value:e,enumerable:!0}):r,e));var dw,Ne,yp,Ut,ue,_t,z,se,P,me=x(()=>{"use strict";dw=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,Ne=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,yp=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Ut=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,ue=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,_t=e=>`\x1B[97m${e}\x1B[0m`,z=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,P=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function dR(){let e=new Map;for(let[t,r]of Object.entries(Ie)){for(let[n,o]of Object.entries(r))Ie[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ie[n],e.set(o[0],o[1]);Object.defineProperty(Ie,t,{value:r,enumerable:!1})}return Object.defineProperty(Ie,"codes",{value:e,enumerable:!1}),Ie.color.close="\x1B[39m",Ie.bgColor.close="\x1B[49m",Ie.color.ansi=pw(),Ie.color.ansi256=fw(),Ie.color.ansi16m=mw(),Ie.bgColor.ansi=pw(10),Ie.bgColor.ansi256=fw(10),Ie.bgColor.ansi16m=mw(10),Object.defineProperties(Ie,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Ie.rgbToAnsi256(...Ie.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,o;if(t>=232)r=((t-232)*10+8)/255,n=r,o=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Ie.ansi256ToAnsi(Ie.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Ie.ansi256ToAnsi(Ie.hexToAnsi256(t)),enumerable:!1}}),Ie}var pw,fw,mw,Ie,O1,cR,uR,L1,pR,ir,gw=x(()=>{"use strict";pw=(e=0)=>t=>`\x1B[${t+e}m`,fw=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,mw=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Ie={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]}},O1=Object.keys(Ie.modifier),cR=Object.keys(Ie.color),uR=Object.keys(Ie.bgColor),L1=[...cR,...uR];pR=dR(),ir=pR});function Wt(e,t=globalThis.Deno?globalThis.Deno.args:Kl.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)}function fR(){if("FORCE_COLOR"in Ue)return Ue.FORCE_COLOR==="true"?1:Ue.FORCE_COLOR==="false"?0:Ue.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ue.FORCE_COLOR,10),3)}function mR(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function gR(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=fR();n!==void 0&&(Gl=n);let o=r?Gl:n;if(o===0)return 0;if(r){if(Wt("color=16m")||Wt("color=full")||Wt("color=truecolor"))return 3;if(Wt("color=256"))return 2}if("TF_BUILD"in Ue&&"AGENT_NAME"in Ue)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(Ue.TERM==="dumb")return i;if(Kl.default.platform==="win32"){let s=yw.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Ue)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Ue)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in Ue)||Ue.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in Ue)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ue.TEAMCITY_VERSION)?1:0;if(Ue.COLORTERM==="truecolor"||Ue.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Ue){let s=Number.parseInt((Ue.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ue.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ue.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ue.TERM)||"COLORTERM"in Ue?1:i}function hw(e,t={}){let r=gR(e,{streamIsTTY:e&&e.isTTY,...t});return mR(r)}var Kl,yw,wp,Ue,Gl,hR,ww,bw=x(()=>{"use strict";Kl=w(require("process"),1),yw=w(require("os"),1),wp=w(require("tty"),1);({env:Ue}=Kl.default);Wt("no-color")||Wt("no-colors")||Wt("color=false")||Wt("color=never")?Gl=0:(Wt("color")||Wt("colors")||Wt("color=true")||Wt("color=always"))&&(Gl=1);hR={stdout:hw({isTTY:wp.default.isatty(1)}),stderr:hw({isTTY:wp.default.isatty(2)})},ww=hR});function kw(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i);while(n!==-1);return s+=e.slice(i),s}function Dw(e,t,r,n){let o=0,i="";do{let s=e[n-1]==="\r";i+=e.slice(o,s?n-1:n)+t+(s?`\r
2
+ "use strict";var LI=Object.create;var _p=Object.defineProperty;var NI=Object.getOwnPropertyDescriptor;var jI=Object.getOwnPropertyNames;var MI=Object.getPrototypeOf,BI=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ap=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fp=(e,t)=>{for(var r in t)_p(e,r,{get:t[r],enumerable:!0})},UI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of jI(t))!BI.call(e,o)&&o!==r&&_p(e,o,{get:()=>t[o],enumerable:!(n=NI(t,o))||n.enumerable});return e};var w=(e,t,r)=>(r=e!=null?LI(MI(e)):{},UI(t||!e||!e.__esModule?_p(r,"default",{value:e,enumerable:!0}):r,e));var Tw,je,Ip,Wt,de,It,q,se,P,ge=x(()=>{"use strict";Tw=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,je=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,Ip=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Wt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,de=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,It=e=>`\x1B[97m${e}\x1B[0m`,q=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,P=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function KI(){let e=new Map;for(let[t,r]of Object.entries(Pe)){for(let[n,o]of Object.entries(r))Pe[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Pe[n],e.set(o[0],o[1]);Object.defineProperty(Pe,t,{value:r,enumerable:!1})}return Object.defineProperty(Pe,"codes",{value:e,enumerable:!1}),Pe.color.close="\x1B[39m",Pe.bgColor.close="\x1B[49m",Pe.color.ansi=Pw(),Pe.color.ansi256=$w(),Pe.color.ansi16m=Ow(),Pe.bgColor.ansi=Pw(10),Pe.bgColor.ansi256=$w(10),Pe.bgColor.ansi16m=Ow(10),Object.defineProperties(Pe,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Pe.rgbToAnsi256(...Pe.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,o;if(t>=232)r=((t-232)*10+8)/255,n=r,o=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Pe.ansi256ToAnsi(Pe.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Pe.ansi256ToAnsi(Pe.hexToAnsi256(t)),enumerable:!1}}),Pe}var Pw,$w,Ow,Pe,LM,VI,GI,NM,JI,ar,Lw=x(()=>{"use strict";Pw=(e=0)=>t=>`\x1B[${t+e}m`,$w=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Ow=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Pe={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]}},LM=Object.keys(Pe.modifier),VI=Object.keys(Pe.color),GI=Object.keys(Pe.bgColor),NM=[...VI,...GI];JI=KI(),ar=JI});function Ht(e,t=globalThis.Deno?globalThis.Deno.args:Zl.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)}function zI(){if("FORCE_COLOR"in We)return We.FORCE_COLOR==="true"?1:We.FORCE_COLOR==="false"?0:We.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(We.FORCE_COLOR,10),3)}function qI(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function YI(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=zI();n!==void 0&&(Xl=n);let o=r?Xl:n;if(o===0)return 0;if(r){if(Ht("color=16m")||Ht("color=full")||Ht("color=truecolor"))return 3;if(Ht("color=256"))return 2}if("TF_BUILD"in We&&"AGENT_NAME"in We)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(We.TERM==="dumb")return i;if(Zl.default.platform==="win32"){let s=jw.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in We)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in We)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in We)||We.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in We)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(We.TEAMCITY_VERSION)?1:0;if(We.COLORTERM==="truecolor"||We.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in We){let s=Number.parseInt((We.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(We.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(We.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(We.TERM)||"COLORTERM"in We?1:i}function Nw(e,t={}){let r=YI(e,{streamIsTTY:e&&e.isTTY,...t});return qI(r)}var Zl,jw,Rp,We,Xl,XI,Mw,Bw=x(()=>{"use strict";Zl=w(require("process"),1),jw=w(require("os"),1),Rp=w(require("tty"),1);({env:We}=Zl.default);Ht("no-color")||Ht("no-colors")||Ht("color=false")||Ht("color=never")?Xl=0:(Ht("color")||Ht("colors")||Ht("color=true")||Ht("color=always"))&&(Xl=1);XI={stdout:Nw({isTTY:Rp.default.isatty(1)}),stderr:Nw({isTTY:Rp.default.isatty(2)})},Mw=XI});function Uw(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i);while(n!==-1);return s+=e.slice(i),s}function Ww(e,t,r,n){let o=0,i="";do{let s=e[n-1]==="\r";i+=e.slice(o,s?n-1:n)+t+(s?`\r
3
3
  `:`
4
4
  `)+r,o=n+1,n=e.indexOf(`
5
- `,o)}while(n!==-1);return i+=e.slice(o),i}var Ew=x(()=>{"use strict"});function Gs(e){return wR(e)}var vw,Sw,bp,mi,Vs,xw,gi,yR,wR,kp,bR,kR,Dp,Jl,DR,ER,H1,sr,Ep=x(()=>{"use strict";gw();bw();Ew();({stdout:vw,stderr:Sw}=ww),bp=Symbol("GENERATOR"),mi=Symbol("STYLER"),Vs=Symbol("IS_EMPTY"),xw=["ansi","ansi","ansi256","ansi16m"],gi=Object.create(null),yR=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=vw?vw.level:0;e.level=t.level===void 0?r:t.level},wR=e=>{let t=(...r)=>r.join(" ");return yR(t,e),Object.setPrototypeOf(t,Gs.prototype),t};Object.setPrototypeOf(Gs.prototype,Function.prototype);for(let[e,t]of Object.entries(ir))gi[e]={get(){let r=Jl(this,Dp(t.open,t.close,this[mi]),this[Vs]);return Object.defineProperty(this,e,{value:r}),r}};gi.visible={get(){let e=Jl(this,this[mi],!0);return Object.defineProperty(this,"visible",{value:e}),e}};kp=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?ir[r].ansi16m(...n):t==="ansi256"?ir[r].ansi256(ir.rgbToAnsi256(...n)):ir[r].ansi(ir.rgbToAnsi(...n)):e==="hex"?kp("rgb",t,r,...ir.hexToRgb(...n)):ir[r][e](...n),bR=["rgb","hex","ansi256"];for(let e of bR){gi[e]={get(){let{level:r}=this;return function(...n){let o=Dp(kp(e,xw[r],"color",...n),ir.color.close,this[mi]);return Jl(this,o,this[Vs])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);gi[t]={get(){let{level:r}=this;return function(...n){let o=Dp(kp(e,xw[r],"bgColor",...n),ir.bgColor.close,this[mi]);return Jl(this,o,this[Vs])}}}}kR=Object.defineProperties(()=>{},{...gi,level:{enumerable:!0,get(){return this[bp].level},set(e){this[bp].level=e}}}),Dp=(e,t,r)=>{let n,o;return r===void 0?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},Jl=(e,t,r)=>{let n=(...o)=>DR(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,kR),n[bp]=e,n[mi]=t,n[Vs]=r,n},DR=(e,t)=>{if(e.level<=0||!t)return e[Vs]?"":t;let r=e[mi];if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=kw(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
6
- `);return i!==-1&&(t=Dw(t,o,n,i)),n+t+o};Object.defineProperties(Gs.prototype,gi);ER=Gs(),H1=Gs({level:Sw?Sw.level:0}),sr=ER});function vp(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))vR(e,t,o,r);return xR(e,t),AR(e,t,n),e}var vR,SR,xR,CR,FR,_R,AR,Cw=x(()=>{"use strict";vR=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);!SR(o,i)&&n||Object.defineProperty(e,r,i)},SR=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},xR=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},CR=(e,t)=>`/* Wrapped ${e}*/
7
- ${t}`,FR=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),_R=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),AR=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=CR.bind(null,n,t.toString());Object.defineProperty(o,"name",_R);let{writable:i,enumerable:s,configurable:a}=FR;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var zl,Fw,_w,Aw=x(()=>{"use strict";Cw();zl=new WeakMap,Fw=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(zl.set(i,++n),n===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return vp(i,e),zl.set(i,n),i};Fw.callCount=e=>{if(!zl.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return zl.get(e)};_w=Fw});var no,Rw=x(()=>{"use strict";no=[];no.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&no.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&no.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var ql,Sp,xp,RR,Cp,Yl,IR,Fp,_p,Ap,Iw,Y1,X1,Tw=x(()=>{"use strict";Rw();ql=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Sp=Symbol.for("signal-exit emitter"),xp=globalThis,RR=Object.defineProperty.bind(Object),Cp=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(xp[Sp])return xp[Sp];RR(xp,Sp,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},Yl=class{},IR=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Fp=class extends Yl{onExit(){return()=>{}}load(){}unload(){}},_p=class extends Yl{#s=Ap.platform==="win32"?"SIGINT":"SIGHUP";#r=new Cp;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let r of no)this.#t[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#s:r;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!ql(this.#e))return()=>{};this.#i===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#r.count+=1;for(let t of no)try{let r=this.#t[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#f(t,...r),this.#e.reallyExit=t=>this.#n(t)}}unload(){this.#i&&(this.#i=!1,no.forEach(t=>{let r=this.#t[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#r.count-=1)}#n(t){return ql(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...r){let n=this.#o;if(t==="exit"&&ql(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},Ap=globalThis.process,{onExit:Iw,load:Y1,unload:X1}=IR(ql(Ap)?new _p(Ap):new Fp)});var Ks,Pw,TR,$w,Ow=x(()=>{"use strict";Ks=w(require("process"),1);Aw();Tw();Pw=Ks.default.stderr.isTTY?Ks.default.stderr:Ks.default.stdout.isTTY?Ks.default.stdout:void 0,TR=Pw?_w(()=>{Iw(()=>{Pw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},$w=TR});var Rp,Xl,hi,Ip,Lw=x(()=>{"use strict";Rp=w(require("process"),1);Ow();Xl=!1,hi={};hi.show=(e=Rp.default.stderr)=>{e.isTTY&&(Xl=!1,e.write("\x1B[?25h"))};hi.hide=(e=Rp.default.stderr)=>{e.isTTY&&($w(),Xl=!0,e.write("\x1B[?25l"))};hi.toggle=(e,t)=>{e!==void 0&&(Xl=e),Xl?hi.show(t):hi.hide(t)};Ip=hi});var Nw=gp((o2,PR)=>{PR.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Tp=gp((i2,Mw)=>{"use strict";var Zl=Object.assign({},Nw()),jw=Object.keys(Zl);Object.defineProperty(Zl,"random",{get(){let e=Math.floor(Math.random()*jw.length),t=jw[e];return Zl[t]}});Mw.exports=Zl});function Pp(){return Ht.default.platform!=="win32"?Ht.default.env.TERM!=="linux":!!Ht.default.env.CI||!!Ht.default.env.WT_SESSION||!!Ht.default.env.TERMINUS_SUBLIME||Ht.default.env.ConEmuTask==="{cmd::Cmder}"||Ht.default.env.TERM_PROGRAM==="Terminus-Sublime"||Ht.default.env.TERM_PROGRAM==="vscode"||Ht.default.env.TERM==="xterm-256color"||Ht.default.env.TERM==="alacritty"||Ht.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ht,Bw=x(()=>{"use strict";Ht=w(require("process"),1)});var $R,OR,LR,Js,Uw=x(()=>{"use strict";Ep();Bw();$R={info:sr.blue("\u2139"),success:sr.green("\u2714"),warning:sr.yellow("\u26A0"),error:sr.red("\u2716")},OR={info:sr.blue("i"),success:sr.green("\u221A"),warning:sr.yellow("\u203C"),error:sr.red("\xD7")},LR=Pp()?$R:OR,Js=LR});function $p({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Ww=x(()=>{"use strict"});function Op(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(NR,"")}var NR,Hw=x(()=>{"use strict";Ww();NR=$p()});function Lp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Vw=x(()=>{"use strict"});function Np(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(jR,"")}var jR,Gw=x(()=>{"use strict";Vw();jR=Lp()});var Ql,ec,jp,Mp,zs,Kw=x(()=>{"use strict";Ql=[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],ec=[12288,12288,65281,65376,65504,65510],jp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Mp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],zs=[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]});var tc,Jw=x(()=>{"use strict";tc=(e,t)=>{let r=0,n=Math.floor(e.length/2)-1;for(;r<=n;){let o=Math.floor((r+n)/2),i=o*2;if(t<e[i])n=o-1;else if(t>e[i+1])r=o+1;else return!0}return!1}});function JR(e){let t=e[0],r=e[1];for(let n=0;n<e.length;n+=2){let o=e[n],i=e[n+1];if(zw>=o&&zw<=i)return[o,i];i-o>r-t&&(t=o,r=i)}return[t,r]}var MR,BR,UR,WR,k2,D2,E2,v2,HR,VR,zw,GR,KR,qw,Yw,Xw,Zw=x(()=>{"use strict";Kw();Jw();MR=Ql[0],BR=Ql.at(-1),UR=ec[0],WR=ec.at(-1),k2=jp[0],D2=jp.at(-1),E2=Mp[0],v2=Mp.at(-1),HR=zs[0],VR=zs.at(-1),zw=19968,[GR,KR]=JR(zs);qw=e=>e<MR||e>BR?!1:tc(Ql,e),Yw=e=>e<UR||e>WR?!1:tc(ec,e),Xw=e=>e>=GR&&e<=KR?!0:e<HR||e>VR?!1:tc(zs,e)});function zR(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Qw(e,{ambiguousAsWide:t=!1}={}){return zR(e),Yw(e)||Xw(e)||t&&qw(e)?2:1}var eb=x(()=>{"use strict";Zw()});var tb,rb=x(()=>{"use strict";tb=()=>/[#*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});function Bp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=Np(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!r};for(let{segment:s}of qR.segment(e)){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)&&!YR.test(s)){if(tb().test(s)){o+=2;continue}o+=Qw(a,i)}}return o}var qR,YR,nb=x(()=>{"use strict";Gw();eb();rb();qR=new Intl.Segmenter,YR=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Up({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var ob=x(()=>{"use strict"});function Hp(){let{env:e}=Wp.default,{TERM:t,TERM_PROGRAM:r}=e;return Wp.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Wp,ib=x(()=>{"use strict";Wp=w(require("process"),1)});var ar,XR,Vp,ZR,Gp,sb=x(()=>{"use strict";ar=w(require("process"),1),XR=3,Vp=class{#s=0;start(){this.#s++,this.#s===1&&this.#r()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#r(){ar.default.platform==="win32"||!ar.default.stdin.isTTY||(ar.default.stdin.setRawMode(!0),ar.default.stdin.on("data",this.#o),ar.default.stdin.resume())}#e(){ar.default.stdin.isTTY&&(ar.default.stdin.off("data",this.#o),ar.default.stdin.pause(),ar.default.stdin.setRawMode(!1))}#o(t){t[0]===XR&&ar.default.emit("SIGINT")}},ZR=new Vp,Gp=ZR});function Jp(e){return new Kp(e)}var qs,Ys,QR,Kp,ab=x(()=>{"use strict";qs=w(require("process"),1);Ep();Lw();Ys=w(Tp(),1);Uw();Hw();nb();ob();ib();sb();QR=w(Tp(),1),Kp=class{#s=0;#r=!1;#e=0;#o=-1;#p=0;#t;#i;#n;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:qs.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#n=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Up({stream:this.#n}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,qs.default.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(r){this.#s=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=t,this.#m()}get interval(){return this.#g??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#o=-1,this.#g=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#i=t}else if(!Hp())this.#i=Ys.default.line;else if(t===void 0)this.#i=Ys.default.dots;else if(t!=="default"&&Ys.default[t])this.#i=Ys.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#l}set suffixText(t=""){this.#l=t,this.#m()}get isSpinning(){return this.#f!==void 0}#y(t=this.#a,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#w(t=this.#l,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#n.columns??80,r=this.#y(this.#a,"-"),n=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+r+"--"+this.#h+"--"+n;this.#e=0;for(let i of Op(o).split(`
8
- `))this.#e+=Math.max(1,Math.ceil(Bp(i,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=t}get isSilent(){return this.#u}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=t}frame(){let t=Date.now();(this.#o===-1||t-this.#p>=this.interval)&&(this.#o=++this.#o%this.#i.frames.length,this.#p=t);let{frames:r}=this.#i,n=r[this.#o];this.color&&(n=sr[this.color](n));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return o+n+i+s}clear(){if(!this.#c||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#n.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#n.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&Ip.hide(this.#n),this.#t.discardStdin&&qs.default.stdin.isTTY&&(this.#r=!0,Gp.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
9
- `),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&Ip.show(this.#n),this.#t.discardStdin&&qs.default.stdin.isTTY&&this.#r&&(Gp.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Js.success,text:t})}fail(t){return this.stopAndPersist({symbol:Js.error,text:t})}warn(t){return this.stopAndPersist({symbol:Js.warning,text:t})}info(t){return this.stopAndPersist({symbol:Js.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let r=t.prefixText??this.#a,n=this.#y(r," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),p=n+o+a+c+`
10
- `;return this.stop(),this.#n.write(p),this}}});function Xs(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),rc.default.platform==="darwin"?eI(e):rc.default.platform==="win32"?tI(e):rI(e)}var Te,zp,rc,wn,qp,yi,eI,tI,rI,Yp=x(()=>{"use strict";Te=w(require("path"),1),zp=w(require("os"),1),rc=w(require("process"),1),wn=zp.default.homedir(),qp=zp.default.tmpdir(),{env:yi}=rc.default,eI=e=>{let t=Te.default.join(wn,"Library");return{data:Te.default.join(t,"Application Support",e),config:Te.default.join(t,"Preferences",e),cache:Te.default.join(t,"Caches",e),log:Te.default.join(t,"Logs",e),temp:Te.default.join(qp,e)}},tI=e=>{let t=yi.APPDATA||Te.default.join(wn,"AppData","Roaming"),r=yi.LOCALAPPDATA||Te.default.join(wn,"AppData","Local");return{data:Te.default.join(r,e,"Data"),config:Te.default.join(t,e,"Config"),cache:Te.default.join(r,e,"Cache"),log:Te.default.join(r,e,"Log"),temp:Te.default.join(qp,e)}},rI=e=>{let t=Te.default.basename(wn);return{data:Te.default.join(yi.XDG_DATA_HOME||Te.default.join(wn,".local","share"),e),config:Te.default.join(yi.XDG_CONFIG_HOME||Te.default.join(wn,".config"),e),cache:Te.default.join(yi.XDG_CACHE_HOME||Te.default.join(wn,".cache"),e),log:Te.default.join(yi.XDG_STATE_HOME||Te.default.join(wn,".local","state"),e),temp:Te.default.join(qp,t,e)}}});function nc(){return/[<>:"/\\|?*\u0000-\u001F]/g}function lb(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var cb=x(()=>{"use strict"});function Zs(e,t={}){let r=/[\u0000-\u001F\u0080-\u009F]/g,n=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(nc().test(o)&&r.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(n,"$1")),e=e.normalize("NFD"),e=e.replace(oI,o),e=e.replace(nc(),o),e=e.replace(r,o),e=e.replace(iI,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=lb().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:nI;if(e.length>i){let s=e.lastIndexOf(".");if(s===-1)e=e.slice(0,i);else{let a=e.slice(0,s),l=e.slice(s);e=a.slice(0,Math.max(1,i-l.length))+l}}return e}var nI,oI,iI,Xp=x(()=>{"use strict";cb();nI=100,oI=/^\.+(\\|\/)|^\.+$/,iI=/\.+$/});var sI,ub=x(()=>{"use strict";sI=w(require("path"),1);Xp()});var db=x(()=>{"use strict";Xp();ub()});var oc,Zp=x(()=>{"use strict";oc="webflow.json"});var oo,Qp=x(()=>{"use strict";oo=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function hb(e){pb=e}function yb(e){fb=e}function aI(){for(let e of wb){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function lI(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||aI()!==null}function V(){return pb?!0:fb?!1:lI()}function lr(){return!V()}function bb(e){mb=e}function Xe(){return mb}function kb(e){gb=e}function ic(){return gb}var pb,fb,mb,gb,wb,nM,we=x(()=>{"use strict";pb=!1,fb=!1,mb=!1;wb=[{variable:"CLAUDECODE",agent:"claude-code"},{variable:"CODEX_THREAD_ID",agent:"codex"},{variable:"CODEX_SANDBOX",agent:"codex"},{variable:"GEMINI_CLI",agent:"gemini-cli"},{variable:"OPENCODE_CLIENT",agent:"opencode"},{variable:"AI_AGENT",agent:"generic-agent"},{variable:"COPILOT_MODEL",agent:"copilot"},{variable:"AUGMENT_AGENT",agent:"augment"},{variable:"ANTIGRAVITY_AGENT",agent:"antigravity"},{variable:"CURSOR_AGENT",agent:"cursor"},{variable:"CURSOR_EXTENSION_HOST_ROLE",agent:"cursor",value:"agent-exec"}],nM=wb.map(e=>e.variable)});function cr(){let e=ic();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Db.statSync)(e)?.isDirectory())return{path:(0,Eb.join)(e,oc),isUserDefined:!0}}catch{if(e.endsWith(".json"))return{path:e,isUserDefined:!0}}throw new Error(`Manifest path must be either a directory or a .json file. Got: ${e}`)}return{path:`./${oc}`,isUserDefined:!1}}var Db,Eb,ef=x(()=>{"use strict";Db=require("fs"),Eb=require("path");Zp();we()});var vb,cI,uI,tf,Sb=x(()=>{"use strict";vb=w(require("ajv")),cI=new vb.default,uI={type:"object",properties:{region:{type:"string",enum:["us","eu"]},library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]},site:{type:"object",properties:{layout:{type:"object",properties:{preset:{type:"string",enum:["library","astro","nextjs","nextjs-pages"]},pagesRoot:{type:"string",minLength:1},componentsRoot:{type:"string",minLength:1},pagesShape:{type:"string",enum:["flat","nested"]}},required:[]}},required:[]}}},tf=cI.compile(uI)});function xb(e){return e instanceof Error?e:new Error("Unknown error")}function oe(){let{path:e}=cr();if(!(0,sc.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,sc.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${xb(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let n;try{n=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${xb(o).message}`)}if(!tf(n)){let o=tf.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:n,manifestPath:e}}var sc,Qs=x(()=>{"use strict";sc=require("fs");ef();Sb()});function ea(e,t){let r=e[t];if(!r)throw new oo(t);return r}var Cb=x(()=>{"use strict";Qp()});function Se(e){let t=oe(),r=t.manifest,n=t.manifestPath,o={...r};for(let i in e){let s=i,a=e[s];if(a!==void 0)if(typeof a=="string"||typeof a=="number"||typeof a=="boolean"||a===null)o[s]=a;else{let l=o[s];o[s]={...typeof l=="object"&&l!==null?l:{},...a}}}return(0,Fb.writeFileSync)(n,JSON.stringify(o,null,2),"utf-8"),o}var Fb,rf=x(()=>{"use strict";Fb=require("fs");Qs()});var Pe=x(()=>{"use strict";Zp();Qp();Qs();ef();Cb();rf()});var ac=gp((vM,dI)=>{dI.exports={name:"@webflow/webflow-cli",version:"2.5.0-next.1",license:"MIT",bin:{webflow:"./dist/index.js"},scripts:{build:"tsup",dev:"tsup",lint:"eslint .","type-check":"tsc -p tsconfig.typecheck.json",test:"jest --ci","test:unit":"jest --ci --ignoreProjects e2e","test:local":"jest","test:e2e:deploy":"bash regression/run-local.sh","test:regression":"jest --config regression/jest.config.js --testTimeout=420000","test:e2e-cache-clear":"bash scripts/clear-e2e-cache.sh"},files:["CHANGELOG.md","dist/**/*"],publishConfig:{access:"public"},dependencies:{"@babel/parser":"^7.26.9","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.27.0","@babel/types":"^7.26.9","@dotenvx/dotenvx":"^1.44.1","@inquirer/prompts":"^7.9.0","@module-federation/enhanced":"2.5.1","@rspack/core":"^1.7.8","@webflow/app":"0.1.0-beta.6","@webflow/cosmic-deploy-contract":"^1.1.0","@webflow/data-types":"*",ajv:"^8.17.1",archiver:"^5.3.1","babel-loader":"^10.0.0",commander:"^10.0.0",cosmiconfig:"^8.2.0","css-loader":"^7.1.2",dotenv:"^16.0.3","env-paths":"^3.0.0","fast-glob":"^3.3.3",filenamify:"^6.0.0","fork-ts-checker-webpack-plugin":"9.1.0","form-data":"4.0.4","fs-extra":"^11.3.0",jsdom:"^26.0.0","jsonc-parser":"^3.2.0",md5:"^2.2.1",memfs:"4.17.0","mime-types":"^2.1.35","mini-css-extract-plugin":"^2.9.2","node-fetch":"^2.6.7",open:"^8.4.2",ora:"^8.2.0",postcss:"^8.5.23","postcss-loader":"^8.1.1","postcss-selector-parser":"^7.1.0",prettier:"^3.9.6",semver:"^7.7.2","serve-handler":"^6.1.5","source-map-support":"^0.5.21",tar:"^7.5.19","ts-checker-rspack-plugin":"^1.0.0","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.2.0",unionfs:"^4.5.4","webflow-api":"3.3.4",webpack:">=5.99.7 <5.106.0","webpack-merge":"^6.0.1","webpack-node-externals":"^3.0.0",yaml:"^2.8.4",zod:"^3.22.4"},devDependencies:{"@module-federation/sdk":"2.5.1","@types/archiver":"^5.3.2","@types/express":"^4.17.13","@types/fs-extra":"^11.0.4","@types/jest":"^30.0.0","@types/md5":"^2.3.2","@types/mime-types":"^2.1.4","@types/nock":"^8.0.33","@types/node":"^22.13.0","@types/node-fetch":"2.6.13","@types/serve-handler":"^6.1.1","@types/source-map":"^0.5.2","@types/webpack-node-externals":"^3.0.4",astro:"^7.0.6","eslint-config-custom":"*",express:"^4.18.1",jest:"^30.4.2","jest-config-custom":"*",nock:"13.3.1",tar:"^7.5.19",tsconfig:"*",tsup:"^8.4.0",typescript:"^5.9.3"},engines:{node:">=22.13.0"}}});function Sr(){try{return ac().version}catch{return"unknown"}}function ur(e=""){if(!e)return"";let t=e;t=t.replace(/\/.*?\/webflow-cli/gi,"/REDACTED_PII/webflow-cli"),t=t.replace(/\/.*?\/node_modules/gi,"/REDACTED_PII/node_modules");let r=ta.default.homedir();if(r){let o=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let n=ta.default.userInfo().username;if(n){let o=new RegExp(`/Users/${n}`,"gi");t=t.replace(o,"/Users/REDACTED_PII")}return t=t.replace(/\/Users\/[^\/\s]+/gi,"/Users/REDACTED_PII"),t=t.replace(/C:\\Users\\[^\\]+/gi,"C:\\Users\\REDACTED_PII"),t=t.replace(/[a-zA-Z0-9]{32,}/g,"[REDACTED_TOKEN]"),t=t.replace(/Bearer\s+[^\s]+/gi,"Bearer [REDACTED_TOKEN]"),t=t.replace(/token[=:]\s*[^\s]+/gi,"token=[REDACTED_TOKEN]"),t=t.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[REDACTED_EMAIL]"),t=t.replace(/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,"[REDACTED_IP]"),t}function nf(e){if(e.stack)return ur(e.stack)}function bn(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],r={};for(let[n,o]of Object.entries(e)){let i=n.toLowerCase();t.some(s=>i.includes(s))?r[n]="[REDACTED]":typeof o=="string"?r[n]=ur(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?r[n]=bn(o):Array.isArray(o)?r[n]=o.map(s=>typeof s=="object"&&s!==null?bn(s):typeof s=="string"?ur(s):s):r[n]=o}return r}function _b(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${ta.default.type()} ${ta.default.release()}`}}function of(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var ta,ra=x(()=>{"use strict";ta=w(require("os"))});function wi(){if(process.platform==="win32"){let r=process.env.APPDATA??na.default.join(sf.default.homedir(),"AppData","Roaming");return na.default.join(r,Ab)}let t=process.env.XDG_CONFIG_HOME??na.default.join(sf.default.homedir(),".config");return na.default.join(t,Ab)}function Rb(){return Xs("webflow-cli").cache}var sf,na,Ab,oa=x(()=>{"use strict";sf=w(require("os")),na=w(require("path"));Yp();Ab="webflow"});function ia(){return af.default.join(wi(),pI)}function lf(){let e=ia();try{if(!bi.default.existsSync(e))return null;let t=bi.default.readFileSync(e,"utf8"),r=JSON.parse(t);return typeof r=="object"&&r!==null&&typeof r.allowTelemetry=="boolean"?r:null}catch{return null}}function cf(e){let t=ia(),r=af.default.dirname(t);bi.default.existsSync(r)||bi.default.mkdirSync(r,{recursive:!0,mode:448}),bi.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}var bi,af,pI,uf=x(()=>{"use strict";bi=w(require("fs")),af=w(require("path"));oa();pI="telemetry.json"});var $,D,xe,ki,df,rt,X,lc,pf,Kr,j=x(()=>{"use strict";me();$=z("\u2713"),D=Ut("\u2716"),xe=Ne("\u2139"),ki=z("\u279C"),df=Ut("\u279C"),rt="\u279C",X=ue("\u26A0"),lc=P("\u2732"),pf=z("\u2732"),Kr=ue("[Deprecated]")});var Ib,kn,ff=x(()=>{"use strict";Ib=w(require("fs"));Pe();ra();uf();R();me();j();we();kn=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}static localManifestExists(){try{let{path:t}=cr();return Ib.default.existsSync(t)}catch{return!1}}static readLocalPreference(){if(e.localManifestExists())try{let{manifest:t}=oe();return t?.telemetry?.global?.allowTelemetry}catch{return}}static readGlobalPreference(){return lf()?.allowTelemetry}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;let t=e.readLocalPreference();if(t!==void 0)return this.cache=t,t;let r=e.readGlobalPreference();if(r!==void 0)return this.cache=r,r}async setPreference(t,r){this.cache=t,r?.local?await this.setLocalPreference(t):await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(Xe()||u.info(`${xe} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(Xe()||(u.info(`${pf} ${P("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${pf} ${P("To opt out, run")} ${z("webflow auth telemetry --disable")}`)),await this.setGlobalPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return e.isDoNotTrackEnabled()?!1:e.readGlobalPreference()}async setGlobalPreference(t){cf({allowTelemetry:t,lastPrompted:Date.now(),version:Sr()}),Xe()||u.info(`${$} Telemetry configuration updated in ${ia()}`);let r=e.readLocalPreference();if(r!==void 0&&r!==t){let{path:n}=cr();u.warn(`${X} ${n} sets telemetry to ${r?"enabled":"disabled"} and overrides the global config for commands run in this directory. Re-run with --local to update it.`)}this.cache=t}async setLocalPreference(t){let r={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Sr()}}};if(Se(r),!Xe()){let{path:n}=cr();u.info(`${$} Telemetry configuration updated in ${n}`)}this.cache=t}async hasGlobalPreference(){return e.readGlobalPreference()!==void 0}async getTelemetryStatus(){if(e.isDoNotTrackEnabled())return{enabled:!1,source:"env",hasPreference:!0};let t=e.readLocalPreference();if(t!==void 0)return{enabled:t,source:"local",hasPreference:!0};let r=e.readGlobalPreference();return r!==void 0?{enabled:r,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,r){this.cache=r}}});async function K(e,t){let n={"User-Agent":`webflow-cli@${Sr()}`};return(0,Tb.default)(e,{...t,headers:{...t?.headers,...n}})}var Tb,lt=x(()=>{"use strict";Tb=w(require("node-fetch"));Z()});var d,C=x(()=>{"use strict";d=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,r){let n=t instanceof Error?t.message:String(t);super(n),this.name="CLIError",this.prefix=r?.prefix,this.skipLogging=r?.skipLogging??!1,this.isUserError=r?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=r?.missingFlag,this.code=r?.code??(t instanceof e?t.code:void 0),t instanceof Error?(this.cause=t,this.stack=t.stack):Error.captureStackTrace&&Error.captureStackTrace(this,e)}}});function $b(e){Pb=e}function ct(){return Pb}function mf(e,t){if(io.includes(e))return e;throw new d(`Invalid region "${e}" from ${t}. Valid regions: ${io.join(", ")}.`,{isUserError:!0})}function Ob(e){if(e)return mf(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return mf(t,"WEBFLOW_REGION");let r;try{r=oe().manifest.region}catch(n){if(n instanceof Error&&n.message.startsWith("Invalid manifest:"))throw new d(n.message,{isUserError:!0});return"us"}return r?mf(r,"webflow.json"):"us"}var io,Pb,Dn=x(()=>{"use strict";C();Pe();io=["us","eu"],Pb="us"});var Lb,Nb=x(()=>{"use strict";Lb=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});function cc(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function hf(){return fI[cc()][ct()]}function O(){return process.env.WEBFLOW_API_HOST?gf("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):hf().api}function Di(){return process.env.WEBFLOW_CDN_API_HOST?gf("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):hf().cdnApi}function xr(){return process.env.WEBFLOW_HOST?gf("WEBFLOW_HOST",process.env.WEBFLOW_HOST):hf().webflow}var gf,fI,sa,yf,aa,la,Ei,ke=x(()=>{"use strict";Dn();Nb();gf=(e,t)=>(Lb(t)||(console.error(`Error: Invalid ${e} environment variable. Only valid plain HTTP/HTTPS URLs without query parameters and anchors is allowed.`),process.exit(1)),t),fI={development:{us:{webflow:"https://wfdev.io:8443",api:"https://api.wfdev.io:8443",cdnApi:"https://api-cdn.wfdev.io:8443"},eu:{webflow:"https://eu.wfdev.io:8443",api:"https://api.eu.wfdev.io:8443",cdnApi:"https://api-cdn.eu.wfdev.io:8443"}},acceptance:{us:{webflow:"https://webflowtest.com",api:"https://api.webflowtest.com",cdnApi:"https://api-cdn.webflowtest.com"},eu:{webflow:"https://eu.webflowtest.com",api:"https://api.eu.webflowtest.com",cdnApi:"https://api-cdn.eu.webflowtest.com"}},sai:{us:{webflow:"https://webflow-sai.com",api:"https://api.webflow-sai.com",cdnApi:"https://api-cdn.webflow-sai.com"},eu:{webflow:"https://eu.webflow-sai.com",api:"https://api.eu.webflow-sai.com",cdnApi:"https://api-cdn.eu.webflow-sai.com"}},production:{us:{webflow:"https://webflow.com",api:"https://api.webflow.com",cdnApi:"https://api-cdn.webflow.com"},eu:{webflow:"https://eu.webflow.com",api:"https://api.eu.webflow.com",cdnApi:"https://api-cdn.eu.webflow.com"}}};sa="wf-manifest.json",yf="mf-manifest.json",aa="@webflow_renderer",la="ssr-bundle.tar",Ei="index.js"});function mI(){let e=process.argv.slice(2),t=[];for(let r=0;r<e.length;r+=1){let n=e[r],o=n.indexOf("=");if(o>0&&jb.has(n.slice(0,o))){t.push(`${n.slice(0,o)}=<redacted>`);continue}t.push(n),jb.has(n)&&r+1<e.length&&(t.push("<redacted>"),r+=1)}return t.join(" ")||void 0}var jb,_,wf=x(()=>{"use strict";ff();ra();R();lt();ke();jb=new Set(["--ref","--name","--q","--branch","--key"]);_=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=kn.getInstance(),this.sessionId=of(),this.platformInfo=_b()}async sendEvent(t){try{if(!await this.isEnabled())return;let r=this.enrichEvent(t),n=this.sanitizeEvent(r);await this.transmitEvent(n)}catch(r){u.debug(`Failed to send telemetry event: ${r}`)}}async sendError(t,r,n){await this.sendEvent({eventType:"error",success:!1,feature:r,name:t.name,message:t.message,cause:t.cause,stack:nf(t),context:r,metadata:n?bn(n):void 0})}async sendUsage(t,r){let{duration:n,...o}=r??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof n=="number"?n:void 0,data:Object.keys(o).length>0?bn(o):void 0})}async sendPerformance(t,r,n,o){await this.sendEvent({eventType:"performance",feature:o,operation:t,duration:r,metrics:n})}async isEnabled(){return await this.consentManager.getPreference()!==!1}async isGloballyEnabled(){return await this.consentManager.getGlobalPreference()!==!1}async updatePreferences(t){await this.consentManager.setPreference(t)}static async promptForConsentIfNeeded(t){let r=kn.getInstance(),n=await r.getPreference();return n!==void 0?n:await r.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:Sr(),command:this.config.suppressCommand?void 0:mI(),metadata:{...t.metadata,commandType:this.config.commandType,siteId:this.config.siteId,projectId:this.config.projectId,os:this.platformInfo.os,arch:this.platformInfo.arch}},...t}}sanitizeEvent(t){let r=JSON.parse(JSON.stringify(t));return r.message&&(r.message=ur(r.message)),r.stack&&(r.stack=ur(r.stack)),r.feature&&(r.feature=ur(r.feature)),r.context&&(r.context=ur(r.context)),r.metadata&&(r.metadata=bn(r.metadata)),r.data&&(r.data=bn(r.data)),r}async transmitEvent(t){let r=this.getEndpoint(),n=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(n){console.log(`\u{1F4CA} [Telemetry] Sending to: ${r}`);let i={...t};i.metadata&&(delete i.metadata.authToken,delete i.metadata.apiToken),console.log("\u{1F4CA} [Telemetry] Payload:",JSON.stringify(i,null,2))}let o=await K(r,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)n&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw n&&console.error(`\u{1F4CA} [Telemetry] Request failed: ${o.status} ${o.statusText}`),new Error(`Telemetry request failed: ${o.status} ${o.statusText}`)}getEndpoint(){let{host:t,commandType:r}=this.config;return`${t}/webflow-cli/${r}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"skills"})}}});var Mb=x(()=>{"use strict"});function Bb(e,t){return async(r,n,o)=>{let i=Date.now(),s=process.memoryUsage().heapUsed;try{let a=await n(),l=Date.now()-i,c=process.memoryUsage().heapUsed;return await e.sendPerformance(r,l,{memoryDelta:c-s,...o},t),a}catch(a){let l=Date.now()-i;throw await e.sendPerformance(r,l,{failed:1,...o},t),a}}}var Z=x(()=>{"use strict";wf();ff();uf();Mb();ra();ra()});var kf,bf,gI,Jr,Df=x(()=>{"use strict";kf=Symbol("webflow-cli-warn"),bf=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let r=t.split(`
11
- `);for(let n=2;n<r.length;n++){let o=r[n],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===kf){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let r=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),n=new Error().stack||"",o=this.parseSource(n);this.warnings.push({message:r,timestamp:Date.now(),source:o,stackTrace:n})})}stop(){this.isActive&&(this.originalConsoleWarn&&(console.warn=this.originalConsoleWarn,this.originalConsoleWarn=null),this.isActive=!1)}displayGrouped(){if(this.warnings.length===0)return;console.log(`
5
+ `,o)}while(n!==-1);return i+=e.slice(o),i}var Hw=x(()=>{"use strict"});function na(e){return QI(e)}var Vw,Gw,Tp,Ci,ra,Kw,_i,ZI,QI,Pp,eR,tR,$p,Ql,rR,nR,VM,lr,Op=x(()=>{"use strict";Lw();Bw();Hw();({stdout:Vw,stderr:Gw}=Mw),Tp=Symbol("GENERATOR"),Ci=Symbol("STYLER"),ra=Symbol("IS_EMPTY"),Kw=["ansi","ansi","ansi256","ansi16m"],_i=Object.create(null),ZI=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Vw?Vw.level:0;e.level=t.level===void 0?r:t.level},QI=e=>{let t=(...r)=>r.join(" ");return ZI(t,e),Object.setPrototypeOf(t,na.prototype),t};Object.setPrototypeOf(na.prototype,Function.prototype);for(let[e,t]of Object.entries(ar))_i[e]={get(){let r=Ql(this,$p(t.open,t.close,this[Ci]),this[ra]);return Object.defineProperty(this,e,{value:r}),r}};_i.visible={get(){let e=Ql(this,this[Ci],!0);return Object.defineProperty(this,"visible",{value:e}),e}};Pp=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?ar[r].ansi16m(...n):t==="ansi256"?ar[r].ansi256(ar.rgbToAnsi256(...n)):ar[r].ansi(ar.rgbToAnsi(...n)):e==="hex"?Pp("rgb",t,r,...ar.hexToRgb(...n)):ar[r][e](...n),eR=["rgb","hex","ansi256"];for(let e of eR){_i[e]={get(){let{level:r}=this;return function(...n){let o=$p(Pp(e,Kw[r],"color",...n),ar.color.close,this[Ci]);return Ql(this,o,this[ra])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);_i[t]={get(){let{level:r}=this;return function(...n){let o=$p(Pp(e,Kw[r],"bgColor",...n),ar.bgColor.close,this[Ci]);return Ql(this,o,this[ra])}}}}tR=Object.defineProperties(()=>{},{..._i,level:{enumerable:!0,get(){return this[Tp].level},set(e){this[Tp].level=e}}}),$p=(e,t,r)=>{let n,o;return r===void 0?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},Ql=(e,t,r)=>{let n=(...o)=>rR(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,tR),n[Tp]=e,n[Ci]=t,n[ra]=r,n},rR=(e,t)=>{if(e.level<=0||!t)return e[ra]?"":t;let r=e[Ci];if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=Uw(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
6
+ `);return i!==-1&&(t=Ww(t,o,n,i)),n+t+o};Object.defineProperties(na.prototype,_i);nR=na(),VM=na({level:Gw?Gw.level:0}),lr=nR});function Lp(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))oR(e,t,o,r);return sR(e,t),uR(e,t,n),e}var oR,iR,sR,aR,lR,cR,uR,Jw=x(()=>{"use strict";oR=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);!iR(o,i)&&n||Object.defineProperty(e,r,i)},iR=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},sR=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},aR=(e,t)=>`/* Wrapped ${e}*/
7
+ ${t}`,lR=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),cR=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),uR=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=aR.bind(null,n,t.toString());Object.defineProperty(o,"name",cR);let{writable:i,enumerable:s,configurable:a}=lR;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var ec,zw,qw,Yw=x(()=>{"use strict";Jw();ec=new WeakMap,zw=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(ec.set(i,++n),n===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return Lp(i,e),ec.set(i,n),i};zw.callCount=e=>{if(!ec.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return ec.get(e)};qw=zw});var po,Xw=x(()=>{"use strict";po=[];po.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&po.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&po.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var tc,Np,jp,dR,Mp,rc,pR,Bp,Up,Wp,Zw,XM,ZM,Qw=x(()=>{"use strict";Xw();tc=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Np=Symbol.for("signal-exit emitter"),jp=globalThis,dR=Object.defineProperty.bind(Object),Mp=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(jp[Np])return jp[Np];dR(jp,Np,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},rc=class{},pR=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Bp=class extends rc{onExit(){return()=>{}}load(){}unload(){}},Up=class extends rc{#s=Wp.platform==="win32"?"SIGINT":"SIGHUP";#r=new Mp;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let r of po)this.#t[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#s:r;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!tc(this.#e))return()=>{};this.#i===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#r.count+=1;for(let t of po)try{let r=this.#t[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#f(t,...r),this.#e.reallyExit=t=>this.#n(t)}}unload(){this.#i&&(this.#i=!1,po.forEach(t=>{let r=this.#t[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#r.count-=1)}#n(t){return tc(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...r){let n=this.#o;if(t==="exit"&&tc(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},Wp=globalThis.process,{onExit:Zw,load:XM,unload:ZM}=pR(tc(Wp)?new Up(Wp):new Bp)});var oa,eb,fR,tb,rb=x(()=>{"use strict";oa=w(require("process"),1);Yw();Qw();eb=oa.default.stderr.isTTY?oa.default.stderr:oa.default.stdout.isTTY?oa.default.stdout:void 0,fR=eb?qw(()=>{Zw(()=>{eb.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},tb=fR});var Hp,nc,Ai,Vp,nb=x(()=>{"use strict";Hp=w(require("process"),1);rb();nc=!1,Ai={};Ai.show=(e=Hp.default.stderr)=>{e.isTTY&&(nc=!1,e.write("\x1B[?25h"))};Ai.hide=(e=Hp.default.stderr)=>{e.isTTY&&(tb(),nc=!0,e.write("\x1B[?25l"))};Ai.toggle=(e,t)=>{e!==void 0&&(nc=e),nc?Ai.show(t):Ai.hide(t)};Vp=Ai});var ob=Ap((i2,mR)=>{mR.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Gp=Ap((s2,sb)=>{"use strict";var oc=Object.assign({},ob()),ib=Object.keys(oc);Object.defineProperty(oc,"random",{get(){let e=Math.floor(Math.random()*ib.length),t=ib[e];return oc[t]}});sb.exports=oc});function Kp(){return Vt.default.platform!=="win32"?Vt.default.env.TERM!=="linux":!!Vt.default.env.CI||!!Vt.default.env.WT_SESSION||!!Vt.default.env.TERMINUS_SUBLIME||Vt.default.env.ConEmuTask==="{cmd::Cmder}"||Vt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Vt.default.env.TERM_PROGRAM==="vscode"||Vt.default.env.TERM==="xterm-256color"||Vt.default.env.TERM==="alacritty"||Vt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Vt,ab=x(()=>{"use strict";Vt=w(require("process"),1)});var gR,hR,yR,ia,lb=x(()=>{"use strict";Op();ab();gR={info:lr.blue("\u2139"),success:lr.green("\u2714"),warning:lr.yellow("\u26A0"),error:lr.red("\u2716")},hR={info:lr.blue("i"),success:lr.green("\u221A"),warning:lr.yellow("\u203C"),error:lr.red("\xD7")},yR=Kp()?gR:hR,ia=yR});function Jp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var cb=x(()=>{"use strict"});function zp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(wR,"")}var wR,ub=x(()=>{"use strict";cb();wR=Jp()});function qp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var db=x(()=>{"use strict"});function Yp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(bR,"")}var bR,pb=x(()=>{"use strict";db();bR=qp()});var ic,sc,Xp,Zp,sa,fb=x(()=>{"use strict";ic=[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],sc=[12288,12288,65281,65376,65504,65510],Xp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Zp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],sa=[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]});var ac,mb=x(()=>{"use strict";ac=(e,t)=>{let r=0,n=Math.floor(e.length/2)-1;for(;r<=n;){let o=Math.floor((r+n)/2),i=o*2;if(t<e[i])n=o-1;else if(t>e[i+1])r=o+1;else return!0}return!1}});function AR(e){let t=e[0],r=e[1];for(let n=0;n<e.length;n+=2){let o=e[n],i=e[n+1];if(gb>=o&&gb<=i)return[o,i];i-o>r-t&&(t=o,r=i)}return[t,r]}var kR,DR,ER,vR,D2,E2,v2,S2,SR,xR,gb,CR,_R,hb,yb,wb,bb=x(()=>{"use strict";fb();mb();kR=ic[0],DR=ic.at(-1),ER=sc[0],vR=sc.at(-1),D2=Xp[0],E2=Xp.at(-1),v2=Zp[0],S2=Zp.at(-1),SR=sa[0],xR=sa.at(-1),gb=19968,[CR,_R]=AR(sa);hb=e=>e<kR||e>DR?!1:ac(ic,e),yb=e=>e<ER||e>vR?!1:ac(sc,e),wb=e=>e>=CR&&e<=_R?!0:e<SR||e>xR?!1:ac(sa,e)});function FR(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function kb(e,{ambiguousAsWide:t=!1}={}){return FR(e),yb(e)||wb(e)||t&&hb(e)?2:1}var Db=x(()=>{"use strict";bb()});var Eb,vb=x(()=>{"use strict";Eb=()=>/[#*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});function Qp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=Yp(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!r};for(let{segment:s}of IR.segment(e)){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)&&!RR.test(s)){if(Eb().test(s)){o+=2;continue}o+=kb(a,i)}}return o}var IR,RR,Sb=x(()=>{"use strict";pb();Db();vb();IR=new Intl.Segmenter,RR=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function ef({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var xb=x(()=>{"use strict"});function rf(){let{env:e}=tf.default,{TERM:t,TERM_PROGRAM:r}=e;return tf.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var tf,Cb=x(()=>{"use strict";tf=w(require("process"),1)});var cr,TR,nf,PR,of,_b=x(()=>{"use strict";cr=w(require("process"),1),TR=3,nf=class{#s=0;start(){this.#s++,this.#s===1&&this.#r()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#r(){cr.default.platform==="win32"||!cr.default.stdin.isTTY||(cr.default.stdin.setRawMode(!0),cr.default.stdin.on("data",this.#o),cr.default.stdin.resume())}#e(){cr.default.stdin.isTTY&&(cr.default.stdin.off("data",this.#o),cr.default.stdin.pause(),cr.default.stdin.setRawMode(!1))}#o(t){t[0]===TR&&cr.default.emit("SIGINT")}},PR=new nf,of=PR});function af(e){return new sf(e)}var aa,la,$R,sf,Ab=x(()=>{"use strict";aa=w(require("process"),1);Op();nb();la=w(Gp(),1);lb();ub();Sb();xb();Cb();_b();$R=w(Gp(),1),sf=class{#s=0;#r=!1;#e=0;#o=-1;#p=0;#t;#i;#n;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:aa.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#n=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:ef({stream:this.#n}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,aa.default.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(r){this.#s=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=t,this.#m()}get interval(){return this.#g??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#o=-1,this.#g=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#i=t}else if(!rf())this.#i=la.default.line;else if(t===void 0)this.#i=la.default.dots;else if(t!=="default"&&la.default[t])this.#i=la.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#l}set suffixText(t=""){this.#l=t,this.#m()}get isSpinning(){return this.#f!==void 0}#y(t=this.#a,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#w(t=this.#l,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#n.columns??80,r=this.#y(this.#a,"-"),n=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+r+"--"+this.#h+"--"+n;this.#e=0;for(let i of zp(o).split(`
8
+ `))this.#e+=Math.max(1,Math.ceil(Qp(i,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=t}get isSilent(){return this.#u}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=t}frame(){let t=Date.now();(this.#o===-1||t-this.#p>=this.interval)&&(this.#o=++this.#o%this.#i.frames.length,this.#p=t);let{frames:r}=this.#i,n=r[this.#o];this.color&&(n=lr[this.color](n));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return o+n+i+s}clear(){if(!this.#c||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#n.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#n.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&Vp.hide(this.#n),this.#t.discardStdin&&aa.default.stdin.isTTY&&(this.#r=!0,of.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
9
+ `),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&Vp.show(this.#n),this.#t.discardStdin&&aa.default.stdin.isTTY&&this.#r&&(of.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:ia.success,text:t})}fail(t){return this.stopAndPersist({symbol:ia.error,text:t})}warn(t){return this.stopAndPersist({symbol:ia.warning,text:t})}info(t){return this.stopAndPersist({symbol:ia.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let r=t.prefixText??this.#a,n=this.#y(r," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),p=n+o+a+c+`
10
+ `;return this.stop(),this.#n.write(p),this}}});function ca(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),lc.default.platform==="darwin"?OR(e):lc.default.platform==="win32"?LR(e):NR(e)}var $e,lf,lc,Sn,cf,Fi,OR,LR,NR,uf=x(()=>{"use strict";$e=w(require("path"),1),lf=w(require("os"),1),lc=w(require("process"),1),Sn=lf.default.homedir(),cf=lf.default.tmpdir(),{env:Fi}=lc.default,OR=e=>{let t=$e.default.join(Sn,"Library");return{data:$e.default.join(t,"Application Support",e),config:$e.default.join(t,"Preferences",e),cache:$e.default.join(t,"Caches",e),log:$e.default.join(t,"Logs",e),temp:$e.default.join(cf,e)}},LR=e=>{let t=Fi.APPDATA||$e.default.join(Sn,"AppData","Roaming"),r=Fi.LOCALAPPDATA||$e.default.join(Sn,"AppData","Local");return{data:$e.default.join(r,e,"Data"),config:$e.default.join(t,e,"Config"),cache:$e.default.join(r,e,"Cache"),log:$e.default.join(r,e,"Log"),temp:$e.default.join(cf,e)}},NR=e=>{let t=$e.default.basename(Sn);return{data:$e.default.join(Fi.XDG_DATA_HOME||$e.default.join(Sn,".local","share"),e),config:$e.default.join(Fi.XDG_CONFIG_HOME||$e.default.join(Sn,".config"),e),cache:$e.default.join(Fi.XDG_CACHE_HOME||$e.default.join(Sn,".cache"),e),log:$e.default.join(Fi.XDG_STATE_HOME||$e.default.join(Sn,".local","state"),e),temp:$e.default.join(cf,t,e)}}});function cc(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Fb(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var Ib=x(()=>{"use strict"});function ua(e,t={}){let r=/[\u0000-\u001F\u0080-\u009F]/g,n=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(cc().test(o)&&r.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(n,"$1")),e=e.normalize("NFD"),e=e.replace(MR,o),e=e.replace(cc(),o),e=e.replace(r,o),e=e.replace(BR,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Fb().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:jR;if(e.length>i){let s=e.lastIndexOf(".");if(s===-1)e=e.slice(0,i);else{let a=e.slice(0,s),l=e.slice(s);e=a.slice(0,Math.max(1,i-l.length))+l}}return e}var jR,MR,BR,df=x(()=>{"use strict";Ib();jR=100,MR=/^\.+(\\|\/)|^\.+$/,BR=/\.+$/});var UR,Rb=x(()=>{"use strict";UR=w(require("path"),1);df()});var Tb=x(()=>{"use strict";df();Rb()});var uc,pf=x(()=>{"use strict";uc="webflow.json"});var fo,ff=x(()=>{"use strict";fo=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Nb(e){Pb=e}function jb(e){$b=e}function WR(){for(let e of Mb){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function HR(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||WR()!==null}function W(){return Pb?!0:$b?!1:HR()}function ur(){return!W()}function Bb(e){Ob=e}function He(){return Ob}function Ub(e){Lb=e}function dc(){return Lb}var Pb,$b,Ob,Lb,Mb,oB,he=x(()=>{"use strict";Pb=!1,$b=!1,Ob=!1;Mb=[{variable:"CLAUDECODE",agent:"claude-code"},{variable:"CODEX_THREAD_ID",agent:"codex"},{variable:"CODEX_SANDBOX",agent:"codex"},{variable:"GEMINI_CLI",agent:"gemini-cli"},{variable:"OPENCODE_CLIENT",agent:"opencode"},{variable:"AI_AGENT",agent:"generic-agent"},{variable:"COPILOT_MODEL",agent:"copilot"},{variable:"AUGMENT_AGENT",agent:"augment"},{variable:"ANTIGRAVITY_AGENT",agent:"antigravity"},{variable:"CURSOR_AGENT",agent:"cursor"},{variable:"CURSOR_EXTENSION_HOST_ROLE",agent:"cursor",value:"agent-exec"}],oB=Mb.map(e=>e.variable)});function dr(){let e=dc();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Wb.statSync)(e)?.isDirectory())return{path:(0,Hb.join)(e,uc),isUserDefined:!0}}catch{if(e.endsWith(".json"))return{path:e,isUserDefined:!0}}throw new Error(`Manifest path must be either a directory or a .json file. Got: ${e}`)}return{path:`./${uc}`,isUserDefined:!1}}var Wb,Hb,mf=x(()=>{"use strict";Wb=require("fs"),Hb=require("path");pf();he()});var Vb,VR,GR,gf,Gb=x(()=>{"use strict";Vb=w(require("ajv")),VR=new Vb.default,GR={type:"object",properties:{region:{type:"string",enum:["us","eu"]},library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]},site:{type:"object",properties:{layout:{type:"object",properties:{preset:{type:"string",enum:["library","astro","nextjs","nextjs-pages"]},pagesRoot:{type:"string",minLength:1},componentsRoot:{type:"string",minLength:1},pagesShape:{type:"string",enum:["flat","nested"]}},required:[]}},required:[]}}},gf=VR.compile(GR)});function Kb(e){return e instanceof Error?e:new Error("Unknown error")}function oe(){let{path:e}=dr();if(!(0,pc.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,pc.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${Kb(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let n;try{n=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${Kb(o).message}`)}if(!gf(n)){let o=gf.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:n,manifestPath:e}}var pc,da=x(()=>{"use strict";pc=require("fs");mf();Gb()});function pa(e,t){let r=e[t];if(!r)throw new fo(t);return r}var Jb=x(()=>{"use strict";ff()});function Se(e){let t=oe(),r=t.manifest,n=t.manifestPath,o={...r};for(let i in e){let s=i,a=e[s];if(a!==void 0)if(typeof a=="string"||typeof a=="number"||typeof a=="boolean"||a===null)o[s]=a;else{let l=o[s];o[s]={...typeof l=="object"&&l!==null?l:{},...a}}}return(0,zb.writeFileSync)(n,JSON.stringify(o,null,2),"utf-8"),o}var zb,hf=x(()=>{"use strict";zb=require("fs");da()});var Oe=x(()=>{"use strict";pf();ff();da();mf();Jb();hf()});var fc=Ap((SB,KR)=>{KR.exports={name:"@webflow/webflow-cli",version:"2.6.0",license:"MIT",bin:{webflow:"./dist/index.js"},scripts:{build:"tsup",dev:"tsup",lint:"eslint .","type-check":"tsc -p tsconfig.typecheck.json",test:"jest --ci","test:unit":"jest --ci --ignoreProjects e2e","test:local":"jest","test:e2e:deploy":"bash regression/run-local.sh","test:regression":"jest --config regression/jest.config.js --testTimeout=420000","test:e2e-cache-clear":"bash scripts/clear-e2e-cache.sh"},files:["CHANGELOG.md","dist/**/*"],publishConfig:{access:"public"},dependencies:{"@babel/parser":"^7.26.9","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.27.0","@babel/types":"^7.26.9","@dotenvx/dotenvx":"^1.44.1","@inquirer/prompts":"^7.9.0","@module-federation/enhanced":"2.5.1","@rspack/core":"^1.7.8","@webflow/app":"0.1.0-beta.6","@webflow/cosmic-deploy-contract":"^1.1.0","@webflow/data-types":"*",ajv:"^8.17.1",archiver:"^5.3.1","babel-loader":"^10.0.0",commander:"^10.0.0",cosmiconfig:"^8.2.0","css-loader":"^7.1.2",dotenv:"^16.0.3","env-paths":"^3.0.0","fast-glob":"^3.3.3",filenamify:"^6.0.0","fork-ts-checker-webpack-plugin":"9.1.0","form-data":"4.0.4","fs-extra":"^11.3.0",jsdom:"^26.0.0","jsonc-parser":"^3.2.0",md5:"^2.2.1",memfs:"4.17.0","mime-types":"^2.1.35","mini-css-extract-plugin":"^2.9.2","node-fetch":"^2.6.7",open:"^8.4.2",ora:"^8.2.0",postcss:"^8.5.23","postcss-loader":"^8.1.1","postcss-selector-parser":"^7.1.0",prettier:"^3.9.6",semver:"^7.7.2","serve-handler":"^6.1.5","source-map-support":"^0.5.21",tar:"^7.5.19","ts-checker-rspack-plugin":"^1.0.0","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.2.0",unionfs:"^4.5.4","webflow-api":"3.3.4",webpack:">=5.99.7 <5.106.0","webpack-merge":"^6.0.1","webpack-node-externals":"^3.0.0",yaml:"^2.8.4",zod:"^3.22.4"},devDependencies:{"@module-federation/sdk":"2.5.1","@types/archiver":"^5.3.2","@types/express":"^4.17.13","@types/fs-extra":"^11.0.4","@types/jest":"^30.0.0","@types/md5":"^2.3.2","@types/mime-types":"^2.1.4","@types/nock":"^8.0.33","@types/node":"^22.13.0","@types/node-fetch":"2.6.13","@types/serve-handler":"^6.1.1","@types/source-map":"^0.5.2","@types/webpack-node-externals":"^3.0.4",astro:"^7.0.6","eslint-config-custom":"*",express:"^4.18.1",jest:"^30.4.2","jest-config-custom":"*",nock:"13.3.1",tar:"^7.5.19",tsconfig:"*",tsup:"^8.4.0",typescript:"^5.9.3"},engines:{node:">=22.13.0"}}});function _r(){try{return fc().version}catch{return"unknown"}}function pr(e=""){if(!e)return"";let t=e;t=t.replace(/\/.*?\/webflow-cli/gi,"/REDACTED_PII/webflow-cli"),t=t.replace(/\/.*?\/node_modules/gi,"/REDACTED_PII/node_modules");let r=fa.default.homedir();if(r){let o=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let n=fa.default.userInfo().username;if(n){let o=new RegExp(`/Users/${n}`,"gi");t=t.replace(o,"/Users/REDACTED_PII")}return t=t.replace(/\/Users\/[^\/\s]+/gi,"/Users/REDACTED_PII"),t=t.replace(/C:\\Users\\[^\\]+/gi,"C:\\Users\\REDACTED_PII"),t=t.replace(/[a-zA-Z0-9]{32,}/g,"[REDACTED_TOKEN]"),t=t.replace(/Bearer\s+[^\s]+/gi,"Bearer [REDACTED_TOKEN]"),t=t.replace(/token[=:]\s*[^\s]+/gi,"token=[REDACTED_TOKEN]"),t=t.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[REDACTED_EMAIL]"),t=t.replace(/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,"[REDACTED_IP]"),t}function yf(e){if(e.stack)return pr(e.stack)}function xn(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],r={};for(let[n,o]of Object.entries(e)){let i=n.toLowerCase();t.some(s=>i.includes(s))?r[n]="[REDACTED]":typeof o=="string"?r[n]=pr(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?r[n]=xn(o):Array.isArray(o)?r[n]=o.map(s=>typeof s=="object"&&s!==null?xn(s):typeof s=="string"?pr(s):s):r[n]=o}return r}function qb(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${fa.default.type()} ${fa.default.release()}`}}function wf(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var fa,ma=x(()=>{"use strict";fa=w(require("os"))});function Cn(){if(process.platform==="win32"){let r=process.env.APPDATA??ga.default.join(bf.default.homedir(),"AppData","Roaming");return ga.default.join(r,Yb)}let t=process.env.XDG_CONFIG_HOME??ga.default.join(bf.default.homedir(),".config");return ga.default.join(t,Yb)}function Xb(){return ca("webflow-cli").cache}var bf,ga,Yb,Ii=x(()=>{"use strict";bf=w(require("os")),ga=w(require("path"));uf();Yb="webflow"});function ha(){return kf.default.join(Cn(),JR)}function Df(){let e=ha();try{if(!Ri.default.existsSync(e))return null;let t=Ri.default.readFileSync(e,"utf8"),r=JSON.parse(t);return typeof r=="object"&&r!==null&&typeof r.allowTelemetry=="boolean"?r:null}catch{return null}}function Ef(e){let t=ha(),r=kf.default.dirname(t);Ri.default.existsSync(r)||Ri.default.mkdirSync(r,{recursive:!0,mode:448}),Ri.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}var Ri,kf,JR,vf=x(()=>{"use strict";Ri=w(require("fs")),kf=w(require("path"));Ii();JR="telemetry.json"});var $,D,xe,Ti,Sf,nt,Z,mc,xf,Xr,N=x(()=>{"use strict";ge();$=q("\u2713"),D=Wt("\u2716"),xe=je("\u2139"),Ti=q("\u279C"),Sf=Wt("\u279C"),nt="\u279C",Z=de("\u26A0"),mc=P("\u2732"),xf=q("\u2732"),Xr=de("[Deprecated]")});var Zb,_n,Cf=x(()=>{"use strict";Zb=w(require("fs"));Oe();ma();vf();F();ge();N();he();_n=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}static localManifestExists(){try{let{path:t}=dr();return Zb.default.existsSync(t)}catch{return!1}}static readLocalPreference(){if(e.localManifestExists())try{let{manifest:t}=oe();return t?.telemetry?.global?.allowTelemetry}catch{return}}static readGlobalPreference(){return Df()?.allowTelemetry}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;let t=e.readLocalPreference();if(t!==void 0)return this.cache=t,t;let r=e.readGlobalPreference();if(r!==void 0)return this.cache=r,r}async setPreference(t,r){this.cache=t,r?.local?await this.setLocalPreference(t):await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(He()||u.info(`${xe} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(He()||(u.info(`${xf} ${P("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${xf} ${P("To opt out, run")} ${q("webflow auth telemetry --disable")}`)),await this.setGlobalPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return e.isDoNotTrackEnabled()?!1:e.readGlobalPreference()}async setGlobalPreference(t){Ef({allowTelemetry:t,lastPrompted:Date.now(),version:_r()}),He()||u.info(`${$} Telemetry configuration updated in ${ha()}`);let r=e.readLocalPreference();if(r!==void 0&&r!==t){let{path:n}=dr();u.warn(`${Z} ${n} sets telemetry to ${r?"enabled":"disabled"} and overrides the global config for commands run in this directory. Re-run with --local to update it.`)}this.cache=t}async setLocalPreference(t){let r={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:_r()}}};if(Se(r),!He()){let{path:n}=dr();u.info(`${$} Telemetry configuration updated in ${n}`)}this.cache=t}async hasGlobalPreference(){return e.readGlobalPreference()!==void 0}async getTelemetryStatus(){if(e.isDoNotTrackEnabled())return{enabled:!1,source:"env",hasPreference:!0};let t=e.readLocalPreference();if(t!==void 0)return{enabled:t,source:"local",hasPreference:!0};let r=e.readGlobalPreference();return r!==void 0?{enabled:r,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,r){this.cache=r}}});async function K(e,t){let n={"User-Agent":`webflow-cli@${_r()}`};return(0,Qb.default)(e,{...t,headers:{...t?.headers,...n}})}var Qb,ct=x(()=>{"use strict";Qb=w(require("node-fetch"));X()});var d,C=x(()=>{"use strict";d=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,r){let n=t instanceof Error?t.message:String(t);super(n),this.name="CLIError",this.prefix=r?.prefix,this.skipLogging=r?.skipLogging??!1,this.isUserError=r?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=r?.missingFlag,this.code=r?.code??(t instanceof e?t.code:void 0),t instanceof Error?(this.cause=t,this.stack=t.stack):Error.captureStackTrace&&Error.captureStackTrace(this,e)}}});function tk(e){ek=e}function ut(){return ek}function _f(e,t){if(mo.includes(e))return e;throw new d(`Invalid region "${e}" from ${t}. Valid regions: ${mo.join(", ")}.`,{isUserError:!0})}function rk(e){if(e)return _f(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return _f(t,"WEBFLOW_REGION");let r;try{r=oe().manifest.region}catch(n){if(n instanceof Error&&n.message.startsWith("Invalid manifest:"))throw new d(n.message,{isUserError:!0});return"us"}return r?_f(r,"webflow.json"):"us"}var mo,ek,An=x(()=>{"use strict";C();Oe();mo=["us","eu"],ek="us"});var nk,ok=x(()=>{"use strict";nk=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});function gc(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function Ff(){return zR[gc()][ut()]}function O(){return process.env.WEBFLOW_API_HOST?Af("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):Ff().api}function Pi(){return process.env.WEBFLOW_CDN_API_HOST?Af("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):Ff().cdnApi}function Ar(){return process.env.WEBFLOW_HOST?Af("WEBFLOW_HOST",process.env.WEBFLOW_HOST):Ff().webflow}var Af,zR,ya,If,wa,ba,$i,De=x(()=>{"use strict";An();ok();Af=(e,t)=>(nk(t)||(console.error(`Error: Invalid ${e} environment variable. Only valid plain HTTP/HTTPS URLs without query parameters and anchors is allowed.`),process.exit(1)),t),zR={development:{us:{webflow:"https://wfdev.io:8443",api:"https://api.wfdev.io:8443",cdnApi:"https://api-cdn.wfdev.io:8443"},eu:{webflow:"https://eu.wfdev.io:8443",api:"https://api.eu.wfdev.io:8443",cdnApi:"https://api-cdn.eu.wfdev.io:8443"}},acceptance:{us:{webflow:"https://webflowtest.com",api:"https://api.webflowtest.com",cdnApi:"https://api-cdn.webflowtest.com"},eu:{webflow:"https://eu.webflowtest.com",api:"https://api.eu.webflowtest.com",cdnApi:"https://api-cdn.eu.webflowtest.com"}},sai:{us:{webflow:"https://webflow-sai.com",api:"https://api.webflow-sai.com",cdnApi:"https://api-cdn.webflow-sai.com"},eu:{webflow:"https://eu.webflow-sai.com",api:"https://api.eu.webflow-sai.com",cdnApi:"https://api-cdn.eu.webflow-sai.com"}},production:{us:{webflow:"https://webflow.com",api:"https://api.webflow.com",cdnApi:"https://api-cdn.webflow.com"},eu:{webflow:"https://eu.webflow.com",api:"https://api.eu.webflow.com",cdnApi:"https://api-cdn.eu.webflow.com"}}};ya="wf-manifest.json",If="mf-manifest.json",wa="@webflow_renderer",ba="ssr-bundle.tar",$i="index.js"});function qR(){let e=process.argv.slice(2),t=[];for(let r=0;r<e.length;r+=1){let n=e[r],o=n.indexOf("=");if(o>0&&ik.has(n.slice(0,o))){t.push(`${n.slice(0,o)}=<redacted>`);continue}t.push(n),ik.has(n)&&r+1<e.length&&(t.push("<redacted>"),r+=1)}return t.join(" ")||void 0}var ik,A,Rf=x(()=>{"use strict";Cf();ma();F();ct();De();ik=new Set(["--ref","--name","--q","--branch","--key","--api-token"]);A=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=_n.getInstance(),this.sessionId=wf(),this.platformInfo=qb()}async sendEvent(t){try{if(!await this.isEnabled())return;let r=this.enrichEvent(t),n=this.sanitizeEvent(r);await this.transmitEvent(n)}catch(r){u.debug(`Failed to send telemetry event: ${r}`)}}async sendError(t,r,n){await this.sendEvent({eventType:"error",success:!1,feature:r,name:t.name,message:t.message,cause:t.cause,stack:yf(t),context:r,metadata:n?xn(n):void 0})}async sendUsage(t,r){let{duration:n,...o}=r??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof n=="number"?n:void 0,data:Object.keys(o).length>0?xn(o):void 0})}async sendPerformance(t,r,n,o){await this.sendEvent({eventType:"performance",feature:o,operation:t,duration:r,metrics:n})}async isEnabled(){return await this.consentManager.getPreference()!==!1}async isGloballyEnabled(){return await this.consentManager.getGlobalPreference()!==!1}async updatePreferences(t){await this.consentManager.setPreference(t)}static async promptForConsentIfNeeded(t){let r=_n.getInstance(),n=await r.getPreference();return n!==void 0?n:await r.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:_r(),command:this.config.suppressCommand?void 0:qR(),metadata:{...t.metadata,commandType:this.config.commandType,siteId:this.config.siteId,projectId:this.config.projectId,os:this.platformInfo.os,arch:this.platformInfo.arch}},...t}}sanitizeEvent(t){let r=JSON.parse(JSON.stringify(t));return r.message&&(r.message=pr(r.message)),r.stack&&(r.stack=pr(r.stack)),r.feature&&(r.feature=pr(r.feature)),r.context&&(r.context=pr(r.context)),r.metadata&&(r.metadata=xn(r.metadata)),r.data&&(r.data=xn(r.data)),r}async transmitEvent(t){let r=this.getEndpoint(),n=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(n){console.log(`\u{1F4CA} [Telemetry] Sending to: ${r}`);let i={...t};i.metadata&&(delete i.metadata.authToken,delete i.metadata.apiToken),console.log("\u{1F4CA} [Telemetry] Payload:",JSON.stringify(i,null,2))}let o=await K(r,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)n&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw n&&console.error(`\u{1F4CA} [Telemetry] Request failed: ${o.status} ${o.statusText}`),new Error(`Telemetry request failed: ${o.status} ${o.statusText}`)}getEndpoint(){let{host:t,commandType:r}=this.config;return`${t}/webflow-cli/${r}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"skills"})}static forSkillsSuggestion(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"skills",suppressCommand:!0})}}});var sk=x(()=>{"use strict"});function ak(e,t){return async(r,n,o)=>{let i=Date.now(),s=process.memoryUsage().heapUsed;try{let a=await n(),l=Date.now()-i,c=process.memoryUsage().heapUsed;return await e.sendPerformance(r,l,{memoryDelta:c-s,...o},t),a}catch(a){let l=Date.now()-i;throw await e.sendPerformance(r,l,{failed:1,...o},t),a}}}var X=x(()=>{"use strict";Rf();Cf();vf();sk();ma();ma()});var Pf,Tf,YR,Zr,$f=x(()=>{"use strict";Pf=Symbol("webflow-cli-warn"),Tf=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let r=t.split(`
11
+ `);for(let n=2;n<r.length;n++){let o=r[n],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===Pf){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let r=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),n=new Error().stack||"",o=this.parseSource(n);this.warnings.push({message:r,timestamp:Date.now(),source:o,stackTrace:n})})}stop(){this.isActive&&(this.originalConsoleWarn&&(console.warn=this.originalConsoleWarn,this.originalConsoleWarn=null),this.isActive=!1)}displayGrouped(){if(this.warnings.length===0)return;console.log(`
12
12
  \u26A0\uFE0F Warnings:
13
13
  `);let t=this.warnings.reduce((r,n)=>{let o=n.source||"General";return r[o]||(r[o]=[]),r[o].push(n),r},{});Object.entries(t).forEach(([r,n])=>{r!=="General"&&console.log(` ${r}:`),n.forEach((o,i)=>{let s=r!=="General"?" ":" ",a=o.message||"[Empty warning message]";console.log(`${s}${i+1}. ${a}`)}),r!=="General"&&console.log("")}),t.General&&console.log("")}debug(){console.log(`
14
14
  \u{1F41B} Debug: Captured Warnings
15
15
  `),this.warnings.forEach((t,r)=>{console.log(`Warning ${r+1}:`),console.log(` Source: ${t.source}`),console.log(` Message: ${t.message}`),console.log(` Message length: ${t.message.length}`),console.log(` Timestamp: ${new Date(t.timestamp).toISOString()}`),t.stackTrace&&(console.log(" Stack (first 3 lines):"),t.stackTrace.split(`
16
- `).slice(0,3).forEach(n=>{console.log(` ${n}`)})),console.log("")})}},gI=new bf,Jr=gI});function bt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function Hb(e,t){if(!e)return t;let r=parseInt(e,10);return isNaN(r)||r<=0?t:r}function zr(e){ua.push(ur(e)),ua.length>wI&&ua.shift()}function Vb(e){vf=e}function Ub(e){return zr(`DEBUG: ${e}`),e}function kI(e){return zr(`INFO: ${e}`),e}function DI(e){return zr(`WARN: ${e}`),e}function EI(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";zr(`ERROR: ${n}${r}`),Sf=!0;let o=e instanceof Error?e.message:String(e);return Ut(`${n}${o}`)}function vI(e){return zr(`SUCCESS: ${e}`),z(e)}function CI(e){let t=Jp({text:`${e}...`,indent:1}).start(),r=!1,n=o=>i=>{if(zr(`${SI[o]||"INFO"}: ${i||e}`),o==="fail"&&(Sf=!0),o==="update"){t.text=i||e;return}r||(r=!0,t.stopAndPersist({symbol:xI[o],text:P(i||e)}))};return{succeed:n("succeed"),fail:n("fail"),warn:n("warn"),info:n("info"),neutral:n("neutral"),update:n("update"),stop:()=>{r||(r=!0,t.stop())}}}function FI(){let e=vi.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:vi.default.statSync(uc.default.join(At,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);for(;e.length>=yI;)try{let t=e.pop();if(!t)break;vi.default.removeSync(uc.default.join(At,t.name))}catch{}}function xf(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;vi.default.ensureDirSync(At),FI(),ua.unshift(`CLI Version: ${Sr()}`,`Node Version: ${process.version}`,`Platform: ${process.platform}`,`Architecture: ${process.arch}`,`Command: ${t||"N/A"}`,`Exit Code: ${e??0}`,`Memory Usage: ${Math.round(process.memoryUsage().heapUsed/1024/1024)}MB`,`Timestamp: ${new Date().toISOString()}`,...vf?[`Sync ID: ${vf}`]:[],"");let r=ua.map(bt);vi.default.writeFileSync(Ef,r.join(`
17
- `)),Sf&&(console.info(`
18
- ${D} ${P("An error occurred. See logs for more information:")}`),console.info(` ${df} Latest log: ${Ef}`),console.info(` ${df} All logs: ${At}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
- ${$} Command completed successfully. Logs written to:`),console.info(` ${ki} Latest log: ${Ef}`),console.info(` ${ki} All logs: ${At}`))}catch(t){console.error("Failed to write logs:",t)}}function Gb(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";zr(`ERROR: ${n}${r}`)}var vi,uc,dB,hI,At,yI,wI,bI,Ef,ua,Sf,vf,SI,xI,Si,Wb,ca,_I,u,R=x(()=>{"use strict";vi=w(require("fs-extra")),uc=w(require("path")),dB=require("source-map-support/register");ab();Yp();db();Z();me();Df();j();hI=Xs("webflow-cli"),At=hI.log;yI=Hb(process.env.MAX_PERSISTED_LOGS,50),wI=Hb(process.env.MAX_IN_MEMORY_LOGS,1e3),bI=`${Zs(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Ef=uc.default.join(At,bI);ua=[],Sf=!1;SI={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},xI={succeed:$,fail:D,warn:X,info:xe,neutral:" ",update:void 0};Si=!1;process.on("uncaughtException",e=>{Si||(Si=!0,zr(`UNCAUGHT EXCEPTION: ${e?.stack}`),xf(1)),Jr.displayGrouped(),Jr.stop(),process.exit(1)});process.on("unhandledRejection",e=>{Si||(Si=!0,zr(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),xf(1)),Jr.displayGrouped(),Jr.stop(),process.exit(1)});process.on("exit",e=>{Si||(Si=!0,xf(e))});Wb=!0,ca=e=>{let t=e.split(`
16
+ `).slice(0,3).forEach(n=>{console.log(` ${n}`)})),console.log("")})}},YR=new Tf,Zr=YR});function bt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function uk(e,t){if(!e)return t;let r=parseInt(e,10);return isNaN(r)||r<=0?t:r}function Qr(e){Da.push(pr(e)),Da.length>QR&&Da.shift()}function dk(e){Lf=e}function lk(e){return Qr(`DEBUG: ${e}`),e}function tT(e){return Qr(`INFO: ${e}`),e}function rT(e){return Qr(`WARN: ${e}`),e}function nT(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";Qr(`ERROR: ${n}${r}`),Nf=!0;let o=e instanceof Error?e.message:String(e);return Wt(`${n}${o}`)}function oT(e){return Qr(`SUCCESS: ${e}`),q(e)}function aT(e){let t=af({text:`${e}...`,indent:1}).start(),r=!1,n=o=>i=>{if(Qr(`${iT[o]||"INFO"}: ${i||e}`),o==="fail"&&(Nf=!0),o==="update"){t.text=i||e;return}r||(r=!0,t.stopAndPersist({symbol:sT[o],text:P(i||e)}))};return{succeed:n("succeed"),fail:n("fail"),warn:n("warn"),info:n("info"),neutral:n("neutral"),update:n("update"),stop:()=>{r||(r=!0,t.stop())}}}function lT(){let e=Oi.default.readdirSync(Rt).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:Oi.default.statSync(hc.default.join(Rt,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);for(;e.length>=ZR;)try{let t=e.pop();if(!t)break;Oi.default.removeSync(hc.default.join(Rt,t.name))}catch{}}function jf(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;Oi.default.ensureDirSync(Rt),lT(),Da.unshift(`CLI Version: ${_r()}`,`Node Version: ${process.version}`,`Platform: ${process.platform}`,`Architecture: ${process.arch}`,`Command: ${t||"N/A"}`,`Exit Code: ${e??0}`,`Memory Usage: ${Math.round(process.memoryUsage().heapUsed/1024/1024)}MB`,`Timestamp: ${new Date().toISOString()}`,...Lf?[`Sync ID: ${Lf}`]:[],"");let r=Da.map(bt);Oi.default.writeFileSync(Of,r.join(`
17
+ `)),Nf&&(console.info(`
18
+ ${D} ${P("An error occurred. See logs for more information:")}`),console.info(` ${Sf} Latest log: ${Of}`),console.info(` ${Sf} All logs: ${Rt}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
+ ${$} Command completed successfully. Logs written to:`),console.info(` ${Ti} Latest log: ${Of}`),console.info(` ${Ti} All logs: ${Rt}`))}catch(t){console.error("Failed to write logs:",t)}}function pk(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";Qr(`ERROR: ${n}${r}`)}var Oi,hc,pU,XR,Rt,ZR,QR,eT,Of,Da,Nf,Lf,iT,sT,Li,ck,ka,cT,u,F=x(()=>{"use strict";Oi=w(require("fs-extra")),hc=w(require("path")),pU=require("source-map-support/register");Ab();uf();Tb();X();ge();$f();N();XR=ca("webflow-cli"),Rt=XR.log;ZR=uk(process.env.MAX_PERSISTED_LOGS,50),QR=uk(process.env.MAX_IN_MEMORY_LOGS,1e3),eT=`${ua(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Of=hc.default.join(Rt,eT);Da=[],Nf=!1;iT={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},sT={succeed:$,fail:D,warn:Z,info:xe,neutral:" ",update:void 0};Li=!1;process.on("uncaughtException",e=>{Li||(Li=!0,Qr(`UNCAUGHT EXCEPTION: ${e?.stack}`),jf(1)),Zr.displayGrouped(),Zr.stop(),process.exit(1)});process.on("unhandledRejection",e=>{Li||(Li=!0,Qr(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),jf(1)),Zr.displayGrouped(),Zr.stop(),process.exit(1)});process.on("exit",e=>{Li||(Li=!0,jf(e))});ck=!0,ka=e=>{let t=e.split(`
20
20
  `).map(r=>r.length?` ${r}`:r).join(`
21
- `);return Wb?(Wb=!1,`
22
- `+t):t};_I={debug:e=>{let t=Ub(e);process.env.DEBUG&&console.debug(ca(t))},trace:e=>{let t=Ub(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(ca(kI(e))),warn:e=>console.warn(ca(DI(e)),kf),error:(e,t)=>{console.error(ca(EI(e,t)))},success:e=>console.log(ca(vI(e))),spinner:CI},u=_I});async function xi(e){process.stdout.write(`
23
- `);try{return await e()}catch(t){throw t instanceof Error&&OI.test(t.message)&&(u.debug(t.message),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&process.stdin.setRawMode(!1),process.exit(130)),t}}async function $e(e){return V()?e.default??!1:xi(()=>ut.confirm({...e,theme:RI}))}async function je(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(r=>{if(!r||typeof r!="object"||ut.Separator.isSeparator(r)||r.type==="separator")return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return xi(()=>ut.select({...e,choices:t,theme:TI}))}async function Ge(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:xi(()=>ut.input({...e,theme:zb}))}async function Xb(e){return V()?null:xi(()=>ut.password({...e,theme:zb}))}async function Cr(e){if(V()){let r=[];return await e.validate?.(r)!==!0?null:r}let t=e.choices.map(r=>{if(!r||typeof r!="object"||r.type==="separator"||ut.Separator.isSeparator(r))return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return xi(()=>ut.checkbox({...e,choices:t,theme:PI}))}async function pc(e){if(V())return"default"in e?e.default:null;let t=(async(r,n)=>(await e.source(r,n)).map(i=>!i||typeof i!="object"||ut.Separator.isSeparator(i)?i:{...i,name:` ${P(i.name??"")}`}));return xi(()=>ut.search({...e,source:t,theme:$I}))}var ut,RI,zb,da,qb,_f,Af,Yb,II,TI,PI,$I,OI,Oe=x(()=>{"use strict";ut=w(require("@inquirer/prompts"));we();R();me();RI={prefix:` ${Ne("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
21
+ `);return ck?(ck=!1,`
22
+ `+t):t};cT={debug:e=>{let t=lk(e);process.env.DEBUG&&console.debug(ka(t))},trace:e=>{let t=lk(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(ka(tT(e))),warn:e=>console.warn(ka(rT(e)),Pf),error:(e,t)=>{console.error(ka(nT(e,t)))},success:e=>console.log(ka(oT(e))),spinner:aT},u=cT});function wk(e){return e instanceof Error&&hT.test(e.message)}async function Ni(e){process.stdout.write(`
23
+ `);try{return await e()}catch(t){throw wk(t)&&(u.debug(t.message),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&process.stdin.setRawMode(!1),process.exit(130)),t}}async function yT(e){process.stdout.write(`
24
+ `);try{return await e()}catch(t){if(wk(t))return u.debug(t.message),null;throw t}}async function Ce(e){if(W())return e.default??!1;let{exitOnCancel:t=!0,...r}=e,n=()=>dt.confirm({...r,theme:dT});return t?Ni(n):yT(n)}async function Me(e){if(W())return"default"in e?e.default:null;let t=e.choices.map(r=>{if(!r||typeof r!="object"||dt.Separator.isSeparator(r)||r.type==="separator")return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return Ni(()=>dt.select({...e,choices:t,theme:fT}))}async function qe(e){return W()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:Ni(()=>dt.input({...e,theme:gk}))}async function bk(e){return W()?null:Ni(()=>dt.password({...e,theme:gk}))}async function Fr(e){if(W()){let r=[];return await e.validate?.(r)!==!0?null:r}let t=e.choices.map(r=>{if(!r||typeof r!="object"||r.type==="separator"||dt.Separator.isSeparator(r))return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return Ni(()=>dt.checkbox({...e,choices:t,theme:mT}))}async function wc(e){if(W())return"default"in e?e.default:null;let t=(async(r,n)=>(await e.source(r,n)).map(i=>!i||typeof i!="object"||dt.Separator.isSeparator(i)?i:{...i,name:` ${P(i.name??"")}`}));return Ni(()=>dt.search({...e,source:t,theme:gT}))}var dt,dT,gk,Ea,hk,Uf,Wf,yk,pT,fT,mT,gT,hT,Fe=x(()=>{"use strict";dt=w(require("@inquirer/prompts"));he();F();ge();dT={prefix:` ${je("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
24
25
  `:`${se(e)}
25
- `,answer:e=>` ${P(e)}`}},zb={prefix:` ${Ne("?")}`,style:{message:e=>`${se(e)}
26
- `,answer:e=>P(e)}},da=2,qb=1,_f=(e,t)=>t==="done"?`${se(e)}
27
- `:se(e),Af=e=>` ${P(bt(e).trim())}`,Yb=e=>{let t=bt(e),r=t.slice(0,da),n=t.slice(da+1+qb);return Ne(`${r} ${n}`)},II=e=>{let t=bt(e),r=t.slice(0,da),n=t[da+2],o=t.slice(da+3+qb);return Ne(`${r} ${n} ${o}`)},TI={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:Yb,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`}},PI={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:II,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`,checked:` ${z("\u25C9")}`,unchecked:` ${P("\u25EF")}`}},$I={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:Yb,searchTerm:e=>Ne(e)},icon:{cursor:` ${Ne("\u23F5")}`}},OI=/SIGINT/i});function Ke(){return!0}var qr=x(()=>{"use strict"});function Yr({apiToken:e,siteId:t,directory:r}){let n=fa.resolve(r?fa.join(r,".env"):fa.join(process.cwd(),".env"));r&&!co.existsSync(r)&&co.mkdirSync(r,{recursive:!0}),co.existsSync(n)||co.writeFileSync(n,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),fc.default.config({path:n,quiet:!0}),e&&fc.default.set("WEBFLOW_API_TOKEN",e,{path:n,encrypt:!1}),t&&fc.default.set("WEBFLOW_SITE_ID",t,{path:n,encrypt:!1})}var co,fa,fc,nk=x(()=>{"use strict";co=w(require("fs")),fa=w(require("path")),fc=w(require("@dotenvx/dotenvx"))});function If(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version===mc&&io.includes(t.region)&&typeof t.session=="object"&&t.session!==null&&typeof t.session.accessToken=="string"}function Sn(){let e=wi();return Tf.default.join(e,jI)}function ok(){let e=Sn();try{if(!vn.default.existsSync(e))return null;let t=vn.default.readFileSync(e,"utf8"),r=JSON.parse(t);if(If(r))return r;let n=r;if(n.version===2&&typeof n.sessions=="object"&&n.sessions){let i=ct(),s=n.sessions,a=s[i]!=null?i:Object.keys(s).find(p=>s[p]!=null);if(a==null)return null;let l=s[a];if(l==null)return null;let c={version:mc,region:a,session:l};return If(c)?c:null}let o=r;if(typeof o.accessToken=="string"){let i={version:mc,region:"us",session:o};return If(i)?i:null}return null}catch{return null}}function Ci(e=ct()){let t=ok();return!t||t.region!==e?null:t.session}function ma(){return ok()?.region??null}function Pf(e,t=ct()){let r=Sn(),n=Tf.default.dirname(r);vn.default.existsSync(n)||vn.default.mkdirSync(n,{recursive:!0,mode:448});let o={version:mc,region:t,session:e};vn.default.writeFileSync(r,JSON.stringify(o,null,2),{encoding:"utf8",mode:384})}function $f(){let e=Sn();try{if(!vn.default.existsSync(e))return;vn.default.unlinkSync(e)}catch{}}var vn,Tf,jI,mc,Of=x(()=>{"use strict";vn=w(require("fs")),Tf=w(require("path"));oa();Dn();jI="auth.json",mc=3});function Fi(){return{serverUrl:xr(),timeoutMs:300*1e3}}var Lf=x(()=>{"use strict";ke()});var ik,sk,ak,lk,MI,ck,BI,uk,dk=x(()=>{"use strict";ik=require("crypto"),sk=w(require("open"));Lf();R();lt();ak=e=>{let t=new Uint8Array(e);return ik.webcrypto.getRandomValues(t),Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")},lk=({pollId:e,clientId:t,scope:r})=>`${Fi().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(r.join(" "))}`,MI=e=>`${Fi().serverUrl}/oauth/webflow/poll?pollId=${e}`,ck=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(r=>setTimeout(r,3e3)),await(0,sk.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},BI=async e=>{let t=MI(e),r=await K(t);if(!r.ok){let n=`Failed to poll for authentication status (${r.status})`;try{let o=await r.json();o&&o.error&&(n+=`: ${o.error}`)}catch{}throw new Error(n)}return r.json()},uk=(e,t)=>{let r=u.spinner("Waiting");return new Promise((n,o)=>{let i=setTimeout(()=>{clearTimeout(i),clearInterval(s),o(new Error("Authentication timed out. Please try again."))},t),s=setInterval(async()=>{try{let a=await BI(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),r.succeed("Authentication successful! You can close the browser window."),n(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function fk(){return[...UI,...Ke()?WI:[]].sort()}function Vt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=Ci();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!pk&&(pk=!0,u.warn(`${X} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${z("webflow auth login --force")} to update your .env file.`)),t}async function T(e){if(e?.apiToken&&!e.force)return e.apiToken;if(!e?.force){let s=Vt();if(s)return s}if(V())throw new d(`No API token found. To authenticate in CI/CD environments:
26
+ `,answer:e=>` ${P(e)}`}},gk={prefix:` ${je("?")}`,style:{message:e=>`${se(e)}
27
+ `,answer:e=>P(e)}},Ea=2,hk=1,Uf=(e,t)=>t==="done"?`${se(e)}
28
+ `:se(e),Wf=e=>` ${P(bt(e).trim())}`,yk=e=>{let t=bt(e),r=t.slice(0,Ea),n=t.slice(Ea+1+hk);return je(`${r} ${n}`)},pT=e=>{let t=bt(e),r=t.slice(0,Ea),n=t[Ea+2],o=t.slice(Ea+3+hk);return je(`${r} ${n} ${o}`)},fT={prefix:` ${je("?")}`,style:{message:Uf,answer:Wf,highlight:yk,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`}},mT={prefix:` ${je("?")}`,style:{message:Uf,answer:Wf,highlight:pT,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`,checked:` ${q("\u25C9")}`,unchecked:` ${P("\u25EF")}`}},gT={prefix:` ${je("?")}`,style:{message:Uf,answer:Wf,highlight:yk,searchTerm:e=>je(e)},icon:{cursor:` ${je("\u23F5")}`}},hT=/SIGINT/i});function Ve(){return!1}var en=x(()=>{"use strict"});function tn({apiToken:e,siteId:t,directory:r}){let n=Sa.resolve(r?Sa.join(r,".env"):Sa.join(process.cwd(),".env"));r&&!wo.existsSync(r)&&wo.mkdirSync(r,{recursive:!0}),wo.existsSync(n)||wo.writeFileSync(n,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),bc.default.config({path:n,quiet:!0}),e&&bc.default.set("WEBFLOW_API_TOKEN",e,{path:n,encrypt:!1}),t&&bc.default.set("WEBFLOW_SITE_ID",t,{path:n,encrypt:!1})}var wo,Sa,bc,xk=x(()=>{"use strict";wo=w(require("fs")),Sa=w(require("path")),bc=w(require("@dotenvx/dotenvx"))});function Vf(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version===kc&&mo.includes(t.region)&&typeof t.session=="object"&&t.session!==null&&typeof t.session.accessToken=="string"}function Rn(){let e=Cn();return Gf.default.join(e,kT)}function Ck(){let e=Rn();try{if(!In.default.existsSync(e))return null;let t=In.default.readFileSync(e,"utf8"),r=JSON.parse(t);if(Vf(r))return r;let n=r;if(n.version===2&&typeof n.sessions=="object"&&n.sessions){let i=ut(),s=n.sessions,a=s[i]!=null?i:Object.keys(s).find(p=>s[p]!=null);if(a==null)return null;let l=s[a];if(l==null)return null;let c={version:kc,region:a,session:l};return Vf(c)?c:null}let o=r;if(typeof o.accessToken=="string"){let i={version:kc,region:"us",session:o};return Vf(i)?i:null}return null}catch{return null}}function ji(e=ut()){let t=Ck();return!t||t.region!==e?null:t.session}function xa(){return Ck()?.region??null}function Kf(e,t=ut()){let r=Rn(),n=Gf.default.dirname(r);In.default.existsSync(n)||In.default.mkdirSync(n,{recursive:!0,mode:448});let o={version:kc,region:t,session:e};In.default.writeFileSync(r,JSON.stringify(o,null,2),{encoding:"utf8",mode:384})}function Jf(){let e=Rn();try{if(!In.default.existsSync(e))return;In.default.unlinkSync(e)}catch{}}var In,Gf,kT,kc,zf=x(()=>{"use strict";In=w(require("fs")),Gf=w(require("path"));Ii();An();kT="auth.json",kc=3});function Mi(){return{serverUrl:Ar(),timeoutMs:300*1e3}}var qf=x(()=>{"use strict";De()});var _k,Ak,Fk,Ik,DT,Rk,ET,Tk,Pk=x(()=>{"use strict";_k=require("crypto"),Ak=w(require("open"));qf();F();ct();Fk=e=>{let t=new Uint8Array(e);return _k.webcrypto.getRandomValues(t),Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")},Ik=({pollId:e,clientId:t,scope:r})=>`${Mi().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(r.join(" "))}`,DT=e=>`${Mi().serverUrl}/oauth/webflow/poll?pollId=${e}`,Rk=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(r=>setTimeout(r,3e3)),await(0,Ak.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},ET=async e=>{let t=DT(e),r=await K(t);if(!r.ok){let n=`Failed to poll for authentication status (${r.status})`;try{let o=await r.json();o&&o.error&&(n+=`: ${o.error}`)}catch{}throw new Error(n)}return r.json()},Tk=(e,t)=>{let r=u.spinner("Waiting");return new Promise((n,o)=>{let i=setTimeout(()=>{clearTimeout(i),clearInterval(s),o(new Error("Authentication timed out. Please try again."))},t),s=setInterval(async()=>{try{let a=await ET(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),r.succeed("Authentication successful! You can close the browser window."),n(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function Ok(){return[...vT,...Ve()?ST:[]].sort()}function kt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=ji();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!$k&&($k=!0,u.warn(`${Z} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${q("webflow auth login --force")} to update your .env file.`)),t}async function R(e){if(e?.apiToken&&!e.force)return e.apiToken;if(!e?.force){let s=kt();if(s)return s}if(W())throw new d(`No API token found. To authenticate in CI/CD environments:
28
29
  1. Generate a Workspace API token in your Webflow Dashboard > Apps & Integrations > Manage > Workspace API Token
29
- 2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=ct(),r=ma();r&&r!==t&&u.warn(`${X} Switching region from ${r.toUpperCase()} to ${t.toUpperCase()} \u2014 the ${r.toUpperCase()} session will be replaced.`);let n=ak(16),o=VI(),i=fk();try{let s=lk({pollId:n,clientId:o,scope:i});u.debug(`OAuth login: region="${ct()}" buildEnv="${cc()}" apiHost="${O()}" oauthServer="${Fi().serverUrl}" clientId="${o}" authorizeUrl="${s}"`),await ck(s);let a=await uk(n,Fi().timeoutMs);return Pf({accessToken:a,scopes:i,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${Sn()}`),a}catch(s){throw new d(s)}}function VI(){if(process.env.WEBFLOW_OAUTH_CLIENT_ID)return process.env.WEBFLOW_OAUTH_CLIENT_ID;let e=cc(),t=ct(),r=HI[e][t];if(r)return r;let n=t.toUpperCase();throw new d(`${n} login is not available for this environment yet. Set WEBFLOW_API_TOKEN to a token from your ${n} workspace, or set WEBFLOW_OAUTH_CLIENT_ID if you have a ${n} client ID.`,{isUserError:!0})}var UI,WI,pk,HI,Nf=x(()=>{"use strict";ke();we();R();j();C();Dn();Of();Lf();dk();me();qr();UI=["assets:read","assets:write","authorized_user:read","cloud_apps:write","cms:read","cms:write","code_components:read","code_components:write","devlink_export:read","forms:read","sites:read","sites:write","workspace:read"],WI=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];pk=!1;HI={development:{us:"db64c798d0a5adb3c9c43b10c80f93fece223acd072246f957d9700b1bf3cab0"},acceptance:{us:"32a6440eefa0b608b39c36164a9cf274c9c096cfe6541e9dab08ff4f372fe245"},sai:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074",eu:"6e2027b2c3a881e6d1f7a0933e7240e9ddf50df5afdde06740e30d56e3deed4b"},production:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}}});function uo(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function xn(e){try{let r=await new mk.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Di()}/v2`}}).sites.list();if(!r||typeof r!="object"||!r.sites||!Array.isArray(r.sites))throw new d("Invalid response from Webflow API");let n=r.sites.map(o=>({id:o.id,displayName:o.displayName??"",shortName:o.shortName||(o.displayName??"").toLowerCase().replace(/\s+/g,"-"),lastUpdated:o.lastUpdated??null,workspaceId:o.workspaceId??null}));return n.sort((o,i)=>o.displayName.localeCompare(i.displayName)),n}catch(t){throw new d(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
30
- `})}}async function _i(e){let t=e.map(n=>({name:`${n.displayName} (${n.shortName})`,value:n})),r=await pc({message:"Search for a Webflow site:",source:n=>{if(!n)return t;let o=n.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!r){if(e.length===0)throw new d("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return r}var mk,gc=x(()=>{"use strict";mk=require("webflow-api");Oe();R();ke();ke();C()});var po,Cn,jf=x(()=>{"use strict";C();po=class extends d{constructor(t){super(t),this.name="NoWebflowSitesError"}},Cn=class extends d{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Je(e,t){let r=t?.site??uo(e);if(V()&&!r)throw new d(`No site ID configured for this project.
31
- Run ${z("webflow auth login")} locally to authenticate and associate this project with a Webflow site,
32
- or provide --site and --api-token when running a CLI command`);let n=await T({apiToken:t?.apiToken,force:t?.force});if(!r||t?.force){let o=await xn(n);if(o.length===0)throw new po("No Webflow sites found in your account. Please make sure you have at least one authorized site in your Webflow account");let i=o.length>1?await _i(o):o[0];r=i.id;let s=Se({siteId:r});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:r,siteName:i.displayName,accessToken:n}}return{siteId:r,accessToken:n}}var gk=x(()=>{"use strict";Pe();we();Nf();gc();C();jf();j();me();R()});async function Mf(e){let t=O(),r=Di();u.debug(`getTokenInfo: region="${ct()}" apiHost="${t}" cdnApiHost="${r}"`);let n=new hk.WebflowClient({accessToken:e,environment:{base:`${t}/v2`,dataApi:`${t}/v2`,contentDeliveryApi:`${r}/v2`}});try{return await n.token.authorizedBy()}catch(o){return u.debug(`getTokenInfo failed: ${o}`),null}}var hk,yk=x(()=>{"use strict";hk=require("webflow-api");ke();R();Dn()});var Y=x(()=>{"use strict";nk();Nf();gk();gc();gc();Of();yk();jf()});function l0(e,t){if(e.includes("..")||dr.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let r=dr.resolve(t,e),n=dr.resolve(t);if(!r.startsWith(n+dr.sep)&&r!==n)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function Uc(e,t,r){let n=dr.join(process.cwd(),t);r&&(0,Rn.existsSync)(n)&&await(0,Bc.rm)(n,{recursive:!0,force:!0}),(0,Rn.existsSync)(n)||await(0,Bc.mkdir)(n);for(let o of e){l0(o.path,n);let i=c0(n,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));u0(n,s)}(0,Rn.writeFileSync)(i,o.content,{flag:"w+"})}}function c0(e,t){return dr.join(e,...t.split("/"))}function u0(e,t){let r=t.split("/"),n=e;for(let o of r)n=dr.join(n,o),(0,Rn.existsSync)(n)||(0,Rn.mkdirSync)(n)}var Rn,Bc,dr,om=x(()=>{"use strict";Rn=require("fs"),Bc=require("fs/promises"),dr=w(require("path"))});function Hc(e){for(let t of e??[]){let r=u[t.status]??u.info,n=m0[t.status]??xe;r(`
33
- ${n} ${t.content}`)}}var m0,am=x(()=>{"use strict";R();j();m0={info:xe,warn:X,success:$}});function cm(e){let{manifestPath:t}=oe();return(0,hD.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var hD,yD=x(()=>{"use strict";hD=require("fs");Qs()});function Vc(e,t,r){try{let n=um(r),o=dm(Object.values(e)),i=t?.force;return o&&n&&!i}catch{return!1}}var wD,bD,um,dm,Gc=x(()=>{"use strict";wD=require("path"),bD=require("fs-extra");um=e=>{try{return(0,bD.existsSync)((0,wD.join)(e,"tsconfig.json"))}catch{return!1}},dm=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function g0(e){let{export:t,...r}=e;return t?r["devlink-export"]!=null?(cm(r),r):(u.warn(`${X} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),r["devlink-export"]={...t},cm(r),r):r}function ED(e,t){try{new RegExp(e)}catch{throw new d(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function SD(e){e=g0(e);let t=e["devlink-export"]||{},r=!1,n=t.rootDir;n||(V()?n=kD:(r=!0,n=await Ge({message:"Enter the root directory for exported components:",default:kD,validate:p=>!p||p.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(w0()?o=!0:V()?o=!1:(r=!0,o=await $e({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=DD:(r=!0,i=await $e({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:DD}))),t.components&&ED(t.components,"components"),t.componentGroups&&ED(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=Kc,a=Jc):(r=!0,await $e({message:"Do you want to export all components?",default:!0})?(s=Kc,a=Jc):(s=await Ge({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Kc,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Ge({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:Jc,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Kc,a=a||Jc;let l=t.relativeHrefRoot;l===void 0&&(l=h0);let c={...t,rootDir:n,components:s,componentGroups:a,ts:o,cssScopes:i,relativeHrefRoot:l};return(!t.rootDir||t.ts===void 0||t.cssScopes===void 0||!t.components||!t.componentGroups||t.relativeHrefRoot===void 0)&&y0(c),{config:c,wasPrompted:r}}function y0(e){Se({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function w0(){try{let e=process.cwd();if(um(e))return!0;let t=["src","app","pages","components"];for(let r of t){let n=vD.join(e,r);if(zc.existsSync(n)&&dm(zc.readdirSync(n)))return!0}}catch{}return!1}var zc,vD,kD,Kc,Jc,DD,h0,xD=x(()=>{"use strict";zc=w(require("fs")),vD=w(require("path"));Oe();we();R();j();C();rf();yD();Gc();kD="./webflow",Kc=".*",Jc=".*",DD=!0,h0="/"});function mo(e){let t=e;for(let r=0;r<8&&t instanceof Error;r+=1){if(t.code===fm)return!0;t=t.cause}return!1}async function _D(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let r,n;try{let o=JSON.parse(t);r=o.message,n=o.code}catch{}throw new Fa(r||`Request failed (HTTP ${e.status}).`,{code:n})}async function mm(e,t,r,n){let o=await b0(r,n,t,e);if(!o.files||!Array.isArray(o.files))throw new d("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function b0(e,t,r,n){let{taskId:o,polling:i}=await k0(e,t,r,n);return D0(e,t,r,o,i)}async function k0(e,t,r,n){let o=await(0,pm.default)(`${O()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",[FD]:t},body:JSON.stringify(n),timeout:6e4});return o.ok||await _D(o),await o.json()}async function D0(e,t,r,n,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,p=i;do{let f=await(0,pm.default)(`${O()}/v2/devlink/${e}/export/${n}`,{headers:{Authorization:`Bearer ${r}`,[FD]:t},timeout:6e4});f.ok||await _D(f);let m=await f.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new Fa("The export task failed. Please try again or report a bug.");await(0,CD.setTimeout)(p),p=Math.min(p*a,s)}while(Date.now()<c);throw new Fa(`Export task timed out after ${l}ms. Please try again.`)}var pm,CD,FD,fm,Fa,gm=x(()=>{"use strict";pm=w(require("node-fetch")),CD=require("timers/promises");R();ke();C();FD="X-WF-Sync-Id",fm="devlink_export_not_entitled",Fa=class extends Error{code;constructor(t,r){super(t),this.code=r?.code}}});var AD,RD=x(()=>{"use strict";Oe();R();AD=async(e,t)=>{if(!t)return;await $e({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function ID(e,t,r){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:r||`${t}s`;return`${e} ${i}`}var TD=x(()=>{"use strict"});async function qc(e){let t=Date.now(),r;try{let{manifest:n}=oe(),{siteId:o,accessToken:i}=await Je(n,e),s=(0,PD.randomUUID)();Vb(s);let{config:a,wasPrompted:l}=await SD(n);u.info(`${$} Export configuration loaded!`),await AD(a,l);let c=_.forExport({authToken:i,siteId:o});r=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:p,messages:f,metadata:m}=await mm(a,i,o,s),g=m.exportCoverage==="full";await Uc(p,a.rootDir,g),r.succeed(`${ID(m.componentCount,"component")} exported to ${a.rootDir}`),Hc(f);let h=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:h,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);throw e?.silentNotEntitled&&mo(p)?r.stop():r.fail(`Components export failed: ${f}`),await c.sendError(p instanceof Error?p:new Error(String(p)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),p}}catch(n){if(!(e?.silentNotEntitled&&mo(n))){let i="Export failed: "+(n instanceof Error?n.message:n);r?r.fail(i):u.error(i,{prefix:`
34
- `+D})}throw new d(n,{skipLogging:!0})}}var PD,$D=x(()=>{"use strict";PD=require("crypto");xD();gm();RD();Z();Y();Pe();TD();R();C();om();j();am()});var OD={};hp(OD,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>fm,exportComponents:()=>qc,isDevlinkNotEntitledError:()=>mo});var Yc=x(()=>{"use strict";$D();gm()});var fe,qm,H,Rr,ja=x(()=>{"use strict";(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(fe||(fe={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qm||(qm={}));H=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rr=e=>{switch(typeof e){case"undefined":return H.undefined;case"string":return H.string;case"number":return Number.isNaN(e)?H.nan:H.number;case"boolean":return H.boolean;case"function":return H.function;case"bigint":return H.bigint;case"symbol":return H.symbol;case"object":return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?H.promise:typeof Map<"u"&&e instanceof Map?H.map:typeof Set<"u"&&e instanceof Set?H.set:typeof Date<"u"&&e instanceof Date?H.date:H.object;default:return H.unknown}}});var I,CT,kt,ku=x(()=>{"use strict";ja();I=fe.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"]),CT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),kt=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};kt.create=e=>new kt(e)});var FT,rn,Ym=x(()=>{"use strict";ku();ja();FT=(e,t)=>{let r;switch(e.code){case I.invalid_type:e.received===H.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,fe.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:r=`Unrecognized key(s) in object: ${fe.joinValues(e.keys,", ")}`;break;case I.invalid_union:r="Invalid input";break;case I.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${fe.joinValues(e.options)}`;break;case I.invalid_enum_value:r=`Invalid enum value. Expected ${fe.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:r="Invalid function arguments";break;case I.invalid_return_type:r="Invalid function return type";break;case I.invalid_date:r="Invalid date";break;case I.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:fe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case I.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case I.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case I.custom:r="Invalid input";break;case I.invalid_intersection_types:r="Intersection results could not be merged";break;case I.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:r="Number must be finite";break;default:r=t.defaultError,fe.assertNever(e)}return{message:r}},rn=FT});function _T(e){pv=e}function Vi(){return pv}var pv,Du=x(()=>{"use strict";Ym();pv=rn});function M(e,t){let r=Vi(),n=Ma({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===rn?void 0:rn].filter(o=>!!o)});e.common.issues.push(n)}var Ma,AT,nt,ee,wo,pt,Eu,vu,Nn,Gi,Xm=x(()=>{"use strict";Du();Ym();Ma=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},AT=[];nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return ee;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ee;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},ee=Object.freeze({status:"aborted"}),wo=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),Eu=e=>e.status==="aborted",vu=e=>e.status==="dirty",Nn=e=>e.status==="valid",Gi=e=>typeof Promise<"u"&&e instanceof Promise});var fv=x(()=>{"use strict"});var J,mv=x(()=>{"use strict";(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(J||(J={}))});function ae(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:o}}function wv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function KT(e){return new RegExp(`^${wv(e)}$`)}function bv(e){let t=`${yv}T${wv(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function JT(e,t){return!!((t==="v4"||!t)&&MT.test(e)||(t==="v6"||!t)&&UT.test(e))}function zT(e,t){if(!OT.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function qT(e,t){return!!((t==="v4"||!t)&&BT.test(e)||(t==="v6"||!t)&&WT.test(e))}function YT(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function Ki(e){if(e instanceof Dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Yt.create(Ki(n))}return new Dt({...e._def,shape:()=>t})}else return e instanceof sn?new sn({...e._def,type:Ki(e.element)}):e instanceof Yt?Yt.create(Ki(e.unwrap())):e instanceof Tr?Tr.create(Ki(e.unwrap())):e instanceof Ir?Ir.create(e.items.map(t=>Ki(t))):e}function Qm(e,t){let r=Rr(e),n=Rr(t);if(e===t)return{valid:!0,data:e};if(r===H.object&&n===H.object){let o=fe.objectKeys(t),i=fe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=Qm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===H.array&&n===H.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],l=Qm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===H.date&&n===H.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function kv(e,t){return new Ao({values:e,typeName:ne.ZodEnum,...ae(t)})}function hv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Dv(e,t={},r){return e?Mn.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=hv(t,n),l=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=hv(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Mn.create()}var Xt,gv,le,RT,IT,TT,PT,$T,OT,LT,NT,jT,Zm,MT,BT,UT,WT,HT,VT,yv,GT,jn,bo,ko,Do,Eo,Ji,vo,So,Mn,on,pr,zi,sn,Dt,xo,nn,Su,Co,Ir,xu,qi,Yi,Cu,Fo,_o,Ao,Ro,Bn,Zt,Yt,Tr,Io,To,Xi,XT,Ba,Ua,Po,ZT,ne,QT,Ev,vv,eP,tP,Sv,rP,nP,oP,iP,sP,aP,lP,cP,uP,dP,pP,fP,mP,gP,hP,yP,wP,bP,kP,DP,EP,vP,SP,xP,CP,FP,_P,AP,RP,IP,TP,PP,$P,OP,xv=x(()=>{"use strict";ku();Du();mv();Xm();ja();Xt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}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}},gv=(e,t)=>{if(Nn(t))return{success:!0,data:t.value};if(!e.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 kt(e.common.issues);return this._error=r,this._error}}};le=class{get description(){return this._def.description}_getType(t){return Rr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Rr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:Rr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Gi(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return gv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Nn(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:t,path:[],parent:r}).then(n=>Nn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Gi(o)?o:Promise.resolve(o));return gv(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:I.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Zt({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 Yt.create(this,this._def)}nullable(){return Tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return Bn.create(this,this._def)}or(t){return xo.create([this,t],this._def)}and(t){return Co.create(this,t,this._def)}transform(t){return new Zt({...ae(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Io({...ae(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new Ba({typeName:ne.ZodBranded,type:this,...ae(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new To({...ae(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ua.create(this,t)}readonly(){return Po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},RT=/^c[^\s-]{8,}$/i,IT=/^[0-9a-z]+$/,TT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PT=/^[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,$T=/^[a-z0-9_-]{21}$/i,OT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LT=/^[-+]?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)?)??$/,NT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",MT=/^(?:(?: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])$/,BT=/^(?:(?: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])$/,UT=/^(([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]))$/,WT=/^(([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])$/,HT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yv="((\\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])))",GT=new RegExp(`^${yv}$`);jn=class e extends le{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==H.string){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.string,received:i.parsedType}),ee}let n=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?M(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&M(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")NT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"email",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Zm||(Zm=new RegExp(jT,"u")),Zm.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"emoji",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")PT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"uuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")$T.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"nanoid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")RT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")IT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid2",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")TT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ulid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),M(o,{validation:"url",code:I.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"regex",code:I.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?bv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?GT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?KT(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?LT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"duration",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?JT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ip",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?zT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"jwt",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?qT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cidr",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?HT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?VT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64url",code:I.invalid_string,message:i.message}),n.dirty()):fe.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:I.invalid_string,...J.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...J.errToObj(t)})}url(t){return this._addCheck({kind:"url",...J.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...J.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...J.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...J.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...J.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...J.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...J.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...J.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...J.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...J.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...J.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...J.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...J.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...J.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...J.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...J.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...J.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...J.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...J.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...J.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...J.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...J.errToObj(r)})}nonempty(t){return this.min(1,J.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};jn.create=e=>new jn({checks:[],typeName:ne.ZodString,coerce:e?.coerce??!1,...ae(e)});bo=class e extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==H.number){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.number,received:i.parsedType}),ee}let n,o=new nt;for(let i of this._def.checks)i.kind==="int"?fe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:I.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?YT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_finite,message:i.message}),o.dirty()):fe.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:J.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:J.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&fe.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bo.create=e=>new bo({checks:[],typeName:ne.ZodNumber,coerce:e?.coerce||!1,...ae(e)});ko=class e extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==H.bigint)return this._getInvalidInput(t);let n,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):fe.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return M(r,{code:I.invalid_type,expected:H.bigint,received:r.parsedType}),ee}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};ko.create=e=>new ko({checks:[],typeName:ne.ZodBigInt,coerce:e?.coerce??!1,...ae(e)});Do=class extends le{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==H.boolean){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.boolean,received:n.parsedType}),ee}return pt(t.data)}};Do.create=e=>new Do({typeName:ne.ZodBoolean,coerce:e?.coerce||!1,...ae(e)});Eo=class e extends le{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==H.date){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.date,received:i.parsedType}),ee}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_date}),ee}let n=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):fe.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:J.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:J.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Eo.create=e=>new Eo({checks:[],coerce:e?.coerce||!1,typeName:ne.ZodDate,...ae(e)});Ji=class extends le{_parse(t){if(this._getType(t)!==H.symbol){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.symbol,received:n.parsedType}),ee}return pt(t.data)}};Ji.create=e=>new Ji({typeName:ne.ZodSymbol,...ae(e)});vo=class extends le{_parse(t){if(this._getType(t)!==H.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.undefined,received:n.parsedType}),ee}return pt(t.data)}};vo.create=e=>new vo({typeName:ne.ZodUndefined,...ae(e)});So=class extends le{_parse(t){if(this._getType(t)!==H.null){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.null,received:n.parsedType}),ee}return pt(t.data)}};So.create=e=>new So({typeName:ne.ZodNull,...ae(e)});Mn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Mn.create=e=>new Mn({typeName:ne.ZodAny,...ae(e)});on=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};on.create=e=>new on({typeName:ne.ZodUnknown,...ae(e)});pr=class extends le{_parse(t){let r=this._getOrReturnCtx(t);return M(r,{code:I.invalid_type,expected:H.never,received:r.parsedType}),ee}};pr.create=e=>new pr({typeName:ne.ZodNever,...ae(e)});zi=class extends le{_parse(t){if(this._getType(t)!==H.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.void,received:n.parsedType}),ee}return pt(t.data)}};zi.create=e=>new zi({typeName:ne.ZodVoid,...ae(e)});sn=class e extends le{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==H.array)return M(r,{code:I.invalid_type,expected:H.array,received:r.parsedType}),ee;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(M(r,{code:s?I.too_big:I.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(M(r,{code:I.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(M(r,{code:I.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Xt(r,s,r.path,a)))).then(s=>nt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Xt(r,s,r.path,a)));return nt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:J.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:J.toString(r)}})}nonempty(t){return this.min(1,t)}};sn.create=(e,t)=>new sn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ae(t)});Dt=class e extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=fe.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==H.object){let c=this._getOrReturnCtx(t);return M(c,{code:I.invalid_type,expected:H.object,received:c.parsedType}),ee}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof pr&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let p=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Xt(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof pr){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(M(o,{code:I.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 p of a){let f=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Xt(o,f,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let f=await p.key,m=await p.value;c.push({key:f,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(n,c)):nt.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return J.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:J.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ne.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of fe.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of fe.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ki(this)}partial(t){let r={};for(let n of fe.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of fe.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Yt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return kv(fe.objectKeys(this.shape))}};Dt.create=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strip",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});Dt.strictCreate=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strict",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});Dt.lazycreate=(e,t)=>new Dt({shape:e,unknownKeys:"strip",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});xo=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new kt(a.ctx.common.issues));return M(r,{code:I.invalid_union,unionErrors:s}),ee}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},p=l._parseSync({data:r.data,path:r.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new kt(l));return M(r,{code:I.invalid_union,unionErrors:a}),ee}}get options(){return this._def.options}};xo.create=(e,t)=>new xo({options:e,typeName:ne.ZodUnion,...ae(t)});nn=e=>e instanceof Fo?nn(e.schema):e instanceof Zt?nn(e.innerType()):e instanceof _o?[e.value]:e instanceof Ao?e.options:e instanceof Ro?fe.objectValues(e.enum):e instanceof Io?nn(e._def.innerType):e instanceof vo?[void 0]:e instanceof So?[null]:e instanceof Yt?[void 0,...nn(e.unwrap())]:e instanceof Tr?[null,...nn(e.unwrap())]:e instanceof Ba||e instanceof Po?nn(e.unwrap()):e instanceof To?nn(e._def.innerType):[],Su=class e extends le{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.object)return M(r,{code:I.invalid_type,expected:H.object,received:r.parsedType}),ee;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(M(r,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=nn(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:ne.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ae(n)})}};Co=class extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Eu(i)||Eu(s))return ee;let a=Qm(i.value,s.value);return a.valid?((vu(i)||vu(s))&&r.dirty(),{status:r.value,value:a.data}):(M(n,{code:I.invalid_intersection_types}),ee)};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(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Co.create=(e,t,r)=>new Co({left:e,right:t,typeName:ne.ZodIntersection,...ae(r)});Ir=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.array)return M(n,{code:I.invalid_type,expected:H.array,received:n.parsedType}),ee;if(n.data.length<this._def.items.length)return M(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&n.data.length>this._def.items.length&&(M(n,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Xt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>nt.mergeArray(r,s)):nt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ir.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ir({items:e,typeName:ne.ZodTuple,rest:null,...ae(t)})};xu=class e extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.object)return M(n,{code:I.invalid_type,expected:H.object,received:n.parsedType}),ee;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Xt(n,a,n.path,a)),value:s._parse(new Xt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?nt.mergeObjectAsync(r,o):nt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof le?new e({keyType:t,valueType:r,typeName:ne.ZodRecord,...ae(n)}):new e({keyType:jn.create(),valueType:t,typeName:ne.ZodRecord,...ae(r)})}},qi=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.map)return M(n,{code:I.invalid_type,expected:H.map,received:n.parsedType}),ee;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:o._parse(new Xt(n,a,n.path,[c,"key"])),value:i._parse(new Xt(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return ee;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return ee;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}}}};qi.create=(e,t,r)=>new qi({valueType:t,keyType:e,typeName:ne.ZodMap,...ae(r)});Yi=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.set)return M(n,{code:I.invalid_type,expected:H.set,received:n.parsedType}),ee;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(M(n,{code:I.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(M(n,{code:I.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let p of l){if(p.status==="aborted")return ee;p.status==="dirty"&&r.dirty(),c.add(p.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>i._parse(new Xt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:J.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Yi.create=(e,t)=>new Yi({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...ae(t)});Cu=class e extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.function)return M(r,{code:I.invalid_type,expected:H.function,received:r.parsedType}),ee;function n(a,l){return Ma({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),rn].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function o(a,l){return Ma({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),rn].filter(c=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Bn){let a=this;return pt(async function(...l){let c=new kt([]),p=await a._def.args.parseAsync(l,i).catch(g=>{throw c.addIssue(n(l,g)),c}),f=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(f,i).catch(g=>{throw c.addIssue(o(f,g)),c})})}else{let a=this;return pt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new kt([n(l,c.error)]);let p=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(p,i);if(!f.success)throw new kt([o(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ir.create(t).rest(on.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ir.create([]).rest(on.create()),returns:r||on.create(),typeName:ne.ZodFunction,...ae(n)})}},Fo=class extends le{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Fo.create=(e,t)=>new Fo({getter:e,typeName:ne.ZodLazy,...ae(t)});_o=class extends le{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return M(r,{received:r.data,code:I.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:t.data}}get value(){return this._def.value}};_o.create=(e,t)=>new _o({value:e,typeName:ne.ZodLiteral,...ae(t)});Ao=class e extends le{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{expected:fe.joinValues(n),received:r.parsedType,code:I.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{received:r.data,code:I.invalid_enum_value,options:n}),ee}return pt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Ao.create=kv;Ro=class extends le{_parse(t){let r=fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==H.string&&n.parsedType!==H.number){let o=fe.objectValues(r);return M(n,{expected:fe.joinValues(o),received:n.parsedType,code:I.invalid_type}),ee}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=fe.objectValues(r);return M(n,{received:n.data,code:I.invalid_enum_value,options:o}),ee}return pt(t.data)}get enum(){return this._def.values}};Ro.create=(e,t)=>new Ro({values:e,typeName:ne.ZodNativeEnum,...ae(t)});Bn=class extends le{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.promise&&r.common.async===!1)return M(r,{code:I.invalid_type,expected:H.promise,received:r.parsedType}),ee;let n=r.parsedType===H.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Bn.create=(e,t)=>new Bn({type:e,typeName:ne.ZodPromise,...ae(t)});Zt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{M(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ee;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ee:l.status==="dirty"?wo(l.value):r.value==="dirty"?wo(l.value):l});{if(r.value==="aborted")return ee;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ee:a.status==="dirty"?wo(a.value):r.value==="dirty"?wo(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(n.common.async)return Promise.resolve(l);if(l 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"?ee:(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"?ee:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Nn(s))return ee;let a=o.transform(s.value,i);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=>Nn(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ee);fe.assertNever(o)}};Zt.create=(e,t,r)=>new Zt({schema:e,typeName:ne.ZodEffects,effect:t,...ae(r)});Zt.createWithPreprocess=(e,t,r)=>new Zt({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...ae(r)});Yt=class extends le{_parse(t){return this._getType(t)===H.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Yt.create=(e,t)=>new Yt({innerType:e,typeName:ne.ZodOptional,...ae(t)});Tr=class extends le{_parse(t){return this._getType(t)===H.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tr.create=(e,t)=>new Tr({innerType:e,typeName:ne.ZodNullable,...ae(t)});Io=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Io.create=(e,t)=>new Io({innerType:e,typeName:ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ae(t)});To=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Gi(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new kt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};To.create=(e,t)=>new To({innerType:e,typeName:ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ae(t)});Xi=class extends le{_parse(t){if(this._getType(t)!==H.nan){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.nan,received:n.parsedType}),ee}return{status:"valid",value:t.data}}};Xi.create=e=>new Xi({typeName:ne.ZodNaN,...ae(e)});XT=Symbol("zod_brand"),Ba=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ua=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ee:i.status==="dirty"?(r.dirty(),wo(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ee:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ne.ZodPipeline})}},Po=class extends le{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Nn(o)&&(o.value=Object.freeze(o.value)),o);return Gi(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Po.create=(e,t)=>new Po({innerType:e,typeName:ne.ZodReadonly,...ae(t)});ZT={object:Dt.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ne||(ne={}));QT=(e,t={message:`Input not instance of ${e.name}`})=>Dv(r=>r instanceof e,t),Ev=jn.create,vv=bo.create,eP=Xi.create,tP=ko.create,Sv=Do.create,rP=Eo.create,nP=Ji.create,oP=vo.create,iP=So.create,sP=Mn.create,aP=on.create,lP=pr.create,cP=zi.create,uP=sn.create,dP=Dt.create,pP=Dt.strictCreate,fP=xo.create,mP=Su.create,gP=Co.create,hP=Ir.create,yP=xu.create,wP=qi.create,bP=Yi.create,kP=Cu.create,DP=Fo.create,EP=_o.create,vP=Ao.create,SP=Ro.create,xP=Bn.create,CP=Zt.create,FP=Yt.create,_P=Tr.create,AP=Zt.createWithPreprocess,RP=Ua.create,IP=()=>Ev().optional(),TP=()=>vv().optional(),PP=()=>Sv().optional(),$P={string:(e=>jn.create({...e,coerce:!0})),number:(e=>bo.create({...e,coerce:!0})),boolean:(e=>Do.create({...e,coerce:!0})),bigint:(e=>ko.create({...e,coerce:!0})),date:(e=>Eo.create({...e,coerce:!0}))},OP=ee});var B={};hp(B,{BRAND:()=>XT,DIRTY:()=>wo,EMPTY_PATH:()=>AT,INVALID:()=>ee,NEVER:()=>OP,OK:()=>pt,ParseStatus:()=>nt,Schema:()=>le,ZodAny:()=>Mn,ZodArray:()=>sn,ZodBigInt:()=>ko,ZodBoolean:()=>Do,ZodBranded:()=>Ba,ZodCatch:()=>To,ZodDate:()=>Eo,ZodDefault:()=>Io,ZodDiscriminatedUnion:()=>Su,ZodEffects:()=>Zt,ZodEnum:()=>Ao,ZodError:()=>kt,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Cu,ZodIntersection:()=>Co,ZodIssueCode:()=>I,ZodLazy:()=>Fo,ZodLiteral:()=>_o,ZodMap:()=>qi,ZodNaN:()=>Xi,ZodNativeEnum:()=>Ro,ZodNever:()=>pr,ZodNull:()=>So,ZodNullable:()=>Tr,ZodNumber:()=>bo,ZodObject:()=>Dt,ZodOptional:()=>Yt,ZodParsedType:()=>H,ZodPipeline:()=>Ua,ZodPromise:()=>Bn,ZodReadonly:()=>Po,ZodRecord:()=>xu,ZodSchema:()=>le,ZodSet:()=>Yi,ZodString:()=>jn,ZodSymbol:()=>Ji,ZodTransformer:()=>Zt,ZodTuple:()=>Ir,ZodType:()=>le,ZodUndefined:()=>vo,ZodUnion:()=>xo,ZodUnknown:()=>on,ZodVoid:()=>zi,addIssueToContext:()=>M,any:()=>sP,array:()=>uP,bigint:()=>tP,boolean:()=>Sv,coerce:()=>$P,custom:()=>Dv,date:()=>rP,datetimeRegex:()=>bv,defaultErrorMap:()=>rn,discriminatedUnion:()=>mP,effect:()=>CP,enum:()=>vP,function:()=>kP,getErrorMap:()=>Vi,getParsedType:()=>Rr,instanceof:()=>QT,intersection:()=>gP,isAborted:()=>Eu,isAsync:()=>Gi,isDirty:()=>vu,isValid:()=>Nn,late:()=>ZT,lazy:()=>DP,literal:()=>EP,makeIssue:()=>Ma,map:()=>wP,nan:()=>eP,nativeEnum:()=>SP,never:()=>lP,null:()=>iP,nullable:()=>_P,number:()=>vv,object:()=>dP,objectUtil:()=>qm,oboolean:()=>PP,onumber:()=>TP,optional:()=>FP,ostring:()=>IP,pipeline:()=>RP,preprocess:()=>AP,promise:()=>xP,quotelessJson:()=>CT,record:()=>yP,set:()=>bP,setErrorMap:()=>_T,strictObject:()=>pP,string:()=>Ev,symbol:()=>nP,transformer:()=>CP,tuple:()=>hP,undefined:()=>oP,union:()=>fP,unknown:()=>aP,util:()=>fe,void:()=>cP});var eg=x(()=>{"use strict";Du();Xm();fv();ja();xv();ku()});var Zi=x(()=>{"use strict";eg();eg()});function Fu(e,t=!1){let r=e.length,n=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,f=0;function m(E,S){let L=0,U=0;for(;L<E||!S;){let N=e.charCodeAt(n);if(N>=48&&N<=57)U=U*16+N-48;else if(N>=65&&N<=70)U=U*16+N-65+10;else if(N>=97&&N<=102)U=U*16+N-97+10;else break;n++,L++}return L<E&&(U=-1),U}function g(E){n=E,o="",i=0,s=16,f=0}function h(){let E=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Qi(e.charCodeAt(n)))for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;else return f=3,e.substring(E,n);let S=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Qi(e.charCodeAt(n))){for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;S=n}else f=3;return e.substring(E,S)}function y(){let E="",S=n;for(;;){if(n>=r){E+=e.substring(S,n),f=2;break}let L=e.charCodeAt(n);if(L===34){E+=e.substring(S,n),n++;break}if(L===92){if(E+=e.substring(S,n),n++,n>=r){f=2;break}switch(e.charCodeAt(n++)){case 34:E+='"';break;case 92:E+="\\";break;case 47:E+="/";break;case 98:E+="\b";break;case 102:E+="\f";break;case 110:E+=`
35
- `;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:let N=m(4,!0);N>=0?E+=String.fromCharCode(N):f=4;break;default:f=5}S=n;continue}if(L>=0&&L<=31)if(Wa(L)){E+=e.substring(S,n),f=2;break}else f=6;n++}return E}function k(){if(o="",f=0,i=n,l=a,p=c,n>=r)return i=r,s=17;let E=e.charCodeAt(n);if(tg(E)){do n++,o+=String.fromCharCode(E),E=e.charCodeAt(n);while(tg(E));return s=15}if(Wa(E))return n++,o+=String.fromCharCode(E),E===13&&e.charCodeAt(n)===10&&(n++,o+=`
36
- `),a++,c=n,s=14;switch(E){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,o=y(),s=10;case 47:let S=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Wa(e.charCodeAt(n));)n++;return o=e.substring(S,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;let L=r-1,U=!1;for(;n<L;){let N=e.charCodeAt(n);if(N===42&&e.charCodeAt(n+1)===47){n+=2,U=!0;break}n++,Wa(N)&&(N===13&&e.charCodeAt(n)===10&&n++,a++,c=n)}return U||(n++,f=1),o=e.substring(S,n),s=13}return o+=String.fromCharCode(E),n++,s=16;case 45:if(o+=String.fromCharCode(E),n++,n===r||!Qi(e.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=h(),s=11;default:for(;n<r&&v(E);)n++,E=e.charCodeAt(n);if(i!==n){switch(o=e.substring(i,n),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(E),n++,s=16}}function v(E){if(tg(E)||Wa(E))return!1;switch(E){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function F(){let E;do E=k();while(E>=12&&E<=15);return E}return{setPosition:g,getPosition:()=>n,scan:t?F:k,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-p,getTokenError:()=>f}}function tg(e){return e===32||e===9}function Wa(e){return e===10||e===13}function Qi(e){return e>=48&&e<=57}var Cv,_u=x(()=>{"use strict";(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Cv||(Cv={}))});var NP,es,jP,Fv=x(()=>{"use strict";NP=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),es=200,jP={" ":{"\n":new Array(es).fill(0).map((e,t)=>`
37
- `+" ".repeat(t)),"\r":new Array(es).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(es).fill(0).map((e,t)=>`\r
38
- `+" ".repeat(t))}," ":{"\n":new Array(es).fill(0).map((e,t)=>`
39
- `+" ".repeat(t)),"\r":new Array(es).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(es).fill(0).map((e,t)=>`\r
40
- `+" ".repeat(t))}}});var rg=x(()=>{"use strict";_u();Fv()});function _v(e,t=[],r=Au.DEFAULT){let n=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):n!==null&&(o[n]=l)}return Av(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,n=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,p)=>{t.push({error:l,offset:c,length:p})}},r),o[0]}function Av(e,t,r=Au.DEFAULT){let n=Fu(e,!1),o=[],i=0;function s(W){return W?()=>i===0&&W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(W){return W?he=>i===0&&W(he,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(W){return W?he=>i===0&&W(he,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(W){return W?()=>{i>0?i++:W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function p(W){return W?()=>{i>0&&i--,i===0&&W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let f=c(t.onObjectBegin),m=l(t.onObjectProperty),g=p(t.onObjectEnd),h=c(t.onArrayBegin),y=p(t.onArrayEnd),k=l(t.onLiteralValue),v=a(t.onSeparator),F=s(t.onComment),E=a(t.onError),S=r&&r.disallowComments,L=r&&r.allowTrailingComma;function U(){for(;;){let W=n.scan();switch(n.getTokenError()){case 4:N(14);break;case 5:N(15);break;case 3:N(13);break;case 1:S||N(11);break;case 2:N(12);break;case 6:N(16);break}switch(W){case 12:case 13:S?N(10):F();break;case 16:N(1);break;case 15:case 14:break;default:return W}}}function N(W,he=[],Vr=[]){if(E(W),he.length+Vr.length>0){let Gr=n.getToken();for(;Gr!==17;){if(he.indexOf(Gr)!==-1){U();break}else if(Vr.indexOf(Gr)!==-1)break;Gr=U()}}}function te(W){let he=n.getTokenValue();return W?k(he):(m(he),o.push(he)),U(),!0}function G(){switch(n.getToken()){case 11:let W=n.getTokenValue(),he=Number(W);isNaN(he)&&(N(2),he=0),k(he);break;case 7:k(null);break;case 8:k(!0);break;case 9:k(!1);break;default:return!1}return U(),!0}function ce(){return n.getToken()!==10?(N(3,[],[2,5]),!1):(te(!1),n.getToken()===6?(v(":"),U(),q()||N(4,[],[2,5])):N(5,[],[2,5]),o.pop(),!0)}function Be(){f(),U();let W=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(W||N(4,[],[]),v(","),U(),n.getToken()===2&&L)break}else W&&N(6,[],[]);ce()||N(4,[],[2,5]),W=!0}return g(),n.getToken()!==2?N(7,[2],[]):U(),!0}function A(){h(),U();let W=!0,he=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(he||N(4,[],[]),v(","),U(),n.getToken()===4&&L)break}else he&&N(6,[],[]);W?(o.push(0),W=!1):o[o.length-1]++,q()||N(4,[],[4,5]),he=!0}return y(),W||o.pop(),n.getToken()!==4?N(8,[4],[]):U(),!0}function q(){switch(n.getToken()){case 3:return A();case 1:return Be();case 10:return te(!0);default:return G()}}return U(),n.getToken()===17?r.allowEmptyContent?!0:(N(4,[],[]),!1):q()?(n.getToken()!==17&&N(9,[],[]),!0):(N(4,[],[]),!1)}var Au,ng=x(()=>{"use strict";_u();(function(e){e.DEFAULT={allowTrailingComma:!1}})(Au||(Au={}))});var Rv=x(()=>{"use strict";rg();ng()});var Iv,Tv,$o,Pv,Ru=x(()=>{"use strict";rg();Rv();_u();ng();(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Iv||(Iv={}));(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Tv||(Tv={}));$o=_v;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Pv||(Pv={}))});var ts,Ae,Oo,an,Tt=x(()=>{"use strict";ts=class extends Error{remediation;documentationUrl;cause;constructor(t,r){super(t),this.name="FrameworkError",this.cause=r?.cause,this.remediation=r?.remediation,this.documentationUrl=r?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
30
+ 2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=ut(),r=xa();r&&r!==t&&u.warn(`${Z} Switching region from ${r.toUpperCase()} to ${t.toUpperCase()} \u2014 the ${r.toUpperCase()} session will be replaced.`);let n=Fk(16),o=CT(),i=Ok();try{let s=Ik({pollId:n,clientId:o,scope:i});u.debug(`OAuth login: region="${ut()}" buildEnv="${gc()}" apiHost="${O()}" oauthServer="${Mi().serverUrl}" clientId="${o}" authorizeUrl="${s}"`),await Rk(s);let a=await Tk(n,Mi().timeoutMs);return Kf({accessToken:a,scopes:i,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${Rn()}`),a}catch(s){throw new d(s)}}function CT(){if(process.env.WEBFLOW_OAUTH_CLIENT_ID)return process.env.WEBFLOW_OAUTH_CLIENT_ID;let e=gc(),t=ut(),r=xT[e][t];if(r)return r;let n=t.toUpperCase();throw new d(`${n} login is not available for this environment yet. Set WEBFLOW_API_TOKEN to a token from your ${n} workspace, or set WEBFLOW_OAUTH_CLIENT_ID if you have a ${n} client ID.`,{isUserError:!0})}var vT,ST,$k,xT,Yf=x(()=>{"use strict";De();he();F();N();C();An();zf();qf();Pk();ge();en();vT=["assets:read","assets:write","authorized_user:read","cloud_apps:write","cms:read","cms:write","code_components:read","code_components:write","devlink_export:read","forms:read","sites:read","sites:write","workspace:read"],ST=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];$k=!1;xT={development:{us:"db64c798d0a5adb3c9c43b10c80f93fece223acd072246f957d9700b1bf3cab0"},acceptance:{us:"32a6440eefa0b608b39c36164a9cf274c9c096cfe6541e9dab08ff4f372fe245"},sai:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074",eu:"6e2027b2c3a881e6d1f7a0933e7240e9ddf50df5afdde06740e30d56e3deed4b"},production:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}}});function bo(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function Tn(e){try{let r=await new Lk.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Pi()}/v2`}}).sites.list();if(!r||typeof r!="object"||!r.sites||!Array.isArray(r.sites))throw new d("Invalid response from Webflow API");let n=r.sites.map(o=>({id:o.id,displayName:o.displayName??"",shortName:o.shortName||(o.displayName??"").toLowerCase().replace(/\s+/g,"-"),lastUpdated:o.lastUpdated??null,workspaceId:o.workspaceId??null}));return n.sort((o,i)=>o.displayName.localeCompare(i.displayName)),n}catch(t){throw new d(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
31
+ `})}}async function Bi(e){let t=e.map(n=>({name:`${n.displayName} (${n.shortName})`,value:n})),r=await wc({message:"Search for a Webflow site:",source:n=>{if(!n)return t;let o=n.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!r){if(e.length===0)throw new d("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return r}var Lk,Dc=x(()=>{"use strict";Lk=require("webflow-api");Fe();F();De();De();C()});var ko,Pn,Xf=x(()=>{"use strict";C();ko=class extends d{constructor(t){super(t),this.name="NoWebflowSitesError"}},Pn=class extends d{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Ye(e,t){let r=t?.site??bo(e);if(W()&&!r)throw new d(`No site ID configured for this project.
32
+ Run ${q("webflow auth login")} locally to authenticate and associate this project with a Webflow site,
33
+ or provide --site and --api-token when running a CLI command`);let n=await R({apiToken:t?.apiToken,force:t?.force});if(!r||t?.force){let o=await Tn(n);if(o.length===0)throw new ko("No Webflow sites found in your account. Please make sure you have at least one authorized site in your Webflow account");let i=o.length>1?await Bi(o):o[0];r=i.id;let s=Se({siteId:r});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:r,siteName:i.displayName,accessToken:n}}return{siteId:r,accessToken:n}}var Nk=x(()=>{"use strict";Oe();he();Yf();Dc();C();Xf();N();ge();F()});async function Zf(e){let t=O(),r=Pi();u.debug(`getTokenInfo: region="${ut()}" apiHost="${t}" cdnApiHost="${r}"`);let n=new jk.WebflowClient({accessToken:e,environment:{base:`${t}/v2`,dataApi:`${t}/v2`,contentDeliveryApi:`${r}/v2`}});try{return await n.token.authorizedBy()}catch(o){return u.debug(`getTokenInfo failed: ${o}`),null}}var jk,Mk=x(()=>{"use strict";jk=require("webflow-api");De();F();An()});var z=x(()=>{"use strict";xk();Yf();Nk();Dc();Dc();zf();Mk();Xf()});var me,bm,V,Ir,La=x(()=>{"use strict";(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(me||(me={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bm||(bm={}));V=me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ir=e=>{switch(typeof e){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(e)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":return Array.isArray(e)?V.array:e===null?V.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?V.promise:typeof Map<"u"&&e instanceof Map?V.map:typeof Set<"u"&&e instanceof Set?V.set:typeof Date<"u"&&e instanceof Date?V.date:V.object;default:return V.unknown}}});var T,D0,Dt,jc=x(()=>{"use strict";La();T=me.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"]),D0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Dt=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Dt.create=e=>new Dt(e)});var E0,sn,km=x(()=>{"use strict";jc();La();E0=(e,t)=>{let r;switch(e.code){case T.invalid_type:e.received===V.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case T.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,me.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:r=`Unrecognized key(s) in object: ${me.joinValues(e.keys,", ")}`;break;case T.invalid_union:r="Invalid input";break;case T.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${me.joinValues(e.options)}`;break;case T.invalid_enum_value:r=`Invalid enum value. Expected ${me.joinValues(e.options)}, received '${e.received}'`;break;case T.invalid_arguments:r="Invalid function arguments";break;case T.invalid_return_type:r="Invalid function return type";break;case T.invalid_date:r="Invalid date";break;case T.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:me.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case T.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case T.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case T.custom:r="Invalid input";break;case T.invalid_intersection_types:r="Intersection results could not be merged";break;case T.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case T.not_finite:r="Number must be finite";break;default:r=t.defaultError,me.assertNever(e)}return{message:r}},sn=E0});function v0(e){_D=e}function Yi(){return _D}var _D,Mc=x(()=>{"use strict";km();_D=sn});function M(e,t){let r=Yi(),n=Na({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===sn?void 0:sn].filter(o=>!!o)});e.common.issues.push(n)}var Na,S0,it,te,Io,pt,Bc,Uc,Ln,Xi,Dm=x(()=>{"use strict";Mc();km();Na=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},S0=[];it=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return te;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return te;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},te=Object.freeze({status:"aborted"}),Io=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),Bc=e=>e.status==="aborted",Uc=e=>e.status==="dirty",Ln=e=>e.status==="valid",Xi=e=>typeof Promise<"u"&&e instanceof Promise});var AD=x(()=>{"use strict"});var J,FD=x(()=>{"use strict";(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(J||(J={}))});function ae(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:o}}function PD(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function U0(e){return new RegExp(`^${PD(e)}$`)}function $D(e){let t=`${TD}T${PD(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function W0(e,t){return!!((t==="v4"||!t)&&$0.test(e)||(t==="v6"||!t)&&L0.test(e))}function H0(e,t){if(!I0.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function V0(e,t){return!!((t==="v4"||!t)&&O0.test(e)||(t==="v6"||!t)&&N0.test(e))}function G0(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function Zi(e){if(e instanceof Et){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Kt.create(Zi(n))}return new Et({...e._def,shape:()=>t})}else return e instanceof cn?new cn({...e._def,type:Zi(e.element)}):e instanceof Kt?Kt.create(Zi(e.unwrap())):e instanceof Tr?Tr.create(Zi(e.unwrap())):e instanceof Rr?Rr.create(e.items.map(t=>Zi(t))):e}function vm(e,t){let r=Ir(e),n=Ir(t);if(e===t)return{valid:!0,data:e};if(r===V.object&&n===V.object){let o=me.objectKeys(t),i=me.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=vm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===V.array&&n===V.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],l=vm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===V.date&&n===V.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function OD(e,t){return new Uo({values:e,typeName:ne.ZodEnum,...ae(t)})}function RD(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function LD(e,t={},r){return e?jn.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=RD(t,n),l=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=RD(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):jn.create()}var Jt,ID,ce,x0,C0,_0,A0,F0,I0,R0,T0,P0,Em,$0,O0,L0,N0,j0,M0,TD,B0,Nn,Ro,To,Po,$o,Qi,Oo,Lo,jn,ln,gr,es,cn,Et,No,an,Wc,jo,Rr,Hc,ts,rs,Vc,Mo,Bo,Uo,Wo,Mn,zt,Kt,Tr,Ho,Vo,ns,K0,ja,Ma,Go,J0,ne,z0,ND,jD,q0,Y0,MD,X0,Z0,Q0,eP,tP,rP,nP,oP,iP,sP,aP,lP,cP,uP,dP,pP,fP,mP,gP,hP,yP,wP,bP,kP,DP,EP,vP,SP,xP,CP,_P,AP,FP,IP,BD=x(()=>{"use strict";jc();Mc();FD();Dm();La();Jt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}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}},ID=(e,t)=>{if(Ln(t))return{success:!0,data:t.value};if(!e.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 Dt(e.common.issues);return this._error=r,this._error}}};ce=class{get description(){return this._def.description}_getType(t){return Ir(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ir(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new it,ctx:{common:t.parent.common,data:t.data,parsedType:Ir(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Xi(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ir(t)},o=this._parseSync({data:t,path:n.path,parent:n});return ID(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ir(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ln(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:t,path:[],parent:r}).then(n=>Ln(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ir(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Xi(o)?o:Promise.resolve(o));return ID(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:T.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new zt({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 Kt.create(this,this._def)}nullable(){return Tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cn.create(this)}promise(){return Mn.create(this,this._def)}or(t){return No.create([this,t],this._def)}and(t){return jo.create(this,t,this._def)}transform(t){return new zt({...ae(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ho({...ae(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new ja({typeName:ne.ZodBranded,type:this,...ae(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Vo({...ae(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ma.create(this,t)}readonly(){return Go.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},x0=/^c[^\s-]{8,}$/i,C0=/^[0-9a-z]+$/,_0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,A0=/^[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,F0=/^[a-z0-9_-]{21}$/i,I0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,R0=/^[-+]?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)?)??$/,T0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,P0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$0=/^(?:(?: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])$/,O0=/^(?:(?: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])$/,L0=/^(([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]))$/,N0=/^(([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])$/,j0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,TD="((\\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])))",B0=new RegExp(`^${TD}$`);Nn=class e extends ce{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==V.string){let i=this._getOrReturnCtx(t);return M(i,{code:T.invalid_type,expected:V.string,received:i.parsedType}),te}let n=new it,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:T.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:T.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?M(o,{code:T.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&M(o,{code:T.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")T0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"email",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Em||(Em=new RegExp(P0,"u")),Em.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"emoji",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")A0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"uuid",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")F0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"nanoid",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")x0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")C0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid2",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")_0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ulid",code:T.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),M(o,{validation:"url",code:T.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"regex",code:T.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),M(o,{code:T.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:T.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:T.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?$D(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:T.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?B0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:T.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?U0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:T.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?R0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"duration",code:T.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?W0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ip",code:T.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?H0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"jwt",code:T.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?V0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cidr",code:T.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?j0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64",code:T.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?M0.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64url",code:T.invalid_string,message:i.message}),n.dirty()):me.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:T.invalid_string,...J.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...J.errToObj(t)})}url(t){return this._addCheck({kind:"url",...J.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...J.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...J.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...J.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...J.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...J.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...J.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...J.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...J.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...J.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...J.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...J.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...J.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...J.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...J.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...J.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...J.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...J.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...J.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...J.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...J.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...J.errToObj(r)})}nonempty(t){return this.min(1,J.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Nn.create=e=>new Nn({checks:[],typeName:ne.ZodString,coerce:e?.coerce??!1,...ae(e)});Ro=class e extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==V.number){let i=this._getOrReturnCtx(t);return M(i,{code:T.invalid_type,expected:V.number,received:i.parsedType}),te}let n,o=new it;for(let i of this._def.checks)i.kind==="int"?me.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:T.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:T.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:T.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?G0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),M(n,{code:T.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:T.not_finite,message:i.message}),o.dirty()):me.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:J.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:J.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&me.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Ro.create=e=>new Ro({checks:[],typeName:ne.ZodNumber,coerce:e?.coerce||!1,...ae(e)});To=class e extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==V.bigint)return this._getInvalidInput(t);let n,o=new it;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:T.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:T.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),M(n,{code:T.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):me.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return M(r,{code:T.invalid_type,expected:V.bigint,received:r.parsedType}),te}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};To.create=e=>new To({checks:[],typeName:ne.ZodBigInt,coerce:e?.coerce??!1,...ae(e)});Po=class extends ce{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==V.boolean){let n=this._getOrReturnCtx(t);return M(n,{code:T.invalid_type,expected:V.boolean,received:n.parsedType}),te}return pt(t.data)}};Po.create=e=>new Po({typeName:ne.ZodBoolean,coerce:e?.coerce||!1,...ae(e)});$o=class e extends ce{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==V.date){let i=this._getOrReturnCtx(t);return M(i,{code:T.invalid_type,expected:V.date,received:i.parsedType}),te}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return M(i,{code:T.invalid_date}),te}let n=new it,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:T.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:T.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):me.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:J.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:J.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};$o.create=e=>new $o({checks:[],coerce:e?.coerce||!1,typeName:ne.ZodDate,...ae(e)});Qi=class extends ce{_parse(t){if(this._getType(t)!==V.symbol){let n=this._getOrReturnCtx(t);return M(n,{code:T.invalid_type,expected:V.symbol,received:n.parsedType}),te}return pt(t.data)}};Qi.create=e=>new Qi({typeName:ne.ZodSymbol,...ae(e)});Oo=class extends ce{_parse(t){if(this._getType(t)!==V.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:T.invalid_type,expected:V.undefined,received:n.parsedType}),te}return pt(t.data)}};Oo.create=e=>new Oo({typeName:ne.ZodUndefined,...ae(e)});Lo=class extends ce{_parse(t){if(this._getType(t)!==V.null){let n=this._getOrReturnCtx(t);return M(n,{code:T.invalid_type,expected:V.null,received:n.parsedType}),te}return pt(t.data)}};Lo.create=e=>new Lo({typeName:ne.ZodNull,...ae(e)});jn=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};jn.create=e=>new jn({typeName:ne.ZodAny,...ae(e)});ln=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};ln.create=e=>new ln({typeName:ne.ZodUnknown,...ae(e)});gr=class extends ce{_parse(t){let r=this._getOrReturnCtx(t);return M(r,{code:T.invalid_type,expected:V.never,received:r.parsedType}),te}};gr.create=e=>new gr({typeName:ne.ZodNever,...ae(e)});es=class extends ce{_parse(t){if(this._getType(t)!==V.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:T.invalid_type,expected:V.void,received:n.parsedType}),te}return pt(t.data)}};es.create=e=>new es({typeName:ne.ZodVoid,...ae(e)});cn=class e extends ce{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==V.array)return M(r,{code:T.invalid_type,expected:V.array,received:r.parsedType}),te;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(M(r,{code:s?T.too_big:T.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(M(r,{code:T.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(M(r,{code:T.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Jt(r,s,r.path,a)))).then(s=>it.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Jt(r,s,r.path,a)));return it.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:J.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:J.toString(r)}})}nonempty(t){return this.min(1,t)}};cn.create=(e,t)=>new cn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ae(t)});Et=class e extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=me.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==V.object){let c=this._getOrReturnCtx(t);return M(c,{code:T.invalid_type,expected:V.object,received:c.parsedType}),te}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof gr&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let p=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Jt(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof gr){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(M(o,{code:T.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 p of a){let f=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Jt(o,f,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let f=await p.key,m=await p.value;c.push({key:f,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>it.mergeObjectSync(n,c)):it.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return J.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:J.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ne.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of me.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of me.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Zi(this)}partial(t){let r={};for(let n of me.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of me.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Kt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return OD(me.objectKeys(this.shape))}};Et.create=(e,t)=>new Et({shape:()=>e,unknownKeys:"strip",catchall:gr.create(),typeName:ne.ZodObject,...ae(t)});Et.strictCreate=(e,t)=>new Et({shape:()=>e,unknownKeys:"strict",catchall:gr.create(),typeName:ne.ZodObject,...ae(t)});Et.lazycreate=(e,t)=>new Et({shape:e,unknownKeys:"strip",catchall:gr.create(),typeName:ne.ZodObject,...ae(t)});No=class extends ce{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Dt(a.ctx.common.issues));return M(r,{code:T.invalid_union,unionErrors:s}),te}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},p=l._parseSync({data:r.data,path:r.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new Dt(l));return M(r,{code:T.invalid_union,unionErrors:a}),te}}get options(){return this._def.options}};No.create=(e,t)=>new No({options:e,typeName:ne.ZodUnion,...ae(t)});an=e=>e instanceof Mo?an(e.schema):e instanceof zt?an(e.innerType()):e instanceof Bo?[e.value]:e instanceof Uo?e.options:e instanceof Wo?me.objectValues(e.enum):e instanceof Ho?an(e._def.innerType):e instanceof Oo?[void 0]:e instanceof Lo?[null]:e instanceof Kt?[void 0,...an(e.unwrap())]:e instanceof Tr?[null,...an(e.unwrap())]:e instanceof ja||e instanceof Go?an(e.unwrap()):e instanceof Vo?an(e._def.innerType):[],Wc=class e extends ce{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==V.object)return M(r,{code:T.invalid_type,expected:V.object,received:r.parsedType}),te;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(M(r,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=an(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:ne.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ae(n)})}};jo=class extends ce{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Bc(i)||Bc(s))return te;let a=vm(i.value,s.value);return a.valid?((Uc(i)||Uc(s))&&r.dirty(),{status:r.value,value:a.data}):(M(n,{code:T.invalid_intersection_types}),te)};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(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};jo.create=(e,t,r)=>new jo({left:e,right:t,typeName:ne.ZodIntersection,...ae(r)});Rr=class e extends ce{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==V.array)return M(n,{code:T.invalid_type,expected:V.array,received:n.parsedType}),te;if(n.data.length<this._def.items.length)return M(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),te;!this._def.rest&&n.data.length>this._def.items.length&&(M(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Jt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>it.mergeArray(r,s)):it.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Rr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Rr({items:e,typeName:ne.ZodTuple,rest:null,...ae(t)})};Hc=class e extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==V.object)return M(n,{code:T.invalid_type,expected:V.object,received:n.parsedType}),te;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Jt(n,a,n.path,a)),value:s._parse(new Jt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?it.mergeObjectAsync(r,o):it.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ce?new e({keyType:t,valueType:r,typeName:ne.ZodRecord,...ae(n)}):new e({keyType:Nn.create(),valueType:t,typeName:ne.ZodRecord,...ae(r)})}},ts=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==V.map)return M(n,{code:T.invalid_type,expected:V.map,received:n.parsedType}),te;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:o._parse(new Jt(n,a,n.path,[c,"key"])),value:i._parse(new Jt(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return te;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return te;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}}}};ts.create=(e,t,r)=>new ts({valueType:t,keyType:e,typeName:ne.ZodMap,...ae(r)});rs=class e extends ce{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==V.set)return M(n,{code:T.invalid_type,expected:V.set,received:n.parsedType}),te;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(M(n,{code:T.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(M(n,{code:T.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let p of l){if(p.status==="aborted")return te;p.status==="dirty"&&r.dirty(),c.add(p.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>i._parse(new Jt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:J.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};rs.create=(e,t)=>new rs({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...ae(t)});Vc=class e extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==V.function)return M(r,{code:T.invalid_type,expected:V.function,received:r.parsedType}),te;function n(a,l){return Na({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Yi(),sn].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function o(a,l){return Na({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Yi(),sn].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Mn){let a=this;return pt(async function(...l){let c=new Dt([]),p=await a._def.args.parseAsync(l,i).catch(g=>{throw c.addIssue(n(l,g)),c}),f=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(f,i).catch(g=>{throw c.addIssue(o(f,g)),c})})}else{let a=this;return pt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new Dt([n(l,c.error)]);let p=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(p,i);if(!f.success)throw new Dt([o(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Rr.create(t).rest(ln.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Rr.create([]).rest(ln.create()),returns:r||ln.create(),typeName:ne.ZodFunction,...ae(n)})}},Mo=class extends ce{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Mo.create=(e,t)=>new Mo({getter:e,typeName:ne.ZodLazy,...ae(t)});Bo=class extends ce{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return M(r,{received:r.data,code:T.invalid_literal,expected:this._def.value}),te}return{status:"valid",value:t.data}}get value(){return this._def.value}};Bo.create=(e,t)=>new Bo({value:e,typeName:ne.ZodLiteral,...ae(t)});Uo=class e extends ce{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{expected:me.joinValues(n),received:r.parsedType,code:T.invalid_type}),te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{received:r.data,code:T.invalid_enum_value,options:n}),te}return pt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Uo.create=OD;Wo=class extends ce{_parse(t){let r=me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==V.string&&n.parsedType!==V.number){let o=me.objectValues(r);return M(n,{expected:me.joinValues(o),received:n.parsedType,code:T.invalid_type}),te}if(this._cache||(this._cache=new Set(me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=me.objectValues(r);return M(n,{received:n.data,code:T.invalid_enum_value,options:o}),te}return pt(t.data)}get enum(){return this._def.values}};Wo.create=(e,t)=>new Wo({values:e,typeName:ne.ZodNativeEnum,...ae(t)});Mn=class extends ce{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==V.promise&&r.common.async===!1)return M(r,{code:T.invalid_type,expected:V.promise,received:r.parsedType}),te;let n=r.parsedType===V.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Mn.create=(e,t)=>new Mn({type:e,typeName:ne.ZodPromise,...ae(t)});zt=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{M(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return te;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?te:l.status==="dirty"?Io(l.value):r.value==="dirty"?Io(l.value):l});{if(r.value==="aborted")return te;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?te:a.status==="dirty"?Io(a.value):r.value==="dirty"?Io(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(n.common.async)return Promise.resolve(l);if(l 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"?te:(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"?te:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ln(s))return te;let a=o.transform(s.value,i);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=>Ln(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):te);me.assertNever(o)}};zt.create=(e,t,r)=>new zt({schema:e,typeName:ne.ZodEffects,effect:t,...ae(r)});zt.createWithPreprocess=(e,t,r)=>new zt({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...ae(r)});Kt=class extends ce{_parse(t){return this._getType(t)===V.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Kt.create=(e,t)=>new Kt({innerType:e,typeName:ne.ZodOptional,...ae(t)});Tr=class extends ce{_parse(t){return this._getType(t)===V.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tr.create=(e,t)=>new Tr({innerType:e,typeName:ne.ZodNullable,...ae(t)});Ho=class extends ce{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===V.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ho.create=(e,t)=>new Ho({innerType:e,typeName:ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ae(t)});Vo=class extends ce{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xi(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Dt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Dt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Vo.create=(e,t)=>new Vo({innerType:e,typeName:ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ae(t)});ns=class extends ce{_parse(t){if(this._getType(t)!==V.nan){let n=this._getOrReturnCtx(t);return M(n,{code:T.invalid_type,expected:V.nan,received:n.parsedType}),te}return{status:"valid",value:t.data}}};ns.create=e=>new ns({typeName:ne.ZodNaN,...ae(e)});K0=Symbol("zod_brand"),ja=class extends ce{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ma=class e extends ce{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?te:i.status==="dirty"?(r.dirty(),Io(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?te:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ne.ZodPipeline})}},Go=class extends ce{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ln(o)&&(o.value=Object.freeze(o.value)),o);return Xi(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Go.create=(e,t)=>new Go({innerType:e,typeName:ne.ZodReadonly,...ae(t)});J0={object:Et.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ne||(ne={}));z0=(e,t={message:`Input not instance of ${e.name}`})=>LD(r=>r instanceof e,t),ND=Nn.create,jD=Ro.create,q0=ns.create,Y0=To.create,MD=Po.create,X0=$o.create,Z0=Qi.create,Q0=Oo.create,eP=Lo.create,tP=jn.create,rP=ln.create,nP=gr.create,oP=es.create,iP=cn.create,sP=Et.create,aP=Et.strictCreate,lP=No.create,cP=Wc.create,uP=jo.create,dP=Rr.create,pP=Hc.create,fP=ts.create,mP=rs.create,gP=Vc.create,hP=Mo.create,yP=Bo.create,wP=Uo.create,bP=Wo.create,kP=Mn.create,DP=zt.create,EP=Kt.create,vP=Tr.create,SP=zt.createWithPreprocess,xP=Ma.create,CP=()=>ND().optional(),_P=()=>jD().optional(),AP=()=>MD().optional(),FP={string:(e=>Nn.create({...e,coerce:!0})),number:(e=>Ro.create({...e,coerce:!0})),boolean:(e=>Po.create({...e,coerce:!0})),bigint:(e=>To.create({...e,coerce:!0})),date:(e=>$o.create({...e,coerce:!0}))},IP=te});var B={};Fp(B,{BRAND:()=>K0,DIRTY:()=>Io,EMPTY_PATH:()=>S0,INVALID:()=>te,NEVER:()=>IP,OK:()=>pt,ParseStatus:()=>it,Schema:()=>ce,ZodAny:()=>jn,ZodArray:()=>cn,ZodBigInt:()=>To,ZodBoolean:()=>Po,ZodBranded:()=>ja,ZodCatch:()=>Vo,ZodDate:()=>$o,ZodDefault:()=>Ho,ZodDiscriminatedUnion:()=>Wc,ZodEffects:()=>zt,ZodEnum:()=>Uo,ZodError:()=>Dt,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Vc,ZodIntersection:()=>jo,ZodIssueCode:()=>T,ZodLazy:()=>Mo,ZodLiteral:()=>Bo,ZodMap:()=>ts,ZodNaN:()=>ns,ZodNativeEnum:()=>Wo,ZodNever:()=>gr,ZodNull:()=>Lo,ZodNullable:()=>Tr,ZodNumber:()=>Ro,ZodObject:()=>Et,ZodOptional:()=>Kt,ZodParsedType:()=>V,ZodPipeline:()=>Ma,ZodPromise:()=>Mn,ZodReadonly:()=>Go,ZodRecord:()=>Hc,ZodSchema:()=>ce,ZodSet:()=>rs,ZodString:()=>Nn,ZodSymbol:()=>Qi,ZodTransformer:()=>zt,ZodTuple:()=>Rr,ZodType:()=>ce,ZodUndefined:()=>Oo,ZodUnion:()=>No,ZodUnknown:()=>ln,ZodVoid:()=>es,addIssueToContext:()=>M,any:()=>tP,array:()=>iP,bigint:()=>Y0,boolean:()=>MD,coerce:()=>FP,custom:()=>LD,date:()=>X0,datetimeRegex:()=>$D,defaultErrorMap:()=>sn,discriminatedUnion:()=>cP,effect:()=>DP,enum:()=>wP,function:()=>gP,getErrorMap:()=>Yi,getParsedType:()=>Ir,instanceof:()=>z0,intersection:()=>uP,isAborted:()=>Bc,isAsync:()=>Xi,isDirty:()=>Uc,isValid:()=>Ln,late:()=>J0,lazy:()=>hP,literal:()=>yP,makeIssue:()=>Na,map:()=>fP,nan:()=>q0,nativeEnum:()=>bP,never:()=>nP,null:()=>eP,nullable:()=>vP,number:()=>jD,object:()=>sP,objectUtil:()=>bm,oboolean:()=>AP,onumber:()=>_P,optional:()=>EP,ostring:()=>CP,pipeline:()=>xP,preprocess:()=>SP,promise:()=>kP,quotelessJson:()=>D0,record:()=>pP,set:()=>mP,setErrorMap:()=>v0,strictObject:()=>aP,string:()=>ND,symbol:()=>Z0,transformer:()=>DP,tuple:()=>dP,undefined:()=>Q0,union:()=>lP,unknown:()=>rP,util:()=>me,void:()=>oP});var Sm=x(()=>{"use strict";Mc();Dm();AD();La();BD();jc()});var os=x(()=>{"use strict";Sm();Sm()});function HL(e,t){if(e.includes("..")||Dr.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let r=Dr.resolve(t,e),n=Dr.resolve(t);if(!r.startsWith(n+Dr.sep)&&r!==n)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function nd(e,t,r){let n=Dr.join(process.cwd(),t);r&&(0,zn.existsSync)(n)&&await(0,rd.rm)(n,{recursive:!0,force:!0}),(0,zn.existsSync)(n)||await(0,rd.mkdir)(n);for(let o of e){HL(o.path,n);let i=VL(n,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));GL(n,s)}(0,zn.writeFileSync)(i,o.content,{flag:"w+"})}}function VL(e,t){return Dr.join(e,...t.split("/"))}function GL(e,t){let r=t.split("/"),n=e;for(let o of r)n=Dr.join(n,o),(0,zn.existsSync)(n)||(0,zn.mkdirSync)(n)}var zn,rd,Dr,Wg=x(()=>{"use strict";zn=require("fs"),rd=require("fs/promises"),Dr=w(require("path"))});function id(e){for(let t of e??[]){let r=u[t.status]??u.info,n=qL[t.status]??xe;r(`
34
+ ${n} ${t.content}`)}}var qL,Gg=x(()=>{"use strict";F();N();qL={info:xe,warn:Z,success:$}});function Jg(e){let{manifestPath:t}=oe();return(0,zS.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var zS,qS=x(()=>{"use strict";zS=require("fs");da()});function sd(e,t,r){try{let n=zg(r),o=qg(Object.values(e)),i=t?.force;return o&&n&&!i}catch{return!1}}var YS,XS,zg,qg,ad=x(()=>{"use strict";YS=require("path"),XS=require("fs-extra");zg=e=>{try{return(0,XS.existsSync)((0,YS.join)(e,"tsconfig.json"))}catch{return!1}},qg=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function YL(e){let{export:t,...r}=e;return t?r["devlink-export"]!=null?(Jg(r),r):(u.warn(`${Z} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),r["devlink-export"]={...t},Jg(r),r):r}function ex(e,t){try{new RegExp(e)}catch{throw new d(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function rx(e){e=YL(e);let t=e["devlink-export"]||{},r=!1,n=t.rootDir;n||(W()?n=ZS:(r=!0,n=await qe({message:"Enter the root directory for exported components:",default:ZS,validate:p=>!p||p.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(QL()?o=!0:W()?o=!1:(r=!0,o=await Ce({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(W()?i=QS:(r=!0,i=await Ce({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:QS}))),t.components&&ex(t.components,"components"),t.componentGroups&&ex(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(W()?(s=ld,a=cd):(r=!0,await Ce({message:"Do you want to export all components?",default:!0})?(s=ld,a=cd):(s=await qe({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:ld,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await qe({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:cd,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||ld,a=a||cd;let l=t.relativeHrefRoot;l===void 0&&(l=XL);let c={...t,rootDir:n,components:s,componentGroups:a,ts:o,cssScopes:i,relativeHrefRoot:l};return(!t.rootDir||t.ts===void 0||t.cssScopes===void 0||!t.components||!t.componentGroups||t.relativeHrefRoot===void 0)&&ZL(c),{config:c,wasPrompted:r}}function ZL(e){Se({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function QL(){try{let e=process.cwd();if(zg(e))return!0;let t=["src","app","pages","components"];for(let r of t){let n=tx.join(e,r);if(ud.existsSync(n)&&qg(ud.readdirSync(n)))return!0}}catch{}return!1}var ud,tx,ZS,ld,cd,QS,XL,nx=x(()=>{"use strict";ud=w(require("fs")),tx=w(require("path"));Fe();he();F();N();C();hf();qS();ad();ZS="./webflow",ld=".*",cd=".*",QS=!0,XL="/"});function ui(e){let t=e;for(let r=0;r<8&&t instanceof Error;r+=1){if(t.code===Xg)return!0;t=t.cause}return!1}async function sx(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let r,n;try{let o=JSON.parse(t);r=o.message,n=o.code}catch{}throw new hl(r||`Request failed (HTTP ${e.status}).`,{code:n})}async function Zg(e,t,r,n){let o=await eN(r,n,t,e);if(!o.files||!Array.isArray(o.files))throw new d("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function eN(e,t,r,n){let{taskId:o,polling:i}=await tN(e,t,r,n);return rN(e,t,r,o,i)}async function tN(e,t,r,n){let o=await(0,Yg.default)(`${O()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",[ix]:t},body:JSON.stringify(n),timeout:6e4});return o.ok||await sx(o),await o.json()}async function rN(e,t,r,n,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,p=i;do{let f=await(0,Yg.default)(`${O()}/v2/devlink/${e}/export/${n}`,{headers:{Authorization:`Bearer ${r}`,[ix]:t},timeout:6e4});f.ok||await sx(f);let m=await f.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new hl("The export task failed. Please try again or report a bug.");await(0,ox.setTimeout)(p),p=Math.min(p*a,s)}while(Date.now()<c);throw new hl(`Export task timed out after ${l}ms. Please try again.`)}var Yg,ox,ix,Xg,hl,Qg=x(()=>{"use strict";Yg=w(require("node-fetch")),ox=require("timers/promises");F();De();C();ix="X-WF-Sync-Id",Xg="devlink_export_not_entitled",hl=class extends Error{code;constructor(t,r){super(t),this.code=r?.code}}});var ax,lx=x(()=>{"use strict";Fe();F();ax=async(e,t)=>{if(!t)return;await Ce({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function cx(e,t,r){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:r||`${t}s`;return`${e} ${i}`}var ux=x(()=>{"use strict"});async function dd(e){let t=Date.now(),r;try{let{manifest:n}=oe(),{siteId:o,accessToken:i}=await Ye(n,e),s=(0,dx.randomUUID)();dk(s);let{config:a,wasPrompted:l}=await rx(n);u.info(`${$} Export configuration loaded!`),await ax(a,l);let c=A.forExport({authToken:i,siteId:o});r=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:p,messages:f,metadata:m}=await Zg(a,i,o,s),g=m.exportCoverage==="full";await nd(p,a.rootDir,g),r.succeed(`${cx(m.componentCount,"component")} exported to ${a.rootDir}`),id(f);let h=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:h,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);throw e?.silentNotEntitled&&ui(p)?r.stop():r.fail(`Components export failed: ${f}`),await c.sendError(p instanceof Error?p:new Error(String(p)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),p}}catch(n){if(!(e?.silentNotEntitled&&ui(n))){let i="Export failed: "+(n instanceof Error?n.message:n);r?r.fail(i):u.error(i,{prefix:`
35
+ `+D})}throw new d(n,{skipLogging:!0})}}var dx,px=x(()=>{"use strict";dx=require("crypto");nx();Qg();lx();X();z();Oe();ux();F();C();Wg();N();Gg()});var fx={};Fp(fx,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>Xg,exportComponents:()=>dd,isDevlinkNotEntitledError:()=>ui});var pd=x(()=>{"use strict";px();Qg()});function Ld(e,t=!1){let r=e.length,n=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,f=0;function m(E,S){let L=0,U=0;for(;L<E||!S;){let j=e.charCodeAt(n);if(j>=48&&j<=57)U=U*16+j-48;else if(j>=65&&j<=70)U=U*16+j-65+10;else if(j>=97&&j<=102)U=U*16+j-97+10;else break;n++,L++}return L<E&&(U=-1),U}function g(E){n=E,o="",i=0,s=16,f=0}function h(){let E=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Ps(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Ps(e.charCodeAt(n)))for(n++;n<e.length&&Ps(e.charCodeAt(n));)n++;else return f=3,e.substring(E,n);let S=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Ps(e.charCodeAt(n))){for(n++;n<e.length&&Ps(e.charCodeAt(n));)n++;S=n}else f=3;return e.substring(E,S)}function y(){let E="",S=n;for(;;){if(n>=r){E+=e.substring(S,n),f=2;break}let L=e.charCodeAt(n);if(L===34){E+=e.substring(S,n),n++;break}if(L===92){if(E+=e.substring(S,n),n++,n>=r){f=2;break}switch(e.charCodeAt(n++)){case 34:E+='"';break;case 92:E+="\\";break;case 47:E+="/";break;case 98:E+="\b";break;case 102:E+="\f";break;case 110:E+=`
36
+ `;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:let j=m(4,!0);j>=0?E+=String.fromCharCode(j):f=4;break;default:f=5}S=n;continue}if(L>=0&&L<=31)if(_l(L)){E+=e.substring(S,n),f=2;break}else f=6;n++}return E}function k(){if(o="",f=0,i=n,l=a,p=c,n>=r)return i=r,s=17;let E=e.charCodeAt(n);if(Ph(E)){do n++,o+=String.fromCharCode(E),E=e.charCodeAt(n);while(Ph(E));return s=15}if(_l(E))return n++,o+=String.fromCharCode(E),E===13&&e.charCodeAt(n)===10&&(n++,o+=`
37
+ `),a++,c=n,s=14;switch(E){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,o=y(),s=10;case 47:let S=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!_l(e.charCodeAt(n));)n++;return o=e.substring(S,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;let L=r-1,U=!1;for(;n<L;){let j=e.charCodeAt(n);if(j===42&&e.charCodeAt(n+1)===47){n+=2,U=!0;break}n++,_l(j)&&(j===13&&e.charCodeAt(n)===10&&n++,a++,c=n)}return U||(n++,f=1),o=e.substring(S,n),s=13}return o+=String.fromCharCode(E),n++,s=16;case 45:if(o+=String.fromCharCode(E),n++,n===r||!Ps(e.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=h(),s=11;default:for(;n<r&&v(E);)n++,E=e.charCodeAt(n);if(i!==n){switch(o=e.substring(i,n),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(E),n++,s=16}}function v(E){if(Ph(E)||_l(E))return!1;switch(E){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function _(){let E;do E=k();while(E>=12&&E<=15);return E}return{setPosition:g,getPosition:()=>n,scan:t?_:k,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-p,getTokenError:()=>f}}function Ph(e){return e===32||e===9}function _l(e){return e===10||e===13}function Ps(e){return e>=48&&e<=57}var VC,Nd=x(()=>{"use strict";(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(VC||(VC={}))});var lj,$s,cj,GC=x(()=>{"use strict";lj=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),$s=200,cj={" ":{"\n":new Array($s).fill(0).map((e,t)=>`
38
+ `+" ".repeat(t)),"\r":new Array($s).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array($s).fill(0).map((e,t)=>`\r
39
+ `+" ".repeat(t))}," ":{"\n":new Array($s).fill(0).map((e,t)=>`
40
+ `+" ".repeat(t)),"\r":new Array($s).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array($s).fill(0).map((e,t)=>`\r
41
+ `+" ".repeat(t))}}});var $h=x(()=>{"use strict";Nd();GC()});function KC(e,t=[],r=jd.DEFAULT){let n=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):n!==null&&(o[n]=l)}return JC(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,n=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,p)=>{t.push({error:l,offset:c,length:p})}},r),o[0]}function JC(e,t,r=jd.DEFAULT){let n=Ld(e,!1),o=[],i=0;function s(H){return H?()=>i===0&&H(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(H){return H?we=>i===0&&H(we,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(H){return H?we=>i===0&&H(we,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(H){return H?()=>{i>0?i++:H(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function p(H){return H?()=>{i>0&&i--,i===0&&H(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let f=c(t.onObjectBegin),m=l(t.onObjectProperty),g=p(t.onObjectEnd),h=c(t.onArrayBegin),y=p(t.onArrayEnd),k=l(t.onLiteralValue),v=a(t.onSeparator),_=s(t.onComment),E=a(t.onError),S=r&&r.disallowComments,L=r&&r.allowTrailingComma;function U(){for(;;){let H=n.scan();switch(n.getTokenError()){case 4:j(14);break;case 5:j(15);break;case 3:j(13);break;case 1:S||j(11);break;case 2:j(12);break;case 6:j(16);break}switch(H){case 12:case 13:S?j(10):_();break;case 16:j(1);break;case 15:case 14:break;default:return H}}}function j(H,we=[],qr=[]){if(E(H),we.length+qr.length>0){let Yr=n.getToken();for(;Yr!==17;){if(we.indexOf(Yr)!==-1){U();break}else if(qr.indexOf(Yr)!==-1)break;Yr=U()}}}function re(H){let we=n.getTokenValue();return H?k(we):(m(we),o.push(we)),U(),!0}function G(){switch(n.getToken()){case 11:let H=n.getTokenValue(),we=Number(H);isNaN(we)&&(j(2),we=0),k(we);break;case 7:k(null);break;case 8:k(!0);break;case 9:k(!1);break;default:return!1}return U(),!0}function ue(){return n.getToken()!==10?(j(3,[],[2,5]),!1):(re(!1),n.getToken()===6?(v(":"),U(),Y()||j(4,[],[2,5])):j(5,[],[2,5]),o.pop(),!0)}function Ue(){f(),U();let H=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(H||j(4,[],[]),v(","),U(),n.getToken()===2&&L)break}else H&&j(6,[],[]);ue()||j(4,[],[2,5]),H=!0}return g(),n.getToken()!==2?j(7,[2],[]):U(),!0}function I(){h(),U();let H=!0,we=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(we||j(4,[],[]),v(","),U(),n.getToken()===4&&L)break}else we&&j(6,[],[]);H?(o.push(0),H=!1):o[o.length-1]++,Y()||j(4,[],[4,5]),we=!0}return y(),H||o.pop(),n.getToken()!==4?j(8,[4],[]):U(),!0}function Y(){switch(n.getToken()){case 3:return I();case 1:return Ue();case 10:return re(!0);default:return G()}}return U(),n.getToken()===17?r.allowEmptyContent?!0:(j(4,[],[]),!1):Y()?(n.getToken()!==17&&j(9,[],[]),!0):(j(4,[],[]),!1)}var jd,Oh=x(()=>{"use strict";Nd();(function(e){e.DEFAULT={allowTrailingComma:!1}})(jd||(jd={}))});var zC=x(()=>{"use strict";$h();Oh()});var qC,YC,mi,XC,Md=x(()=>{"use strict";$h();zC();Nd();Oh();(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(qC||(qC={}));(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(YC||(YC={}));mi=KC;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(XC||(XC={}))});var Os,Te,gi,yn,Mt=x(()=>{"use strict";Os=class extends Error{remediation;documentationUrl;cause;constructor(t,r){super(t),this.name="FrameworkError",this.cause=r?.cause,this.remediation=r?.remediation,this.documentationUrl=r?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
41
42
 
42
43
  How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
43
44
 
44
- Documentation: ${this.documentationUrl}`),t}},Ae=class extends ts{constructor(t,r){super(t,r),this.name="FrameworkValidationError"}},Oo=class extends ts{configFile;constructor(t,r){super(t,r),this.name="FrameworkConfigError",this.configFile=r?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
45
+ Documentation: ${this.documentationUrl}`),t}},Te=class extends Os{constructor(t,r){super(t,r),this.name="FrameworkValidationError"}},gi=class extends Os{configFile;constructor(t,r){super(t,r),this.name="FrameworkConfigError",this.configFile=r?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
45
46
 
46
- Config file: ${this.configFile}`),t}},an=class extends ts{constructor(t,r){super(t,r),this.name="FrameworkDetectionError"}}});var $v,ft,ln=x(()=>{"use strict";$v=w(require("semver")),ft=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,r){return{detected:!1}}static detectFromBuiltOutput(t){return!1}static getOutputDeployMetadata(){throw new Error("getOutputDeployMetadata must be implemented by the framework subclass")}getOutputDeployMetadata(){return this.constructor.getOutputDeployMetadata()}getFrameworkVersion(){}async postBuild(){}getAdditionalConfigFiles(){return[]}getUserConfigPatterns(){return[]}hasDependency(t){let{packageJson:r}=this.ctx;return t in(r.dependencies||{})||t in(r.devDependencies||{})}getDependencyVersion(t){let{packageJson:r}=this.ctx;return r.dependencies?.[t]||r.devDependencies?.[t]}resolveFrameworkVersion(t){let r=this.getDependencyVersion(t);if(r)return $v.default.coerce(r)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}}});function GP(){return process.version.slice(1)}function KP(e){let t=Lo.coerce(e);return t?t.major:null}function JP(e,t){let r=Lo.coerce(e),n=Lo.coerce(t);return!r||!n?!1:Lo.gte(r,n)}function Un(e,t,r){let n=GP(),o=t.minimum;if(JP(n,o))e.debug(`Node.js version ${n} meets requirement ${o}`);else{let i=KP(o),s=`${r} requires Node.js ${o} or higher. Current version: ${n}`;if(t.severity==="error")throw new Ae(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
47
+ Config file: ${this.configFile}`),t}},yn=class extends Os{constructor(t,r){super(t,r),this.name="FrameworkDetectionError"}}});var ZC,mt,wn=x(()=>{"use strict";ZC=w(require("semver")),mt=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,r){return{detected:!1}}static detectFromBuiltOutput(t){return!1}static getOutputDeployMetadata(){throw new Error("getOutputDeployMetadata must be implemented by the framework subclass")}getOutputDeployMetadata(){return this.constructor.getOutputDeployMetadata()}getFrameworkVersion(){}async postBuild(){}getAdditionalConfigFiles(){return[]}getUserConfigPatterns(){return[]}hasDependency(t){let{packageJson:r}=this.ctx;return t in(r.dependencies||{})||t in(r.devDependencies||{})}getDependencyVersion(t){let{packageJson:r}=this.ctx;return r.dependencies?.[t]||r.devDependencies?.[t]}resolveFrameworkVersion(t){let r=this.getDependencyVersion(t);if(r)return ZC.default.coerce(r)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}}});function hj(){return process.version.slice(1)}function yj(e){let t=hi.coerce(e);return t?t.major:null}function wj(e,t){let r=hi.coerce(e),n=hi.coerce(t);return!r||!n?!1:hi.gte(r,n)}function to(e,t,r){let n=hj(),o=t.minimum;if(wj(n,o))e.debug(`Node.js version ${n} meets requirement ${o}`);else{let i=yj(o),s=`${r} requires Node.js ${o} or higher. Current version: ${n}`;if(t.severity==="error")throw new Te(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
47
48
 
48
49
  nvm install ${i}
49
- nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var Lo,Ov=x(()=>{"use strict";Lo=w(require("semver"));Tt()});function Ha(e){let t=Lv.default.join(e,"package.json");if(!Iu.statSync(t,{throwIfNoEntry:!1}))return;let r=Iu.readFileSync(t).toString("utf8"),n;try{n=JSON.parse(r)}catch(o){throw new Ae("package.json was not valid JSON",{cause:o})}try{return Nv.parse(n)}catch(o){throw new Ae("package.json schema validation failed",{cause:o})}}var Iu,Lv,Nv,ig=x(()=>{"use strict";Iu=w(require("fs")),Lv=w(require("path"));Zi();Tt();Nv=B.object({name:B.string().optional(),version:B.string().optional(),dependencies:B.record(B.string()).optional(),devDependencies:B.record(B.string()).optional()})});function rs(e,t,r="webflow.json"){let n=jv.default.join(t,r);if(!Tu.statSync(n,{throwIfNoEntry:!1}))return r.endsWith(".json")?rs(e,t,r+"c"):void 0;let o=Tu.readFileSync(n).toString("utf8"),i;try{i=$o(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${n} ${JSON.stringify(o)}: ${s}`);return}try{let s=Pu.parse(i);return e.debug(`loaded ${n}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${n} was valid JSON but schema validation failed: ${s}`);return}}var Tu,jv,Pu,sg=x(()=>{"use strict";Tu=w(require("fs")),jv=w(require("path"));Zi();Ru();Pu=B.object({cloud:B.object({contract_version:B.string().optional(),framework:B.string().optional(),framework_version:B.string().optional(),entrypoint_path:B.string().optional(),deployment_type:B.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:B.boolean().optional(),assets_path_prefix:B.string().optional(),assets_source_skip_mount_path:B.boolean().optional()}).passthrough().optional()}).passthrough()});function ag(e,t,r,n,o){if(!r||n!=="astro"&&n!=="nextjs")return t;let i=Mv.join(e,t);if(!ns.existsSync(i)||!ns.statSync(i).isDirectory())return t;let a=ns.readdirSync(i,{withFileTypes:!0}).find(l=>!(!l.isDirectory()||o&&l.name===o||n==="astro"&&(l.name==="_routes.json"||l.name==="_worker.js")));return a?`${t}/${a.name}`:t}var ns,Mv,Bv=x(()=>{"use strict";ns=w(require("fs")),Mv=w(require("path"))});async function Ze(e){let{log:t,cwd:r,args:n}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...Wv,...n];t.debug(`npm ${i.join(" ")} (in ${r})`),(0,Uv.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:r,env:o,stdio:"inherit"})}var Uv,Wv,Hv=x(()=>{"use strict";Uv=require("child_process"),Wv=["--no-update-notifier","--no-progress","--no-audit","--no-fund"]});function fr(e){if(!e)return null;let t=Vv.coerce(e);return t?t.major:null}function Wn(e,t,r,n){let o=n?.exclude?Array.isArray(n.exclude)?n.exclude:[n.exclude]:[],i=Pr.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(n?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=n?.followSymlinks!==!1,a=s?Le.statSync(t,{throwIfNoEntry:!1}):Le.lstatSync(t,{throwIfNoEntry:!1});if(!a)return e.trace(`Source does not exist: ${t}`),0;if(!s&&a.isSymbolicLink())return e.trace(`Skipping symlink: ${t}`),0;if(a.isDirectory()){e.trace(`Copying directory: ${t} -> ${r}`);let c=Le.readdirSync(t),p=0;for(let f of c)p+=Wn(e,Pr.join(t,f),Pr.join(r,f),n);return p}let l=Pr.dirname(r);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${r}`),Le.copyFileSync(t,r),1}function Et(e){return Le.existsSync(e)}function wt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function $r(e,t,r,n){if(!Le.existsSync(t))throw new Oo(`Template not found: ${t}`,{configFile:t});let o=Le.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${r}`);let i=n||process.env,s=o.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(l,c)=>i[c]??"").replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(l,c)=>i[c]??""),a=Pr.dirname(r);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(r,s)}function Or(e,t,r,n){for(let o of n){let i=Pr.join(t,`${r}.${o}`);if(Le.existsSync(i)){let s=Pr.join(t,`clouduser.${r}.${o}`);return e.info(`Renaming user config: ${r}.${o} -> clouduser.${r}.${o}`),Le.renameSync(i,s),s}}return null}var Vv,Le,Pr,Lr=x(()=>{"use strict";Vv=w(require("semver")),Le=w(require("fs")),Pr=w(require("path"));Tt();Ov();ig();sg();Bv();Hv()});var vt,Va,lg,Gv,No,Kv=x(()=>{"use strict";vt=w(require("path")),Va=w(require("fs"));ln();Tt();Lr();lg=wt(vt.join(__dirname,"templates","astro","v5"),vt.join(__dirname,"templates","v5")),Gv=wt(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),No=class extends ft{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return n==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=fr(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^5.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=fr(o);if(i!==null&&i>=6)throw new Ae(`Astro ${i}.x detected but was routed to the Astro 5 builder. This is an internal error.`,{remediation:"Ensure your package.json has astro@^6.0.0 - the Astro 6 builder will be used automatically. If this persists, please report the issue."});t.info(`Validated Astro project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^12.0.0"}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^4.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn(`Installing ${n.name}@${n.version} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:r,args:["install","--save",`${n.name}@${n.version}`]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(lg,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return vt.join(lg,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(Gv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Va.writeFileSync(vt.join(r,"clouduser.astro.config.mjs"),`export default {};
50
- `));let i=vt.join(Gv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Va.copyFileSync(i,vt.join(r,"astro.config.webflow.ts")));let s=vt.join(lg,"astro.config.mjs.template"),a=vt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Va.copyFileSync(l.templatePath,vt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist",staticAssetsExclude:["_worker.js"],workerEntryPath:"dist/_worker.js/index.js",deploymentType:"ssr",dryRunEntryPath:"./index.js"}}}});async function $u(e){let{log:t,cwd:r,adapterName:n,installVersion:o,fixedFloor:i,declaredVersion:s}=e;if(!s){t.warn(`Installing ${n}@${o} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:r,args:["install","--save",`${n}@${o}`]});return}let a=Ga.coerce(s);if(!a||!Ga.lt(a,i))return;let l=Ga.coerce(i)?.major;a.major===l?(t.warn(`Detected ${n}@${s}, which has a known base-path bug (withastro/astro#16276) that breaks static assets on mounted apps. Upgrading to ${o}.`),await Ze({log:t,cwd:r,args:["install","--save",`${n}@${o}`]})):t.warn(`${n}@${s} predates the base-path fix in ${i} and upgrading crosses a major version. Please upgrade to ${n}@${o} manually to avoid broken asset serving on mounted apps.`)}var Ga,cg=x(()=>{"use strict";Ga=w(require("semver"));Lr()});var St,Ka,ug,Jv,jo,zv=x(()=>{"use strict";St=w(require("path")),Ka=w(require("fs"));ln();Tt();Lr();cg();ug=wt(St.join(__dirname,"templates","astro","v6"),St.join(__dirname,"templates","v6")),Jv=wt(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),jo=class extends ft{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=fr(o);return i!==null&&i>=7?{detected:!1}:i!==null&&i>=6?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^6.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=fr(o);if(i!==null&&i<6)throw new Ae(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro5Builder for Astro 5.x, or upgrade: npm install astro@^6.0.0"});if(i!==null&&i>=7)throw new Ae(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro7Builder for Astro 7.x, or downgrade: npm install astro@^6.0.0"});t.info(`Validated Astro 6 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^13.3.1",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^5.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(await $u({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"13.3.1",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ze({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(ug,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return St.join(ug,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(Jv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Ka.writeFileSync(St.join(r,"clouduser.astro.config.mjs"),`export default {};
51
- `));let i=St.join(Jv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ka.copyFileSync(i,St.join(r,"astro.config.webflow.ts")));let s=St.join(ug,"astro.config.mjs.template"),a=St.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ka.copyFileSync(l.templatePath,St.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}}});var xt,Ja,dg,qv,os,Yv=x(()=>{"use strict";xt=w(require("path")),Ja=w(require("fs"));ln();Tt();Lr();cg();dg=wt(xt.join(__dirname,"templates","astro","v7"),xt.join(__dirname,"templates","v7")),qv=wt(xt.join(__dirname,"templates","astro"),xt.join(__dirname,"templates")),os=class extends ft{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=fr(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^7.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=fr(o);if(i!==null&&i<7)throw new Ae(`Astro ${i}.x detected but Astro7Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro6Builder for Astro 6.x, or upgrade: npm install astro@^7.0.0"});t.info(`Validated Astro 7 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"14.1.7",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^6.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(await $u({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"14.0.0",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ze({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:xt.join(dg,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return xt.join(dg,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,xt.join(qv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Ja.writeFileSync(xt.join(r,"clouduser.astro.config.mjs"),`export default {};
52
- `));let i=xt.join(qv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ja.copyFileSync(i,xt.join(r,"astro.config.webflow.ts")));let s=xt.join(dg,"astro.config.mjs.template"),a=xt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ja.copyFileSync(l.templatePath,xt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}}});var Ou=x(()=>{"use strict";Kv();zv();Yv()});var He,Qt,is,ss,Lu=x(()=>{"use strict";He=w(require("path")),Qt=w(require("fs"));ln();Tt();Lr();is=wt(He.join(__dirname,"templates","nextjs"),He.join(__dirname,"templates")),ss=class extends ft{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,r){let n=r?.cloud?.framework;return n==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:n&&n!=="nextjs"?{detected:!1}:t.dependencies?.next!==void 0||t.devDependencies?.next!==void 0?{detected:!0,reason:'Found "next" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.next||r.devDependencies?.next;if(!n)throw new Ae("Next.js is not installed in this project.",{remediation:"Install Next.js by running: npm install next",documentationUrl:"https://nextjs.org/docs/getting-started/installation"});t.info(`Validated Next.js project: next@${n}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await Ze({log:t,cwd:r,args:["install","--save",n.name]}))}getWebflowLoader(){return{templatePath:He.join(is,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["next.config.mjs","next.config.cjs","next.config.js","next.config.ts"]}getWranglerTemplatePath(){return He.join(is,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,He.join(is,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(Qt.existsSync(He.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:r,cwd:n}=this.ctx,o=this.findOpenNextConfig();if(o){r.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(r.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!Qt.existsSync(t))throw new Oo(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=He.join(n,"open-next.config.ts");Qt.copyFileSync(t,i),r.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=Or(t,r,"next.config",["mjs","cjs","js","ts"]);o===null?(t.info("no user next.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.next.config.ts stub"),Qt.writeFileSync(He.join(r,"clouduser.next.config.ts"),`export default {};
53
- `)):He.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${He.basename(o)}`),Qt.writeFileSync(He.join(r,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
50
+ nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var hi,QC=x(()=>{"use strict";hi=w(require("semver"));Mt()});function Al(e){let t=e_.default.join(e,"package.json");if(!Bd.statSync(t,{throwIfNoEntry:!1}))return;let r=Bd.readFileSync(t).toString("utf8"),n;try{n=JSON.parse(r)}catch(o){throw new Te("package.json was not valid JSON",{cause:o})}try{return t_.parse(n)}catch(o){throw new Te("package.json schema validation failed",{cause:o})}}var Bd,e_,t_,Nh=x(()=>{"use strict";Bd=w(require("fs")),e_=w(require("path"));os();Mt();t_=B.object({name:B.string().optional(),version:B.string().optional(),dependencies:B.record(B.string()).optional(),devDependencies:B.record(B.string()).optional()})});function Ls(e,t,r="webflow.json"){let n=r_.default.join(t,r);if(!Ud.statSync(n,{throwIfNoEntry:!1}))return r.endsWith(".json")?Ls(e,t,r+"c"):void 0;let o=Ud.readFileSync(n).toString("utf8"),i;try{i=mi(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${n} ${JSON.stringify(o)}: ${s}`);return}try{let s=Wd.parse(i);return e.debug(`loaded ${n}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${n} was valid JSON but schema validation failed: ${s}`);return}}var Ud,r_,Wd,jh=x(()=>{"use strict";Ud=w(require("fs")),r_=w(require("path"));os();Md();Wd=B.object({cloud:B.object({contract_version:B.string().optional(),framework:B.string().optional(),framework_version:B.string().optional(),entrypoint_path:B.string().optional(),deployment_type:B.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:B.boolean().optional(),assets_path_prefix:B.string().optional(),assets_source_skip_mount_path:B.boolean().optional()}).passthrough().optional()}).passthrough()});function Mh(e,t,r,n,o){if(!r||n!=="astro"&&n!=="nextjs")return t;let i=n_.join(e,t);if(!Ns.existsSync(i)||!Ns.statSync(i).isDirectory())return t;let a=Ns.readdirSync(i,{withFileTypes:!0}).find(l=>!(!l.isDirectory()||o&&l.name===o||n==="astro"&&(l.name==="_routes.json"||l.name==="_worker.js")));return a?`${t}/${a.name}`:t}var Ns,n_,o_=x(()=>{"use strict";Ns=w(require("fs")),n_=w(require("path"))});async function et(e){let{log:t,cwd:r,args:n}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...s_,...n];t.debug(`npm ${i.join(" ")} (in ${r})`),(0,i_.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:r,env:o,stdio:"inherit"})}var i_,s_,a_=x(()=>{"use strict";i_=require("child_process"),s_=["--no-update-notifier","--no-progress","--no-audit","--no-fund"]});function Er(e){if(!e)return null;let t=l_.coerce(e);return t?t.major:null}function ro(e,t,r,n){let o=n?.exclude?Array.isArray(n.exclude)?n.exclude:[n.exclude]:[],i=Ur.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(n?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=n?.followSymlinks!==!1,a=s?Le.statSync(t,{throwIfNoEntry:!1}):Le.lstatSync(t,{throwIfNoEntry:!1});if(!a)return e.trace(`Source does not exist: ${t}`),0;if(!s&&a.isSymbolicLink())return e.trace(`Skipping symlink: ${t}`),0;if(a.isDirectory()){e.trace(`Copying directory: ${t} -> ${r}`);let c=Le.readdirSync(t),p=0;for(let f of c)p+=ro(e,Ur.join(t,f),Ur.join(r,f),n);return p}let l=Ur.dirname(r);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${r}`),Le.copyFileSync(t,r),1}function Ct(e){return Le.existsSync(e)}function wt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function Wr(e,t,r,n){if(!Le.existsSync(t))throw new gi(`Template not found: ${t}`,{configFile:t});let o=Le.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${r}`);let i=n||process.env,s=o.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(l,c)=>i[c]??"").replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(l,c)=>i[c]??""),a=Ur.dirname(r);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(r,s)}function Hr(e,t,r,n){for(let o of n){let i=Ur.join(t,`${r}.${o}`);if(Le.existsSync(i)){let s=Ur.join(t,`clouduser.${r}.${o}`);return e.info(`Renaming user config: ${r}.${o} -> clouduser.${r}.${o}`),Le.renameSync(i,s),s}}return null}var l_,Le,Ur,Vr=x(()=>{"use strict";l_=w(require("semver")),Le=w(require("fs")),Ur=w(require("path"));Mt();QC();Nh();jh();o_();a_()});var _t,Fl,Bh,c_,yi,u_=x(()=>{"use strict";_t=w(require("path")),Fl=w(require("fs"));wn();Mt();Vr();Bh=wt(_t.join(__dirname,"templates","astro","v5"),_t.join(__dirname,"templates","v5")),c_=wt(_t.join(__dirname,"templates","astro"),_t.join(__dirname,"templates")),yi=class extends mt{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return n==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=Er(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&to(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Te("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^5.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Te('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=Er(o);if(i!==null&&i>=6)throw new Te(`Astro ${i}.x detected but was routed to the Astro 5 builder. This is an internal error.`,{remediation:"Ensure your package.json has astro@^6.0.0 - the Astro 6 builder will be used automatically. If this persists, please report the issue."});t.info(`Validated Astro project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^12.0.0"}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^4.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn(`Installing ${n.name}@${n.version} (required for Cloudflare deployment)...`),await et({log:t,cwd:r,args:["install","--save",`${n.name}@${n.version}`]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await et({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:_t.join(Bh,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return _t.join(Bh,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,_t.join(c_,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Hr(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Fl.writeFileSync(_t.join(r,"clouduser.astro.config.mjs"),`export default {};
51
+ `));let i=_t.join(c_,"astro.config.webflow.ts");Ct(i)&&(t.info("Copying astro.config.webflow.ts..."),Fl.copyFileSync(i,_t.join(r,"astro.config.webflow.ts")));let s=_t.join(Bh,"astro.config.mjs.template"),a=_t.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await Wr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Ct(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Fl.copyFileSync(l.templatePath,_t.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist",staticAssetsExclude:["_worker.js"],workerEntryPath:"dist/_worker.js/index.js",deploymentType:"ssr",dryRunEntryPath:"./index.js"}}}});async function Hd(e){let{log:t,cwd:r,adapterName:n,installVersion:o,fixedFloor:i,declaredVersion:s}=e;if(!s){t.warn(`Installing ${n}@${o} (required for Cloudflare deployment)...`),await et({log:t,cwd:r,args:["install","--save",`${n}@${o}`]});return}let a=Il.coerce(s);if(!a||!Il.lt(a,i))return;let l=Il.coerce(i)?.major;a.major===l?(t.warn(`Detected ${n}@${s}, which has a known base-path bug (withastro/astro#16276) that breaks static assets on mounted apps. Upgrading to ${o}.`),await et({log:t,cwd:r,args:["install","--save",`${n}@${o}`]})):t.warn(`${n}@${s} predates the base-path fix in ${i} and upgrading crosses a major version. Please upgrade to ${n}@${o} manually to avoid broken asset serving on mounted apps.`)}var Il,Uh=x(()=>{"use strict";Il=w(require("semver"));Vr()});var At,Rl,Wh,d_,wi,p_=x(()=>{"use strict";At=w(require("path")),Rl=w(require("fs"));wn();Mt();Vr();Uh();Wh=wt(At.join(__dirname,"templates","astro","v6"),At.join(__dirname,"templates","v6")),d_=wt(At.join(__dirname,"templates","astro"),At.join(__dirname,"templates")),wi=class extends mt{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=Er(o);return i!==null&&i>=7?{detected:!1}:i!==null&&i>=6?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&to(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Te("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^6.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Te('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=Er(o);if(i!==null&&i<6)throw new Te(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro5Builder for Astro 5.x, or upgrade: npm install astro@^6.0.0"});if(i!==null&&i>=7)throw new Te(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro7Builder for Astro 7.x, or downgrade: npm install astro@^6.0.0"});t.info(`Validated Astro 6 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^13.3.1",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^5.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(await Hd({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"13.3.1",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await et({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await et({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:At.join(Wh,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return At.join(Wh,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,At.join(d_,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Hr(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Rl.writeFileSync(At.join(r,"clouduser.astro.config.mjs"),`export default {};
52
+ `));let i=At.join(d_,"astro.config.webflow.ts");Ct(i)&&(t.info("Copying astro.config.webflow.ts..."),Rl.copyFileSync(i,At.join(r,"astro.config.webflow.ts")));let s=At.join(Wh,"astro.config.mjs.template"),a=At.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await Wr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Ct(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Rl.copyFileSync(l.templatePath,At.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}}});var Ft,Tl,Hh,f_,js,m_=x(()=>{"use strict";Ft=w(require("path")),Tl=w(require("fs"));wn();Mt();Vr();Uh();Hh=wt(Ft.join(__dirname,"templates","astro","v7"),Ft.join(__dirname,"templates","v7")),f_=wt(Ft.join(__dirname,"templates","astro"),Ft.join(__dirname,"templates")),js=class extends mt{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=Er(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&to(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Te("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^7.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Te('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=Er(o);if(i!==null&&i<7)throw new Te(`Astro ${i}.x detected but Astro7Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro6Builder for Astro 6.x, or upgrade: npm install astro@^7.0.0"});t.info(`Validated Astro 7 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"14.1.7",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^6.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(await Hd({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"14.0.0",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await et({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await et({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:Ft.join(Hh,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return Ft.join(Hh,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ft.join(f_,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Hr(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Tl.writeFileSync(Ft.join(r,"clouduser.astro.config.mjs"),`export default {};
53
+ `));let i=Ft.join(f_,"astro.config.webflow.ts");Ct(i)&&(t.info("Copying astro.config.webflow.ts..."),Tl.copyFileSync(i,Ft.join(r,"astro.config.webflow.ts")));let s=Ft.join(Hh,"astro.config.mjs.template"),a=Ft.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await Wr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Ct(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Tl.copyFileSync(l.templatePath,Ft.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}}});var Vd=x(()=>{"use strict";u_();p_();m_()});var Je,or,Ms,Bs,Gd=x(()=>{"use strict";Je=w(require("path")),or=w(require("fs"));wn();Mt();Vr();Ms=wt(Je.join(__dirname,"templates","nextjs"),Je.join(__dirname,"templates")),Bs=class extends mt{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,r){let n=r?.cloud?.framework;return n==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:n&&n!=="nextjs"?{detected:!1}:t.dependencies?.next!==void 0||t.devDependencies?.next!==void 0?{detected:!0,reason:'Found "next" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.next||r.devDependencies?.next;if(!n)throw new Te("Next.js is not installed in this project.",{remediation:"Install Next.js by running: npm install next",documentationUrl:"https://nextjs.org/docs/getting-started/installation"});t.info(`Validated Next.js project: next@${n}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await et({log:t,cwd:r,args:["install","--save",n.name]}))}getWebflowLoader(){return{templatePath:Je.join(Ms,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["next.config.mjs","next.config.cjs","next.config.js","next.config.ts"]}getWranglerTemplatePath(){return Je.join(Ms,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Je.join(Ms,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(or.existsSync(Je.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:r,cwd:n}=this.ctx,o=this.findOpenNextConfig();if(o){r.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(r.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!or.existsSync(t))throw new gi(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=Je.join(n,"open-next.config.ts");or.copyFileSync(t,i),r.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=Hr(t,r,"next.config",["mjs","cjs","js","ts"]);o===null?(t.info("no user next.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.next.config.ts stub"),or.writeFileSync(Je.join(r,"clouduser.next.config.ts"),`export default {};
54
+ `)):Je.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${Je.basename(o)}`),or.writeFileSync(Je.join(r,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
54
55
  declare const config: UserNextConfig;
55
56
  export default config;
56
- `));let i=He.join(is,"next.config.webflow.ts");Et(i)&&(t.info("Copying next.config.webflow.ts..."),Qt.copyFileSync(i,He.join(r,"next.config.webflow.ts")));let s=He.join(is,"next.config.ts.template"),a=He.join(r,"next.config.ts");t.info("Generating next.config.ts from template..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Qt.copyFileSync(l.templatePath,He.join(r,l.destinationName)));let c=He.join(is,"open-next.config.ts");this.ensureOpenNextConfig(c)}getBuildCommand(){return"opennextjs-cloudflare build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("next")}static getOutputDeployMetadata(){return{staticAssetsPath:".open-next/assets",workerEntryPath:".open-next/worker.js",deploymentType:"ssr",dryRunEntryPath:"./worker.js"}}static detectFromBuiltOutput(t){return Qt.statSync(He.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}}});var Pt,er,Nu,as,ju=x(()=>{"use strict";Pt=w(require("path")),er=w(require("fs"));Ru();ln();Tt();Lr();Nu=wt(Pt.join(__dirname,"templates","vite"),Pt.join(__dirname,"templates")),as=class extends ft{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,r){let n=r?.cloud?.framework;return n==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:n&&n!=="vite"?{detected:!1}:t.dependencies?.vite!==void 0||t.devDependencies?.vite!==void 0?{detected:!0,reason:'Found "vite" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.vite||r.devDependencies?.vite;if(!n)throw new Ae("Vite is not installed in this project.",{remediation:"Install Vite by running: npm install vite",documentationUrl:"https://vitejs.dev/guide/"});t.info(`Validated Vite project: vite@${n}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:r,packageJson:n}=this.ctx,o=n.devDependencies?.vite||n.dependencies?.vite||"",i=fr(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Ze({log:t,cwd:r,args:["install","--save-dev","vite@^6.1.0"]}));let s=this.getCloudflareAdapter();this.hasDependency(s.name)||(t.warn("Vite integration requires @cloudflare/vite-plugin, installing now..."),await Ze({log:t,cwd:r,args:["install","--save",s.name]}));let a=this.getRequiredIntegrations();for(let l of a)if(!this.hasDependency(l.name)){t.info(`Installing ${l.name}...`);let c=l.dev?["install","--save-dev",l.name]:["install","--save",l.name];await Ze({log:t,cwd:r,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Pt.join(Nu,"wrangler.json")}getAdditionalConfigFiles(){return[Pt.join(Nu,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:r}=this.ctx;for(let n of["wrangler.json","wrangler.jsonc"]){let o=Pt.join(r,n);if(er.existsSync(o)){try{let i=er.readFileSync(o,"utf8"),s=$o(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${n} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${n}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:r}=this.ctx,n=Pt.join(r,"src","worker.ts");if(er.existsSync(n)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),er.mkdirSync(Pt.join(r,"src"),{recursive:!0}),er.writeFileSync(n,`/// <reference types="@cloudflare/workers-types" />
57
+ `));let i=Je.join(Ms,"next.config.webflow.ts");Ct(i)&&(t.info("Copying next.config.webflow.ts..."),or.copyFileSync(i,Je.join(r,"next.config.webflow.ts")));let s=Je.join(Ms,"next.config.ts.template"),a=Je.join(r,"next.config.ts");t.info("Generating next.config.ts from template..."),await Wr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Ct(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),or.copyFileSync(l.templatePath,Je.join(r,l.destinationName)));let c=Je.join(Ms,"open-next.config.ts");this.ensureOpenNextConfig(c)}getBuildCommand(){return"opennextjs-cloudflare build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("next")}static getOutputDeployMetadata(){return{staticAssetsPath:".open-next/assets",workerEntryPath:".open-next/worker.js",deploymentType:"ssr",dryRunEntryPath:"./worker.js"}}static detectFromBuiltOutput(t){return or.statSync(Je.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}}});var Bt,ir,Kd,Us,Jd=x(()=>{"use strict";Bt=w(require("path")),ir=w(require("fs"));Md();wn();Mt();Vr();Kd=wt(Bt.join(__dirname,"templates","vite"),Bt.join(__dirname,"templates")),Us=class extends mt{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,r){let n=r?.cloud?.framework;return n==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:n&&n!=="vite"?{detected:!1}:t.dependencies?.vite!==void 0||t.devDependencies?.vite!==void 0?{detected:!0,reason:'Found "vite" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.vite||r.devDependencies?.vite;if(!n)throw new Te("Vite is not installed in this project.",{remediation:"Install Vite by running: npm install vite",documentationUrl:"https://vitejs.dev/guide/"});t.info(`Validated Vite project: vite@${n}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:r,packageJson:n}=this.ctx,o=n.devDependencies?.vite||n.dependencies?.vite||"",i=Er(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await et({log:t,cwd:r,args:["install","--save-dev","vite@^6.1.0"]}));let s=this.getCloudflareAdapter();this.hasDependency(s.name)||(t.warn("Vite integration requires @cloudflare/vite-plugin, installing now..."),await et({log:t,cwd:r,args:["install","--save",s.name]}));let a=this.getRequiredIntegrations();for(let l of a)if(!this.hasDependency(l.name)){t.info(`Installing ${l.name}...`);let c=l.dev?["install","--save-dev",l.name]:["install","--save",l.name];await et({log:t,cwd:r,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Bt.join(Kd,"wrangler.json")}getAdditionalConfigFiles(){return[Bt.join(Kd,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:r}=this.ctx;for(let n of["wrangler.json","wrangler.jsonc"]){let o=Bt.join(r,n);if(ir.existsSync(o)){try{let i=ir.readFileSync(o,"utf8"),s=mi(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${n} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${n}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:r}=this.ctx,n=Bt.join(r,"src","worker.ts");if(ir.existsSync(n)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),ir.mkdirSync(Bt.join(r,"src"),{recursive:!0}),ir.writeFileSync(n,`/// <reference types="@cloudflare/workers-types" />
57
58
 
58
59
  interface Env {
59
60
  ASSETS: Fetcher;
@@ -64,50 +65,124 @@ export default {
64
65
  return env.ASSETS.fetch(request);
65
66
  },
66
67
  } satisfies ExportedHandler<Env>;
67
- `)}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=this.hasCustomWorkerEntry();Or(t,r,"vite.config",["mjs","cjs","js","ts"])===null&&(t.info("no user vite.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.vite.config.ts stub"),er.writeFileSync(Pt.join(r,"clouduser.vite.config.ts"),`export default {};
68
- `));let s=Pt.join(Nu,"vite.config.webflow.ts");Et(s)&&(t.info("Copying vite.config.webflow.ts..."),er.copyFileSync(s,Pt.join(r,"vite.config.webflow.ts")));let a=Pt.join(Nu,"vite.config.ts.template"),l=Pt.join(r,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await $r(t,a,l,{...process.env,...n}),o||this.ensureWorkerEntry()}getBuildCommand(){return"vite build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("vite")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"./src/worker.ts",deploymentType:"ssr-spa-combo",usesAssetsBinding:!0}}}});function qP(e,t){if(!t.includes("*"))return e===t;let r=t.split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${r}$`).test(e)}function Ya(e){return e===".well-known"?!1:e.startsWith(".")||qa.includes(e)?!0:pg.some(t=>qP(e,t))}function Xa(e){let t=[],r=(n,o)=>{let i;try{i=Xv.readdirSync(n,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){Ya(s.name)||r(za.join(n,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||ZP.has(s.name))&&t.push(a)}};return r(e,""),t}var Xv,za,zP,qa,pg,YP,XP,ZP,mr,Mu=x(()=>{"use strict";Xv=w(require("fs")),za=w(require("path"));ln();Lr();zP=wt(za.join(__dirname,"templates","static"),za.join(__dirname,"templates")),qa=["_headers","_redirects"],pg=["node_modules","package.json","package-lock.json","yarn.lock","pnpm-lock.yaml","webflow.json","webflow.jsonc","wrangler.json","wrangler.jsonc","wrangler.toml","clouduser.wrangler.json","clouduser","terraform.tfstate","terraform.tfstate.*","*.tfvars","auth.json","*.pem","*.key","*.pfx","*.p12","id_rsa","id_rsa.*","id_dsa","id_ecdsa","id_ed25519"];YP=["requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","composer.json","composer.lock","auth.json","Gemfile","Gemfile.lock","config.ru","go.mod","go.sum","Cargo.toml","Cargo.lock","pom.xml","build.gradle","build.gradle.kts","deno.json","deno.jsonc","bun.lockb","mix.exs","Dockerfile","Procfile"],XP=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],ZP=new Set([...YP,...XP]);mr=class extends ft{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,r){return r?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Xa(this.cwd);t.length>0&&this.log.warn(`static app declared, but build/runtime files are present (${t.join(", ")}); they will be published as static assets unless removed`),this.log.info("Static app: no framework, no dependencies, no build \u2014 nothing to validate")}async installDependencies(){}async prepareConfig(){}getBuildCommand(){return""}getCloudflareAdapter(){return null}getRequiredIntegrations(){return[]}getWebflowLoader(){return null}getNodeVersionRequirement(){return null}getWranglerTemplatePath(){return za.join(zP,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}}});var Zv=x(()=>{"use strict"});function Bu(e,t){for(let r of tS){let n=r.detect(e,t);if(n.detected)return{Builder:r,result:n}}return null}function fg(e,t){let r=Bu(e.packageJson,t);if(!r)throw new an("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Za.join(", ")})`});return e.log.info(`Detected framework: ${r.result.reason}`),new r.Builder(e)}function rS(e){let{hasPackageJson:t,specifiedFramework:r,hasRootIndexHtmlFile:n,hasRuntimeIndicators:o}=e;if(r==="static")return!0;let i=r!=null&&r!=="static";return!t&&!i&&n&&!o}function Qa(e,t,r){let n=r?.cloud?.framework,i=Qv.lstatSync(eS.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Xa(e),a=rS({hasPackageJson:t!=null,specifiedFramework:n,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&n==null)throw new an(`Found index.html but also build/runtime indicators (${s.join(", ")}); this is not a no-framework static app and will not be published as static assets.`,{remediation:'Remove those files, or declare a framework in webflow.json (e.g. { "cloud": { "framework": "static" } } to force static).'});return{isStatic:a}}var Qv,eS,tS,Za,mg=x(()=>{"use strict";Qv=w(require("fs")),eS=w(require("path"));Tt();Ou();Lu();ju();Mu();Ou();Lu();ju();Mu();ln();Zv();Tt();tS=[os,jo,No,ss,as,mr],Za=["astro","nextjs","vite","static"]});var nS=x(()=>{"use strict";mg();ln();Ou();Lu();ju();Mu();Tt()});function Uu(e,t,r,n){let o=oS.join(t,"webflow.json"),i={cloud:{}};if(ls.existsSync(o))try{let a=ls.readFileSync(o,"utf8"),l=JSON.parse(a),c=Pu.safeParse(l);if(c.success)i=c.data;else{let p=c.error.issues.map(f=>`${f.path.join(".")}: ${f.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${p}`),i=l}i.cloud||(e.warn('webflow.json is missing "cloud" property, adding it'),i.cloud={})}catch(a){e.warn(`Failed to parse existing webflow.json, overwriting: ${a}`)}let s=i.cloud;if(s.framework=r,n){let a=n.getOutputDeployMetadata();s.contract_version="1",s.deployment_type=a.deploymentType,a.deploymentType!=="static"&&(s.entrypoint_path=a.dryRunEntryPath??"./index.js"),s.skip_no_bundle=a.skipNoBundle===!0;let l=n.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,iS.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${r}`),ls.writeFileSync(o,JSON.stringify(i,null,2))}function sS(e,t){let r=rs(e,t);if(r?.cloud?.framework)return r.cloud.framework;let n=Ha(t),{isStatic:o}=Qa(t,n,r);if(o)return e.info("Detected static app (no framework, no build)"),Uu(e,t,mr.frameworkName),mr.frameworkName;if(!n)throw new an("Cannot detect framework: no package.json found",{remediation:'Run this command from your project root, or add a webflow.json with: { "cloud": { "framework": "<name>" } }'});e.info("webflow.json has no framework \u2014 detecting from package.json...");let i=Bu(n,r);if(!i)throw new an("Could not detect framework from package.json or webflow.json",{remediation:'Add a webflow.json with: { "cloud": { "framework": "<name>" } } (supported: astro, nextjs, vite)'});let s=i.Builder.frameworkName;return e.info(`Detected framework: ${i.result.reason}`),Uu(e,t,s),s}var ls,oS,iS,aS=x(()=>{"use strict";ls=w(require("fs")),oS=w(require("path")),iS=require("@webflow/cosmic-deploy-contract");mg();Tt();ig();sg();Lr();nS();Lr()});var el=x(()=>{"use strict";aS()});function cS(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
69
- `)}function uS(e,t="wrangler.json"){let r=gr.join(e,t);if(!mt.existsSync(r)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),uS(e,t+"c");u.warn(`/${t} not found`);return}let n=mt.readFileSync(r,"utf8");u.info(`reading /${t}...`);let o;try{o=$o(n)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=lS.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
70
- ${cS(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function dS(e,t){let r=null,n=null,o=gr.join(t,"wrangler.json"),i=gr.join(t,"wrangler.jsonc");mt.existsSync(o)?(r=o,n=".json"):mt.existsSync(i)&&(r=i,n=".jsonc"),r&&n&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${n}...`),mt.copyFileSync(r,gr.join(t,`clouduser.wrangler${n}`)));let s=r?uS(t,gr.basename(r)):null,a=e.getWranglerTemplatePath(),l=gr.join(t,"wrangler.json");if(!mt.existsSync(a))throw new Error(`Wrangler template not found at ${a}. Make sure the template is properly copied during build.`);if(u.info(`copying wrangler template for ${e.info.name} to /wrangler.json`),mt.copyFileSync(a,l),!s)return;let c=JSON.parse(mt.readFileSync(l,"utf8"));if(s.kv_namespaces&&s.kv_namespaces.length>0&&(c.kv_namespaces=s.kv_namespaces,u.info(`merged ${s.kv_namespaces.length} KV namespace(s) into template`)),s.r2_buckets&&s.r2_buckets.length>0&&(c.r2_buckets=s.r2_buckets,u.info(`merged ${s.r2_buckets.length} R2 bucket(s) into template`)),s.d1_databases&&s.d1_databases.length>0&&(c.d1_databases=s.d1_databases,u.info(`merged ${s.d1_databases.length} D1 database(s) into template`)),mt.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let p in s.d1_databases){let f=s.d1_databases[p];if(!f.migrations_dir){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir is not defined`);continue}let m=f.migrations_dir,g=gr.join(t,m);if(!mt.existsSync(g)){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let h=gr.join(t,"clouduser","migrations",m),y=Wn(u,g,h);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) is empty`)}}function QP(e){if(!/^[a-z0-9-]+$/.test(e))throw new Error(`Invalid object storage bucket name ${JSON.stringify(e)}: Only lowercase letters, numbers, and hyphens are allowed.`);if(e.startsWith("-")||e.endsWith("-"))throw new Error(`Invalid object storage bucket name "${e}": Cannot begin or end with a hyphen.`);if(e.length>27)throw new Error(`Invalid object storage bucket name "${e}": Must be 27 characters or fewer (currently ${e.length} characters).`)}function pS(e){let t=null;for(let s of[".json",".jsonc"]){let a=gr.join(e,`clouduser.wrangler${s}`);if(mt.existsSync(a)){t=a;break}}if(!t)return;let r=mt.readFileSync(t,"utf8"),n;try{n=$o(r)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=lS.safeParse(n);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
71
- ${cS(o.error)}`);let i=o.data;if(i.r2_buckets&&i.r2_buckets.length>0){u.info(`validating ${i.r2_buckets.length} object storage bucket name(s)...`);for(let s of i.r2_buckets)QP(s.bucket_name)}}var mt,gr,lS,fS=x(()=>{"use strict";mt=w(require("fs")),gr=w(require("path"));Zi();Ru();el();R();lS=B.object({name:B.string(),main:B.string().optional(),compatibility_date:B.string(),compatibility_flags:B.array(B.string()).optional(),placement:B.object({mode:B.string()}).passthrough().optional(),assets:B.object({directory:B.string(),binding:B.string().optional()}).passthrough().optional(),d1_databases:B.array(B.object({database_name:B.string(),database_id:B.string(),binding:B.string(),migrations_dir:B.string().optional()}).passthrough()).default([]),kv_namespaces:B.array(B.object({binding:B.string(),id:B.string()}).passthrough()).default([]),r2_buckets:B.array(B.object({binding:B.string(),bucket_name:B.string()}).passthrough()).default([])}).passthrough()});var cn,mS=x(()=>{"use strict";cn={LEGACY:"legacy",V2:"v2"}});function hS(e,t,r){if(!r)return t;let n=`${t}/${r}`,o=gS.join(e,n);return Wu.existsSync(o)&&Wu.statSync(o).isDirectory()?n:t}var Wu,gS,yS=x(()=>{"use strict";Wu=w(require("fs")),gS=w(require("path"))});var wS={};hp(wS,{detectBuilderV2:()=>e$});async function e$(e=process.cwd(),t,r,n){let o=(0,gt.loadPackageJson)(e),i=(0,gt.loadWebflowJson)(u,e),s={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:gg(r)}:{}},a={cwd:e,log:{debug:c=>u.debug(c),info:c=>u.info(c),warn:c=>u.warn(c),error:c=>u.error(c)},runCommand:gt.nodeCommandRunner,telemetry:gt.noopTelemetry,fs:gt.nodeFileSystem,packageJson:o??{},userEnv:s},{isStatic:l}=(0,gt.detectStaticApp)(e,o,i);if(l)return new gt.StaticBuilder(a);if(!o)throw new Error("No package.json file found");return(0,gt.detectAndCreateBuilder)(a,i)}var gt,bS=x(()=>{"use strict";gt=require("@webflow/app");R();hg()});function ES(e){let t=process.env.COSMIC_BUILD_ENGINE;return t===cn.V2||t===cn.LEGACY?t:e===cn.V2||e===cn.LEGACY?e:cn.LEGACY}function r$(e){return e===cn.V2?"@webflow/app@0.1.0-beta.6":cn.LEGACY}function un(e,t){let r=Math.min(Hu,process.stdout.columns??Hu),n=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,r-n.length));u.info(`
72
- ${se(`${n}${o}`)}`)}function yg(e,t){let r=Math.min(Hu,process.stdout.columns??Hu),n=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,r-n.length));u.info(`
73
- ${se(_t(`${n}${o}`))}`)}async function vS(e=process.cwd(),t,r,n,o){if(ES(o)===cn.V2){let{detectBuilderV2:p}=await Promise.resolve().then(()=>(bS(),wS));return p(e,t,r,n)}let i=Ha(e),s=rs(u,e),a={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:gg(r)}:{}},l={cwd:e,log:u,packageJson:i??{},userEnv:a},{isStatic:c}=Qa(e,i,s);if(c)return new mr(l);if(!i)throw new Error("No package.json file found");return fg(l,s)}async function SS(e,t={}){let r=t.projectPath||process.cwd(),n=Date.now(),o=pe.join(r,".tmp",`webflow-build-${n}`),i=t.outputDir||pe.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=wg(r),c=t.telemetry,p=e.getBuildCommand(),f=e.getOutputDeployMetadata(),m=f.deploymentType==="static",g=ES(t.serverBuildEngine);await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),ie.mkdirSync(o,{recursive:!0});try{u.info(`Build engine: ${se(r$(g))}`),un("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${f.deploymentType}`);let h=e.getNodeVersionRequirement();h&&Un(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),un("\u2699\uFE0F ","Configure wrangler"),await dS(e,r),u.info("Preparing framework configuration..."),await e.prepareConfig()),Uu(u,r,e.info.name,e),m||(un("\u{1F4E6}","Install dependencies"),await n$(r,e.info.name,t.telemetry),pS(r),un("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await o$(r,p,t.telemetry),await e.postBuild(),un("\u{1F9EA}","Wrangler dry-run"),await i$(r,i)),un("\u{1F4C1}","Copy assets"),await a$(r,i,e,s),un("\u{1F381}","Create tarball");let y=await l$(i),k=Date.now()-a;return u.info(`${$} Build completed in ${(k/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:k,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),y}catch(h){let y=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:y,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function wg(e){let t=pe.join(e,"wrangler.json");if(!ie.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let r=JSON.parse(ie.readFileSync(t,"utf8")),n=r.kv_namespaces||[],o=r.d1_databases||[],i=r.r2_buckets||[],s=r.vars||{};return{hasKV:n.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:n.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(r){return console.debug("Failed to parse wrangler.json for bindings detection:",r),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function xS(e){try{let t=pe.dirname(e);t.includes(".tmp/webflow-build-")&&(un("\u{1F9F9}","Clean up build artifacts"),ie.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function CS(e,t){try{un("\u{1F9F9}","Revert framework configuration");let r=t.getUserConfigPatterns(),n=new Set;for(let s of r){let a=pe.extname(s).slice(1),l=pe.basename(s,`.${a}`);if(!n.has(l)){n.add(l);for(let c of["mjs","cjs","js","ts"]){let p=pe.join(e,`clouduser.${l}.${c}`),f=pe.join(e,`${l}.${c}`);if(ie.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),ie.existsSync(f)&&ie.unlinkSync(f),ie.renameSync(p,f);break}}}}for(let s of[".jsonc",".json"]){let a=pe.join(e,`clouduser.wrangler${s}`);if(ie.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=pe.join(e,"wrangler.json");ie.existsSync(l)&&ie.unlinkSync(l);let c=pe.join(e,`wrangler${s}`);ie.renameSync(a,c);break}}let o=pe.join(e,"clouduser");ie.existsSync(o)&&(u.info("cleaning up clouduser directory..."),ie.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=pe.join(e,pe.basename(s));ie.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),ie.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=pe.join(e,i.destinationName);ie.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),ie.unlinkSync(s))}}catch(r){u.warn(`Warning: Failed to cleanup framework configuration: ${r}`)}}async function n$(e,t,r){let n=Date.now(),o=["--no-update-notifier","--no-progress"],i=pe.join(e,"package-lock.json");try{ie.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,tl.execSync)(`npm ci --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"})):(u.info("Warning: No package-lock.json found, installing dependencies with npm install --include=dev"),(0,tl.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-n;await r?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:ie.existsSync(i)})}catch(s){let a=Date.now()-n;throw await r?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:ie.existsSync(i)}),s}}function gg(e){let t="production",r;switch(t){case"development":r="wf-app-dev";break;case"acceptance":r="wf-app-acceptance";break;default:r="wf-app-prod"}return`https://${e}.${r}.cosmic.webflow.services`}async function o$(e,t,r){let n=Date.now();try{(0,tl.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-n;await r?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-n;throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"cloud_build_command_failure",{duration:i,buildCommand:t}),new Error(`Build command failed: ${t}`)}}async function i$(e,t){ie.mkdirSync(t,{recursive:!0});let r=pe.join(e,"wrangler.json"),n=pe.join(e,"wrangler.jsonc");if(!ie.existsSync(r)&&!ie.existsSync(n))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,tl.execSync)(`npx wrangler@${t$} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function kS(e,t){let r=pe.join(e,"webflow.json");ie.existsSync(r)?(u.info("including webflow.json in output..."),ie.copyFileSync(r,pe.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function s$(e,t,r){let n=r.replace(/\/+$/,"").replace(/^\/+/,""),o=pe.join(t,"assets"),i=pe.join(o,n||"");ie.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${n}...`);for(let s of ie.readdirSync(e))Wn(u,pe.join(e,s),pe.join(i,s),{excludeFn:Ya,followSymlinks:!1});for(let s of qa){let a=pe.join(e,s);ie.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),ie.copyFileSync(a,pe.join(o,s)))}}async function a$(e,t,r,n){let o=r.getOutputDeployMetadata();if(o.deploymentType==="static"){s$(e,t,n),kS(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=n.replace(/\/+$/,"").replace(/^\/+/,"");a?i=hS(e,i,l):i=ag(e,i,l,r.info.name,s);let c=pe.join(t,"assets",l||"");ie.mkdirSync(c,{recursive:!0});let p=pe.join(e,i);if(ie.existsSync(p)&&ie.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Wn(u,p,c,{exclude:s})):Wn(u,p,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");kS(e,t);let f=null;for(let m of[".json",".jsonc"]){let g=pe.join(e,`clouduser.wrangler${m}`);if(ie.existsSync(g)){f=g;break}}if(f){u.info("including user wrangler config in output..."),ie.copyFileSync(f,pe.join(t,"clouduser.wrangler.json"));let m=pe.join(e,"clouduser","migrations");if(ie.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let g=pe.join(t,"migrations");Wn(u,m,g)}}}async function l$(e){let t=`${e}.tar.gz`;try{return await DS.create({gzip:!0,file:t,cwd:pe.dirname(e)},[pe.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(r){throw new d(r,{prefix:"Failed to create tarball:"})}}var ie,pe,tl,DS,t$,Hu,hg=x(()=>{"use strict";ie=w(require("fs")),pe=w(require("path")),tl=require("child_process"),DS=w(require("tar"));fS();R();C();j();me();el();mS();yS();t$="4.82.1",Hu=60});var uw=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function aR(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.code==="DEP0040"&&typeof t.message=="string"&&t.message.includes("punycode")}function lR(e=process){if(e[uw])return;e[uw]=!0;let t=e.emit;e.emit=function(n,...o){return n==="warning"&&aR(o[0])?!1:t.call(this,n,...o)}}lR();var ZA=w(require("fs")),QA=require("commander");var qA=require("commander");me();R();var Kb=require("child_process"),Jb=require("fs"),Cf=w(require("semver"));R();var Ff="@webflow/webflow-cli",so="@webflow/data-types",dc="@webflow/react",AI=[Ff,so,dc],ao=class{getInstalledDependencies(){try{let t=(0,Kb.execSync)(`npm ls ${AI.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),r=JSON.parse(t);return r.dependencies?Object.entries(r.dependencies).reduce((n,[o,{version:i}])=>(n[o]=i,n),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let r=JSON.parse((0,Jb.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...r.dependencies,...r.devDependencies}}checkCLIAndDataTypes(t){let r=t[so];if(!r)return;let o=this.getRequiredDependencies(Ff)[so];if(!Cf.default.satisfies(r,o))throw new Error(`Version mismatch: ${Ff} requires ${so} v${o} but found v${r}`)}checkReactAndDataTypes(t){let r=t[so],n=t[dc];if(!(!r||!n)&&!Cf.default.eq(r,n))throw new Error(`Version mismatch: ${dc} and ${so} must be on the same version. Found ${dc}@${n} and ${so}@${r}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var tk=require("fs-extra");Oe();var rk=require("@dotenvx/dotenvx"),lo=w(require("semver"));R();var Zb=require("child_process"),Qb=require("util"),LI=(0,Qb.promisify)(Zb.exec);async function En(e,t){try{let{stdout:r,stderr:n}=await LI(e,t);return{stdout:r.toString().trim(),stderr:n.toString().trim(),code:0}}catch(r){let n=r;return{stdout:n.stdout??"",stderr:n.stderr??String(n.message??""),code:n.code??1}}}we();var Rf=w(ac());j();me();(0,rk.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var ek={npm:{updateCommand:"npm install",update:async e=>await En(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await En(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await En(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await En(`pnpm outdated --json ${e}`);return JSON.parse(t)},lockFile:"pnpm-lock.yaml",globalFlag:"--global",supported:!0},yarn:{lockFile:"yarn.lock",globalFlag:"",updateCommand:"",getOutdated:async()=>({}),update:async()=>({stdout:"",stderr:"",code:0}),supported:!1}},NI=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],pa=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(ek))if((0,tk.existsSync)(t.lockFile))return t;return ek.npm}async listOutdatedPackages(t="local",r=NI){let{getOutdated:n,globalFlag:o}=this.packageManager,i=await n(`${t==="global"?o:""} ${r?.join(" ")}`);return Object.fromEntries(Object.entries(i).map(([s,a])=>Array.isArray(a)?[s,{current:a[0].current,latest:a[0].latest,installationType:t}]:[s,{current:a.current,latest:a.latest,installationType:t}]))}async getOutdatedPackages(){let t=await this.listOutdatedPackages();if(t["@webflow/webflow-cli"])return t;let r=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...r}}async showUpdatePrompt(t){let r={name:"Update all packages",value:"update-all"},n=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${rt} ${a})`,value:i})),o=await Cr({message:`New versions of the following ${Ne("@webflow")} packages are available. Would you like to update them?`,choices:[r,...n]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:r,globalFlag:n}=this.packageManager;u.info(`${xe} New versions of the following ${Ne("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(P(` ${lc} ${s} (${a} ${rt} ${l})`))});let o=Object.entries(t).filter(([,{installationType:s}])=>s==="local").map(([s])=>`${s}@latest`),i=Object.entries(t).filter(([,{installationType:s}])=>s==="global").map(([s])=>`${s}@latest`);u.info(`
74
- ${rt} To update, run:`),o.length>0&&u.info(z(` ${r} ${o.join(" ")}`)),i.length>0&&u.info(z(` ${r} ${n} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=lo.prerelease(Rf.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:n,code:o}=await En(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!n.trim()){r.succeed("Up to date");return}let i=n.trim(),s=Rf.default.version;if(!lo.valid(i)||!lo.valid(s)){r.succeed("Up to date");return}if(!lo.gt(i,s)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||V()){u.info(`${xe} A new version of @webflow/webflow-cli@${t} is available.`);let{code:f}=await En("npm ls @webflow/webflow-cli --json"),g=(f===0?"local":"global")==="global"?" --global":"";u.info(`${rt} To update, run: `+z(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`)+`
75
- `);return}let{code:l}=await En("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await $e({message:`A new version of @webflow/webflow-cli@${t} is available.
76
- Would you like to update it?`,default:!1})){r=u.spinner("Updating");let f=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${f} @webflow/webflow-cli@${t}`),r.succeed("Updated successfully")}catch{let g=c==="global"?` ${this.packageManager.globalFlag}`:"";r.fail("Update failed. Manually run: "+z(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let n=await this.getOutdatedPackages();if(!(Object.keys(n).length>0)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||V()){this.showUpdateSuggestions(n);return}let s=await this.showUpdatePrompt(n);if(s.length>0){r=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,g)=>(m[n[g].installationType==="global"?"global":"local"].push(g),m),{local:[],global:[]}),{update:c,globalFlag:p,updateCommand:f}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${p} ${l.map(m=>`${m}@latest`).join(" ")}`),r.succeed("Updated successfully")}catch{r.fail("Update failed. Manually run: "+z(`${f} ${s.map(g=>`${g}@latest`).join(" ")}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}};we();Dn();qr();Df();wf();Oe();Z();Y();we();Pe();R();C();j();me();Dn();var be=require("commander");C();R();function dt(e){let t=Object.fromEntries(e.map(r=>[r.toLowerCase(),r]));return r=>{let n=[],o=[];for(let i of r){let s=t[i.toLowerCase()];s?n.push(s):o.push(i)}return{valid:n,invalid:o}}}function Fe(e,t,r){let n=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(n);if(o.length===0)throw new d(`No valid fields specified. Available: ${r.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${r.join(", ")}`),o}me();R();var wk=(e,t)=>e+" ".repeat(Math.max(0,t-bt(e).length));function ze(e,t){let r=e.map((s,a)=>Math.max(bt(s).length,...t.map(l=>bt(String(l[a])).length))),n=r.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>wk(s,r[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>wk(String(a),r[l]+2)).join("")).join(`
68
+ `)}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=this.hasCustomWorkerEntry();Hr(t,r,"vite.config",["mjs","cjs","js","ts"])===null&&(t.info("no user vite.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.vite.config.ts stub"),ir.writeFileSync(Bt.join(r,"clouduser.vite.config.ts"),`export default {};
69
+ `));let s=Bt.join(Kd,"vite.config.webflow.ts");Ct(s)&&(t.info("Copying vite.config.webflow.ts..."),ir.copyFileSync(s,Bt.join(r,"vite.config.webflow.ts")));let a=Bt.join(Kd,"vite.config.ts.template"),l=Bt.join(r,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await Wr(t,a,l,{...process.env,...n}),o||this.ensureWorkerEntry()}getBuildCommand(){return"vite build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("vite")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"./src/worker.ts",deploymentType:"ssr-spa-combo",usesAssetsBinding:!0}}}});function kj(e,t){if(!t.includes("*"))return e===t;let r=t.split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${r}$`).test(e)}function Ol(e){return e===".well-known"?!1:e.startsWith(".")||$l.includes(e)?!0:Vh.some(t=>kj(e,t))}function Ll(e){let t=[],r=(n,o)=>{let i;try{i=g_.readdirSync(n,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){Ol(s.name)||r(Pl.join(n,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||vj.has(s.name))&&t.push(a)}};return r(e,""),t}var g_,Pl,bj,$l,Vh,Dj,Ej,vj,vr,zd=x(()=>{"use strict";g_=w(require("fs")),Pl=w(require("path"));wn();Vr();bj=wt(Pl.join(__dirname,"templates","static"),Pl.join(__dirname,"templates")),$l=["_headers","_redirects"],Vh=["node_modules","package.json","package-lock.json","yarn.lock","pnpm-lock.yaml","webflow.json","webflow.jsonc","wrangler.json","wrangler.jsonc","wrangler.toml","clouduser.wrangler.json","clouduser","terraform.tfstate","terraform.tfstate.*","*.tfvars","auth.json","*.pem","*.key","*.pfx","*.p12","id_rsa","id_rsa.*","id_dsa","id_ecdsa","id_ed25519"];Dj=["requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","composer.json","composer.lock","auth.json","Gemfile","Gemfile.lock","config.ru","go.mod","go.sum","Cargo.toml","Cargo.lock","pom.xml","build.gradle","build.gradle.kts","deno.json","deno.jsonc","bun.lockb","mix.exs","Dockerfile","Procfile"],Ej=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],vj=new Set([...Dj,...Ej]);vr=class extends mt{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,r){return r?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Ll(this.cwd);t.length>0&&this.log.warn(`static app declared, but build/runtime files are present (${t.join(", ")}); they will be published as static assets unless removed`),this.log.info("Static app: no framework, no dependencies, no build \u2014 nothing to validate")}async installDependencies(){}async prepareConfig(){}getBuildCommand(){return""}getCloudflareAdapter(){return null}getRequiredIntegrations(){return[]}getWebflowLoader(){return null}getNodeVersionRequirement(){return null}getWranglerTemplatePath(){return Pl.join(bj,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}}});var h_=x(()=>{"use strict"});function qd(e,t){for(let r of b_){let n=r.detect(e,t);if(n.detected)return{Builder:r,result:n}}return null}function Gh(e,t){let r=qd(e.packageJson,t);if(!r)throw new yn("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Nl.join(", ")})`});return e.log.info(`Detected framework: ${r.result.reason}`),new r.Builder(e)}function k_(e){let{hasPackageJson:t,specifiedFramework:r,hasRootIndexHtmlFile:n,hasRuntimeIndicators:o}=e;if(r==="static")return!0;let i=r!=null&&r!=="static";return!t&&!i&&n&&!o}function jl(e,t,r){let n=r?.cloud?.framework,i=y_.lstatSync(w_.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Ll(e),a=k_({hasPackageJson:t!=null,specifiedFramework:n,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&n==null)throw new yn(`Found index.html but also build/runtime indicators (${s.join(", ")}); this is not a no-framework static app and will not be published as static assets.`,{remediation:'Remove those files, or declare a framework in webflow.json (e.g. { "cloud": { "framework": "static" } } to force static).'});return{isStatic:a}}var y_,w_,b_,Nl,Kh=x(()=>{"use strict";y_=w(require("fs")),w_=w(require("path"));Mt();Vd();Gd();Jd();zd();Vd();Gd();Jd();zd();wn();h_();Mt();b_=[js,wi,yi,Bs,Us,vr],Nl=["astro","nextjs","vite","static"]});var D_=x(()=>{"use strict";Kh();wn();Vd();Gd();Jd();zd();Mt()});function Yd(e,t,r,n){let o=E_.join(t,"webflow.json"),i={cloud:{}};if(Ws.existsSync(o))try{let a=Ws.readFileSync(o,"utf8"),l=JSON.parse(a),c=Wd.safeParse(l);if(c.success)i=c.data;else{let p=c.error.issues.map(f=>`${f.path.join(".")}: ${f.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${p}`),i=l}i.cloud||(e.warn('webflow.json is missing "cloud" property, adding it'),i.cloud={})}catch(a){e.warn(`Failed to parse existing webflow.json, overwriting: ${a}`)}let s=i.cloud;if(s.framework=r,n){let a=n.getOutputDeployMetadata();s.contract_version="1",s.deployment_type=a.deploymentType,a.deploymentType!=="static"&&(s.entrypoint_path=a.dryRunEntryPath??"./index.js"),s.skip_no_bundle=a.skipNoBundle===!0;let l=n.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,v_.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${r}`),Ws.writeFileSync(o,JSON.stringify(i,null,2))}function S_(e,t){let r=Ls(e,t);if(r?.cloud?.framework)return r.cloud.framework;let n=Al(t),{isStatic:o}=jl(t,n,r);if(o)return e.info("Detected static app (no framework, no build)"),Yd(e,t,vr.frameworkName),vr.frameworkName;if(!n)throw new yn("Cannot detect framework: no package.json found",{remediation:'Run this command from your project root, or add a webflow.json with: { "cloud": { "framework": "<name>" } }'});e.info("webflow.json has no framework \u2014 detecting from package.json...");let i=qd(n,r);if(!i)throw new yn("Could not detect framework from package.json or webflow.json",{remediation:'Add a webflow.json with: { "cloud": { "framework": "<name>" } } (supported: astro, nextjs, vite)'});let s=i.Builder.frameworkName;return e.info(`Detected framework: ${i.result.reason}`),Yd(e,t,s),s}var Ws,E_,v_,x_=x(()=>{"use strict";Ws=w(require("fs")),E_=w(require("path")),v_=require("@webflow/cosmic-deploy-contract");Kh();Mt();Nh();jh();Vr();D_();Vr()});var Ml=x(()=>{"use strict";x_()});function __(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
70
+ `)}function A_(e,t="wrangler.json"){let r=Sr.join(e,t);if(!gt.existsSync(r)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),A_(e,t+"c");u.warn(`/${t} not found`);return}let n=gt.readFileSync(r,"utf8");u.info(`reading /${t}...`);let o;try{o=mi(n)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=C_.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
71
+ ${__(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function F_(e,t){let r=null,n=null,o=Sr.join(t,"wrangler.json"),i=Sr.join(t,"wrangler.jsonc");gt.existsSync(o)?(r=o,n=".json"):gt.existsSync(i)&&(r=i,n=".jsonc"),r&&n&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${n}...`),gt.copyFileSync(r,Sr.join(t,`clouduser.wrangler${n}`)));let s=r?A_(t,Sr.basename(r)):null,a=e.getWranglerTemplatePath(),l=Sr.join(t,"wrangler.json");if(!gt.existsSync(a))throw new Error(`Wrangler template not found at ${a}. Make sure the template is properly copied during build.`);if(u.info(`copying wrangler template for ${e.info.name} to /wrangler.json`),gt.copyFileSync(a,l),!s)return;let c=JSON.parse(gt.readFileSync(l,"utf8"));if(s.kv_namespaces&&s.kv_namespaces.length>0&&(c.kv_namespaces=s.kv_namespaces,u.info(`merged ${s.kv_namespaces.length} KV namespace(s) into template`)),s.r2_buckets&&s.r2_buckets.length>0&&(c.r2_buckets=s.r2_buckets,u.info(`merged ${s.r2_buckets.length} R2 bucket(s) into template`)),s.d1_databases&&s.d1_databases.length>0&&(c.d1_databases=s.d1_databases,u.info(`merged ${s.d1_databases.length} D1 database(s) into template`)),gt.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let p in s.d1_databases){let f=s.d1_databases[p];if(!f.migrations_dir){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir is not defined`);continue}let m=f.migrations_dir,g=Sr.join(t,m);if(!gt.existsSync(g)){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let h=Sr.join(t,"clouduser","migrations",m),y=ro(u,g,h);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) is empty`)}}function Sj(e){if(!/^[a-z0-9-]+$/.test(e))throw new Error(`Invalid object storage bucket name ${JSON.stringify(e)}: Only lowercase letters, numbers, and hyphens are allowed.`);if(e.startsWith("-")||e.endsWith("-"))throw new Error(`Invalid object storage bucket name "${e}": Cannot begin or end with a hyphen.`);if(e.length>27)throw new Error(`Invalid object storage bucket name "${e}": Must be 27 characters or fewer (currently ${e.length} characters).`)}function I_(e){let t=null;for(let s of[".json",".jsonc"]){let a=Sr.join(e,`clouduser.wrangler${s}`);if(gt.existsSync(a)){t=a;break}}if(!t)return;let r=gt.readFileSync(t,"utf8"),n;try{n=mi(r)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=C_.safeParse(n);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
72
+ ${__(o.error)}`);let i=o.data;if(i.r2_buckets&&i.r2_buckets.length>0){u.info(`validating ${i.r2_buckets.length} object storage bucket name(s)...`);for(let s of i.r2_buckets)Sj(s.bucket_name)}}var gt,Sr,C_,R_=x(()=>{"use strict";gt=w(require("fs")),Sr=w(require("path"));os();Md();Ml();F();C_=B.object({name:B.string(),main:B.string().optional(),compatibility_date:B.string(),compatibility_flags:B.array(B.string()).optional(),placement:B.object({mode:B.string()}).passthrough().optional(),assets:B.object({directory:B.string(),binding:B.string().optional()}).passthrough().optional(),d1_databases:B.array(B.object({database_name:B.string(),database_id:B.string(),binding:B.string(),migrations_dir:B.string().optional()}).passthrough()).default([]),kv_namespaces:B.array(B.object({binding:B.string(),id:B.string()}).passthrough()).default([]),r2_buckets:B.array(B.object({binding:B.string(),bucket_name:B.string()}).passthrough()).default([])}).passthrough()});var bn,T_=x(()=>{"use strict";bn={LEGACY:"legacy",V2:"v2"}});function $_(e,t,r){if(!r)return t;let n=`${t}/${r}`,o=P_.join(e,n);return Xd.existsSync(o)&&Xd.statSync(o).isDirectory()?n:t}var Xd,P_,O_=x(()=>{"use strict";Xd=w(require("fs")),P_=w(require("path"))});var L_={};Fp(L_,{detectBuilderV2:()=>xj});async function xj(e=process.cwd(),t,r,n){let o=(0,ht.loadPackageJson)(e),i=(0,ht.loadWebflowJson)(u,e),s={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:Jh(r)}:{}},a={cwd:e,log:{debug:c=>u.debug(c),info:c=>u.info(c),warn:c=>u.warn(c),error:c=>u.error(c)},runCommand:ht.nodeCommandRunner,telemetry:ht.noopTelemetry,fs:ht.nodeFileSystem,packageJson:o??{},userEnv:s},{isStatic:l}=(0,ht.detectStaticApp)(e,o,i);if(l)return new ht.StaticBuilder(a);if(!o)throw new Error("No package.json file found");return(0,ht.detectAndCreateBuilder)(a,i)}var ht,N_=x(()=>{"use strict";ht=require("@webflow/app");F();zh()});function B_(e){let t=process.env.COSMIC_BUILD_ENGINE;return t===bn.V2||t===bn.LEGACY?t:e===bn.V2||e===bn.LEGACY?e:bn.LEGACY}function _j(e){return e===bn.V2?"@webflow/app@0.1.0-beta.6":bn.LEGACY}function kn(e,t){let r=Math.min(Zd,process.stdout.columns??Zd),n=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,r-n.length));u.info(`
73
+ ${se(`${n}${o}`)}`)}function qh(e,t){let r=Math.min(Zd,process.stdout.columns??Zd),n=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,r-n.length));u.info(`
74
+ ${se(It(`${n}${o}`))}`)}async function U_(e=process.cwd(),t,r,n,o){if(B_(o)===bn.V2){let{detectBuilderV2:p}=await Promise.resolve().then(()=>(N_(),L_));return p(e,t,r,n)}let i=Al(e),s=Ls(u,e),a={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:Jh(r)}:{}},l={cwd:e,log:u,packageJson:i??{},userEnv:a},{isStatic:c}=jl(e,i,s);if(c)return new vr(l);if(!i)throw new Error("No package.json file found");return Gh(l,s)}async function W_(e,t={}){let r=t.projectPath||process.cwd(),n=Date.now(),o=fe.join(r,".tmp",`webflow-build-${n}`),i=t.outputDir||fe.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=Yh(r),c=t.telemetry,p=e.getBuildCommand(),f=e.getOutputDeployMetadata(),m=f.deploymentType==="static",g=B_(t.serverBuildEngine);await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),ie.mkdirSync(o,{recursive:!0});try{u.info(`Build engine: ${se(_j(g))}`),kn("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${f.deploymentType}`);let h=e.getNodeVersionRequirement();h&&to(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),kn("\u2699\uFE0F ","Configure wrangler"),await F_(e,r),u.info("Preparing framework configuration..."),await e.prepareConfig()),Yd(u,r,e.info.name,e),m||(kn("\u{1F4E6}","Install dependencies"),await Aj(r,e.info.name,t.telemetry),I_(r),kn("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await Fj(r,p,t.telemetry),await e.postBuild(),kn("\u{1F9EA}","Wrangler dry-run"),await Ij(r,i)),kn("\u{1F4C1}","Copy assets"),await Tj(r,i,e,s),kn("\u{1F381}","Create tarball");let y=await Pj(i),k=Date.now()-a;return u.info(`${$} Build completed in ${(k/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:k,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),y}catch(h){let y=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:y,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function Yh(e){let t=fe.join(e,"wrangler.json");if(!ie.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let r=JSON.parse(ie.readFileSync(t,"utf8")),n=r.kv_namespaces||[],o=r.d1_databases||[],i=r.r2_buckets||[],s=r.vars||{};return{hasKV:n.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:n.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(r){return console.debug("Failed to parse wrangler.json for bindings detection:",r),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function H_(e){try{let t=fe.dirname(e);t.includes(".tmp/webflow-build-")&&(kn("\u{1F9F9}","Clean up build artifacts"),ie.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function V_(e,t){try{kn("\u{1F9F9}","Revert framework configuration");let r=t.getUserConfigPatterns(),n=new Set;for(let s of r){let a=fe.extname(s).slice(1),l=fe.basename(s,`.${a}`);if(!n.has(l)){n.add(l);for(let c of["mjs","cjs","js","ts"]){let p=fe.join(e,`clouduser.${l}.${c}`),f=fe.join(e,`${l}.${c}`);if(ie.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),ie.existsSync(f)&&ie.unlinkSync(f),ie.renameSync(p,f);break}}}}for(let s of[".jsonc",".json"]){let a=fe.join(e,`clouduser.wrangler${s}`);if(ie.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=fe.join(e,"wrangler.json");ie.existsSync(l)&&ie.unlinkSync(l);let c=fe.join(e,`wrangler${s}`);ie.renameSync(a,c);break}}let o=fe.join(e,"clouduser");ie.existsSync(o)&&(u.info("cleaning up clouduser directory..."),ie.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=fe.join(e,fe.basename(s));ie.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),ie.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=fe.join(e,i.destinationName);ie.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),ie.unlinkSync(s))}}catch(r){u.warn(`Warning: Failed to cleanup framework configuration: ${r}`)}}async function Aj(e,t,r){let n=Date.now(),o=["--no-update-notifier","--no-progress"],i=fe.join(e,"package-lock.json");try{ie.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,Bl.execSync)(`npm ci --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"})):(u.info("Warning: No package-lock.json found, installing dependencies with npm install --include=dev"),(0,Bl.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-n;await r?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:ie.existsSync(i)})}catch(s){let a=Date.now()-n;throw await r?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:ie.existsSync(i)}),s}}function Jh(e){let t="production",r;switch(t){case"development":r="wf-app-dev";break;case"acceptance":r="wf-app-acceptance";break;default:r="wf-app-prod"}return`https://${e}.${r}.cosmic.webflow.services`}async function Fj(e,t,r){let n=Date.now();try{(0,Bl.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-n;await r?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-n;throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"cloud_build_command_failure",{duration:i,buildCommand:t}),new Error(`Build command failed: ${t}`)}}async function Ij(e,t){ie.mkdirSync(t,{recursive:!0});let r=fe.join(e,"wrangler.json"),n=fe.join(e,"wrangler.jsonc");if(!ie.existsSync(r)&&!ie.existsSync(n))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,Bl.execSync)(`npx wrangler@${Cj} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function j_(e,t){let r=fe.join(e,"webflow.json");ie.existsSync(r)?(u.info("including webflow.json in output..."),ie.copyFileSync(r,fe.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function Rj(e,t,r){let n=r.replace(/\/+$/,"").replace(/^\/+/,""),o=fe.join(t,"assets"),i=fe.join(o,n||"");ie.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${n}...`);for(let s of ie.readdirSync(e))ro(u,fe.join(e,s),fe.join(i,s),{excludeFn:Ol,followSymlinks:!1});for(let s of $l){let a=fe.join(e,s);ie.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),ie.copyFileSync(a,fe.join(o,s)))}}async function Tj(e,t,r,n){let o=r.getOutputDeployMetadata();if(o.deploymentType==="static"){Rj(e,t,n),j_(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=n.replace(/\/+$/,"").replace(/^\/+/,"");a?i=$_(e,i,l):i=Mh(e,i,l,r.info.name,s);let c=fe.join(t,"assets",l||"");ie.mkdirSync(c,{recursive:!0});let p=fe.join(e,i);if(ie.existsSync(p)&&ie.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),ro(u,p,c,{exclude:s})):ro(u,p,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");j_(e,t);let f=null;for(let m of[".json",".jsonc"]){let g=fe.join(e,`clouduser.wrangler${m}`);if(ie.existsSync(g)){f=g;break}}if(f){u.info("including user wrangler config in output..."),ie.copyFileSync(f,fe.join(t,"clouduser.wrangler.json"));let m=fe.join(e,"clouduser","migrations");if(ie.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let g=fe.join(t,"migrations");ro(u,m,g)}}}async function Pj(e){let t=`${e}.tar.gz`;try{return await M_.create({gzip:!0,file:t,cwd:fe.dirname(e)},[fe.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(r){throw new d(r,{prefix:"Failed to create tarball:"})}}var ie,fe,Bl,M_,Cj,Zd,zh=x(()=>{"use strict";ie=w(require("fs")),fe=w(require("path")),Bl=require("child_process"),M_=w(require("tar"));R_();F();C();N();ge();Ml();T_();O_();Cj="4.82.1",Zd=60});var Rw=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function WI(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.code==="DEP0040"&&typeof t.message=="string"&&t.message.includes("punycode")}function HI(e=process){if(e[Rw])return;e[Rw]=!0;let t=e.emit;e.emit=function(n,...o){return n==="warning"&&WI(o[0])?!1:t.call(this,n,...o)}}HI();var PI=w(require("fs")),$I=require("commander");var II=require("commander");ge();F();var fk=require("child_process"),mk=require("fs"),Mf=w(require("semver"));F();var Bf="@webflow/webflow-cli",go="@webflow/data-types",yc="@webflow/react",uT=[Bf,go,yc],ho=class{getInstalledDependencies(){try{let t=(0,fk.execSync)(`npm ls ${uT.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),r=JSON.parse(t);return r.dependencies?Object.entries(r.dependencies).reduce((n,[o,{version:i}])=>(n[o]=i,n),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let r=JSON.parse((0,mk.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...r.dependencies,...r.devDependencies}}checkCLIAndDataTypes(t){let r=t[go];if(!r)return;let o=this.getRequiredDependencies(Bf)[go];if(!Mf.default.satisfies(r,o))throw new Error(`Version mismatch: ${Bf} requires ${go} v${o} but found v${r}`)}checkReactAndDataTypes(t){let r=t[go],n=t[yc];if(!(!r||!n)&&!Mf.default.eq(r,n))throw new Error(`Version mismatch: ${yc} and ${go} must be on the same version. Found ${yc}@${n} and ${go}@${r}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var vk=require("fs-extra");Fe();var Sk=require("@dotenvx/dotenvx"),yo=w(require("semver"));F();var kk=require("child_process"),Dk=require("util"),wT=(0,Dk.promisify)(kk.exec);async function Fn(e,t){try{let{stdout:r,stderr:n}=await wT(e,t);return{stdout:r.toString().trim(),stderr:n.toString().trim(),code:0}}catch(r){let n=r;return{stdout:n.stdout??"",stderr:n.stderr??String(n.message??""),code:n.code??1}}}he();var Hf=w(fc());N();ge();(0,Sk.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var Ek={npm:{updateCommand:"npm install",update:async e=>await Fn(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await Fn(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await Fn(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await Fn(`pnpm outdated --json ${e}`);return JSON.parse(t)},lockFile:"pnpm-lock.yaml",globalFlag:"--global",supported:!0},yarn:{lockFile:"yarn.lock",globalFlag:"",updateCommand:"",getOutdated:async()=>({}),update:async()=>({stdout:"",stderr:"",code:0}),supported:!1}},bT=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],va=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(Ek))if((0,vk.existsSync)(t.lockFile))return t;return Ek.npm}async listOutdatedPackages(t="local",r=bT){let{getOutdated:n,globalFlag:o}=this.packageManager,i=await n(`${t==="global"?o:""} ${r?.join(" ")}`);return Object.fromEntries(Object.entries(i).map(([s,a])=>Array.isArray(a)?[s,{current:a[0].current,latest:a[0].latest,installationType:t}]:[s,{current:a.current,latest:a.latest,installationType:t}]))}async getOutdatedPackages(){let t=await this.listOutdatedPackages();if(t["@webflow/webflow-cli"])return t;let r=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...r}}async showUpdatePrompt(t){let r={name:"Update all packages",value:"update-all"},n=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${nt} ${a})`,value:i})),o=await Fr({message:`New versions of the following ${je("@webflow")} packages are available. Would you like to update them?`,choices:[r,...n]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:r,globalFlag:n}=this.packageManager;u.info(`${xe} New versions of the following ${je("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(P(` ${mc} ${s} (${a} ${nt} ${l})`))});let o=Object.entries(t).filter(([,{installationType:s}])=>s==="local").map(([s])=>`${s}@latest`),i=Object.entries(t).filter(([,{installationType:s}])=>s==="global").map(([s])=>`${s}@latest`);u.info(`
75
+ ${nt} To update, run:`),o.length>0&&u.info(q(` ${r} ${o.join(" ")}`)),i.length>0&&u.info(q(` ${r} ${n} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=yo.prerelease(Hf.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:n,code:o}=await Fn(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!n.trim()){r.succeed("Up to date");return}let i=n.trim(),s=Hf.default.version;if(!yo.valid(i)||!yo.valid(s)){r.succeed("Up to date");return}if(!yo.gt(i,s)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||W()){u.info(`${xe} A new version of @webflow/webflow-cli@${t} is available.`);let{code:f}=await Fn("npm ls @webflow/webflow-cli --json"),g=(f===0?"local":"global")==="global"?" --global":"";u.info(`${nt} To update, run: `+q(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`)+`
76
+ `);return}let{code:l}=await Fn("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await Ce({message:`A new version of @webflow/webflow-cli@${t} is available.
77
+ Would you like to update it?`,default:!1})){r=u.spinner("Updating");let f=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${f} @webflow/webflow-cli@${t}`),r.succeed("Updated successfully")}catch{let g=c==="global"?` ${this.packageManager.globalFlag}`:"";r.fail("Update failed. Manually run: "+q(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let n=await this.getOutdatedPackages();if(!(Object.keys(n).length>0)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||W()){this.showUpdateSuggestions(n);return}let s=await this.showUpdatePrompt(n);if(s.length>0){r=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,g)=>(m[n[g].installationType==="global"?"global":"local"].push(g),m),{local:[],global:[]}),{update:c,globalFlag:p,updateCommand:f}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${p} ${l.map(m=>`${m}@latest`).join(" ")}`),r.succeed("Updated successfully")}catch{r.fail("Update failed. Manually run: "+q(`${f} ${s.map(g=>`${g}@latest`).join(" ")}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}};he();An();en();$f();Rf();Fe();X();z();var gm=w(require("fs")),hm=w(require("path"));F();var vo=w(require("fs")),Eo=w(require("path")),Sc=w(require("tar"));C();F();var Qf=w(require("fs")),$n=w(require("path"));C();var _T=[/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,/\x1b[P^_][\s\S]*?\x1b\\/g,/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,/\x1b[\x20-\x7e]/g,/[\x80-\x9f]/g,/[\x00-\x08\x0b-\x1f\x7f]/g,/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g],AT=/[\r\n\u2028\u2029]+/g;function Ca(e){if(e==null)return"";let t=String(e);for(let r of _T)t=t.replace(r,"");return t}function b(e){return Ca(e).replace(AT," ").trim()}var Bk={impl:$n.default.posix,caseInsensitive:!1},em={impl:$n.default.win32,caseInsensitive:!0};function Do(){let e=process.platform;return e==="win32"?em:{impl:$n.default.posix,caseInsensitive:e==="darwin"}}function Ec(e,t){let r=t.impl.resolve(e);return t.caseInsensitive?r.toLowerCase():r}function On(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function ot(e,t,r=Do()){if(On(e)||On(t))return!1;let n=Ec(e,r),o=Ec(t,r);if(n===o)return!0;let i=r.impl.relative(n,o);return i===""?!0:r.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function vc(e,t,r=Do()){if(On(e)||On(t))return!1;let[n,o]=await Promise.all([fr(e),fr(t)]);return ot(n,o,r)}function Be(e,t,r,n=Do()){if(!ot(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside.
78
+ expected inside: ${b(e)}
79
+ resolved to: ${b(t)}
80
+ Please report this.`)}async function Ui(e,t,r,n=Do()){if(!await vc(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside once symlinks are followed.
81
+ expected inside: ${b(e)}
82
+ resolved to: ${b(t)}
83
+ Please report this.`)}function FT(e,t,r=Do()){return ot(e,t,r)||ot(t,e,r)}async function tm(e,t,r=Do()){if(On(e)||On(t))return!1;let[n,o]=await Promise.all([fr(e),fr(t)]);return FT(n,o,r)}function Xe(e,t,r=Do()){return typeof e!="string"||typeof t!="string"||On(e)||On(t)?!1:Ec(e,r)===Ec(t,r)}async function fr(e){let t=$n.default.resolve(e);try{return await Qf.default.promises.realpath(t)}catch{}try{let r=await Qf.default.promises.realpath($n.default.dirname(t));return $n.default.join(r,$n.default.basename(t))}catch{return t}}var IT=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function Wi(e){if(!e)return"empty entry path";if(e.includes("\0"))return"NUL byte in entry path";if(/[\x01-\x1f\x7f]/.test(e))return"control character in entry path";if(e.startsWith("/")||e.startsWith("\\"))return"absolute entry path";if(/^[A-Za-z]:/.test(e))return"Windows drive-relative entry path";if(e.includes("\\"))return"backslash in entry path";for(let t of e.split("/")){if(t===""||t==="."){if(t===".")return'traversal segment "." in entry path';continue}if(t==="..")return'traversal segment ".." in entry path';if(/[. ]$/.test(t))return"entry path segment ends with a dot or space";if(IT.test(t))return"Windows reserved device name in entry path"}return null}var om=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),RT=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),TT=32,PT=512,rm=10,Hk=100,Uk=100;function Vk(){return{retained:[],fatal:[],fatalCount:0,count:0}}function Gk(e,t,r){e.count+=1;let n={code:t,message:Ca(r)};e.retained.length<Uk&&e.retained.push(n),RT.has(t)&&(e.fatalCount+=1,e.fatal.length<Uk&&e.fatal.push(n))}async function Kk(e,t,r){let n=await $T(r.containmentRoot),o=await OT(n,t),i=await Wk(e),s=await NT(e,r),a=await MT(e,o,r);if(a.warnings.fatal.length>0)throw Zk(a.warnings.fatal,a.warnings.fatalCount);for(let c of a.warnings.retained)u.debug(`tar warning ${c.code}: ${c.message}`);if(a.refused.length>0)throw WT(a.refused,a.refusedCount);let l=await Wk(e);if(i!==l)throw new d("Refusing to continue: the downloaded archive changed while it was being read, so what was validated is not what was extracted. Nothing about the extracted directory can be trusted. Please retry.");return await BT(n,o),{skipped:s.skipped,fileCount:a.fileCount,unpackedBytes:a.unpackedBytes,warnings:[...s.warnings.retained,...a.warnings.retained],warningCount:s.warnings.count+a.warnings.count}}async function Wk(e){try{let t=await vo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new d(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function $T(e){try{return await vo.default.promises.realpath(Eo.default.resolve(e))}catch(t){throw new d(`Refusing to extract: the directory the extraction must stay inside ("${b(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function OT(e,t){let r=Eo.default.resolve(t);Be(e,r,"the extraction directory");let o=Eo.default.relative(e,r).split(Eo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Eo.default.join(i,s);let a=await LT(i);if(a===null){await vo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new d(`Refusing to extract: "${b(i)}" is a symbolic link, and extracting into it would write the archive somewhere other than where it was checked. Remove or replace it with a real directory and retry.`);if(!a.isDirectory())throw new d(`Refusing to extract: "${b(i)}" exists and is not a directory.`)}return r}async function LT(e){try{return await vo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new d(`Could not inspect "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function NT(e,t){let r=Jk(t.limits),n=Yk(t.consumedSubtrees),o=[],i=[],s=Vk(),a=0,l=0,c=0,p=!1,f=!1,m=(g,h)=>{c+=1,o.length<Hk&&o.push({entryPath:g,reason:h})};try{await Sc.list({file:e,onReadEntry:g=>{let h=g.path,y=g.type;if(zk(y)||(a+=1,a>r.maxFiles&&!p&&(p=!0,m(h,`archive has more than ${r.maxFiles} files`))),!om.has(y)){let _=`unsupported entry type ${y}`;n(h)?m(h,_):p||i.push({entryPath:h,reason:_});return}let k=Wi(h)??qk(h,r);if(k){m(h,k);return}let v=g.size;v>r.maxEntryBytes&&m(h,`entry is ${Hi(v)}, over the ${Hi(r.maxEntryBytes)} per-file cap`),l+=v,l>r.maxUnpackedBytes&&!f&&(f=!0,m(h,`unpacked total passes the ${Hi(r.maxUnpackedBytes)} cap`))},onwarn:(g,h)=>{Gk(s,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not read the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}if(o.length>0)throw UT(o,c);if(s.fatal.length>0)throw Zk(s.fatal,s.fatalCount);for(let g of i)u.debug(`Skipped archive entry "${b(g.entryPath)}": ${g.reason}`);return{skipped:i,warnings:s}}function jT(e,t,r,n){if(!om.has(t))return`unsupported entry type ${t}`;let o=Wi(e)??qk(e,n);return o||(r>n.maxEntryBytes?`entry is ${Hi(r)}, over the ${Hi(n.maxEntryBytes)} per-file cap`:null)}async function MT(e,t,r){let n=Jk(r.limits),o=Yk(r.consumedSubtrees),i=Vk(),s=[],a=0,l=0,c=0,p=(g,h)=>(a+=1,s.length<Hk&&s.push({entryPath:g,reason:h}),!1),f=()=>!1,m=(g,h)=>{let y="type"in h?h.type:h.isDirectory()?"Directory":"File",k=h.size;if(!om.has(y)&&!o(g))return f();let v=jT(g,y,k,n);if(v)return p(g,v);if(c+k>n.maxUnpackedBytes)return p(g,`unpacked total passes the ${Hi(n.maxUnpackedBytes)} cap`);if(!zk(y)){if(l+1>n.maxFiles)return p(g,`archive has more than ${n.maxFiles} files`);l+=1}return c+=k,!0};try{await Sc.extract({file:e,cwd:t,strip:r.strip??0,preservePaths:!1,filter:m,onwarn:(g,h)=>{Gk(i,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not extract the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function BT(e,t){Be(e,await vo.default.promises.realpath(t),"the extracted directory");let r=[t];for(;r.length>0;){let n=r.pop(),o=await vo.default.promises.readdir(n,{withFileTypes:!0});for(let i of o){let s=Eo.default.join(n,i.name);if(!i.isFile()&&!i.isDirectory())throw new d(`Refusing to continue: extraction produced a non-regular entry at "${b(s)}". Please report this.`);Be(e,s,"an extracted archive entry"),i.isDirectory()&&r.push(s)}}}function Jk(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??TT,maxPathLength:e.maxPathLength??PT}}function zk(e){return e==="Directory"||e==="GNUDumpDir"}function nm(e){return e.replace(/\/+$/,"")}function qk(e,t){let r=nm(e);if(r.length>t.maxPathLength)return`entry path is ${r.length} characters, over the ${t.maxPathLength}-character limit`;let n=r.split("/").filter(o=>o!=="").length;return n>t.maxPathDepth?`entry path is ${n} levels deep, over the ${t.maxPathDepth}-level limit`:null}function Yk(e){let t=e.map(nm);return r=>{let n=nm(r).split("/").slice(1).join("/");return t.some(o=>n===o||n.startsWith(`${o}/`))}}function Hi(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],r=e/1024,n=t[0];for(let o=1;o<t.length&&r>=1024;o+=1)r/=1024,n=t[o];return`${parseFloat(r.toFixed(1))} ${n}`}function UT(e,t){return new d(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
84
+ ${Xk(e,t).join(`
85
+ `)}
86
+ Nothing was extracted. Please report this.`)}function WT(e,t){return new d(`Refusing to continue: the downloaded archive changed while it was being read. ${t} ${t===1?"entry":"entries"} that passed validation would not have passed it on the second read.
87
+ ${Xk(e,t).join(`
88
+ `)}
89
+ The extracted directory cannot be trusted. Please retry.`)}function Xk(e,t){let r=e.slice(0,rm),n=r.map(i=>` - "${b(i.entryPath)}": ${i.reason}`),o=t-r.length;return o>0&&n.push(` \u2026 and ${o} more.`),n}function Zk(e,t){let r=e.slice(0,rm).map(o=>` - ${o.code}: ${o.message}`),n=t-Math.min(e.length,rm);return n>0&&r.push(` \u2026 and ${n} more.`),new d(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
90
+ ${r.join(`
91
+ `)}
92
+ This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var HT="webflow",im="webflow-skills",be=`${HT}/${im}`,Ge="main",xc=`plugins/${im}`,rn=`${xc}/.claude-plugin/plugin.json`,sm=[`${xc}/skills`,"skills"],Qk=[`${xc}/skills`,`${xc}/.claude-plugin`];function eD(e){return`${im}-${e}`}var Gt=/^[0-9a-f]{40}$/,Cc=/^[A-Za-z0-9._/-]{1,255}$/,VT=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function tD(e){let t=e.split(":",1)[0];return VT.includes(t)}var Tt="https://api.github.com",So="https://codeload.github.com";var rD="skills",_c="download-",Ac="extract-";var on=w(require("fs")),Rc=w(require("path"));Ii();C();F();C();function oD(e){let t=r=>Math.round(r*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function mr(e){try{return new URL(e).hostname}catch{return e}}function GT(e){return new d(`Could not find ref "${b(e)}" in ${be}.
93
+ \u2022 The default branch is "${Ge}".
94
+ \u2022 This repo has no tags or releases yet, so "--ref v1.0.7" will not resolve.
95
+ \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function KT(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let r=new Date(t*1e3);if(Number.isNaN(r.getTime()))return"a few minutes";let n=String(r.getHours()).padStart(2,"0"),o=String(r.getMinutes()).padStart(2,"0");return`${n}:${o} local time`}function JT(e){return new d(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
96
+ \u2022 Retry after ${KT(e)}.
97
+ \u2022 Or set GITHUB_TOKEN / GH_TOKEN in your environment to raise the limit to 5,000/hour.
98
+ \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function zT(){return new d(`GitHub refused the request (403). This is a permission error, not a rate limit.
99
+ \u2022 If you are behind a proxy that filters ${mr(Tt)}, set HTTPS_PROXY.
100
+ \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function qT(e,t){return new d(`${mr(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function YT(e,t,r){return new d(`${mr(e)} returned an unexpected ${t} ${b(r)} response. Please report this if it persists.`)}function Vi(e,t,r){let{status:n}=t;if(n===404)return GT(r??Ge);let o=t.headers.get("x-ratelimit-remaining");return n===429||n===403&&o==="0"?JT(t.headers.get("x-ratelimit-reset")):n===403?zT():n>=500?qT(e,n):YT(e,n,t.statusText)}function iD(e){let t=e?mr(e):"an unnamed host";return new d(`Refusing to follow a redirect to ${b(t)} while a GitHub token is attached, because the token would be re-sent to that host. Unset GITHUB_TOKEN / GH_TOKEN to retry unauthenticated, or report this if ${mr(Tt)} is genuinely redirecting.`,{isUserError:!0})}function nD(e,t){return new d(`Could not reach ${mr(e)}${t?` (${t})`:""}.
101
+ \u2022 Check your network connection.
102
+ \u2022 Behind a corporate proxy, set HTTPS_PROXY. Note that the CLI's HTTP client does not read proxy environment variables automatically.
103
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Fc(e,t){return new d(`Timed out after ${Math.round(t/1e3)}s waiting for ${mr(e)}.
104
+ \u2022 Check your network connection, then retry.
105
+ \u2022 Behind a corporate proxy, set HTTPS_PROXY.
106
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Ic(){return new d(`The skills catalog download exceeded ${oD(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function sD(e){return new d(`Commit ${b(e)} of ${be} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
107
+ \u2022 Retry without --ref to take the current "${Ge}".`,{isUserError:!0})}function aD(){return new d("The skills catalog download returned no response body. Please retry.")}function _a(e){return new d(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function lD(){return new d(`${mr(Tt)} answered the ref lookup with something that is not a 40-character commit SHA. Refusing to guess at what to install. Please report this if it persists.`)}function cD(){return new d(`${mr(Tt)} answered the ref lookup with more than ${oD(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
108
+ \u2022 If a proxy is intercepting ${mr(Tt)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function Gi(e){return new d(`Expected a full 40-character commit SHA but got "${b(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function nn(e,t){return new d(`Invalid --ref "${b(e)}": ${t}.
109
+ \u2022 Pass a branch name (e.g. "${Ge}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function uD(e,t){let r=t.length===0?"nothing":t.map(n=>`"${b(n)}"`).join(", ");return new d(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${r}. Please report this.`)}var XT=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function ZT(e){if(typeof e!="object"||e===null)return;let t=e;if(typeof t.code=="string")return t.code;if(typeof t.errno=="string")return t.errno}function Fa(e,t,r){if(r instanceof d)return r;let n=ZT(r);if(n==="ENOSPC"||n==="EDQUOT"||n==="EFBIG")return _a("writing the skills catalog");if(n&&XT.has(n))return nD(e,n);let o=r?.type;if(o==="request-timeout")return Fc(e,t);if(o==="max-size")return Ic();let i=r instanceof Error?r.message:String(r);return/network timeout|timed? ?out/i.test(i)?Fc(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?nD(e,""):new d(`Could not fetch the skills catalog from ${mr(e)}: ${b(i)}`)}function Ki(){return Rc.default.join(Xb(),rD)}function lm(e){if(!Gt.test(e))throw Gi(e);return Rc.default.join(Ki(),e)}async function Ia(){let e=Ki();try{return await on.default.promises.mkdir(e,{recursive:!0,mode:448}),await on.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?_a("creating the skills cache directory"):new d(`Could not create the skills cache directory "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function cm(e){let t=lm(e),r;try{r=await on.default.promises.lstat(t)}catch(n){return n.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${n instanceof Error?n.message:String(n)}`),null}if(r.isSymbolicLink())throw new d(`Refusing to use the skills cache: "${b(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return r.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var e0=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function t0(e){try{return(await on.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function um(e,t){let r=lm(e),n=Ki();await Ui(n,r,"the skills cache entry"),await Ui(n,t,"the extracted skills catalog being published");try{return await on.default.promises.rename(t,r),{dir:r,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw _a("publishing the skills catalog to the cache");if(i!==void 0&&e0.has(i)&&await t0(r))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:r,published:!1};throw new d(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function xo(e){await Ui(Ki(),e,"the skills cache path being removed");try{await on.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}function r0(e){return Gt.test(e)||e.startsWith(_c)||e.startsWith(Ac)}async function Tc(e){let t=Ki(),r;try{r=await on.default.promises.readdir(t,{withFileTypes:!0})}catch(o){o.code!=="ENOENT"&&u.debug(`Skills cache sweep skipped: ${o instanceof Error?o.message:String(o)}`);return}let n=Date.now()-6048e5;for(let o of r){if(o.name===e||!r0(o.name))continue;let i=Rc.default.join(t,o.name);try{if((await on.default.promises.lstat(i)).mtimeMs>=n)continue;await xo(i),u.debug(`Swept stale skills cache entry "${o.name}".`)}catch(s){u.debug(`Skills cache sweep could not handle "${o.name}": ${s instanceof Error?s.message:String(s)}`)}}}var fm=w(require("fs")),dm=w(require("path")),fD=require("stream"),mD=require("stream/promises");ct();F();var n0="catalog.tar.gz",Ra=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},Pc=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},pm=class extends fD.Transform{constructor(r){super();this.cap=r}bytes=0;_transform(r,n,o){let i=Buffer.isBuffer(r)?r:Buffer.from(r);if(this.bytes+=i.length,this.bytes>this.cap){o(new Pc);return}o(null,i)}};async function mm(e){if(!Gt.test(e))throw Gi(e);let t=await Ia(),r=await fm.default.promises.mkdtemp(dm.default.join(t,_c)),n=dm.default.join(r,n0),o=`${So}/${be}/tar.gz/${e}`;try{let i=await o0(o,e),s=await i0(i,n);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:n,downloadDir:r,bytes:s}}catch(i){throw await xo(r),Fa(So,6e4,i)}}async function o0(e,t){let r=0;for(let n=0;n<2;n+=1){let o=await K(e,{headers:{Accept:"application/x-gzip"},timeout:6e4});if(o.ok){let i=Number(o.headers.get("content-length"));if(Number.isFinite(i)&&i>33554432)throw Ic();return o}if(o.status>=500&&n===0){r=o.status,u.debug(`codeload.github.com returned ${o.status}; retrying once in ${1e3}ms.`),await new Promise(i=>{setTimeout(i,1e3)});continue}throw o.status===404?sD(t):Vi(So,o)}throw Vi(So,{status:r||500,statusText:"Server Error",headers:{get:()=>null}})}async function i0(e,t){let r=e.body;if(!r)throw aD();let n=new pm(33554432),o=setTimeout(()=>{r.destroy?.(new Ra),n.destroy(new Ra)},6e4);o.unref?.();try{await(0,mD.pipeline)(r,n,fm.default.createWriteStream(t,{mode:384}))}catch(i){throw pD(i,Pc)?Ic():pD(i,Ra)?Fc(So,6e4):i}finally{clearTimeout(o)}return n.bytes}function pD(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let r=e.cause;if(r instanceof t||r instanceof Error&&r.name===t.name)return!0}return!1}ct();F();var s0=["GITHUB_TOKEN","GH_TOKEN"];function a0(){for(let e of s0){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function l0(e){if(e==="")throw nn(e,"it is empty");if(!Cc.test(e))throw nn(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw nn(e,"it starts with '-'");if(e.includes(".."))throw nn(e,"it contains '..'");if(e.endsWith(".lock"))throw nn(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw nn(e,"it starts or ends with '/'");if(e.includes("//"))throw nn(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw nn(e,"a path component ends with '.'")}function c0(e){return e.split("/").map(encodeURIComponent).join("/")}function u0(e){return new Promise(t=>{setTimeout(t,e)})}async function $a(e=Ge){if(Gt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};l0(e);let t=a0(),r=`${Tt}/repos/${be}/commits/${c0(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let n=await d0(r,e,t),o=await f0(n);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function d0(e,t,r){let n=null;for(let o=0;o<2;o+=1){let i;try{i=await K(e,{headers:{Accept:"application/vnd.github.sha",...r?{Authorization:`Bearer ${r}`}:{}},timeout:1e4,...r?{redirect:"manual"}:{}})}catch(s){throw Fa(Tt,1e4,s)}if(r&&i.status>=300&&i.status<400)throw iD(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(n=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await u0(1e3);continue}throw Vi(Tt,i,t)}throw Vi(Tt,{status:n??500,statusText:"Server Error",headers:{get:()=>null}},t)}var Oc=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function p0(e){let t=e.body;if(!t)return"";let r=[],n=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(n+=i.length,n>4096)throw new Oc;r.push(i)}return Buffer.concat(r).toString("utf8")}async function f0(e){let t;try{t=await p0(e)}catch(n){throw n instanceof Oc?cD():Fa(Tt,1e4,n)}let r=t.trim();if(!Gt.test(r))throw lD();return r}async function Ji(e={}){let t=await m0(e),{commit:r,ref:n}=t,o=await cm(r);if(o)return u.debug(`Using cached skills catalog for ${r}.`),await Tc(r),{ref:n,commit:r,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await g0(r);return await Tc(r),{ref:n,commit:r,...i}}async function m0(e){if(e.commit!==void 0){if(!Gt.test(e.commit))throw Gi(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return $a(e.ref)}async function g0(e){let t=await Ia(),r=await mm(e),n=await gm.default.promises.mkdtemp(hm.default.join(t,Ac));try{let o=await Kk(r.tarPath,n,{strip:0,containmentRoot:t,consumedSubtrees:Qk,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await h0(n,e),{dir:s,published:a}=await um(e,i);return u.debug(`Extracted skills catalog ${e}: ${o.fileCount} files, ${o.unpackedBytes} bytes, ${o.skipped.length} entries skipped${a?"":" (another process published first)"}.`),{root:s,fromCache:!1,skippedEntries:o.skipped,downloadedBytes:r.bytes}}finally{await xo(n),await xo(r.downloadDir)}}async function h0(e,t){let r=eD(t),n=await gm.default.promises.readdir(e,{withFileTypes:!0}),o=n.filter(i=>i.isDirectory());if(n.length!==1||o.length!==1||o[0].name!==r)throw uD(r,n.map(i=>i.name));return hm.default.join(e,r)}var Co=`https://github.com/${be}/issues`,Pt="SKILL.md",Oa=new Set([".git","node_modules","__pycache__",".DS_Store"]),_o=new Set([".git","node_modules","__pycache__"]),Ao=new Set([".DS_Store","Thumbs.db"]),Fo=8,Lc=512,Nc=128,wD=1024,bD=32,kD=256,DD=64,ED=64,ym=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,vD=256,SD=4;var wm=w(require("fs")),zi=w(require("path"));C();async function qi(e){let t=zi.default.join(e,...rn.split("/"));Be(e,t,"the catalog plugin manifest");let r;try{r=await wm.default.promises.readFile(t,"utf8")}catch(i){if(!b0(i))throw new d(`Failed to read the catalog manifest at ${rn}: ${i instanceof Error?i.message:String(i)}`)}if(r===void 0)return{...await xD(e),version:"",source:"fallback"};let n=w0(r);if(n.skills===void 0)return{...await xD(e),version:n.version,source:"fallback"};let o=await y0(t,n.skills,e);if(!o)throw new d(`The catalog manifest at ${rn} declares its skills directory as "${b(n.skills)}", which does not exist in the downloaded catalog. This is a bug in ${be}. Please report it.`);return{version:n.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function y0(e,t,r){let n=zi.default.dirname(e),o=[{base:zi.default.dirname(n),relativeTo:"plugin root"},{base:n,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=zi.default.resolve(s.base,t);if(Be(r,a,"the catalog skills directory"),!!await CD(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${rn} declares "skills": "${b(t)}", which only resolves relative to the ${s.relativeTo}. This means ${be} changed its layout; please report it at ${Co}.`]}}}function w0(e){let t;try{t=JSON.parse(e)}catch(o){throw new d(`The catalog manifest at ${rn} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${be}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new d(`The catalog manifest at ${rn} is not a JSON object. This is a bug in ${be}. Please report it.`);let r=t,n=r.skills;if(n!==void 0&&(typeof n!="string"||n.trim()===""))throw new d(`The catalog manifest at ${rn} declares "skills" as ${k0(n)}, but it must be a non-empty string. This is a bug in ${be}. Please report it.`);return{version:typeof r.version=="string"?r.version.trim():"",skills:typeof n=="string"?n:void 0}}async function xD(e){for(let t of sm){let r=zi.default.join(e,...t.split("/"));if(Be(e,r,"the catalog skills directory"),!!await CD(r))return{skillsDir:r,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${be} changed its layout; please report it at ${Co}.`]}}throw new d(`The downloaded catalog has no skills directory: ${rn} is absent and none of ${sm.join(", ")} exists. This is a bug in ${be}. Please report it.`)}async function CD(e){try{return(await wm.default.promises.stat(e)).isDirectory()}catch{return!1}}function b0(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function k0(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="string"?"an empty string":typeof e=="object"?"an object":`a ${typeof e}`}var UD=require("yaml");os();var $t=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},RP=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,TP=/^\uFEFF/,PP="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",WD="\u2014 wrap the value in double quotes",$P={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},OP=100,LP=B.object({name:B.string().trim().min(1).max(Nc),description:B.string().trim().min(1).max(wD),"mcp-version":B.string().max(bD).optional(),compatibility:B.string().max(kD).optional(),license:B.string().max(DD).optional(),metadata:B.record(B.unknown()).optional()}).passthrough(),xm=["name","description"];function Ko(e){let t=e.replace(TP,""),r=RP.exec(t);if(!r){if(t.trimStart().startsWith("---"))throw new $t(PP);return{frontmatter:Cm({}),body:t,raw:e}}let n=r[1]??"",o=r[2]??"",i=NP(n,1);return{frontmatter:Cm(i),body:o,raw:e}}function NP(e,t){let r=(0,UD.parseDocument)(e,$P),[n]=r.errors;if(n)throw new $t(jP(n,e,t));let o;try{o=r.toJS({maxAliasCount:OP})}catch(i){throw new $t(`YAML parse error: ${i instanceof Error?i.message:String(i)}`)}if(o==null)return{};if(typeof o!="object"||Array.isArray(o)||o instanceof Date)throw new $t(`frontmatter is not a YAML mapping (parsed as ${_m(o)})`);return o}function jP(e,t,r){let n=e.pos?.[0],o="",i="";if(typeof n=="number"&&n>=0){let a=t.slice(0,n),l=a.split(`
110
+ `).length,c=n-(a.lastIndexOf(`
111
+ `)+1)+1;o=` at line ${l+r}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${WD}`:"";return`YAML parse error: ${e.message}${o}${s}`}function Cm(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new $t(`frontmatter is not a YAML mapping (parsed as ${_m(e)})`);let t={...e},r=xm.filter(i=>!(i in t)||t[i]===void 0);if(r.length>0)throw new $t(`missing required frontmatter field(s): ${r.join(", ")}`);let n=xm.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(n.length>0){let i=xm.map(a=>_m(t[a])).join(" and "),s=n.some(a=>BP(t[a]));throw new $t(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${WD}`:""}`)}t.metadata=MP(t.metadata),t.metadata===void 0&&delete t.metadata;let o=LP.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new $t(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function MP(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function BP(e){return!(e==null||typeof e=="string")}function _m(e){return e===null?"null":e===void 0?"nothing":Array.isArray(e)?"list":e instanceof Date?"date":typeof e=="string"?e.trim()===""?"empty string":"string":typeof e=="object"?"mapping":typeof e}function Am(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function Fm(e){let t=e.metadata?.category;if(typeof t!="string")return;let r=t.trim();return r===""?void 0:r}var Gc=w(require("path"));C();var UP=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),Im="/webflow-skills-store";function Bn(e){if(typeof e!="string")return;let t=HD(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,ED),r=HD(t);if(r&&!UP.has(r)&&WP(r))return r}function HD(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function WP(e){return[Bk,em].every(r=>{let n=r.impl.join(Im,e);return!ot(Im,n,r)||r.impl.basename(n)!==e?!1:r.impl.dirname(n)===r.impl.normalize(Im)})}function Rm(e){return ym.test(e)}var Un=e=>Gc.default.posix.basename(Gc.default.posix.dirname(e.split(Gc.default.win32.sep).join("/")));function un(e,t){let r=typeof e=="string"?e.trim():"",n=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(r==="")return n();let o=[s=>s.name===r,s=>s.folderName===r,s=>s.dir===r],i=Bn(r);i!==void 0&&o.push(s=>s.dir===i||Bn(s.name)===i||Bn(s.folderName)===i);for(let s of o){let a=t.filter(s);if(a.length===1)return{kind:"match",skill:a[0]};if(a.length>1)return{kind:"ambiguous",matches:a}}return n()}function VD(e){return GD(e,t=>t.dir)}function Tm(e){let[t]=VD(e);if(!t)return;let r=t.skills.length,n=t.skills.map(o=>` "${b(o.name)}" (${b(o.skillPath)})`);throw new d(`${r===2?"Two":String(r)} skills resolve to the same install directory "${b(t.value)}":
112
+ ${n.join(`
113
+ `)}
114
+ This is a bug in ${be}. Please report it.`)}function Pm(e){return GD(e,t=>t.name)}function $m(e){let[t,...r]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${b(e.value)}": ${e.skills.map(n=>b(n.skillPath)).join(", ")}. Using ${b(t?.skillPath??"")} and ignoring ${r.length===1?"the other":"the others"}. This is a bug in ${be}. Please report it.`}function GD(e,t){let r=new Map;for(let n of e){let o=t(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return[...r.entries()].filter(([,n])=>n.length>1).map(([n,o])=>({value:n,skills:o}))}var is=w(require("fs")),qt=w(require("path"));C();async function ss(e,t){Be(t,e,"the catalog skills directory");let r=[],n=[],o=[],i=new Set,s=f=>(o.push(...f.warnings),f.kind==="skipped"?(n.push({skillPath:f.skillPath,reason:f.reason}),!1):(r.push(f.skill),!f.skill.internal));for(let f of await Ba(e,"the catalog skills directory")){if(Oa.has(f.name))continue;let m=qt.default.join(e,f.name);if(!await Om(m,f))continue;let g=await JD(m);if(g.kind!=="none"&&i.add(g.path),!(g.kind!=="none"&&s(await KD({skillDir:m,manifest:g,extractRoot:t}))))for(let h of await Ba(m)){if(Oa.has(h.name))continue;let y=qt.default.join(m,h.name);if(!await Om(y,h))continue;let k=await JD(y);k.kind!=="none"&&(i.add(k.path),s(await KD({skillDir:y,manifest:k,extractRoot:t,parentCategory:f.name})))}}let a=await VP(r),l=Pm(a),c=new Set;for(let f of l){o.push($m(f));for(let m of f.skills.slice(1))c.add(m.skillPath)}let p=a.filter(f=>!c.has(f.skillPath));Tm(p),o.push(...await GP(e,t,i));for(let f of n)o.push(`Skipped ${f.skillPath} \u2014 ${f.reason}`);return n.length>0&&o.push(`${n.length} skill${n.length===1?" was":"s were"} skipped. ${n.length===1?"This is a defect":"These are defects"} in ${be} \u2014 please report ${n.length===1?"it":"them"} at ${Co}.`),{skills:p,skipped:n,warnings:o}}async function KD(e){let{skillDir:t,manifest:r,extractRoot:n,parentCategory:o}=e,i=YD(n,r.path),s=[],a=h=>({kind:"skipped",skillPath:i,reason:b(h),warnings:s});if(r.kind==="symlink")return a(`${Pt} is a symbolic link; skill files must be regular files`);let l;try{l=await is.default.promises.readFile(r.path,"utf8")}catch(h){return a(`failed to read file: ${h instanceof Error?h.message:String(h)}`)}let c;try{c=Ko(l).frontmatter}catch(h){if(h instanceof $t)return a(h.reason);throw h}let p=b(c.name),f=b(c.description);if(p==="")return a(`frontmatter name "${b(c.name)}" cannot be used as a directory name`);let m=Bn(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);Rm(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${be}.`);let g=await HP(t,r.path);return g.symlink?a(`contains a symbolic link (${g.symlink}); skill files must be regular files`):(g.truncated&&s.push(`${i} sits in a directory with more than ${Lc} files; only the first ${Lc} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Un(i),description:f,category:Fm(c)??o,internal:Am(c),path:t,skillPath:i,supplementaryFiles:g.files}})}async function JD(e){let t=qt.default.join(e,Pt),r=await zD(t);if(r)return r;let n=Pt.toLowerCase();for(let o of await Ba(e)){if(o.name===Pt||o.name.toLowerCase()!==n)continue;let i=await zD(qt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function zD(e){try{let t=await is.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Om(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await is.default.promises.stat(e)).isDirectory()}catch{return!1}}async function Ba(e,t){try{return(await is.default.promises.readdir(e,{withFileTypes:!0})).sort((n,o)=>n.name<o.name?-1:n.name>o.name?1:0)}catch(r){if(!t)return[];throw new d(`Failed to read ${t} (${b(e)}): ${r instanceof Error?r.message:String(r)}`)}}async function HP(e,t){let r=[],n,o=!1,i=async(s,a)=>{if(!(a>Fo||n!==void 0))for(let l of await Ba(s)){if(n!==void 0)return;let c=qt.default.join(s,l.name);if(l.isSymbolicLink()){n=qD(e,c);return}if(l.isDirectory()){if(_o.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Ao.has(l.name)&&c!==t){if(r.length>=Lc){o=!0;return}r.push(qD(e,c))}}};return await i(e,1),{files:r.sort(),symlink:n,truncated:o}}async function VP(e){let t=new Set,r=[];for(let n of e){let o;try{o=await is.default.promises.realpath(n.path)}catch{o=qt.default.resolve(n.path)}t.has(o)||(t.add(o),r.push(n))}return r}async function GP(e,t,r){let n=[],o=vD,i=async(s,a)=>{if(!(a>SD||o<=0)){o-=1;for(let l of await Ba(s)){if(Oa.has(l.name))continue;let c=qt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Pt.toLowerCase()){r.has(c)||n.push(YD(t,c));continue}await Om(c,l)&&await i(c,a+1)}}};return await i(e,1),n.length===0?[]:[`${n.length} ${Pt} file(s) in the catalog sit outside the layout this CLI reads (for example ${n[0]}) and were ignored. ${be} may have changed its layout; please report it at ${Co}.`]}function YD(e,t){return qt.default.relative(e,t).split(qt.default.sep).join("/")}function qD(e,t){return qt.default.relative(e,t).split(qt.default.sep).join("/")}var hr=w(require("os")),Pr=w(require("path"));function Jo(e,t){let r=process.env[e]?.trim();return r||t}function XD(e){let t=process.env[e]?.trim();return t||void 0}var pe={home:()=>hr.default.homedir(),configHome:()=>Jo("XDG_CONFIG_HOME",Pr.default.join(hr.default.homedir(),".config")),hardcodedConfigHome:()=>Pr.default.join(hr.default.homedir(),".config"),claudeHome:()=>Jo("CLAUDE_CONFIG_DIR",Pr.default.join(hr.default.homedir(),".claude")),codexHome:()=>Jo("CODEX_HOME",Pr.default.join(hr.default.homedir(),".codex")),vibeHome:()=>Jo("VIBE_HOME",Pr.default.join(hr.default.homedir(),".vibe")),hermesHome:()=>Jo("HERMES_HOME",Pr.default.join(hr.default.homedir(),".hermes")),autohandHome:()=>Jo("AUTOHAND_HOME",Pr.default.join(hr.default.homedir(),".autohand")),grokHome:()=>Jo("GROK_HOME",Pr.default.join(hr.default.homedir(),".grok")),appData:()=>XD("APPDATA"),flatpakConfigHome:()=>XD("FLATPAK_XDG_CONFIG_HOME")};function yr(...e){return Pr.default.join(hr.default.homedir(),...e)}var lE=w(require("fs")),Ee=w(require("path"));C();N();var vt=w(require("path"));var Lm=[".openclaw",".clawdbot",".moltbot"];function ZD(e,t){let r=Lm.find(n=>t(vt.default.join(e,n)));return vt.default.join(e,r??Lm[0],"skills")}function QD(e,t){return Lm.some(r=>t(vt.default.join(e,r)))}function eE(e,t,r=pe.appData(),n=pe.flatpakConfigHome()){return!!(t(vt.default.join(e,"zed"))||r&&t(vt.default.join(r,"Zed"))||n&&t(vt.default.join(n,"zed")))}var JP="/Applications/ZCode.app";function tE(e,t){return t(vt.default.join(e,".zcode"))||t(JP)}function rE(e,t){return t(vt.default.join(e,"kimchi"))}var zP="/etc/codex";function nE(e,t){return t(e)||t(zP)}function oE(e,t){return t(vt.default.join(e,".replit"))}function iE(e,t){return t(vt.default.join(e,".promptscript"))||t(vt.default.join(e,"promptscript.yaml"))}function sE(e,t,r){return r(vt.default.join(t,"data","skills"))||r(vt.default.join(e,".astrbot"))}function aE(){return!1}function qP(e){try{return lE.default.existsSync(e)}catch{return!1}}function ye(e,t,r){return{id:e,displayName:t,skillsDir:`${r}/skills`,globalSkillsDir:()=>yr(r,"skills"),detect:n=>n.pathExists(Ee.default.join(n.homeDir,r)),sharedStore:!1}}function st(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>yr(...e.global),detect:t=>t.pathExists(Ee.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",zo=[ye("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>Ee.default.join(pe.configHome(),"agents","skills"),detect:e=>e.pathExists(Ee.default.join(e.configHome,"amp")),sharedStore:!0},st({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),st({id:"antigravity-cli",displayName:"Antigravity CLI",project:Qe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>yr(".astrbot","data","skills"),detect:e=>sE(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>Ee.default.join(pe.autohandHome(),"skills"),detect:e=>e.pathExists(pe.autohandHome()),sharedStore:!1},ye("augment","Augment",".augment"),ye("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>Ee.default.join(pe.claudeHome(),"skills"),detect:e=>e.pathExists(pe.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>ZD(pe.home(),qP),detect:e=>QD(e.homeDir,e.pathExists),sharedStore:!1},st({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),ye("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>yr(".codebuddy","skills"),detect:e=>e.pathExists(Ee.default.join(e.cwd,".codebuddy"))||e.pathExists(Ee.default.join(e.homeDir,".codebuddy")),sharedStore:!1},ye("codemaker","Codemaker",".codemaker"),ye("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Qe,globalSkillsDir:()=>Ee.default.join(pe.codexHome(),"skills"),detect:e=>nE(pe.codexHome(),e.pathExists),sharedStore:!0},ye("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>yr(".continue","skills"),detect:e=>e.pathExists(Ee.default.join(e.cwd,".continue"))||e.pathExists(Ee.default.join(e.homeDir,".continue")),sharedStore:!1},st({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>Ee.default.join(pe.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(Ee.default.join(pe.hardcodedConfigHome(),"crush")),sharedStore:!1},st({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),st({id:"deepagents",displayName:"Deep Agents",project:Qe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>Ee.default.join(pe.configHome(),"devin","skills"),detect:e=>e.pathExists(Ee.default.join(e.configHome,"devin")),sharedStore:!1},st({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),ye("droid","Droid",".factory"),st({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),ye("forgecode","ForgeCode",".forge"),st({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),st({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>Ee.default.join(pe.configHome(),"goose","skills"),detect:e=>e.pathExists(Ee.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>Ee.default.join(pe.grokHome(),"skills"),detect:e=>e.pathExists(pe.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>Ee.default.join(pe.hermesHome(),"skills"),detect:e=>e.pathExists(pe.hermesHome()),sharedStore:!1},ye("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>yr(".jazz","skills"),detect:e=>e.pathExists(Ee.default.join(e.homeDir,".jazz"))||e.pathExists(Ee.default.join(e.cwd,".jazz")),sharedStore:!1},ye("junie","Junie",".junie"),ye("iflow-cli","iFlow CLI",".iflow"),ye("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>Ee.default.join(pe.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>rE(pe.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>yr(".agents","skills"),detect:e=>e.pathExists(Ee.default.join(e.homeDir,".kimi-code"))||e.pathExists(Ee.default.join(e.homeDir,".kimi")),sharedStore:!0},ye("kiro-cli","Kiro CLI",".kiro"),ye("kode","Kode",".kode"),ye("lingma","Lingma",".lingma"),st({id:"loaf",displayName:"Loaf",project:Qe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),ye("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>Ee.default.join(pe.vibeHome(),"skills"),detect:e=>e.pathExists(pe.vibeHome()),sharedStore:!1},ye("moxby","Moxby",".moxby"),ye("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>Ee.default.join(pe.configHome(),"opencode","skills"),detect:e=>e.pathExists(Ee.default.join(e.configHome,"opencode")),sharedStore:!0},ye("openhands","OpenHands",".openhands"),ye("ona","Ona",".ona"),st({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),ye("qoder","Qoder",".qoder"),st({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),ye("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Qe,globalSkillsDir:()=>Ee.default.join(pe.configHome(),"agents","skills"),detect:e=>oE(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},ye("reasonix","Reasonix",".reasonix"),ye("rovodev","Rovo Dev",".rovodev"),ye("roo","Roo Code",".roo"),st({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),ye("terramind","Terramind",".terramind"),ye("tinycloud","Tinycloud",".tinycloud"),ye("trae","Trae",".trae"),st({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),st({id:"warp",displayName:"Warp",project:Qe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),st({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Qe,globalSkillsDir:()=>yr(".agents","skills"),detect:e=>eE(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>yr(".zcode","skills"),detect:e=>tE(e.homeDir,e.pathExists),sharedStore:!1},ye("zencoder","Zencoder",".zencoder"),ye("zenflow","Zenflow",".zencoder"),ye("neovate","Neovate",".neovate"),ye("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Qe,globalSkillsDir:()=>{},detect:e=>iE(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},ye("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>Ee.default.join(pe.configHome(),"agents","skills"),detect:aE,sharedStore:!0,showInSharedList:!1}],Nm=new Map(zo.map(e=>[e.id,e])),qo=zo.map(e=>e.id);function Ua(e){return Nm.has(e)}function $r(e){return Nm.get(e)}function Kc(e){let t=Nm.get(e);if(t)return t;throw new d(`${D} Unknown agent: ${b(e)}
115
+ ${qo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function Jc(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Or(e){return zo.filter(t=>Jc(t,e))}var jm=w(require("path"));C();N();var zc=".agents",qc="skills";function at(e,t){let r=e==="global"?pe.home():t;return jm.default.join(r,zc,qc)}function St(e,t,r){if(t==="global")return e.globalSkillsDir()??null;let n=jm.default.resolve(r,...e.skillsDir.split("/"));return Be(r,n,`${e.id} project skills directory`),n}function Mm(e,t,r){return Xe(St(e,t,r),at(t,r))}function Bm(e,t,r){let n=new Map;for(let o of e){let i=St(o,t,r);if(i===null)continue;let s=n.get(i);s?s.push(o):n.set(i,[o])}return n}var Um=w(require("fs")),cE=w(require("path"));function YP(e){try{return Um.default.existsSync(e)}catch{return!1}}function XP(e){try{let t=JSON.parse(Um.default.readFileSync(cE.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function Yc(e){return{homeDir:pe.home(),configHome:pe.configHome(),cwd:e,pathExists:YP,readPackageJson:XP}}async function Wa(e,t,r=Yc(t)){return Xc(Or(e),r).map(n=>n.id)}function Xc(e,t){return e.filter(r=>{try{return r.detect(t)}catch{return!1}})}var mE=w(require("fs"));var Zc=["webflow-cli:cloud","webflow-cli:code-component","webflow-cli:designer-extension","webflow-cli:devlink","webflow-cli:troubleshooter"],uE="WEBFLOW_NO_SKILLS_PROMPT";var dE="skills_suggestion_shown",pE="skills_suggestion_accepted",fE="skills_suggestion_declined";var ZP=new Set(["astrbot","codebuddy","continue","jazz","replit","promptscript"]),QP=new Set(["universal"]),e$=new Set(Zc.flatMap(e=>{let t=Bn(e);return t===void 0?[e]:[e,t]}));function t$(e){try{return mE.default.readdirSync(e).some(t=>e$.has(t))}catch{return!1}}function r$(){return zo.filter(e=>!ZP.has(e.id)&&!QP.has(e.id))}function Wm(e){let{cwd:t,scope:r}=e,n=e.ctx??Yc(t),o=Xc(r$(),n),i;try{i=Bm(o,r,t)}catch{return{present:[],unconfigured:[]}}let s=new Map;for(let[l,c]of i){let p=t$(l);for(let f of c)s.set(f.id,p)}let a=[];for(let l of o){let c=s.get(l.id);c!==void 0&&a.push({id:l.id,displayName:l.displayName,hasWebflowSkills:c})}return{present:a,unconfigured:a.filter(l=>!l.hasWebflowSkills)}}var gE=w(require("fs")),hE=w(require("path"));C();he();Fe();F();N();var Ha=[".git","package.json","webflow.json"];function Va(e){for(let t of Ha)try{if(gE.default.existsSync(hE.default.join(e,t)))return t}catch{}return null}function Ga(e){return Va(e)===null?"global":"project"}function yE(e){let t=Va(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${Ha.join(", ")} found in this directory.`}async function Qc(e,t){if(e.global&&e.project)throw new d(`${D} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let r=Ga(t);return e.yes||W()?(u.info(yE(t)),r):Me({message:"Where should these skills be installed?",default:r,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();he();Fe();F();N();var Ka="all",Yt="universal",n$=6,o$=20,i$=80;function as(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function s$(e,t){let r=Array.from({length:t.length+1},(n,o)=>o);for(let n=1;n<=e.length;n+=1){let o=[n];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(r[i]+1,o[i-1]+1,r[i-1]+(e[n-1]===t[i-1]?0:1));r=o}return r[t.length]}function kE(e){let t=e.toLowerCase(),r=Math.max(1,Math.floor(t.length/3)),n=null,o=Number.POSITIVE_INFINITY;for(let i of qo){let s=s$(t,i);s<o&&(o=s,n=i)}return o<=r?n:null}function ls(e){let t=e.filter(r=>!Ua(r));if(t.length>0){let r=Array.from(new Set(t.map(o=>kE(o)).filter(o=>o!==null))),n=r.length>0?` Did you mean: ${r.join(", ")}?
116
+ `:"";throw new d(`${D} Unknown agent(s): ${t.map(o=>b(o)).join(", ")}
117
+ `+n+` ${qo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(r=>$r(r))}function tu(e,t){return Or(e).filter(r=>Mm(r,e,t))}function DE(e,t){return tu(e,t).filter(r=>r.showInSharedList!==!1)}function EE(e,t){let n=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-n.length,i=n.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function vE(e,t,r=n$){return EE(DE(e,t),r)}function wE(e,t){let r=process.stdout.columns??i$,n=Math.max(20,r-t);return e.length<=n?e:`${e.slice(0,n-1)}\u2026`}function a$(e,t,r){return t==="project"?e.skillsDir:St(e,t,r)??""}function eu(e,...t){let r=new Set(t.flat());return Or(e).filter(n=>r.has(n.id))}async function bE(e,t,r){let n=tu(e,t),o=new Set(n.map(f=>f.id)),i=Or(e).filter(f=>!o.has(f.id)),s=new Set(r),a=vE(e,t),l=at(e,t),c=[];n.length>0&&c.push({value:"",name:wE(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let f of i){let m=a$(f,e,t),g=s.has(f.id)?" (detected)":"";c.push({value:f.id,name:wE(`${f.displayName} ${m}${g}`,8),checked:s.has(f.id)})}let p=await Fr({message:n.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(o$,Math.max(4,c.length)),validate:f=>f.length>0||n.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return eu(e,n.map(f=>f.id),(p??[]).filter(Boolean))}async function Ja(e){let{scope:t,cwd:r,options:n}=e,o=as(n.agent),i=n.allAgents===!0||o.includes(Ka),s=o.filter(c=>c!==Ka),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(p=>Ua(p));return{agents:eu(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(p=>!Ua(p))}}if(s.length>0&&!i){let c=ls(s),p=c.filter(f=>!Jc(f,t));if(p.length>0){let f=p.map(m=>m.displayName).join(", ");throw new d(`${D} ${f} does not support global skill installation \u2014 its skills live inside a project.
118
+ Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:eu(t,c.map(f=>f.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Or(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await Wa(t,r);if(l.length===0){if(W()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${at(t,r)}).`);let c=$r(Yt);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await bE(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}return n.yes||W()?{agents:eu(t,tu(t,r).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await bE(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}var AE=w(require("os")),Wn=w(require("path"));ge();N();F();var SE=(e,t)=>e+" ".repeat(Math.max(0,t-bt(e).length));function Ze(e,t){let r=e.map((s,a)=>Math.max(bt(s).length,...t.map(l=>bt(String(l[a])).length))),n=r.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>SE(s,r[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>SE(String(a),r[l]+2)).join("")).join(`
77
119
  `);return`${o}
78
120
  ${n}
79
- ${i}`}function Ai(e){return e?`
121
+ ${i}`}var Hn=1,l$=24,c$=100,FE=8,u$=5;function Yo(e,t={}){if(e==="")return"";let r=Wn.default.resolve(e),n=Wn.default.resolve(t.cwd??process.cwd()),o=Wn.default.resolve(t.home??AE.default.homedir()),i=xE(n,r);if(i!==null)return b(i===""?".":`.${Wn.default.sep}${i}`);let s=xE(o,r);return s!==null?b(s===""?"~":`~${Wn.default.sep}${s}`):b(r)}function ru(e={}){return t=>Yo(t,e)}function xE(e,t){let r=Wn.default.relative(e,t);return r===""?"":r.startsWith("..")||Wn.default.isAbsolute(r)?null:r}var CE={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function Vm(e){let{plan:t,materialized:r,dryRun:n}=e,o=[],i=[];for(let g of t.skills){let h=CE[g.storeOverwrite];h!==void 0&&!t.force&&o.push({name:g.name,dir:g.dir,overwrite:g.storeOverwrite,reason:h,requiredFlag:"--force",...g.detail!==void 0?{detail:g.detail}:{}});for(let y of g.targets){if(!y.blocked)continue;let k=CE[y.overwrite];k!==void 0&&o.push({name:g.name,dir:g.dir,agent:y.agent,overwrite:y.overwrite,reason:k,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let g of t.skills)for(let h of g.targets){if(!h.blocked)continue;let y=s.get(g.name)??new Set;y.add(h.path),s.set(g.name,y)}let a=0,l=0,c=0,p=0,f=0,m=0;for(let g of r){if(g.storeAction==="written"&&(l+=1),g.storeAction==="failed"){i.push({name:g.name,message:g.error??"the canonical store could not be written"});continue}if(g.storeAction!=="blocked"){(g.storeAction==="written"||g.storeAction==="adopted"||g.storeAction==="unchanged")&&(a+=1);for(let h of g.targets){if(h.skipped===!0){m+=1;continue}if(!h.success){if(s.get(g.name)?.has(h.path))continue;i.push({name:g.name,agent:h.agent,...h.errno!==void 0?{errno:h.errno}:{},message:h.error??"the destination could not be written"});continue}h.link==="symlink"&&(c+=1),h.link==="copy"&&h.requestedMode==="copy"&&(p+=1),h.symlinkFailed===!0&&(f+=1)}}}return n&&(m=t.skills.reduce((g,h)=>g+h.targets.filter(y=>y.skipped).length,0)),{blocked:o,failures:i,summary:{requested:t.skills.length,installed:a,skipped:m,blocked:o.length,failed:i.length,storeWrites:l,symlinks:c,copies:p,symlinkFallbacks:f}}}function Gm(e,t){let r=t.display??(o=>o),n=[];n.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),n.push(` scope ${e.scope} (${r(e.root)})`),n.push(` source ${d$(e.source)}`),n.push(` store ${r(e.storeBase)}`),n.push(` mode ${e.mode}`);for(let o of e.skills)n.push(""),n.push(` ${b(o.dir)}`),n.push(` store ${r(o.storePath)}`),n.push(...p$(o,r)),o.blocked&&o.detail!==void 0&&n.push(` ${de("blocked")} ${o.detail}`);if(e.warnings.length>0){n.push("");for(let o of e.warnings)n.push(` ${de("\u26A0")} ${o}`)}return n.join(`
122
+ `)}function d$(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${IE(e.commit)}${t}`}function IE(e){return e.slice(0,FE)}function p$(e,t){let r=[],n=e.targets.filter(s=>s.link==="canonical"),o=e.targets.filter(s=>!s.skipped&&s.link==="symlink"),i=e.targets.filter(s=>!s.skipped&&s.link==="copy");n.length>0&&r.push(` shared ${za(n)}`),o.length>0&&r.push(` symlink \u2192 ${_E(o,t)}`),i.length>0&&r.push(` copy \u2192 ${_E(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&r.push(` ${P("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&r.push(` overwrites ${s.label} ${P(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return r}function _E(e,t){if(e.length===1){let r=e[0];return`${r.label} (${t(r.path)})`}return za(e)}function za(e,t=u$){let r=e.map(n=>b(n.label));return r.length<=t?r.join(", "):`${r.slice(0,t).join(", ")} +${r.length-t} more`}function RE(e,t={}){let r=t.display??(i=>i),n=[],{summary:o}=e;n.push(q(`Installed ${o.installed} ${Hm(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;n.push(` ${b(r(i.storePath))}`);let s=i.targets.filter(c=>c.success&&c.link==="canonical"),a=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="symlink"),l=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="copy");s.length>0&&n.push(` shared: ${za(s)}`),a.length>0&&n.push(` symlinked: ${za(a)}`),l.length>0&&n.push(` copied: ${za(l)}`),i.detail!==void 0&&n.push(` ${P(i.detail)}`)}if(o.symlinkFallbacks>0){let i=f$(e.materialized);n.push(`${de("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${Hm(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),n.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return n.push(...m$(e.blocked)),n.push(...g$(e.failures)),n.push(...nu(e.plan.warnings)),n.join(`
123
+ `)}function f$(e){let t=new Set;for(let r of e)for(let n of r.targets)n.symlinkFailed===!0&&n.errno!==void 0&&t.add(n.errno);return[...t].sort()}function m$(e){if(e.length===0)return[];let t=["",de(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let r of e){let n=r.agent===void 0?"shared store":b(r.agent);t.push(` \u2022 ${b(r.name)} (${n})`),r.detail!==void 0&&t.push(` ${r.detail}`)}return t}function g$(e){if(e.length===0)return[];let t=["",Wt(`${e.length} ${Hm(e.length,"failure")}:`)];for(let r of e){let n=r.agent===void 0?"":` (${b(r.agent)})`;t.push(` \u2022 ${b(r.name)}${n}: ${b(r.message)}`)}return t}function nu(e){return e.length===0?[]:["",...e.map(t=>`${de("\u26A0")} ${t}`)]}function Hm(e,t){return e===1?t:`${t}s`}function ou(e){let{plan:t}=e,r=new Map(e.materialized.map(n=>[n.name,n]));return{kind:"skills.install",schemaVersion:Hn,dryRun:e.dryRun,restored:e.restored,scope:t.scope,root:t.root,store:t.storeBase,mode:t.mode,force:t.force,lockfile:e.lockfilePath,source:{...t.source,cacheHit:e.cacheHit},...e.extraSources!==void 0&&e.extraSources.length>0?{sources:[t.source,...e.extraSources]}:{},skills:t.skills.map(n=>h$(n,r.get(n.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function h$(e,t){let r=new Map((t?.targets??[]).map(n=>[n.path,n]));return{name:e.name,dir:e.dir,description:e.description,skillPath:e.skillPath,storePath:e.storePath,storeOverwrite:e.storeOverwrite,storeAction:t?.storeAction??null,contentHash:t?.hashes?.contentHash??null,modeHash:t?.hashes?.modeHash??null,upToDate:e.upToDate,fileCount:e.fileCount,byteCount:e.byteCount,blocked:e.blocked,detail:e.detail??null,targets:e.targets.map(n=>y$(n,r.get(n.path)))}}function y$(e,t){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:t?.link??e.link,overwrite:e.overwrite,blocked:e.blocked,skipped:t?.skipped??e.skipped,skipReason:t?.skipReason??e.skipReason??null,symlinkFailed:t?.symlinkFailed??!1,errno:t?.errno??null,error:t?.error??null}}var Xo=["name","dir","description","status","mode","agents","scope"],qa="name,status,agents",cs=["name","dir","status","scope"],w$={"up-to-date":q,modified:de,missing:Wt,unmanaged:P};function TE(e,t,r={}){let n=r.columns??process.stdout.columns??c$,o=e.map(l=>t.map(c=>b$(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((p,f,m)=>{if(m===i)return p;let g=Math.max(f.length,...o.map(h=>h[m].length),0);return p+g+2},0),c=Math.max(l$,n-l-2);for(let p of o)p[i]=D$(p[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((p,f)=>t[f]==="status"?w$[e[c].status](p):p));return Ze(s,a)}function b$(e,t){switch(t){case"name":return b(e.name);case"dir":return b(e.dir);case"description":return b(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return k$(e);case"scope":return e.scope}}var PE="shared";function k$(e){let t=[],r=0;for(let n of e.agents){let o=b(n.id);if(!n.present){t.push(`${o} (missing)`);continue}if(n.link==="canonical"){r+=1;continue}t.push(o)}return r>0?[PE,...t].join(", "):t.join(", ")}function $E(e,t={}){let r=t.display??(s=>s),n=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&n.add(a.id);if(n.size===0)return"";let o=[...n].sort().join(", "),i=t.store===void 0?"":` = ${r(t.store)}`;return P(`${PE}${i}, read directly by ${n.size} agent${n.size===1?"":"s"}:
124
+ ${o}`)}function D$(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function OE(e,t={}){let r=t.display??(l=>l),n=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${IE(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${n} skills \u2014 ${r(a)}${s}`)}function Km(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let r of e)for(let n of r.skills)t.total+=1,n.status==="up-to-date"?t.upToDate+=1:n.status==="modified"?t.modified+=1:n.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function LE(e){return{kind:"skills.list",schemaVersion:Hn,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(r=>({name:r.name,dir:r.dir,description:r.description,skillPath:r.skillPath??null,storePath:r.storePath,recordedHash:r.recordedHash,onDiskHash:r.onDiskHash,status:r.status,statusDetail:r.statusDetail??null,mode:r.mode,commit:r.commit??null,ref:r.ref??null,category:r.category??null,agents:r.agents.map(n=>({id:n.id,label:n.label,path:n.path,link:n.link,present:n.present,diverged:n.diverged??!1}))}))})),summary:Km(e.inventories),warnings:[...e.warnings]}}var Jm="No skills installed. Run `webflow skills install` to get started.";function NE(e,t){let r=t==="desc"?-1:1;return(n,o)=>{let i=String(n[e]??""),s=String(o[e]??"");return i===s?n.name<o.name?-1:n.name>o.name?1:0:(i<s?-1:1)*r}}function jE(e){let t=[],{summary:r}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Jm;if(e.source.upToDate)t.push(`${$} ${b(e.source.repo)}@${b(e.source.ref)} is still ${E$(e.source.resolvedCommit)} \u2014 all ${r.checked} skill${r.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${xe} ${r.outdated+r.conflicts} of ${r.checked} skills would change.`:`${$} Updated ${r.updated} skill${r.updated===1?"":"s"}`+(r.blocked>0?`, skipped ${r.blocked}`:"")+(r.failed>0?`, ${r.failed} failed`:"");t.push(o)}let n=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[b(o.dir),o.action,o.detail?b(o.detail):""]);n.length>0&&t.push("",Ze(["SKILL","ACTION","DETAIL"],n));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${b(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${b(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
125
+ `)}function E$(e){return e===null?"unknown":e.slice(0,FE)}function zm(e,t,r={}){let n=i=>b((r.display??Yo)(i)),o=[];o.push(`${r.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${b(i.name)} \u2192 ${b(i.dir)}`),!i.onDisk&&i.targets.length===0){o.push(" (lockfile entry only \u2014 no directory on disk; the stale entry will be removed)");continue}i.onDisk&&o.push(` ${n(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>b(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${n(s.path)} ${b(s.label)} (unlink)`)}return r.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
126
+ `)}function ME(e,t={}){let r=o=>b((t.display??Yo)(o));if(e.skills.length===0)return"No skills removed.";let n=[];n.push(`${$} Removed ${e.summary.removed} skill${e.summary.removed===1?"":"s"}`+(e.summary.failed>0?`, ${e.summary.failed} failed`:""));for(let o of e.skills){let i=o.targets.filter(a=>a.action==="unlinked"),s=o.storeAction==="deleted"?"store directory deleted":o.storeAction==="kept"?`store kept \u2014 still used by ${o.keptBecause.map(a=>b(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";n.push(` ${b(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&n.push(` removed empty directories: ${e.removedDirectories.map(o=>r(o)).join(", ")}`);for(let o of e.failures)n.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.lockfileDeleted?n.push(`${xe} ${r(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&n.push(`${xe} ${r(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),n.join(`
127
+ `)}z();C();he();Fe();F();N();X();he();F();function v$(e){let t=Va(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${Ha.join(", ")} found in this directory.`}async function iu(e,t,r){return!(e.global===!0||e.project===!0)&&(e.yes===!0||W())?(r||u.info(v$(t)),Ga(t)):Qc(e,t)}function us(e){return e==="locally-modified"||e==="unmanaged"}var Qo=w(require("fs")),wr=w(require("path"));C();var Ym=require("crypto"),cu=w(require("fs"));C();var Zo=w(require("fs")),Lr=w(require("path"));C();var qm=2e3,UE=8;async function su(e){let t=Lr.default.resolve(e),r=[],n=[],o=async(i,s)=>{if(s>Fo)throw new d(`Skill directory ${b(t)} nests deeper than ${Fo} levels at ${b(i)}. Refusing to copy or hash a tree this deep.`);let a=await Zo.default.promises.readdir(i,{withFileTypes:!0});a.sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0);for(let l of a){let c=Lr.default.join(i,l.name);if(Be(t,c,"a skill file"),l.isSymbolicLink()){n.push(BE(t,c));continue}if(l.isDirectory()){if(_o.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Ao.has(l.name))continue;let p=await Zo.default.promises.lstat(c);if(r.length>=qm)throw new d(`Skill directory ${b(t)} contains more than ${qm} files. Refusing to copy or hash it.`);let f=BE(t,c);r.push({rel:f,key:f.normalize("NFC"),abs:c,mode:p.mode&511,size:p.size})}};return await o(t,1),r.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),n.sort(),{files:r,symlinks:n}}function au(e,t){let[r]=t.symlinks;if(r!==void 0)throw new d(`Skill directory ${b(e)} contains a symbolic link ("${b(r)}"); skill files must be regular files. If this came from ${be}, please report it.`)}async function lu(e,t){let r=Lr.default.resolve(e),n=Lr.default.resolve(t),o=await su(r);au(r,o),await Zo.default.promises.mkdir(n,{recursive:!0});let i=new Set;for(let a of o.files){let l=Lr.default.dirname(Lr.default.join(n,...a.rel.split("/")));l!==n&&i.add(l)}for(let a of[...i].sort())Be(n,a,"a skill destination directory"),await Zo.default.promises.mkdir(a,{recursive:!0});let s=0;return await S$(o.files,UE,async a=>{let l=Lr.default.join(n,...a.rel.split("/"));Be(n,l,"a skill destination file"),await Zo.default.promises.copyFile(a.abs,l),await Zo.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function BE(e,t){return Lr.default.relative(e,t).split(Lr.default.sep).join("/")}async function S$(e,t,r){let n=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;n<e.length;){let i=e[n++];if(i===void 0)return;await r(i)}});await Promise.all(o)}var HE=1024*1024,VE=4294967295,Xm=Buffer.from([0]);async function uu(e){let t=await su(e);au(e,t);let r=(0,Ym.createHash)("sha256"),n=(0,Ym.createHash)("sha256"),o=0;for(let i of t.files)await x$(r,i),C$(n,i),o+=i.size;return{contentHash:`sha256:${r.digest("hex")}`,modeHash:`sha256:${n.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function Xt(e){try{return await uu(e)}catch(t){if(F$(t))return null;throw t}}function Ot(e,t,r=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:r==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function x$(e,t){if(t.size<=HE){let o=await cu.default.promises.readFile(t.abs);return WE(e,t,o.length),e.update(o),o.length}let r=await _$(t.abs);WE(e,t,r);let n=await A$(e,t.abs,r);if(n!==r)throw new d(`${b(t.abs)} changed while it was being hashed (${r} bytes, then ${n}). Re-run the command.`);return n}function WE(e,t,r){if(r>VE)throw new d(`${b(t.abs)} is ${r} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(Xm);let n=Buffer.alloc(4);n.writeUInt32BE(r,0),e.update(n)}function C$(e,t){e.update(t.key,"utf8"),e.update(Xm),e.update((t.mode&73)!==0?"x":"-"),e.update(Xm)}async function _$(e){let t=0;for await(let r of cu.default.createReadStream(e))t+=r.length;return t}async function A$(e,t,r){let n=0;for await(let o of cu.default.createReadStream(t)){let i=o;if(n+=i.length,n>r)return e.update(i.subarray(0,i.length-(n-r))),n;e.update(i)}return n}function F$(e){return Vn(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:Vn(e.cause)==="ENOENT"}function Vn(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var JE=require("crypto"),Ie=w(require("fs")),ve=w(require("path"));C();F();var I$=/\.[0-9a-f]{6}\.tmp$/,zE=3600*1e3;async function Qm(e,t=r=>r){let r=ve.default.join(e,zc);for(let n of[r,ve.default.join(r,qc)]){if(await qE(n)==="other")throw new d(`${b(t(n))} exists but is not a directory. The Webflow CLI needs it as the shared skills store. Remove or rename it, then re-run.`,{isUserError:!0});if(await du(e,n))throw new d(`${b(t(n))} resolves outside ${b(t(e))} once symlinks are followed. The Webflow CLI will not use it as the shared skills store. Remove or repoint it, then re-run.`,{isUserError:!0})}}async function du(e,t){if(!ot(e,t)||await eg(e,t)!==void 0)return!0;try{await Ie.default.promises.lstat(t)}catch{return!1}return!await vc(e,t)}async function eg(e,t){let r=ve.default.resolve(e),n=ve.default.relative(r,ve.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(ve.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=ve.default.join(i,s);let a;try{a=await Ie.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await vc(r,i))return i}}async function pu(e,t){let r=ve.default.resolve(e),n=ve.default.relative(r,ve.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(ve.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=ve.default.join(i,s);let a=await qE(i);if(a==="absent")return;if(a==="other")return i}}async function Ya(e,t={}){if(t.dryRun)return[];let r=t.maxAgeMs??zE,n=t.now??Date.now(),o=[],i;try{i=await Ie.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!I$.test(s.name))continue;let a=ve.default.join(e,s.name);try{Be(e,a,"a stale staging directory");let l=await Ie.default.promises.lstat(a);if(n-l.mtimeMs<r)continue;await Ie.default.promises.rm(a,{recursive:!0,force:!0}),o.push(a)}catch(l){u.debug(`Could not sweep staging directory ${a}: ${l instanceof Error?l.message:String(l)}`)}}return o}async function fu(e){let{storeDir:t,slug:r,root:n,mode:o,agent:i,label:s}=e,a=e.platform??process.platform,l=ve.default.resolve(e.linkPath),c={agent:i,label:s,path:l,canonicalPath:t,requestedMode:o},p=y=>({...c,success:!1,link:o,error:y});if(ve.default.basename(l)!==r)return p(`Refusing to write ${b(l)}: its final component is not "${b(r)}".`);let f=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${b(l)} for ${b(s)}: ${y}`});if(!ot(n,l))return f(`it resolves outside ${b(n)}.`);let m=await eg(n,l);if(m!==void 0)return f(`${b(m)} is a symbolic link that leaves ${b(n)}.`);let g=await pu(n,l);if(g!==void 0)return p(`${b(g)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(Xe(t,l))return{...c,success:!0,link:"canonical"};let h=await P$(l,t);if(h&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!h){let[y,k]=await Promise.all([fr(t),fr(l)]);if(Xe(y,k))return{...c,success:!0,link:"canonical"};if(Xe(await KE(t),await KE(l)))return{...c,success:!0,link:"canonical"};if(await tm(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await GE(t,l,r),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:Vn(y),error:Zm(y)}}try{if(await $$(l,r),await Ie.default.promises.mkdir(ve.default.dirname(l),{recursive:!0}),a==="win32")await Ie.default.promises.symlink(ve.default.resolve(t),l,"junction");else{let y=await fr(ve.default.dirname(l));await Ie.default.promises.symlink(ve.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let k=Vn(y);try{return await GE(t,l,r),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:k}}catch(v){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:Vn(v)??k,error:Zm(v)}}}}async function Xa(e,t,r={}){if(Be(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),ve.default.basename(t.storePath)!==t.dir)throw new d(`Refusing to write ${b(t.storePath)}: its final component is not "${b(t.dir)}". Please report this.`);let n={name:t.name,dir:t.dir,storePath:t.storePath};if(us(t.storeOverwrite)&&!e.force)return{...n,storeAction:"blocked",hashes:null,targets:[],success:!1,error:t.detail};let o,i,s;try{t.storeOverwrite==="adoptable"?(i="adopted",o=t.onDisk??t.upstream):t.upToDate?(i="unchanged",o=t.onDisk??t.upstream):await tm(t.sourceDir,t.storePath)?(i="unchanged",o=t.onDisk??t.upstream,s="the extracted source and the canonical store are the same directory; nothing to copy"):(o=await R$(t),i="written")}catch(l){return{...n,storeAction:"failed",hashes:null,targets:[],success:!1,error:Zm(l)}}let a=[];for(let l of t.targets)a.push(await T$(e,t,l,r));return{...n,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function R$(e){await Ie.default.promises.mkdir(ve.default.dirname(e.storePath),{recursive:!0});let t=rg(e.storePath);try{await lu(e.sourceDir,t),await tg(e.storePath,e.dir),await Ie.default.promises.rename(t,e.storePath)}finally{await Ie.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return uu(e.storePath)}async function T$(e,t,r,n){let o={agent:r.agent,label:r.label,path:r.path,canonicalPath:t.storePath,requestedMode:e.mode};return r.link==="canonical"?{...o,success:!0,link:"canonical"}:r.skipped?{...o,success:!0,link:r.link,skipped:!0,skipReason:r.skipReason,error:void 0}:r.blocked?{...o,success:!1,link:r.link,error:r.detail}:fu({storeDir:t.storePath,linkPath:r.path,slug:t.dir,root:e.root,mode:e.mode,agent:r.agent,label:r.label,platform:n.platform})}async function GE(e,t,r){await Ie.default.promises.mkdir(ve.default.dirname(t),{recursive:!0});let n=rg(t);try{await lu(e,n),await tg(t,r),await Ie.default.promises.rename(n,t)}finally{await Ie.default.promises.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}async function P$(e,t){let r;try{r=await Ie.default.promises.lstat(e)}catch{return!1}if(!r.isSymbolicLink())return!1;let n=await Ie.default.promises.readlink(e).catch(()=>null);if(n===null)return!1;let o=ve.default.resolve(ve.default.dirname(e),n);if(Xe(o,t))return!0;let[i,s]=await Promise.all([fr(o),fr(t)]);return Xe(i,s)}async function $$(e,t){let r;try{r=await Ie.default.promises.lstat(e)}catch(n){Vn(n)==="ELOOP"&&await Ie.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(r.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await tg(e,t)}async function tg(e,t){if(ve.default.basename(e)!==t)throw new d(`Refusing to delete ${b(e)}: its final component is not "${b(t)}". Please report this.`);let r;try{r=await Ie.default.promises.lstat(e)}catch{return}if(r.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await Ie.default.promises.rm(e,{recursive:!0,force:!0})}function rg(e){return`${e}.${(0,JE.randomBytes)(3).toString("hex")}.tmp`}async function KE(e){let t=ve.default.resolve(e),r=await fr(ve.default.dirname(t));return ve.default.join(r,ve.default.basename(t))}async function qE(e){let t;try{t=await Ie.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await Ie.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Zm(e){let t=e instanceof Error?e.message:String(e);return b(t)}var O$=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],L$=64;async function Za(e){let t=e.platform??process.platform,r=e.display??(c=>c),n=wr.default.resolve(e.root),o=at(e.scope,n),i=e.recorded??{},s=new Set(e.warnings??[]);await Qm(n,r);let a=await N$({targets:e.targets,scope:e.scope,root:n,storeBase:o,display:r,warn:c=>s.add(c)});for(let c of await U$({groups:a,skills:e.skills,display:r}))s.add(c);let l=[];for(let c of e.skills)l.push(await B$({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:r}));return{scope:e.scope,root:n,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function N$(e){let{targets:t,scope:r,root:n,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=St(c.agent,r,n);if(p===null){s(`${b(c.agent.displayName)} does not support ${r} installation and was skipped.`);continue}let f=a.get(p);f?(f.agents.push(c.agent),f.explicit=f.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let f=p.agents.slice().sort((h,y)=>h.id<y.id?-1:h.id>y.id?1:0);if(Xe(c,o)){l.push({dir:c,agents:f,canonical:!0});continue}if(await du(n,c)){let h=mu(c),y=`${b(i(c))} resolves outside ${b(i(n))}`+(h?` (check $${h})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:f,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await pu(n,c);if(m!==void 0){let h=`${b(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(h),l.push({dir:c,agents:f,canonical:!1,skipReason:"path-conflict",detail:h});continue}if(!(p.explicit||await M$(p.agents,r,n,c))){l.push({dir:c,agents:f,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${b(i(o))}`});continue}l.push({dir:c,agents:f,canonical:!1})}return l}function j$(e,t,r,n){if(t==="global")return wr.default.dirname(n);let[o]=e.skillsDir.split(/[\\/]/);return wr.default.join(r,o??e.skillsDir)}async function M$(e,t,r,n){for(let o of e)if(await W$(j$(o,t,r,n)))return!0;return!1}async function B$(e){let{discovered:t,groups:r,storeBase:n,mode:o,force:i,platform:s,display:a}=e,l=wr.default.join(n,t.dir),c=await H$(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,f=e.recorded!==null&&p===null,m=await XE({dest:l,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),g=[];for(let v of r){let _=v.canonical?l:wr.default.join(v.dir,t.dir),E=v.canonical?"canonical":o;if(v.canonical||v.skipReason!==void 0){g.push({agent:ZE(v),agents:v.agents.map(U=>U.id),label:QE(v),path:_,link:E,overwrite:v.canonical?m.overwrite:"fresh",blocked:v.canonical?m.blocked:!1,skipped:!v.canonical,...v.skipReason!==void 0?{skipReason:v.skipReason}:{},...v.detail!==void 0?{detail:v.detail}:{}});continue}let S=await XE({dest:_,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),L=us(S.overwrite)&&!i;g.push({agent:ZE(v),agents:v.agents.map(U=>U.id),label:QE(v),path:_,link:E,overwrite:S.overwrite,blocked:L,skipped:!1,...L?{detail:YE(S,_,a)}:{}})}let h=us(m.overwrite)&&!i,y=g.find(v=>v.blocked),k=h?YE(m,l,a):y?.detail;return{name:t.name,dir:t.dir,description:t.description,skillPath:t.skillPath,sourceDir:t.path,storePath:l,storeOverwrite:m.overwrite,upToDate:m.upToDate,targets:g,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:p,blocked:h||y!==void 0,...k!==void 0?{detail:k}:{}}}function YE(e,t,r){return e.problem===void 0?tv(e.overwrite,t,r):`${b(r(t))} could not be verified: ${e.problem} It was not installed by the Webflow CLI, or has been changed since. Re-run with --force to replace it.`}async function XE(e){let{dest:t,storePath:r,recorded:n,upstream:o,platform:i}=e,s=(c,p,f)=>({overwrite:c,upToDate:p,onDisk:f,blocked:!1}),a;try{a=await Qo.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await Qo.default.promises.readlink(t).catch(()=>null),p=c===null?null:wr.default.resolve(wr.default.dirname(t),c);return p!==null&&Xe(p,r)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await Xt(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:b(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(n===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(n!==null)return Ot(l,n,i)?s("managed-update",Ot(l,o,i),l):s("locally-modified",!1,l);if(Ot(l,o,i)){let c=await ev(t);return c===void 0?s("adoptable",!0,l):{overwrite:"unmanaged",upToDate:!1,onDisk:l,blocked:!1,problem:`it matches the pinned upstream content but also contains "${b(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function ev(e,t="",r=0){if(r>Fo)return;let n;try{n=await Qo.default.promises.readdir(e,{withFileTypes:!0})}catch{return}n.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of n){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(_o.has(o.name))return i;let s=await ev(wr.default.join(e,o.name),i,r+1);if(s!==void 0)return s;continue}if(!o.isFile()||Ao.has(o.name))return i}}function tv(e,t,r=n=>n){let n=b(r(t));return e==="locally-modified"?`${n} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${n} already exists, differs from the pinned upstream content, and was not installed by the Webflow CLI (no lockfile entry). It may be managed by another tool \u2014 the Claude Code plugin marketplace installs the same skills. Re-run with --force to take ownership and replace it.`}async function U$(e){let{groups:t,skills:r,display:n}=e,o=new Map(r.map(s=>[s.name,s.dir]));if(o.size===0)return[];let i=[];for(let s of t){if(s.skipReason!==void 0)continue;let a;try{a=await Qo.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,p)=>c.name<p.name?-1:c.name>p.name?1:0);let l=L$;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let p=wr.default.join(s.dir,c.name,Pt),f;try{f=Ko(await Qo.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(f);m===void 0||m===c.name||i.push(`${b(n(s.dir))} already contains "${b(c.name)}", whose ${Pt} declares the name "${b(f)}" \u2014 the same skill this install writes to "${b(m)}". Your agent would load it twice; remove one of them.`)}}return i}function mu(e){let t=wr.default.resolve(e);for(let r of O$){let n=process.env[r]?.trim();if(n&&ot(n,t))return r}}function ZE(e){return e.agents[0]?.id??""}function QE(e){let t=e.agents.map(r=>r.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function W$(e){try{return await Qo.default.promises.lstat(e),!0}catch{return!1}}async function H$(e){let t=await Xt(e);if(t!==null)return t;throw new d(`The extracted skill directory ${b(e)} is no longer present. Re-run the command.`)}os();var Lt=1,sv=/^sha256:[0-9a-f]{64}$/,ng=128,og=1024,rv=256,V$=/[\x00-\x1f\x7f]/;function av(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>ng?`must be at most ${ng} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":Wi(e)}function gu(e){return e.trim()===""?"must not be empty":e.length>og?`must be at most ${og} characters`:Wi(e)}function nv(e){return(t,r)=>{let n=e(t);n!==null&&r.addIssue({code:B.ZodIssueCode.custom,message:n})}}var lv=B.string().regex(Gt,"must be a 40-character lowercase commit SHA"),cv=B.string().regex(Cc,"is not a usable git ref for this repository"),ov=B.string().regex(sv,'must look like "sha256:<64 lowercase hex>"'),G$=B.string().min(1,"must not be empty").max(Nc).refine(e=>e.trim()!=="","must not be blank").refine(e=>!V$.test(e),"must not contain control characters"),iv=B.string().datetime({offset:!0}),uv=B.object({commit:lv,dir:B.string().superRefine(nv(av)),skillPath:B.string().superRefine(nv(gu)).optional(),contentHash:ov.optional(),modeHash:ov.optional(),ref:cv.optional(),agents:B.array(B.string().min(1).max(64)).default([]),mode:B.enum(["symlink","copy"]).default("symlink"),category:B.string().min(1).max(64).optional(),installedAt:iv.optional(),updatedAt:iv.optional()}).passthrough(),dv=B.object({repo:B.string().min(1).max(rv).default(be),ref:cv.default(Ge),commit:lv.optional(),pluginVersion:B.string().min(1).max(rv).optional()}).passthrough(),pv=B.object({lockfileVersion:B.number().int().min(0),source:dv.default({}),skills:B.record(G$,uv).default({})}).passthrough();function fv(e){return e.length===0?"the lockfile":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function ig(e){let[t]=e.issues;return t?`${fv([...t.path])} ${t.message}`:"did not match the expected shape"}function hu(e){return pv.safeParse(e)}var yu=w(require("path"));Ii();C();var mv="webflow-skills-lock.json",gv="skills-lock.json";function ei(e){if(typeof e!="string"||e.trim()==="")throw new d("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return yu.default.join(yu.default.resolve(e),mv)}function ti(){return yu.default.join(Cn(),gv)}function Qa(e,t){return e==="global"?ti():ei(t??"")}var yv=w(require("fs"));var K$=/^<{7}/m,J$=/^\uFEFF/;async function Nr(e){let t;try{t=await yv.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:z$(c)}}let r=t.replace(J$,"");if(K$.test(r))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(r.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let n;try{n=JSON.parse(r)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:q$(c,r)}}if(n===null||typeof n!="object"||Array.isArray(n))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${hv(n)}, not an object`};let o=n,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${hv(i)})`};let s=typeof i=="number"?i:0;if(s>Lt){let c=hu(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Lt?{...o,lockfileVersion:Lt}:o,l=hu(a);return l.success?s<Lt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:ig(l.error)}}function z$(e){let t=e.code,r=e instanceof Error?e.message:String(e);return t?`${{EACCES:"permission denied",EPERM:"operation not permitted",EISDIR:"the path is a directory, not a file",ELOOP:"too many symbolic links",ENOTDIR:"a parent path component is not a directory"}[t]??r} (${t})`:r}function q$(e,t){let r=e instanceof Error?e.message:String(e),n=/position (\d+)/.exec(r);if(!n)return r;let o=Number(n[1]);if(!Number.isFinite(o)||o<0)return r;let i=t.slice(0,o),s=i.split(`
128
+ `).length,a=o-(i.lastIndexOf(`
129
+ `)+1)+1;return`${r.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function hv(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?"a string":typeof e=="number"?"a number":typeof e=="boolean"?"a boolean":typeof e}function el(e,t){return e<t?-1:e>t?1:0}function ds(e){return[...new Set(e)].sort(el)}function ps(e){return{lockfileVersion:Lt,source:{repo:be,ref:Ge,...e},skills:{}}}function br(e){return Object.keys(e.skills).sort(el)}function wu(e){return Object.keys(e.skills).length===0}function tl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function sg(e,t){return{...e,skills:{...e.skills,...t}}}function ag(e,t){return{...e,source:{...e.source,...t}}}function lg(e,t){let r=[],n=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],r.push(i)):n.push(i);return{lock:{...e,skills:o},removed:r,missing:n}}function rl(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function cg(e){let{installedAt:t,updatedAt:r,...n}=e;return n}var bv=require("crypto"),fs=w(require("fs")),fg=w(require("path"));F();var wv=w(require("path"));C();function bu(e){return b(wv.default.basename(e))}function ug(e){return b(e)}function ri(e){let t=bu(e.path),r=b(e.detail);if(e.reason==="merge-conflict")return new d(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new d(`Could not read ${t}: ${r}.
130
+ ${ug(e.path)}`,{isUserError:!0});let n=e.reason==="invalid-json"?`${t} is not valid JSON: ${r}`:`${t} is not a valid lockfile: ${r}`;return new d(`${n}.
131
+ ${ug(e.path)}
132
+ Fix the file and re-run. It is not read as empty on purpose \u2014 that would discard the record of every installed skill on the next write.`,{isUserError:!0})}function ni(e){return new d(`Your ${bu(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Lt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function dg(e,t){return new d(`Refusing to write ${bu(e)}: it is at lockfile version ${t} and this CLI supports ${Lt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function pg(e,t){let r=b(t instanceof Error?t.message:String(t));return new d(`Could not write ${bu(e)}: ${r}.
133
+ ${ug(e)}
134
+ Your skills are on disk but are not recorded, so 'webflow skills update' and 'webflow skills remove' will not see them. Fix the problem and re-run the same install \u2014 it adopts the existing directories and does not need --force.`)}var kv=420,Du=448,Dv=8;function ku(e){if(Array.isArray(e))return e.map(ku);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(el).map(r=>[r,ku(t[r])]))}return e}function Y$(e,t){let r={};for(let[n,o]of Object.entries(e.skills)){let i={...o,agents:ds(o.agents??[])};r[n]=t==="project"?cg(i):i}return{...e,skills:r}}function Ev(e,t){let r=Y$(e,t.kind);return`${JSON.stringify(ku(r),null,2)}
135
+ `}async function vv(e,t,r){if(t.lockfileVersion>Lt)throw dg(e,t.lockfileVersion);let n=fg.default.resolve(e),o=fg.default.dirname(n),i=Ev(t,r),s=`${n}.${(0,bv.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await fs.default.promises.mkdir(o,{recursive:!0,mode:Du});let l=await fs.default.promises.open(s,"wx",kv);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await fs.default.promises.rename(s,n),a=!0}catch(l){throw pg(e,l)}finally{a||await fs.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function mg(e){try{return await fs.default.promises.unlink(e),!0}catch(t){return t.code!=="ENOENT"&&u.debug(`Could not remove the empty skills state file: ${t instanceof Error?t.message:String(t)}`),!1}}function oi(e){let t=e.batchSize??Dv,r=e.lock,n=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await vv(e.path,r,{kind:e.kind}),n=0,i=!1,o+=1)},a=async()=>{n+=1,i=!0,n>=t&&await s()};return{get lock(){return r},get pendingCount(){return n},get flushCount(){return o},async record(l,c){r=sg(r,{[l]:c}),await a()},async forget(l){let c=lg(r,[l]);return r=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){r=ag(r,l),i=!0},flush:s}}var Sv="skills_install";async function ms(e,t){let r=Date.now(),n=kt(),o=n?A.forSkills({authToken:n}):null;try{let i=await X$(e??[],t);await o?.sendUsage(Sv,{duration:Date.now()-r,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),Sv,{duration:Date.now()-r}),new d(i,{prefix:`${D} Failed to install skills:`,...i instanceof d&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function X$(e,t){let r=t.json===!0||He(),n=t.dryRun===!0,o=process.cwd(),i=await iu({global:t.global,project:t.project,yes:t.yes},o,r),s=t.global!==!0&&t.project!==!0,a=i==="global"?pe.home():o,l=ru({cwd:o,home:pe.home()}),c=i==="global"?"global":"project",p=Qa(c,a),f=await Nr(p);if(f.kind==="corrupt")throw ri(f);if(f.kind==="too-new")throw ni(f);let m=f.kind==="ok"?f.lock:ps({ref:t.ref??Ge}),g=br(m),h=e.length===0&&t.allSkills!==!0&&g.length>0&&(W()||t.yes===!0);await Ya(at(i,a),{dryRun:n});let y=h?tO(m,g,t.ref):[null],k=[],v=[],_=!1,E=[],S=0,L=0;for(let ue of y){let Ue=await Z$({group:ue,names:e,options:t,scope:i,root:a,lock:m,display:l,json:r});Ue!==null&&(k.push(Ue.plan),_=_||Ue.cacheHit,E=Ue.agents,S=Math.max(S,Ue.detectedCount),L+=Ue.duplicateNameWarnings)}if(k.length===0||k.every(ue=>ue.skills.length===0))return r?u.info(JSON.stringify(ou(lO({plan:k[0]??null,scope:i,root:a,lockPath:p,dryRun:n,restore:h,cacheHit:_,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),Eu({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:_,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L});let U=k[0];if(n){let ue=_v({plans:k,materialized:[],dryRun:!0,restore:h,cacheHit:_,lockPath:p});if(r)u.info(JSON.stringify(ou(ue),null,2));else{for(let Ue of k)u.info(Gm(Ue,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return Eu({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:_,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L})}if(t.yes!==!0&&!W()&&r)throw new d(`Installation requires confirmation, and --json cannot prompt.
136
+ Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!W()){for(let Ue of k)u.info(Gm(Ue,{dryRun:!1,display:l}));if(!await Ce({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),Eu({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:_,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L,cancelled:!0})}let j=oi({path:p,kind:c,lock:m}),re=new Date().toISOString();for(let ue of k)for(let Ue of ue.skills){let I=await Xa(ue,Ue);v.push(I);let Y=aO({plan:ue,skill:I,skillPath:Ue.skillPath,existing:tl(j.lock,I.name),previousAgents:tl(m,I.name)?.agents??[],restore:h,kind:c,now:re});Y!==null&&await j.record(I.name,Y)}j.updateSource({repo:U.source.repo,ref:U.source.ref,commit:U.source.commit,pluginVersion:U.source.pluginVersion}),await j.flush({force:!0});let G=_v({plans:k,materialized:v,dryRun:!1,restore:h,cacheHit:_,lockPath:p});return r?u.info(JSON.stringify(ou(G),null,2)):(u.info(RE(G,{display:l})),u.info(`Wrote ${l(p)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(G.failures.length>0||G.summary.blocked>0&&G.summary.installed===0)&&(process.exitCode=1),Eu({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:_,plans:k,materialized:v,agents:E,detectedCount:S,duplicateNameWarnings:L})}async function Z$(e){let{group:t,names:r,options:n,scope:o,root:i,lock:s,display:a}=e,l=await Ji(t===null||t.commit===void 0?{ref:t?.ref??n.ref}:{commit:t.commit,ref:t.ref}),c=await qi(l.root),p=await ss(c.skillsDir,l.root),f=[...c.warnings,...p.warnings],m=await rO({discovered:p.skills,names:r,allSkills:n.allSkills===!0,restoreNames:t?.names,recordedNames:br(s),warn:E=>f.push(E)});if(m.length===0)return null;let g=t===null?void 0:ds(t.names.flatMap(E=>tl(s,E)?.agents??[])),h=await Q$({scope:o,root:i,options:n,json:e.json,...g!==void 0&&g.length>0?{recordedAgents:g}:{}});for(let E of h.unknownRecorded)f.push(`The lockfile records the agent "${b(E)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=h.source==="explicit"||h.source==="prompt",k=h.agents.map(E=>({agent:E,explicit:y})),v={repo:be,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},_=await Za({scope:o,root:i,mode:t?.mode??(n.copy===!0?"copy":"symlink"),force:n.force===!0,source:v,skills:m,targets:k,recorded:s.skills,warnings:f,display:a});return{plan:_,cacheHit:l.fromCache,agents:h.agents,detectedCount:h.detected.length,duplicateNameWarnings:eO(_.warnings)}}async function Q$(e){let{scope:t,root:r,options:n,json:o}=e,i={scope:t,cwd:r,options:{agent:n.agent,allAgents:n.allAgents,yes:n.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(n.agent?.length??0)>0||n.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await Wa(t,r);if(a.length===0){let l=Kc(Yt);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return Ja({...i,detected:a})}return Ja(i)}function eO(e){return e.filter(t=>t.includes("would load it twice")).length}function tO(e,t,r){let n=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=r===void 0?`${i.commit}|${i.mode}`:i.mode,l=n.get(a);if(l){l.names.push(o);continue}n.set(a,{...r===void 0?{commit:i.commit}:{},ref:r??s,mode:i.mode,names:[o]})}return[...n.values()]}async function rO(e){let{discovered:t,names:r,allSkills:n,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let p of o){let f=t.find(m=>m.name===p);if(f===void 0){s(`${b(p)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(f)}return c}let a=t.filter(c=>!c.internal);if(n)return a;if(r.length>0)return r.map(c=>nO(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(W())throw new d(`No skills were named. Pass skill names, or --all-skills to install every skill in the catalog (${a.length} available).`,{isUserError:!0,missingFlag:"all-skills"});return iO(a,l)}function nO(e,t){let r=un(e,[...t]);if(r.kind==="match")return r.skill;throw r.kind==="ambiguous"?new d(`"${b(e)}" matches more than one skill: ${r.matches.map(n=>b(n.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new d(`No skill matches "${b(e)}".`+(r.candidates.length>0?`
137
+ Available: ${r.candidates.map(n=>b(n)).join(", ")}`:""),{isUserError:!0})}var oO=20,xv=60;async function iO(e,t){let r=new Set(t.map(s=>s.name)),n=[...e].sort((s,a)=>Cv(s.category??"",a.category??"")||Cv(s.name,a.name)),o=await Fr({message:"Select skills to install",pageSize:Math.min(oO,Math.max(4,n.length)),choices:n.map(s=>({value:s.name,name:`${b(s.name)} ${sO(b(s.description))}`,checked:r.has(s.name)})),validate:s=>s.length>0?!0:"Select at least one skill, or press Ctrl-C to cancel."}),i=new Set(o??[]);return n.filter(s=>i.has(s.name))}function Cv(e,t){return e<t?-1:e>t?1:0}function sO(e){return e.length<=xv?e:`${e.slice(0,xv-1)}\u2026`}function aO(e){let{plan:t,skill:r,existing:n,restore:o,kind:i,now:s}=e;if(!(r.storeAction==="written"||r.storeAction==="adopted"||r.storeAction==="unchanged")||r.hashes===null)return null;let l=new Map(t.skills.find(f=>f.name===r.name)?.targets.map(f=>[f.path,f.agents])??[]),c=[];for(let f of r.targets)f.skipped===!0||!f.success||c.push(...l.get(f.path)??[f.agent]);o&&c.push(...e.previousAgents);let p={agents:ds(c),commit:t.source.commit,contentHash:r.hashes.contentHash,modeHash:r.hashes.modeHash,dir:r.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?rl(p,{...n?{existing:n}:{},now:s}):p}function _v(e){let{plans:t,materialized:r,dryRun:n,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(p=>p.skills),warnings:[...new Set(t.flatMap(p=>p.warnings))],blocked:t.flatMap(p=>p.blocked)},c=Vm({plan:l,materialized:r,dryRun:n});return{plan:l,dryRun:n,restored:o,cacheHit:i,materialized:[...r],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(p=>p.source)}:{}}}function lO(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:be,ref:e.options.ref??Ge,commit:"",pluginVersion:""},skills:[],warnings:[],blocked:[]};return{plan:e.plan??t,dryRun:e.dryRun,restored:e.restore,cacheHit:e.cacheHit,materialized:[],lockfilePath:e.lockPath,blocked:[],failures:[],summary:{requested:0,installed:0,skipped:0,blocked:0,failed:0,storeWrites:0,symlinks:0,copies:0,symlinkFallbacks:0}}}function Eu(e){let t=e.plans[0],r=e.plans.flatMap(i=>i.skills),n={};for(let i of r)n[i.storeOverwrite]=(n[i.storeOverwrite]??0)+1;let o=t?Vm({plan:{...t,skills:r,blocked:[]},materialized:e.materialized,dryRun:e.dryRun}):null;return{count:o?.summary.installed??0,scope:e.scope,scopeAutoDetected:e.scopeAutoDetected,mode:t?.mode??(e.options.copy===!0?"copy":"symlink"),agentCount:e.agents.length,agentIds:e.agents.map(i=>i.id),detectedAgentCount:e.detectedCount,sharedDirTargetCount:r.reduce((i,s)=>i+s.targets.filter(a=>a.link==="canonical").length,0),symlinkFallbackCount:o?.summary.symlinkFallbacks??0,symlinkFallbackErrno:[...new Set(e.materialized.flatMap(i=>i.targets.filter(s=>s.symlinkFailed===!0).map(s=>s.errno??"unknown")))].sort(),skillNames:r.map(i=>i.name),refKind:cO(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:n,blockedCount:o?.summary.blocked??0,skippedCount:o?.summary.skipped??0,warningCount:[...new Set(e.plans.flatMap(i=>i.warnings))].length,restored:e.restore,duplicateNameWarnings:e.duplicateNameWarnings,...e.cancelled===!0?{cancelled:!0}:{}}}function cO(e){return e===void 0||e===Ge?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}z();C();C();F();function ft(e){let t=Object.fromEntries(e.map(r=>[r.toLowerCase(),r]));return r=>{let n=[],o=[];for(let i of r){let s=t[i.toLowerCase()];s?n.push(s):o.push(i)}return{valid:n,invalid:o}}}function Re(e,t,r){let n=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(n);if(o.length===0)throw new d(`No valid fields specified. Available: ${r.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${r.join(", ")}`),o}he();F();N();X();var vu=w(require("fs")),gs=w(require("path"));var uO=256;async function Av(e){let{scope:t,lock:r}=e,n=gs.default.resolve(e.root),o=at(t,n),i=e.display??(p=>p),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let p of Object.keys(r.skills).sort()){let f=r.skills[p];c.add(f.dir),l.push(await dO({name:p,entry:f,scope:t,root:n,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await gO({scope:t,root:n,store:o,recordedDirs:c})),{scope:t,root:n,store:o,lockfile:e.lockfile,source:r.source,skills:l,warnings:a}}async function dO(e){let{name:t,entry:r,scope:n,root:o,store:i,platform:s,display:a,warn:l}=e,c=gs.default.join(i,r.dir),p=fO(r),f=await Xt(c),m={name:t,dir:r.dir,description:await hO(c),scope:n,status:"up-to-date",mode:r.mode,storePath:c,recordedHash:r.contentHash??null,onDiskHash:f?.contentHash??null,...r.skillPath!==void 0?{skillPath:r.skillPath}:{},...r.commit!==void 0?{commit:r.commit}:{},...r.ref!==void 0?{ref:r.ref}:{},...r.category!==void 0?{category:r.category}:{},agents:[]},g=[],h;for(let y of r.agents){let k=$r(y);if(k===void 0){g.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${b(t)} records the agent "${b(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let v=St(k,n,o);if(v===null){g.push({id:y,label:k.displayName,path:null,link:"missing",present:!1});continue}let _=gs.default.join(v,r.dir);if(Xe(_,c)){g.push({id:y,label:k.displayName,path:_,link:"canonical",present:f!==null});continue}let E=await mO(_);if(E==="missing"){g.push({id:y,label:k.displayName,path:_,link:"missing",present:!1}),l(`${b(t)} is recorded for ${b(k.displayName)} but ${b(a(_))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let S=!1;if(r.mode==="copy"&&E==="copy"&&p!==null){let L=await Xt(_);S=L===null||!Ot(L,p,s),S&&h===void 0&&(h=k.displayName)}g.push({id:y,label:k.displayName,path:_,link:E,present:!0,...S?{diverged:!0}:{}})}return{...m,agents:g,...pO({onDisk:f,recorded:p,platform:s,divergedLabel:h})}}function pO(e){let{onDisk:t,recorded:r,platform:n,divergedLabel:o}=e;return t===null?{status:"missing"}:r!==null&&!Ot(t,r,n)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${b(o)} copy diverges`}:{status:"up-to-date"}}function fO(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function mO(e){try{let t=await vu.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function gO(e){let{scope:t,store:r,recordedDirs:n}=e,o;try{o=await vu.default.promises.readdir(r,{withFileTypes:!0})}catch{return[]}let i=[],s=uO;for(let a of[...o].sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0)){if(s<=0)break;if(!a.isDirectory()&&!a.isSymbolicLink()||n.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=gs.default.join(r,a.name),c=await Xt(l);if(c===null)continue;let p=await Fv(l);p!==null&&tD(p.name)&&i.push({name:p.name,dir:a.name,description:p.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function hO(e){return(await Fv(e))?.description??""}async function Fv(e){try{let t=await vu.default.promises.readFile(gs.default.join(e,Pt),"utf8"),r=Ko(t);return{name:r.frontmatter.name,description:r.frontmatter.description}}catch{return null}}var Iv="skills_list",yO="name",wO=ft(Xo);async function Su(e){let t=Date.now(),r=kt(),n=r?A.forSkills({authToken:r}):null;try{let o=await bO(e);await n?.sendUsage(Iv,{duration:Date.now()-t,...o})}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),Iv,{duration:Date.now()-t}),new d(o,{prefix:`${D} Failed to list skills:`,...o instanceof d&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function bO(e){let t=e.json===!0||He(),r=process.cwd(),n=ru({cwd:r,home:pe.home()}),o=[],i=DO(e.fields,o),s=EO(e.sortBy),a=vO(e.order),l=SO(e.agent),c=kO(e),p=[],f=0;for(let h of c){let y=h==="global"?pe.home():r,k=Qa(h==="global"?"global":"project",y),v=await Nr(k),_;if(v.kind==="ok")_=v.lock;else if(v.kind==="too-new")_=v.lock??ps(),o.push(`${n(k)} was written by a newer Webflow CLI (lockfile version ${v.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(v.kind==="corrupt"){o.push(`Skipped ${n(k)} \u2014 ${v.detail}. Fix the file and re-run.`);continue}else _=ps();let E=await Av({scope:h,root:y,lockfile:k,lock:_,display:n});o.push(...E.warnings),f+=E.skills.length,l!==null&&(E.skills=E.skills.filter(S=>S.agents.some(L=>l.has(L.id)))),E.skills.sort(NE(s,a)),p.push(E)}let m=Km(p);if(t)return u.info(JSON.stringify(LE({inventories:p,warnings:o}),null,2)),gg({inventories:p,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&f>0?`No skills are linked into ${[...l].sort().join(", ")}. ${f} ${f===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${f===1?"it":"them"}.`:Jm);for(let h of nu(o))u.info(h);return gg({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}let g=[];for(let h of p){if(h.skills.length===0)continue;let y=$E(h.skills,{store:h.store,display:n});g.push([OE(h,{display:n}),"",TE(h.skills,i),...y===""?[]:["",y]].join(`
138
+ `))}u.info(g.join(`
139
+
140
+ `));for(let h of nu(o))u.info(h);return gg({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}function kO(e){if(e.global===!0&&e.project===!0)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function DO(e,t){let r=(e??qa).split(",").map(i=>i.trim()).filter(Boolean),{valid:n,invalid:o}=wO(r);if(n.length===0)throw new d(`No valid fields specified. Available: ${Xo.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${Xo.join(", ")}`),n}function EO(e){if(e===void 0||e==="")return yO;let t=cs.find(r=>r===e.trim().toLowerCase());if(t===void 0)throw new d(`Cannot sort by "${e}". Available: ${cs.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function vO(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new d(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function SO(e){let t=as(e);return t.length===0?null:new Set(ls(t).map(r=>r.id))}function gg(e){let t=new Set;for(let r of e.inventories)for(let n of r.skills)for(let o of n.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(r=>r.scope),statusCounts:{upToDate:e.summary.upToDate,modified:e.summary.modified,missing:e.summary.missing,unmanaged:e.summary.unmanaged},agentIds:[...t].sort(),json:e.json,fieldCount:e.fields.length,agentFiltered:e.agentFilter!==null}}var xt=w(require("fs")),nl=w(require("os")),lt=w(require("path"));z();C();he();Fe();F();N();X();async function Au(e,t){let r=Date.now(),n=WO();try{let o=t.json===!0||He(),i=await xO(e,t,o);await n?.sendUsage("skills_remove",{duration:Date.now()-r,count:i.summary.requested,removed:i.summary.removed,storeDeleted:i.summary.storeDeleted,storeKept:i.summary.storeKept,failed:i.summary.failed,dryRun:i.dryRun,agentFiltered:i.agents!==null}),NO(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-r,dryRun:t.dryRun===!0}),o instanceof d?o:new d(o,{prefix:`${D} Failed to remove skills:`})}}async function xO(e,t,r){let n=process.cwd(),o=[],i=t.dryRun===!0,s=await iu(t,n,r),a=s==="global"?nl.default.homedir():n,l=at(s,a),c=s==="global"?ti():ei(a),p=await Nr(c);if(p.kind==="corrupt")throw ri(p);if(p.kind==="too-new")throw ni(p);let f=p.kind==="ok"?p.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=as(t.agent),h=m.length===0||m.includes(Ka)?null:ls(m).map(I=>I.id),y=Or(s),k=await CO({agents:y,scope:s,root:a,storeBase:l,warnings:o}),v=Ov(k.dirNames,f),_=await AO({names:e,options:t,identities:v,scope:s,cwd:n,json:r,warnings:o});if(_.length===0)return $v({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let E=new Set(h??[...qo,Yt]);if(h?.includes(Yt))for(let I of _){let Y=(I.entry?.agents??[]).filter(H=>H!==Yt&&!E.has(H));if(Y.length>0)throw new d(`Cannot remove the shared store for "${b(I.name)}" while ${Y.map(H=>b(H)).join(", ")} still link to it.
141
+ Remove those first, or run \`webflow skills remove ${b(I.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${D} Cannot remove skills:`})}let S=[];for(let I of _)S.push(await IO({identity:I,agents:h===null?y:y.filter(Y=>h.includes(Y.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:E}));if(i)return{...hg({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:S.map(I=>BO(I,s)),summary:{requested:S.length,removed:0,storeDeleted:S.filter(I=>I.storeWillBeDeleted).length,storeKept:S.filter(I=>I.onDisk&&!I.storeWillBeDeleted).length,staleLockEntriesRemoved:S.filter(I=>!I.onDisk).length,failed:0},lockfileEmpty:MO(f,S),lockfileDeleted:!1};if(!await LO(S,s,t,r))return r||u.info("Removal cancelled \u2014 no changes made."),$v({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let L=new Set(k.skillDirs),U=oi({path:c,kind:s,lock:f}),j=[],re=[],G=[];for(let I of S){let Y=_.find(H=>H.dir===I.dir);re.push(await TO({plan:I,identity:Y,scope:s,root:a,storeBase:l,knownDirs:L,writer:U,failures:j,removedDirectories:G}))}await U.flush({force:!0});let ue=wu(U.lock),Ue=!1;return ue&&s==="global"&&(Ue=await mg(c)),{...hg({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:re,removedDirectories:G,failures:j,summary:{requested:S.length,removed:re.filter(I=>I.success).length,storeDeleted:re.filter(I=>I.storeAction==="deleted").length,storeKept:re.filter(I=>I.storeAction==="kept").length,staleLockEntriesRemoved:re.filter(I=>I.storeAction==="absent"&&I.lockEntry==="removed").length,failed:j.length},lockfileEmpty:ue,lockfileDeleted:Ue}}async function CO(e){let{agents:t,scope:r,root:n,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...wg(t,r,n,l)]){if(await UO(c)){i.push(`${ol(c)} is a symbolic link, not a directory. Skills are not removed through one \u2014 repoint or replace it, then re-run.`);continue}a.add(c);let p;try{p=await xt.default.promises.readdir(c,{withFileTypes:!0})}catch(f){let m=f.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${ol(c)}: ${yg(f)}`);continue}for(let f of p)(f.isDirectory()||f.isSymbolicLink())&&s.add(f.name)}return{dirNames:s,skillDirs:a}}function wg(e,t,r,n){let o=new Set;for(let i of e){try{let a=St(i,t,r);if(a!==null){if(ot(r,a))o.add(a);else if(n){let l=mu(a);n(`${ol(a)} resolves outside ${ol(r)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=lt.default.resolve(r,...i.skillsDir.split("/"));s.startsWith(lt.default.resolve(r)+lt.default.sep)&&o.add(s)}return[...o]}function Ov(e,t){let r=new Map;for(let n of e)r.set(n,{name:n,dir:n,folderName:n,entry:null});for(let n of br(t)){let o=t.skills[n];r.set(o.dir,{name:n,dir:o.dir,folderName:o.skillPath?Un(o.skillPath):o.dir,entry:o})}return[...r.values()]}function xu(e){return e.entry===null}function _O(e){return new d(`"${b(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
142
+ It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${D} Refusing to remove an unmanaged skill directory:`})}async function AO(e){let{names:t,options:r,identities:n,scope:o,cwd:i,json:s,warnings:a}=e,l=r.force===!0,c=n.filter(g=>!xu(g)),p=n.filter(xu);if(t.length>0){let g=[];for(let h of t){let y=un(h,n);if(y.kind==="match"){if(!l&&xu(y.skill))throw _O(y.skill);g.includes(y.skill)||g.push(y.skill);continue}throw y.kind==="ambiguous"?new d(`"${b(h)}" matches ${y.matches.length} installed skills: ${y.matches.map(k=>b(k.dir)).join(", ")}.
143
+ Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot remove skills:`}):await FO(h,y.candidates,o,i)}return g}if(r.all)return l?n:(Rv(p,a),c);if(W()||s)throw new d("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${D} Nothing to remove:`});let f=l?n:c;return l||Rv(p,a),f.length===0?[]:await Fr({message:`Which skills should be removed (${o} scope)?`,choices:f.map(g=>({value:g,name:`${b(g.dir)}${xu(g)?" (not in the lockfile)":""}`})),validate:g=>g.length>0?!0:"Select at least one skill."})??[]}function Rv(e,t){e.length!==0&&t.push(`${e.length} skill ${e.length===1?"directory":"directories"} have no lockfile entry and were left untouched: ${e.map(r=>b(r.dir)).join(", ")}. Pass --force to remove them too.`)}async function FO(e,t,r,n){let o=r==="project"?"global":"project",i=o==="global"?nl.default.homedir():n,s=o==="global"?ti():ei(i),a=await Nr(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await xt.default.promises.readdir(at(o,i)).catch(()=>[]);if(un(e,Ov(c,l)).kind!=="none")return new d(`"${b(e)}" is not installed at ${r} scope (${ol(r==="global"?nl.default.homedir():n)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${D} Cannot remove skills:`})}}return new d(`"${b(e)}" is not installed at ${r} scope.
144
+ `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>b(l)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot remove skills:`})}async function IO(e){let{identity:t,agents:r,scope:n,root:o,storeBase:i,removalTargets:s}=e,a=lt.default.join(i,t.dir),l=new Map;for(let m of r)for(let g of wg([m],n,o)){let h=lt.default.join(g,t.dir);if(Xe(h,a))continue;let y=l.get(h);if(y){y.agents.push(m.id);continue}await _u(h)&&l.set(h,{agent:m.id,agents:[m.id],label:m.displayName,path:h})}let c=[...l.values()].sort((m,g)=>m.path<g.path?-1:m.path>g.path?1:0),{deleted:p,keptBecause:f}=await RO({identity:t,allAgents:e.allAgents,scope:n,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await _u(a),targets:c,storeWillBeDeleted:p,keptBecause:f}}async function RO(e){let{identity:t,removalTargets:r}=e,n=t.entry?.agents??[];if(n.length>0){let i=n.filter(s=>!r.has(s)).sort((s,a)=>s<a?-1:s>a?1:0);return{deleted:i.length===0,keptBecause:i}}let o=[];for(let i of e.allAgents)if(!r.has(i.id))for(let s of wg([i],e.scope,e.root)){let a=lt.default.join(s,t.dir);if(!Xe(a,lt.default.join(e.storeBase,t.dir))&&await _u(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function TO(e){let{plan:t,identity:r,scope:n,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let f of t.targets){let m=await _u(f.path);try{await Tv({target:f.path,slug:t.dir,knownDirs:o,root:e.root}),await Pv(f.path),a.push({...f,action:m?"unlinked":"absent",error:null})}catch(g){l=!0;let h=yg(g);s.push({name:r.name,agent:f.agent,...Cu(g)!==void 0?{errno:Cu(g)}:{},message:h}),a.push({...f,action:"failed",error:h})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await Tv({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await Pv(t.storePath),c="deleted"}catch(f){l=!0,c="failed",s.push({name:r.name,...Cu(f)!==void 0?{errno:Cu(f)}:{},message:yg(f)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let p="absent";return!l&&r.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(r.name,{...r.entry,agents:t.keptBecause}),p="updated"):p=await i.forget(r.name)?"removed":"absent"),l||e.removedDirectories.push(...await $O({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:n})),{name:r.name,dir:t.dir,scope:n,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:p,targets:a,success:!l,error:null}}async function Tv(e){let{target:t,slug:r,knownDirs:n,root:o}=e;if(lt.default.basename(t)!==r)throw new d(`Refusing to delete ${b(t)}: its final component is not "${b(r)}".`);let i=lt.default.dirname(t),s;try{s=await xt.default.promises.realpath(i)}catch{throw new d(`Refusing to delete ${b(t)}: its parent directory ${b(i)} could not be resolved.`)}if(!await PO(n,s))throw new d(`Refusing to delete ${b(t)}: ${b(i)} is not a known skills directory.`);let l=await xt.default.promises.realpath(o).catch(()=>o);if(Xe(s,l))throw new d(`Refusing to delete ${b(t)}: ${b(i)} resolves to the scope root itself, not to a skills directory.`);Be(l,lt.default.join(s,lt.default.basename(t)),"a skill directory being removed")}async function PO(e,t){for(let r of e){if(Xe(r,t))return!0;let n=await xt.default.promises.realpath(r).catch(()=>null);if(n!==null&&Xe(n,t))return!0}return!1}async function Pv(e){let t=null;try{t=await xt.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await xt.default.promises.rm(e,{force:!0});return}await xt.default.promises.rm(e,{recursive:!0,force:!0})}async function $O(e){let t=[],r=new Set([e.root,nl.default.homedir(),lt.default.dirname(e.root)].map(o=>lt.default.resolve(o))),n=[];for(let o of e.targets)n.push(lt.default.dirname(o.path));e.storeDeleted&&n.push(e.storeBase,lt.default.dirname(e.storeBase));for(let o of n){let i=lt.default.resolve(o);if(!r.has(i)&&ot(e.root,i))try{let s=await xt.default.promises.realpath(i);if(r.has(s)||!await OO(e.root,s))continue;await xt.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function OO(e,t){let r=await xt.default.promises.realpath(e).catch(()=>e);return ot(r,t)&&!Xe(r,t)}async function LO(e,t,r,n){if(r.yes)return!0;if(W()||n)throw new d(`Removal requires confirmation in non-interactive mode.
145
+ Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot remove skills:`});return u.info(zm(e,t)),Ce({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function NO(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${Z} ${b(r)}`);if(e.dryRun){u.info(zm(e.skills.map(r=>({name:r.name,dir:r.dir,storePath:r.storePath,onDisk:r.storeAction!=="absent",targets:r.targets,storeWillBeDeleted:r.storeAction==="deleted",keptBecause:r.keptBecause})),e.scope,{dryRun:!0}));return}u.info(ME(e))}function jO(e,t){let r=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&r.add(i)}if(r.size!==1)return null;let[n]=[...r];return n==="copy"?"copy":"symlink"}function hg(e){return{kind:"skills.remove",schemaVersion:Hn,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:jO(e.plans,e.lock),source:{...e.lock.source},agents:e.filterIds,skills:[],removedDirectories:[],failures:[],summary:{requested:0,removed:0,storeDeleted:0,storeKept:0,staleLockEntriesRemoved:0,failed:0},lockfileEmpty:!1,lockfileDeleted:!1,warnings:[...new Set(e.warnings)]}}function $v(e){return{...hg(e),lockfileEmpty:wu(e.lock)}}function MO(e,t){let r=new Set(t.filter(n=>n.keptBecause.length===0).map(n=>n.name));return br(e).every(n=>r.has(n))}function BO(e,t){return{name:e.name,dir:e.dir,scope:t,storePath:e.storePath,storeAction:e.onDisk?e.storeWillBeDeleted?"deleted":"kept":"absent",keptBecause:e.keptBecause,lockEntry:e.keptBecause.length>0?"updated":"removed",targets:e.targets.map(r=>({...r,action:"unlinked",error:null})),success:!0,error:null}}async function UO(e){try{return(await xt.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function _u(e){try{return await xt.default.promises.lstat(e),!0}catch{return!1}}function Cu(e){let t=e?.code;return typeof t=="string"?t:void 0}function yg(e){return b(e instanceof Error?e.message:String(e))}function WO(){let e=kt();return e?A.forSkills({authToken:e}):null}function ol(e){return Yo(e)}var hs=w(require("fs")),jv=w(require("os")),kr=w(require("path"));z();C();he();Fe();F();N();X();function Mv(e){let{presence:t,upstream:r,local:n,force:o}=e;if(!e.hasSkillPath){if(!e.foundByName)return{guard:"G2",state:"untracked",action:"skipped",willWrite:!1,blocked:!1,reason:"tracking-unrepairable"};let c=n==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:n==="absent"||r==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(n==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(n==="absent")return{guard:"G4",state:"missing",action:"reinstalled",willWrite:!0,blocked:!1,reason:"store-directory-missing"};if(t==="missing")return{guard:"G5",state:"removed-upstream",action:"orphaned",willWrite:!1,blocked:!1,reason:n==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":n==="differs"?r==="differs"?"conflict":"locally-modified":r==="differs"?"upstream-changed":"unchanged";if(n==="same")return i?{guard:"grid",state:s,action:r==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:r==="differs"?{guard:"grid",state:s,action:"updated",willWrite:!0,blocked:!1,reason:null}:{guard:"grid",state:s,action:"unchanged",willWrite:!1,blocked:!1,reason:null};let a=i?r==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":r==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?r==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&r==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function Fu(e,t){let r=Date.now(),n=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});let i=pL(),s=t.json===!0||He();try{let a=await HO({names:e,options:t,checkOnly:n,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-r,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:n,force:o,scopeCount:a.scopes.length}),uL(a,s),(a.failures.length>0||!n&&a.summary.conflicts>0&&a.summary.updated===0)&&(process.exitCode=1)}catch(a){throw await i?.sendError(a instanceof Error?a:new Error(String(a)),"skills_update",{duration:Date.now()-r,checkOnly:n,force:o}),a instanceof d?a:new d(a,{prefix:`${D} Failed to update skills:`})}}async function HO(e){let{names:t,options:r,checkOnly:n,force:o,json:i}=e,s=[],a=process.cwd(),l=await VO(r,a,n,s);if(l.length===0)return kg({checkOnly:n,force:o,warnings:s});let c=GO(l,t,r);if(c.length===0)return kg({checkOnly:n,force:o,warnings:s,scopes:l.map(S=>S.scope)});let p=new Map;for(let{state:S,key:L}of c){let U=bg(r,S.lock,L);p.has(U)||p.set(U,(await $a(U)).commit)}let f=new Map;for(let{state:S,key:L}of c){let U=S.lock.skills[L];f.set(`${S.scope}\0${L}`,await qO(S,U))}let m=c.every(({state:S,key:L})=>{let U=S.lock.skills[L];return p.get(bg(r,S.lock,L))===U.commit}),g=c.every(({state:S,key:L})=>f.get(`${S.scope}\0${L}`)!==null);if(m&&g&&r.ref===void 0&&!o)return cL({selected:c,states:l,localDigests:f,refs:p,options:r,checkOnly:n,force:o,warnings:s});let h=new Map;for(let S of new Set(p.values()))h.set(S,await zO(S,s));let y=[],k=[];for(let{state:S,key:L}of c){let U=S.lock.skills[L],j=bg(r,S.lock,L),re=p.get(j),G=h.get(re);try{y.push(await YO({state:S,key:L,entry:U,ref:j,commit:re,catalog:G,force:o,checkOnly:n,localDigest:f.get(`${S.scope}\0${L}`)??null,warnings:s}))}catch(ue){k.push({name:L,errno:Nv(ue),message:Dg(ue)})}}let v=y.filter(S=>S.localDrift==="differs"&&S.outcome.willWrite);if(!n&&v.length>0&&!await iL(v,r,i))return kg({checkOnly:n,force:o,warnings:s,scopes:l.map(L=>L.scope),cancelled:!0});let _=new Map,E=[];if(!n)for(let S of l)S.readOnly||await Ya(S.storeBase,{dryRun:!1});for(let S of y)try{E.push(await QO({candidate:S,checkOnly:n,force:o,options:r,writers:_,failures:k,warnings:s}))}catch(L){k.push({name:S.key,errno:Nv(L),message:Dg(L)}),E.push(sL(S,Dg(L)))}if(r.ref!==void 0&&!n)for(let S of l)S.readOnly||Bv(S,_);for(let[S,L]of _){let U=l.find(ue=>ue.scope===S),j=r.ref??U.lock.source.ref??Ge,re=p.get(j)??y.find(ue=>ue.scopeState.scope===S)?.commit,G=Vv(h);L.updateSource({ref:j,...re!==void 0?{commit:re}:{},...G!==void 0?{pluginVersion:G}:{}}),await L.flush({force:!0})}return lL({reports:E,candidates:y,failures:k,states:l,refs:p,catalogs:h,options:r,checkOnly:n,force:o,warnings:s})}async function VO(e,t,r,n){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?jv.default.homedir():t,l=s==="global"?ti():ei(a),c=await Nr(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ri(c);if(c.kind==="too-new"){if(!r||c.lock===null)throw ni(c);n.push(`${sl(l)} was written by a newer Webflow CLI (lockfile version ${c.version}); reporting read-only.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:at(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&n.push(`${sl(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:at(s,a),readOnly:r})}}return i}function GO(e,t,r){if(t.length===0)return e.flatMap(s=>br(s.lock).map(a=>({state:s,key:a})));let n=r.global===!0||r.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=un(s,JO(l.lock));if(c.kind==="ambiguous")throw new d(`"${b(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(p=>b(p.name)).join(", ")}.
146
+ Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw KO(s,e);if(a.length>1&&!n)throw new d(`"${b(s)}" is installed at more than one scope:
147
+ `+a.map(l=>` ${l.state.scope}: ${sl(l.state.lockPath)}`).join(`
148
+ `)+`
149
+ Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function KO(e,t){let r=t.flatMap(n=>br(n.lock).map(o=>n.lock.skills[o]?.dir??o));return new d(`"${b(e)}" is not installed.
150
+ `+(r.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(r)].sort().map(n=>b(n)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot update skills:`})}function JO(e){return br(e).map(t=>{let r=e.skills[t];return{name:t,dir:r.dir,folderName:r.skillPath?Un(r.skillPath):r.dir}})}function bg(e,t,r){return e.ref??t.skills[r]?.ref??t.source.ref??Ge}async function zO(e,t){let r=await Ji({commit:e}),n=await qi(r.root),o=await ss(n.skillsDir,r.root);return t.push(...n.warnings,...o.warnings),{commit:e,root:r.root,pluginVersion:n.version,skills:o.skills}}async function qO(e,t){let r=kr.default.join(e.storeBase,t.dir),n=await Xt(r);if(n===null)return null;if(t.mode!=="copy")return n;let o=vg(t);if(o===null)return n;for(let i of dL(t)){let s=St(i,e.scope,e.root);if(s===null)continue;let a=await Xt(kr.default.join(s,t.dir));if(a!==null&&!Ot(a,o))return a}return n}async function YO(e){let{state:t,key:r,entry:n,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=vg(n),p=kr.default.join(t.storeBase,n.dir),f=XO(n,s,l,r),m=s.skills.find(re=>re.name===r)??null,g=f!==null?"exists":m!==null?"moved":"missing",h=g==="exists"?f:g==="moved"?m.path:null,y=h===null?null:await Xt(h),k=e.localDigest===null?"absent":c===null||Ot(e.localDigest,c)?"same":"differs",v=Ot(y,c)?"same":"differs",_=Mv({hasSkillPath:typeof n.skillPath=="string"&&n.skillPath!=="",foundByName:m!==null,presence:g,upstream:v,local:k,force:a}),E=g==="moved"&&m!==null?m.dir:n.dir,S=g==="exists"?n.skillPath:g==="moved"?m.skillPath:n.skillPath??null,{agents:L,dropped:U}=ZO(t,n,l),j=h===null||S===null?null:{name:r,dir:E,folderName:Un(S),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:h,skillPath:S,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:r,entry:n,dir:n.dir,newDir:E,storeDir:p,mode:n.mode,agents:L,droppedAgents:U,presence:g,upstreamDrift:v,localDrift:k,outcome:_,recorded:c,onDisk:e.localDigest,upstream:y,discovered:j,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:aL(_,{key:r,storeDir:p,recordedSkillPath:n.skillPath??null,newSkillPath:S,checkOnly:e.checkOnly})}}function XO(e,t,r,n){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=gu(o);if(i!==null)return r.push(`The recorded path for "${b(n)}" ${i}; locating it by name instead.`),null;let s=kr.default.resolve(t.root,...o.split("/"));return Be(t.root,s,"the recorded skill path"),hs.default.existsSync(s)?kr.default.dirname(s):null}function ZO(e,t,r){let n=[],o=[];for(let i of t.agents??[]){if(i===Yt){n.push(i);continue}let s=$r(i);if(s===void 0){n.push(i);continue}if(St(s,e.scope,e.root)===null){o.push(i),r.push(`${b(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}n.push(i)}return{agents:n,dropped:o}}async function QO(e){let{candidate:t,checkOnly:r,force:n,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return il(t,r,[]);let l=await eL(t,n),c=new Set(t.droppedAgents);for(let h of l.targets)if(h.skipReason==="agent-dir-absent")for(let y of h.agents)c.add(y);e.warnings.push(...l.warnings);let p=t.agents.filter(h=>!c.has(h));if(p.length===0&&p.push(Yt),r)return il(t,!0,l.targets.map(h=>Eg(h)),[...c]);let f,m=t.onDisk;if(a.willWrite){let h=await Xa(l.plan,l.skill);if(f=h.targets.map((y,k)=>Uv(y,l.targets[k])),m=h.hashes,!h.success||h.storeAction==="failed"){let y=h.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let k of h.targets)!k.success&&k.error&&s.push({name:t.key,agent:k.agent,...k.errno!==void 0?{errno:k.errno}:{},message:k.error});return{...il(t,!1,f,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await rL(t,l.targets)}else{f=[];for(let h of l.targets)f.push(await tL(t,h))}let g=p.length!==(t.entry.agents??[]).length||p.some((h,y)=>(t.entry.agents??[])[y]!==h);return nL(t,a,g,o)&&!t.scopeState.readOnly&&await Bv(t.scopeState,i).record(t.key,oL(t,m,a,o,p)),il(t,!1,f,[...c])}async function eL(e,t){let r={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},n=[];for(let s of e.agents){if(s===Yt)continue;let a=$r(s);a!==void 0&&n.push({agent:a,explicit:!1})}let o=await Za({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:r,skills:[e.discovered],targets:n,recorded:e.scopeState.lock.skills,platform:process.platform,display:sl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function tL(e,t){if(t.skipped||t.link==="canonical")return Eg(t);if(t.overwrite!=="fresh")return{...Eg(t),action:"unchanged"};let r=await fu({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...Uv(r,t),action:r.success?"relinked":"failed"}}async function rL(e,t){let r=e.dir,n=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>kr.default.dirname(i.path))];for(let i of new Set(o)){let s=kr.default.join(i,r);if(kr.default.basename(s)===r&&s!==kr.default.join(i,e.newDir))try{let a=await hs.default.promises.realpath(i);if(!ot(n,a))continue;await Ui(n,kr.default.join(a,r),"a renamed skill directory"),(await hs.default.promises.lstat(s)).isSymbolicLink()?await hs.default.promises.rm(s,{force:!0}):await hs.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function nL(e,t,r,n){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||n.ref!==void 0&&n.ref!==e.entry.ref?!0:r}function oL(e,t,r,n,o){let i=r.willWrite,s={...e.entry,commit:i?e.commit:e.entry.commit,dir:i?e.newDir:e.entry.dir,agents:[...o],mode:e.mode,...e.discovered!==null?{skillPath:e.discovered.skillPath}:{},...n.ref!==void 0?{ref:n.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?rl(s,{existing:e.entry,now:new Date().toISOString()}):s}function Bv(e,t){let r=t.get(e.scope);if(r)return r;let n=oi({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,n),n}async function iL(e,t,r){if(t.yes)return!0;if(W()||r)throw new d(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
151
+ `+e.map(n=>` ${b(n.key)}`).join(`
152
+ `)+`
153
+ Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let n of e)u.warn(` ${b(n.key)}`);return Ce({message:"Discard local changes and replace with upstream?",default:!1})}function il(e,t,r,n=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:Wv(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!n.includes(o)),droppedAgents:n,reason:e.outcome.reason,detail:e.detail,fromCommit:e.entry.commit,toCommit:e.outcome.willWrite?e.commit:null,skillPath:e.discovered?.skillPath??e.entry.skillPath??null,targets:r}}function sL(e,t){return{...il(e,!1,[]),state:"failed",action:"failed",detail:t}}function Eg(e){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.overwrite==="fresh"?"relinked":"unchanged",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:!1,errno:null,error:e.detail??null}}function Uv(e,t){return{agent:e.agent,agents:t?.agents??[e.agent],label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.success?"linked":"failed",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:e.symlinkFailed===!0,errno:e.errno??null,error:e.error??null}}function Wv(e,t){if(!t)return e;switch(e){case"updated":return"would-update";case"moved":return"would-move";case"moved+updated":return"would-move-and-update";case"reinstalled":return"would-reinstall";case"repaired":return"would-repair";default:return e}}function aL(e,t){let r=b(t.key),{checkOnly:n}=t;switch(e.reason){case"tracking-unrepairable":return"update tracking is missing and no upstream skill declares this name; nothing was changed.";case"not-on-disk-and-removed-upstream":return`not on disk and no longer published upstream. Clear the entry with \`webflow skills remove ${r}\`.`;case"store-directory-missing":return n?"the store directory is missing and would be restored.":"the store directory was missing and has been restored.";case"removed-upstream":return`no longer published upstream. Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"locally-modified":return e.willWrite?Lv(n):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?Lv(n):`updating would discard your edits. Review ${sl(t.storeDir)}, then run \`webflow skills update ${r} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${b(t.recordedSkillPath)} \u2192 ${b(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?n?"moved upstream; local changes would be discarded.":"moved upstream; local changes were discarded.":"moved upstream AND locally modified. Re-run with --force.";case"moved-upstream-changed-upstream-and-locally-modified":return e.willWrite?n?"moved and changed upstream; local changes would be discarded.":"moved and changed upstream; local changes were discarded.":"moved upstream, changed upstream, AND locally modified. Re-run with --force.";default:return null}}function Lv(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function lL(e){let{reports:t,candidates:r,failures:n,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ge;return{kind:"skills.update",schemaVersion:Hn,checkOnly:e.checkOnly,force:e.force,scopes:o.map(c=>c.scope),source:{repo:a?.lock.source.repo??"",ref:l,recordedCommit:a?.lock.source.commit??null,resolvedCommit:i.get(l)??null,recordedPluginVersion:a?.lock.source.pluginVersion??null,resolvedPluginVersion:Vv(e.catalogs)??null,upToDate:!1},skills:t,blocked:r.filter(c=>c.outcome.blocked).map(c=>({name:c.key,dir:c.dir,scope:c.scopeState.scope,state:c.outcome.state,reason:c.outcome.reason,requiredFlag:"--force"})),failures:n,summary:Hv(t,n,e.checkOnly),warnings:[...new Set(e.warnings)]}}function Hv(e,t,r){let n=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:n("upstream-changed","renamed-upstream","missing","untracked"),unchanged:n("unchanged"),locallyModified:n("locally-modified"),conflicts:n("conflict"),removedUpstream:n("removed-upstream","stale-entry"),updated:r?0:e.filter(i=>o.has(i.action)).length,relinked:e.reduce((i,s)=>i+s.targets.filter(a=>a.action==="relinked").length,0),unlinked:e.reduce((i,s)=>i+s.droppedAgents.length,0),blocked:e.filter(i=>i.action==="blocked").length,failed:t.length}}function cL(e){let{selected:t,states:r,localDigests:n,refs:o,options:i}=e,s=r[0],a=i.ref??s?.lock.source.ref??Ge,l=t.map(({state:c,key:p})=>{let f=c.lock.skills[p],m=vg(f),g=n.get(`${c.scope}\0${p}`)??null,h=m!==null&&!Ot(g,m);return{name:p,dir:f.dir,scope:c.scope,guard:"grid",state:h?"locally-modified":"unchanged",action:h?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:g?.contentHash??null,agents:f.agents??[],droppedAgents:[],reason:h?"locally-modified":null,detail:h?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:f.commit,toCommit:null,skillPath:f.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:Hn,checkOnly:e.checkOnly,force:e.force,scopes:r.map(c=>c.scope),source:{repo:s?.lock.source.repo??"",ref:a,recordedCommit:s?.lock.source.commit??null,resolvedCommit:o.get(a)??null,recordedPluginVersion:s?.lock.source.pluginVersion??null,resolvedPluginVersion:s?.lock.source.pluginVersion??null,upToDate:!0},skills:l,blocked:[],failures:[],summary:Hv(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function kg(e){return{kind:"skills.update",schemaVersion:Hn,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:Ge,recordedCommit:null,resolvedCommit:null,recordedPluginVersion:null,resolvedPluginVersion:null,upToDate:!0},skills:[],blocked:[],failures:[],summary:{checked:0,outdated:0,unchanged:0,locallyModified:0,conflicts:0,removedUpstream:0,updated:0,relinked:0,unlinked:0,blocked:0,failed:0},warnings:[...new Set(e.warnings)]}}function uL(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${Z} ${b(r)}`);u.info(jE(e))}function vg(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function dL(e){let t=[];for(let r of e.agents??[]){let n=$r(r);n!==void 0&&t.push(n)}return t}function Vv(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function Nv(e){let t=e?.code;return typeof t=="string"?t:void 0}function Dg(e){return b(e instanceof Error?e.message:String(e))}function pL(){let e=kt();return e?A.forSkills({authToken:e}):null}function sl(e){return Yo(e)}z();he();Fe();F();X();var Gv=require("crypto"),dn=w(require("fs")),Iu=w(require("path"));Ii();F();var fL="skills-prompt.json",mL=1,gL=420;function Kv(){return Iu.default.join(Cn(),fL)}function Jv(){try{return dn.default.existsSync(Kv())}catch{return!1}}function Ru(e,t=[]){return{version:mL,answered:e,answeredAt:new Date().toISOString(),detectedAgents:[...t]}}function Tu(e){let t=Iu.default.resolve(Kv()),r=Iu.default.dirname(t),n=`${JSON.stringify(e,null,2)}
154
+ `,o=`${t}.${(0,Gv.randomBytes)(6).toString("hex")}.tmp`,i=!1;try{dn.default.mkdirSync(r,{recursive:!0,mode:Du});let s=dn.default.openSync(o,"wx",gL);try{dn.default.writeFileSync(s,n,"utf8");try{dn.default.fsyncSync(s)}catch{}}finally{dn.default.closeSync(s)}return dn.default.renameSync(o,t),i=!0,!0}catch(s){return u.debug(`Could not record the skills suggestion prompt: ${s instanceof Error?s.message:String(s)}`),!1}finally{if(!i)try{dn.default.rmSync(o,{force:!0})}catch{}}}F();function Zt(e,t={}){return e.hook("postAction",async(r,n)=>{try{await zv(n,t)}catch(o){u.debug(`Skills suggestion skipped: ${o instanceof Error?o.message:String(o)}`)}}),e}var hL="unanswered";async function zv(e,t={}){if(bL()||He()||t.except?.includes(e.name())||process.env[uE]!==void 0||W()||Jv())return;let r=Wm({cwd:process.cwd(),scope:"global"});r.unconfigured.length!==0&&await yL(r)}async function yL(e){let t=e.present.map(s=>s.id);if(!Tu(Ru(hL,t))){u.debug("Skipping the skills suggestion: the prompt could not be recorded as asked.");return}let r=DL(),n=kL(e),o=r?.sendUsage(dE,n);if(u.info(`Before you go: Webflow skills are not installed for ${EL(e.unconfigured.map(s=>s.displayName))}.`),!await Ce({message:"Install them so your agent knows how to use the Webflow CLI?",default:!1,exitOnCancel:!1})){Tu(Ru(!1,t)),await Promise.all([o,r?.sendUsage(fE,n)]);return}await wL(e.unconfigured.map(s=>s.id)),Tu(Ru(!0,t)),await Promise.all([o,r?.sendUsage(pE,n)])}async function wL(e){let t=process.exitCode;try{await ms([...Zc],{yes:!0,global:!0,agent:[...e]})}catch(r){u.debug(`Skills suggestion install failed: ${vL(r)}`),u.warn("Could not install the Webflow skills. Run `webflow skills install --global` to try again.")}finally{process.exitCode=t}}function bL(){let e=process.exitCode;return e!==void 0&&e!==0}function kL(e){return{agentIds:e.unconfigured.map(t=>t.id),agentCount:e.present.length,unconfiguredCount:e.unconfigured.length}}function DL(){let e=kt();return e?A.forSkillsSuggestion({authToken:e}):null}function EL(e){let t=e.slice(0,3).join(", "),r=e.length-3;return r>0?`${t} and ${r} more`:t}function vL(e){return e instanceof Error?e.message:String(e)}he();Oe();F();C();N();ge();An();var ke=require("commander");ge();var SL=/^[A-Za-z0-9_@%+=:,./-]+$/;function xL(e){return SL.test(e)?e:`'${e.replace(/'/g,`'"'"'`)}'`}function ys(e,t=[]){return e?`
80
155
 
81
- More: pass --cursor ${e}`:""}var bk=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],kk=["id","url","lastPublished","fullSiteCompiledAt"],Dk=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],hc="id,name,siteId,createdAt",Bf="id,name,description,siteId,appPath,createdAt",yc="id,url,lastPublished",wc="id,branch,deployUrl,latestDeploymentStatus,createdAt",GI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function KI(e,t){return e==null||e===""?P("\u2014"):GI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ga(e,t,r){if(e.length===0)return P(r);let n=t.map(i=>se(i)),o=e.map(i=>t.map(s=>KI(i[s],s)));return ze(n,o)}var bc=dt(bk),Ek=dt(kk),vk=dt(Dk);function Fn(){return bk}function ha(){return kk}function ya(){return Dk}function kc(e,t=hc.split(",")){return ga(e,t,"No apps found.")}function Sk(e,t=yc.split(",")){return ga(e,t,"No domains found.")}function xk(e,t=wc.split(",")){return ga(e,t,"No environments found.")}function Ck(e){return e.siteName?`Permanently delete app "${e.name}" (attached to site "${e.siteName}", ${e.id}). This cannot be undone.`:`Archive standalone app "${e.name}" (${e.id}).`}var JI=["success","failed","canceled","unstaged"],Dc=5,Ec=600;function Fk(e){return JI.includes(e)}var _k=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],wa="id,status,sourceType,commitHash,buildStartedAt",vc=dt(_k);function _n(){return _k}function ba(e,t=wa.split(",")){return ga(e,t,"No deployments found.")}Dn();var Uf=()=>new be.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),Wf=()=>new be.Option("--region <region>",`Webflow region to target: ${io.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(io),Ak=()=>new be.Option("--input","Force interactive mode, overriding the automatic no-input detection."),Hf=()=>new be.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),Vf=()=>new be.Option("--skip-update-check","Skip checking for @webflow packages updates"),Gf=()=>new be.Option("--verbose","Display more information for debugging purposes."),Xr=()=>new be.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Rt=()=>new be.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ri=e=>{if(e.trim()==="")throw new be.InvalidArgumentError("must be a non-empty value.");return e},Sc=(e,t)=>`Supplying multiple filters combines them with AND (all must match), so ${t} plus a non-matching --q returns an empty page \u2014 that means nothing matched all filters, not that the ${e} is absent.`,xc=e=>new be.Option("--q <text>",`Case-insensitive substring (contains) match on ${e}. Use it to discover matches; it never searches ids or variable values. For an exact single-item lookup, prefer the exact filter instead.`).argParser(Ri),re=()=>new be.Option("--json","Output as JSON"),ka=()=>new be.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Da=()=>new be.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),Kf=()=>new be.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),_e=()=>new be.Option("--dry-run","Preview without executing"),Ii=()=>new be.Option("-y, --yes","Skip confirmation prompt"),Ti=()=>new be.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Cc=()=>new be.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),Ea=()=>new be.Option("-g, --global","Operate on the per-user (home directory) install"),va=()=>new be.Option("-p, --project","Operate on the current project's install"),We=e=>new be.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Pi=e=>new be.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),Fc=()=>new be.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),_c=()=>new be.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),zI=100,Ac=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new be.InvalidArgumentError("must be a positive integer.");return t},Jf=()=>new be.Option("--limit <n>","Max log lines to return (default: 100)").default(zI).argParser(Ac),qI=20,Rk=()=>new be.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(qI).argParser(Ac),Ik=e=>{let t=Number(e);if(!Number.isInteger(t))throw new be.InvalidArgumentError("must be an integer number of seconds.");return t},Tk=()=>new be.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(Dc).argParser(Ik),Pk=()=>new be.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Ec).argParser(Ik),Sa=e=>async(t,r)=>{let o={...r.parent?.opts()||{},...t};await e(o)};var Ok=e=>{let t=e.command("auth").description("Authentication and configuration commands");t.command("login").description("Authenticate with Webflow and save credentials to .env file").option("-f, --force","Force reauthentication even if credentials exist").action(async r=>{if(V()){u.info(`${D} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:n}=oe();if(!r.force&&Ci()?.accessToken){let i=uo(n);u.info(`${$} Webflow credentials already exist (${ct().toUpperCase()}):`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
82
- Use --force flag to reauthenticate anyway`);return}try{u.info(`${rt} Authenticating against the ${ct().toUpperCase()} region...`);let o=await T({force:!0});Yr({apiToken:o}),u.info(`
83
- You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new d(o,{prefix:`${D} Authentication failed:`})}}),t.command("status").description("Show current authentication status").addOption(re()).action(async r=>{let n=ct(),o=Ci(),i=o?.accessToken?null:Vt(),s=o?.accessToken??i,a=!o?.accessToken&&!!i,l=a?process.env.WEBFLOW_API_TOKEN===i?"WEBFLOW_API_TOKEN":process.env.WEBFLOW_WORKSPACE_API_TOKEN===i?"WEBFLOW_WORKSPACE_API_TOKEN":"WEBFLOW_SITE_API_TOKEN":null;if(!s){r.json?u.info(JSON.stringify({loggedIn:!1,region:n},null,2)):u.info(`${D} Not logged in to the ${n.toUpperCase()} region. Run ${z("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let c=await Mf(s);if(!c){r.json?u.info(JSON.stringify({loggedIn:!1,region:n,error:"invalid_or_expired_token"},null,2)):u.info(`${D} Token is invalid or expired. Run ${z("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}if(r.json){u.info(JSON.stringify({loggedIn:!0,region:a?"unknown":n,user:{firstName:c.firstName,lastName:c.lastName,email:c.email},scopes:o?.scopes??[],...l?{tokenSource:l}:{}},null,2));return}u.info(`${$} Logged in as ${c.firstName} ${c.lastName} (${c.email})`),u.info(l?` Region: unknown (from ${l})`:` Region: ${n.toUpperCase()}`),o?.scopes?.length&&u.info(` Scopes: ${o.scopes.join(", ")}`),u.info(` Session: ${Sn()}`)}catch(c){throw new d(c,{prefix:`${D} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove the stored credentials").action(async()=>{let r=ma();if($f(),!r){u.info(`${$} No stored session to log out of.`);return}u.info(`${$} Logged out of the ${r.toUpperCase()} region.`),u.info(`${rt} Run ${z("webflow auth login")} to authenticate again.`)}),t.command("telemetry").description("Manage telemetry settings for all Webflow CLI commands").option("--enable","Enable telemetry for all commands").option("--disable","Disable telemetry for all commands").option("--status","Show current telemetry status").option("--local","Write the preference to the current directory's webflow.json instead of the global config").action(async r=>{let n=kn.getInstance();if(r.status){let s=await n.getTelemetryStatus();u.info($k(s.enabled));return}if(r.enable){await n.setPreference(!0,{local:r.local}),u.info(zf(!0));return}if(r.disable){await n.setPreference(!1,{local:r.local}),u.info(zf(!1));return}let o=await n.getTelemetryStatus();if(u.info($k(o.enabled)),V()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await je({message:"What would you like to do?",choices:[{name:"Enable telemetry for all commands",value:"enable"},{name:"Disable telemetry for all commands",value:"disable"},{name:"Cancel",value:"cancel"}]});if(i==="enable"||i==="disable"){let s=i==="enable";await n.setPreference(s,{local:r.local}),u.info(zf(s))}})},zf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,$k=e=>`${xe} Telemetry status: ${e?`enabled ${$}`:`disabled ${D}`}`;var tD=w(require("http")),rD=w(require("node-fetch")),nD=w(require("serve-handler")),oD=require("fs"),iD=w(require("path")),sD=require("commander");var Nk=w(require("archiver")),Yf=require("commander"),Tc=require("fs");var Lk=require("cosmiconfig"),qf=require("commander"),Rc=async(e,t)=>{let r=await YI(t),n=r.config.apiVersion;return n&&typeof n!="string"&&qf.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:r.filepath,config:{publicDir:e,...r.config}}},YI=async e=>{let r=await(0,Lk.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return r||qf.program.error(`No ${e} file was found. Run this command within your extension folder.`),r};var jk=w(require("mime-types")),Ic=w(require("path")),XI=5*1024*1024,ZI=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),Mk=async(e,t,r)=>{let{config:n,filepath:o}=await Rc(e,t),i=Ic.join(o,".."),s=!0,a=!1,l=p=>{let f=p.name,m=jk.default.lookup(f);return f==="index.html"&&(a=!0),f&&f.endsWith(".DS_Store")||!m?!1:ZI.has(m)?p:(console.log(`Invalid file type: ${m} for file: ${f}`),s=!1,!1)},c=p=>{(0,Tc.unlink)(r,f=>{f&&console.error(`Failed to delete file: ${f}`),Yf.program.error(p)})};return console.log(`Packaging the contents of the ${n.publicDir} folder into ${r}...`),new Promise(p=>{let f=(0,Nk.default)("zip",{zlib:{level:9}}),m=(0,Tc.createWriteStream)(Ic.join(i,r));m.on("close",()=>{p(void 0)}),f.directory(Ic.join(i,n.publicDir),!1,l),f.file(o,{name:t}),f.pipe(m),f.finalize(),f.on("warning",g=>{console.log(g)}),f.on("error",g=>{Yf.program.error(g.message)}),f.on("finish",()=>{if(!a){c("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!s){c("Bundling failed due to invalid file types");return}if(!f.pointer()||f.pointer()===0){c("Bundling failed with no output");return}if(f.pointer()>=XI){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${f.pointer()} total bytes written`),console.log(`Done! ${r} is ready for you to upload to your Webflow app.`)})})};var xa=w(require("path")),Fr=w(require("fs/promises")),Oc=w(require("fs")),Uk=require("url"),wW=require("dotenv/config"),Wk=["js","cjs","json"],Qf=process.cwd(),Hk=".webflowrc",Qr=xa.extname(Oc.readdirSync(Qf).find(e=>e.includes(Hk))??"").replace(/\./g,""),Zr=xa.join(Qf,`${Hk}${Qr&&`.${Qr}`}`),Vk=Oc.existsSync(Zr),Xf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${Wk.join(", ")}`)}},Pc=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Qr}. The supported extensions are: ${Wk.join(", ")}`)}},$c=class extends Error{constructor(t){let r=t.includes(".webflowrc"),n=t.includes("webflow.json"),o;r?o=`It seems like you don't have a .webflowrc file in your project (${t}). Make sure there is a .webflowrc file in your project root.`:n?o=`It seems like you don't have a webflow.json file in your project (${t}). Make sure there is a webflow.json file in your project root.`:o=`It seems like you don't have a config file in your project (${t}). Make sure there is a config file in your project root.`,super(o)}},Zf=class extends Error{constructor(t){super(`The following required fields are missing or undefined in your .webflowrc file: ${t}. If you're using process.env variables, make sure they're set up correctly.`)}};async function QI(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,Uk.pathToFileURL)(e).href:e)).default}function Bk(e,t){let r=t.filter(n=>!e[n]);if(r.length)throw new Zf(r.join(", "))}async function $i(e=[],t=!1){if(!Vk){if(t)return{};throw new $c(Zr)}if(!Qr)throw new Xf;switch(Qr){case"js":case"cjs":{await Fr.access(Zr);let r=await QI(Zr);return Bk(r,e),r}case"json":{let r=JSON.parse(await Fr.readFile(Zr,"utf8"));return Bk(r,e),r}default:throw new Pc}}function e0(e,t){if(Qr==="js"||Qr==="cjs"){let n=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(n)return n[1]}}function t0(e,t,r){let n=e0(t,r);if(n){let o=new RegExp(`${r}: ".*?",`,"g");return e.replace(o,`${r}: process.env.${n},`)}return e}async function r0(e){let t=["authToken","host","siteId"],r=await Fr.readFile(Zr,"utf-8");for(let n of t)e=t0(e,r,n);return e}async function n0(){try{let e=xa.join(Qf,"package.json");return await Fr.access(e),JSON.parse(await Fr.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function Gk(e){if(!Vk)throw new $c(Zr);let t=JSON.stringify(e,null,2);switch(Qr){case"js":case"cjs":{let r=await r0(t.replace(/"([^"]+)":/g,"$1:")),n=await n0()&&Qr==="js"?"export default ":"module.exports = ";return Fr.writeFile(Zr,n+r)}case"json":return Fr.writeFile(Zr,t);default:throw new Pc}}var An=w(require("fs")),Gt=w(require("path"));var Ca="webflow.json",Kk="index.html",Jk="bundle.zip",em="public",tm="extension-scaffolds",Lc="default";var zk="package.json",qk="wf-placeholder-name",rm=e=>JSON.stringify(e,null,2),Yk=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
156
+ More: pass ${["--cursor",e,...t].map(xL).join(" ")}`:""}function ws(e,t){let r=e?.join(",");return r&&r!==t?["--fields",r]:[]}var Yv=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],Xv=["id","url","lastPublished","fullSiteCompiledAt"],Zv=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],Pu="id,name,siteId,createdAt",Sg="id,name,description,siteId,appPath,createdAt",bs="id,url,lastPublished",$u="id,branch,deployUrl,latestDeploymentStatus,createdAt",CL=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function _L(e,t){return e==null||e===""?P("\u2014"):CL.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function al(e,t,r){if(e.length===0)return P(r);let n=t.map(i=>se(i)),o=e.map(i=>t.map(s=>_L(i[s],s)));return Ze(n,o)}var Ou=ft(Yv),Qv=ft(Xv),eS=ft(Zv);function Gn(){return Yv}function ll(){return Xv}function cl(){return Zv}function Lu(e,t=Pu.split(",")){return al(e,t,"No apps found.")}function tS(e,t=bs.split(",")){return al(e,t,"No domains found.")}function rS(e,t=$u.split(",")){return al(e,t,"No environments found.")}function nS(e){return e.siteName?`Permanently delete app "${e.name}" (attached to site "${e.siteName}", ${e.id}). This cannot be undone.`:`Archive standalone app "${e.name}" (${e.id}).`}function oS(e,t){let r=t===1?"1 environment":`${t} environments`,n=`Delete environment \`${e.branch}\` at ${e.mount} (${e.id}). This app has ${r}.`;return t===1&&(n+=" This is the app's only environment \u2014 the server will refuse this."),n}var AL=["success","failed","canceled","unstaged"],Nu=5,ju=600;function iS(e){return AL.includes(e)}var sS=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],ii="id,status,sourceType,commitHash,buildStartedAt",Mu=ft(sS);function Kn(){return sS}function ul(e,t=ii.split(",")){return al(e,t,"No deployments found.")}An();var xg=()=>new ke.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),Cg=()=>new ke.Option("--region <region>",`Webflow region to target: ${mo.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(mo),aS=()=>new ke.Option("--input","Force interactive mode, overriding the automatic no-input detection."),_g=()=>new ke.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),Ag=()=>new ke.Option("--skip-update-check","Skip checking for @webflow packages updates"),Fg=()=>new ke.Option("--verbose","Display more information for debugging purposes."),pn=()=>new ke.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Nt=()=>new ke.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),ks=e=>{if(e.trim()==="")throw new ke.InvalidArgumentError("must be a non-empty value.");return e},Bu=(e,t)=>`Supplying multiple filters combines them with AND (all must match), so ${t} plus a non-matching --q returns an empty page \u2014 that means nothing matched all filters, not that the ${e} is absent.`,Uu=e=>new ke.Option("--q <text>",`Case-insensitive substring (contains) match on ${e}. Use it to discover matches; it never searches ids or variable values. For an exact single-item lookup, prefer the exact filter instead.`).argParser(ks),ee=()=>new ke.Option("--json","Output as JSON"),si=()=>new ke.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),ai=()=>new ke.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),Ig=()=>new ke.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),_e=()=>new ke.Option("--dry-run","Preview without executing"),li=()=>new ke.Option("-y, --yes","Skip confirmation prompt"),Ds=()=>new ke.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Wu=()=>new ke.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),dl=()=>new ke.Option("-g, --global","Operate on the per-user (home directory) install"),pl=()=>new ke.Option("-p, --project","Operate on the current project's install"),Ke=e=>new ke.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Es=e=>new ke.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),Hu=()=>new ke.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),Vu=()=>new ke.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),FL=100,Gu=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new ke.InvalidArgumentError("must be a positive integer.");return t},Rg=()=>new ke.Option("--limit <n>","Max log lines to return (default: 100)").default(FL).argParser(Gu),IL=20,lS=()=>new ke.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(IL).argParser(Gu),cS=e=>{let t=Number(e);if(!Number.isInteger(t))throw new ke.InvalidArgumentError("must be an integer number of seconds.");return t},uS=()=>new ke.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(Nu).argParser(cS),dS=()=>new ke.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(ju).argParser(cS),fl=e=>async(t,r)=>{let o={...r.parent?.opts()||{},...t};await e(o)};var fS=e=>{let t=e.command("auth").description("Authentication and configuration commands");t.command("login").description("Authenticate with Webflow and save credentials to .env file").option("-f, --force","Force reauthentication even if credentials exist").action(async r=>{if(W()){u.info(`${D} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:n}=oe();if(!r.force&&ji()?.accessToken){let i=bo(n);u.info(`${$} Webflow credentials already exist (${ut().toUpperCase()}):`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
157
+ Use --force flag to reauthenticate anyway`);return}try{u.info(`${nt} Authenticating against the ${ut().toUpperCase()} region...`);let o=await R({force:!0});tn({apiToken:o}),u.info(`
158
+ You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new d(o,{prefix:`${D} Authentication failed:`})}}),t.command("status").description("Show current authentication status").addOption(ee()).action(async r=>{let n=ut(),o=ji(),i=o?.accessToken?null:kt(),s=o?.accessToken??i,a=!o?.accessToken&&!!i,l=a?process.env.WEBFLOW_API_TOKEN===i?"WEBFLOW_API_TOKEN":process.env.WEBFLOW_WORKSPACE_API_TOKEN===i?"WEBFLOW_WORKSPACE_API_TOKEN":"WEBFLOW_SITE_API_TOKEN":null;if(!s){r.json?u.info(JSON.stringify({loggedIn:!1,region:n},null,2)):u.info(`${D} Not logged in to the ${n.toUpperCase()} region. Run ${q("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let c=await Zf(s);if(!c){r.json?u.info(JSON.stringify({loggedIn:!1,region:n,error:"invalid_or_expired_token"},null,2)):u.info(`${D} Token is invalid or expired. Run ${q("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}if(r.json){u.info(JSON.stringify({loggedIn:!0,region:a?"unknown":n,user:{firstName:c.firstName,lastName:c.lastName,email:c.email},scopes:o?.scopes??[],...l?{tokenSource:l}:{}},null,2));return}u.info(`${$} Logged in as ${c.firstName} ${c.lastName} (${c.email})`),u.info(l?` Region: unknown (from ${l})`:` Region: ${n.toUpperCase()}`),o?.scopes?.length&&u.info(` Scopes: ${o.scopes.join(", ")}`),u.info(` Session: ${Rn()}`)}catch(c){throw new d(c,{prefix:`${D} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove the stored credentials").action(async()=>{let r=xa();if(Jf(),!r){u.info(`${$} No stored session to log out of.`);return}u.info(`${$} Logged out of the ${r.toUpperCase()} region.`),u.info(`${nt} Run ${q("webflow auth login")} to authenticate again.`)}),t.command("telemetry").description("Manage telemetry settings for all Webflow CLI commands").option("--enable","Enable telemetry for all commands").option("--disable","Disable telemetry for all commands").option("--status","Show current telemetry status").option("--local","Write the preference to the current directory's webflow.json instead of the global config").action(async r=>{let n=_n.getInstance();if(r.status){let s=await n.getTelemetryStatus();u.info(pS(s.enabled));return}if(r.enable){await n.setPreference(!0,{local:r.local}),u.info(Tg(!0));return}if(r.disable){await n.setPreference(!1,{local:r.local}),u.info(Tg(!1));return}let o=await n.getTelemetryStatus();if(u.info(pS(o.enabled)),W()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await Me({message:"What would you like to do?",choices:[{name:"Enable telemetry for all commands",value:"enable"},{name:"Disable telemetry for all commands",value:"disable"},{name:"Cancel",value:"cancel"}]});if(i==="enable"||i==="disable"){let s=i==="enable";await n.setPreference(s,{local:r.local}),u.info(Tg(s))}}),Zt(t,{except:["status"]})},Tg=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,pS=e=>`${xe} Telemetry status: ${e?`enabled ${$}`:`disabled ${D}`}`;var PS=w(require("http")),$S=w(require("node-fetch")),OS=w(require("serve-handler")),LS=require("fs"),NS=w(require("path")),jS=require("commander");var gS=w(require("archiver")),$g=require("commander"),zu=require("fs");var mS=require("cosmiconfig"),Pg=require("commander"),Ku=async(e,t)=>{let r=await RL(t),n=r.config.apiVersion;return n&&typeof n!="string"&&Pg.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:r.filepath,config:{publicDir:e,...r.config}}},RL=async e=>{let r=await(0,mS.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return r||Pg.program.error(`No ${e} file was found. Run this command within your extension folder.`),r};var hS=w(require("mime-types")),Ju=w(require("path")),TL=5*1024*1024,PL=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),yS=async(e,t,r)=>{let{config:n,filepath:o}=await Ku(e,t),i=Ju.join(o,".."),s=!0,a=!1,l=p=>{let f=p.name,m=hS.default.lookup(f);return f==="index.html"&&(a=!0),f&&f.endsWith(".DS_Store")||!m?!1:PL.has(m)?p:(console.log(`Invalid file type: ${m} for file: ${f}`),s=!1,!1)},c=p=>{(0,zu.unlink)(r,f=>{f&&console.error(`Failed to delete file: ${f}`),$g.program.error(p)})};return console.log(`Packaging the contents of the ${n.publicDir} folder into ${r}...`),new Promise(p=>{let f=(0,gS.default)("zip",{zlib:{level:9}}),m=(0,zu.createWriteStream)(Ju.join(i,r));m.on("close",()=>{p(void 0)}),f.directory(Ju.join(i,n.publicDir),!1,l),f.file(o,{name:t}),f.pipe(m),f.finalize(),f.on("warning",g=>{console.log(g)}),f.on("error",g=>{$g.program.error(g.message)}),f.on("finish",()=>{if(!a){c("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!s){c("Bundling failed due to invalid file types");return}if(!f.pointer()||f.pointer()===0){c("Bundling failed with no output");return}if(f.pointer()>=TL){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${f.pointer()} total bytes written`),console.log(`Done! ${r} is ready for you to upload to your Webflow app.`)})})};var ml=w(require("path")),jr=w(require("fs/promises")),Xu=w(require("fs")),bS=require("url"),N7=require("dotenv/config"),kS=["js","cjs","json"],Ng=process.cwd(),DS=".webflowrc",mn=ml.extname(Xu.readdirSync(Ng).find(e=>e.includes(DS))??"").replace(/\./g,""),fn=ml.join(Ng,`${DS}${mn&&`.${mn}`}`),ES=Xu.existsSync(fn),Og=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${kS.join(", ")}`)}},qu=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${mn}. The supported extensions are: ${kS.join(", ")}`)}},Yu=class extends Error{constructor(t){let r=t.includes(".webflowrc"),n=t.includes("webflow.json"),o;r?o=`It seems like you don't have a .webflowrc file in your project (${t}). Make sure there is a .webflowrc file in your project root.`:n?o=`It seems like you don't have a webflow.json file in your project (${t}). Make sure there is a webflow.json file in your project root.`:o=`It seems like you don't have a config file in your project (${t}). Make sure there is a config file in your project root.`,super(o)}},Lg=class extends Error{constructor(t){super(`The following required fields are missing or undefined in your .webflowrc file: ${t}. If you're using process.env variables, make sure they're set up correctly.`)}};async function $L(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,bS.pathToFileURL)(e).href:e)).default}function wS(e,t){let r=t.filter(n=>!e[n]);if(r.length)throw new Lg(r.join(", "))}async function vs(e=[],t=!1){if(!ES){if(t)return{};throw new Yu(fn)}if(!mn)throw new Og;switch(mn){case"js":case"cjs":{await jr.access(fn);let r=await $L(fn);return wS(r,e),r}case"json":{let r=JSON.parse(await jr.readFile(fn,"utf8"));return wS(r,e),r}default:throw new qu}}function OL(e,t){if(mn==="js"||mn==="cjs"){let n=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(n)return n[1]}}function LL(e,t,r){let n=OL(t,r);if(n){let o=new RegExp(`${r}: ".*?",`,"g");return e.replace(o,`${r}: process.env.${n},`)}return e}async function NL(e){let t=["authToken","host","siteId"],r=await jr.readFile(fn,"utf-8");for(let n of t)e=LL(e,r,n);return e}async function jL(){try{let e=ml.join(Ng,"package.json");return await jr.access(e),JSON.parse(await jr.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function vS(e){if(!ES)throw new Yu(fn);let t=JSON.stringify(e,null,2);switch(mn){case"js":case"cjs":{let r=await NL(t.replace(/"([^"]+)":/g,"$1:")),n=await jL()&&mn==="js"?"export default ":"module.exports = ";return jr.writeFile(fn,n+r)}case"json":return jr.writeFile(fn,t);default:throw new qu}}var Jn=w(require("fs")),Qt=w(require("path"));var gl="webflow.json",SS="index.html",xS="bundle.zip",jg="public",Mg="extension-scaffolds",Zu="default";var CS="package.json",_S="wf-placeholder-name",Bg=e=>JSON.stringify(e,null,2),AS=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
84
159
  \u2502 `+e+` \u2502
85
- \u2570`+t+"\u256F"};var Xk=async(e,t="./",r=Lc,n)=>{let o=n[r];try{for(let i of o){let s=Gt.join(t,i),a=s0(s,r,e);if(i.includes(zk)||i.includes(Ca))await i0(i,a,e);else{let l=await An.promises.readFile(i);await eD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},Zk=async()=>{let e={},t=Gt.resolve(__dirname),r=Gt.join(t,tm),n=await An.promises.readdir(r);for(let o of n){let i=Gt.join(r,o),s=await Qk(i);e[o]=s}return e},Qk=async e=>{let t=[];try{let r=await An.promises.readdir(e);for(let n of r){let o=Gt.join(e,n);if((await An.promises.stat(o)).isDirectory()){let s=await Qk(o);t.push(...s)}else t.push(o)}}catch(r){console.error(`Error reading ${Gt}, `,r)}return t},eD=async(e,t)=>{try{await An.promises.mkdir(Gt.dirname(e),{recursive:!0}),await An.promises.writeFile(e,t)}catch(r){console.error("Error writing file ",r)}},i0=async(e,t,r)=>An.promises.readFile(e,"utf8").then(async n=>{let o=n.replace(qk,r);await eD(t,o)}),s0=(e,t,r)=>{let n=Gt.join(tm,t),o=e.indexOf(n);if(o!==-1){let i=e.substring(o+n.length+1);return Gt.join(r,i)}return""};var Nc=async()=>await Zk(),aD=async()=>{let e=await Nc(),t=Object.keys(e).join(", ");console.log(`Your available templates are: ${t}`),console.log('\u{1F4A1} Syntax: "webflow extension init projectName templateName"'),console.log('\u{1F31F} Example: "webflow extension init my-first-extension react"')},lD=async(e,t=Lc)=>{let r=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let n=await Nc();await Xk(e,r,t,n),console.log(`Done! Check out ${r}/README.md for steps on how to develop your extension.`)},cD=()=>Mk(em,Ca,Jk),uD=async e=>{let{config:t,filepath:r}=await Rc(em,Ca),n=iD.join(r,"..",t.publicDir,Kk),i=(await $i([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(g=>t.featureFlags?.[g]===!0?`ff_on=${g}`:`ff_off=${g}`).join("&"),l=a?`&${a}`:"",p=await(await(0,rD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),f=new tD.Server((g,h)=>{if(g.url==="/"){oD.promises.readFile(n,{encoding:"utf-8"}).catch(y=>{sD.program.error(y.message)}).then(y=>{let k=p.replace("{{ui}}",y);return h.writeHead(200,{"Content-Length":Buffer.byteLength(k),"Content-Type":"text/html"}),h.end(k)});return}if(g.url==="/__webflow")return h.writeHead(200,{"Content-Length":Buffer.byteLength(rm(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),h.end(rm(t));(0,nD.default)(g,h,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=a0(e);f.listen(m),console.log(Yk(`Serving your extension at http://localhost:${m}`)+`
86
- `)},a0=e=>{if(e){let t=parseInt(e,10);return isNaN(t)?(console.log("Invalid port number provided. Using the default port "+1337),1337):t}return 1337};Oe();C();var dD=e=>{let t=e.command("extension").description("CLI for developing Designer Extensions.");t.command("list").description("Get list of project templates that can be used for `init`").action(aD),t.command("init").description("Bootstrap a Designer Extension.").argument("[projectName]","What is your Designer Extension's name?").argument("[scaffoldName]","Which project template do you want to use?").action(async(r,n)=>{let o=await Nc(),i=Object.keys(o),s=await Ge({message:"What would you like to name your Designer Extension?",default:r,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new d("When --no-input mode is enabled please provide the [projectName] argument.");let a=await je({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:n||"default"});await lD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(cD),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(uD)};var lm=w(require("process"));R();ke();Pe();var fD=w(require("fs"));C();async function Mc(e){let{authToken:t,siteId:r}=e||{},{path:n,isUserDefined:o}=cr(),i=fD.existsSync(n),s=!1;try{let{manifest:a}=oe();s=!0,o&&u.info(`Using manifest file: ${n}`);try{let l=ea(a,"devlink");if(!t||!r)throw new Error(`Missing Site ID or API token. Make sure you have WEBFLOW_API_TOKEN and WEBFLOW_SITE_ID set in your environment variables, or pass them as arguments --site and --api-token.
160
+ \u2570`+t+"\u256F"};var FS=async(e,t="./",r=Zu,n)=>{let o=n[r];try{for(let i of o){let s=Qt.join(t,i),a=UL(s,r,e);if(i.includes(CS)||i.includes(gl))await BL(i,a,e);else{let l=await Jn.promises.readFile(i);await TS(a,l)}}}catch(i){console.error("Error writing file, ",i)}},IS=async()=>{let e={},t=Qt.resolve(__dirname),r=Qt.join(t,Mg),n=await Jn.promises.readdir(r);for(let o of n){let i=Qt.join(r,o),s=await RS(i);e[o]=s}return e},RS=async e=>{let t=[];try{let r=await Jn.promises.readdir(e);for(let n of r){let o=Qt.join(e,n);if((await Jn.promises.stat(o)).isDirectory()){let s=await RS(o);t.push(...s)}else t.push(o)}}catch(r){console.error(`Error reading ${Qt}, `,r)}return t},TS=async(e,t)=>{try{await Jn.promises.mkdir(Qt.dirname(e),{recursive:!0}),await Jn.promises.writeFile(e,t)}catch(r){console.error("Error writing file ",r)}},BL=async(e,t,r)=>Jn.promises.readFile(e,"utf8").then(async n=>{let o=n.replace(_S,r);await TS(t,o)}),UL=(e,t,r)=>{let n=Qt.join(Mg,t),o=e.indexOf(n);if(o!==-1){let i=e.substring(o+n.length+1);return Qt.join(r,i)}return""};var Qu=async()=>await IS(),MS=async()=>{let e=await Qu(),t=Object.keys(e).join(", ");console.log(`Your available templates are: ${t}`),console.log('\u{1F4A1} Syntax: "webflow extension init projectName templateName"'),console.log('\u{1F31F} Example: "webflow extension init my-first-extension react"')},BS=async(e,t=Zu)=>{let r=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let n=await Qu();await FS(e,r,t,n),console.log(`Done! Check out ${r}/README.md for steps on how to develop your extension.`)},US=()=>yS(jg,gl,xS),WS=async e=>{let{config:t,filepath:r}=await Ku(jg,gl),n=NS.join(r,"..",t.publicDir,SS),i=(await vs([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(g=>t.featureFlags?.[g]===!0?`ff_on=${g}`:`ff_off=${g}`).join("&"),l=a?`&${a}`:"",p=await(await(0,$S.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),f=new PS.Server((g,h)=>{if(g.url==="/"){LS.promises.readFile(n,{encoding:"utf-8"}).catch(y=>{jS.program.error(y.message)}).then(y=>{let k=p.replace("{{ui}}",y);return h.writeHead(200,{"Content-Length":Buffer.byteLength(k),"Content-Type":"text/html"}),h.end(k)});return}if(g.url==="/__webflow")return h.writeHead(200,{"Content-Length":Buffer.byteLength(Bg(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),h.end(Bg(t));(0,OS.default)(g,h,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=WL(e);f.listen(m),console.log(AS(`Serving your extension at http://localhost:${m}`)+`
161
+ `)},WL=e=>{if(e){let t=parseInt(e,10);return isNaN(t)?(console.log("Invalid port number provided. Using the default port "+1337),1337):t}return 1337};Fe();C();var HS=e=>{let t=e.command("extension").description("CLI for developing Designer Extensions.");t.command("list").description("Get list of project templates that can be used for `init`").action(MS),t.command("init").description("Bootstrap a Designer Extension.").argument("[projectName]","What is your Designer Extension's name?").argument("[scaffoldName]","Which project template do you want to use?").action(async(r,n)=>{let o=await Qu(),i=Object.keys(o),s=await qe({message:"What would you like to name your Designer Extension?",default:r,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new d("When --no-input mode is enabled please provide the [projectName] argument.");let a=await Me({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:n||"default"});await BS(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(US),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(WS),Zt(t,{except:["serve"]})};var Kg=w(require("process"));F();De();Oe();var GS=w(require("fs"));C();async function td(e){let{authToken:t,siteId:r}=e||{},{path:n,isUserDefined:o}=dr(),i=GS.existsSync(n),s=!1;try{let{manifest:a}=oe();s=!0,o&&u.info(`Using manifest file: ${n}`);try{let l=pa(a,"devlink");if(!t||!r)throw new Error(`Missing Site ID or API token. Make sure you have WEBFLOW_API_TOKEN and WEBFLOW_SITE_ID set in your environment variables, or pass them as arguments --site and --api-token.
87
162
 
88
163
  To set up your credentials, run:
89
- webflow auth login`);return pD(l?.relativeHrefRoot),{...l,host:O(),authToken:t,siteId:r,cssModules:!!l?.cssModules,components:jc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new d(l,{prefix:`Failed to read devlink config from manifest file: ${n}
164
+ webflow auth login`);return VS(l?.relativeHrefRoot),{...l,host:O(),authToken:t,siteId:r,cssModules:!!l?.cssModules,components:ed(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new d(l,{prefix:`Failed to read devlink config from manifest file: ${n}
90
165
  `})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${n}
91
166
  `:`Your manifest file exists but is invalid or missing required properties: ${n}
92
- `;throw new d(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),r||a.push("siteId");let l=await $i(a);return pD(l?.relativeHrefRoot),{...l,host:l.host||O(),cssModules:!!l?.cssModules,components:jc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(a){throw a instanceof Error&&a.message.includes(".webflowrc")&&(a.message=`No configuration file found. Please create either:
167
+ `;throw new d(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),r||a.push("siteId");let l=await vs(a);return VS(l?.relativeHrefRoot),{...l,host:l.host||O(),cssModules:!!l?.cssModules,components:ed(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(a){throw a instanceof Error&&a.message.includes(".webflowrc")&&(a.message=`No configuration file found. Please create either:
93
168
  - webflow.json with a "devlink" section, or
94
169
  - .webflowrc file
95
- in your project root.`),new d(a)}}function pD(e){if(!(e===void 0||e===!1)){if(typeof e=="string"){if(e==="/"||e.startsWith("http://")||e.startsWith("https://"))return;throw new Error(`Invalid relativeHrefRoot value "${e}". Must be false, "/" or an absolute URL starting with http:// or https://`)}throw new Error(`Invalid relativeHrefRoot type. Must be false, "/" or an absolute URL string, got: ${typeof e}`)}}function jc(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}om();lt();C();var Oi=class extends Error{};function d0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function p0(e){switch(e.status){case 400:{let t=await e.text(),r=d0(t);throw new Oi(r||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new Oi("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new Oi("`webflow devlink sync` is no longer available. Run `webflow devlink export` instead \u2014 see the migration guide: https://developers.webflow.com/devlink/docs/reference/migrate-from-sync");default:throw new Oi(`Something went wrong (HTTP ${e.status}).`)}}async function f0(e){try{let{siteId:t,host:r,authToken:n,...o}=e,i=await K(`${r}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():p0(i)}catch(t){throw new d(t,{skipLogging:!0})}}async function im(e){try{let t=await f0(e);if(!t.files||!Array.isArray(t.files))throw new d("Invalid response format from V1 API: expected 'files' array");let r=t.metadata?.exportCoverage==="full";return await Uc(t.files,e.rootDir,r),{messages:t.messages}}catch(t){throw t instanceof d?t:new d(t,{skipLogging:!0})}}var fo=w(require("process"));R();Pe();lt();var sm=class{config;error;constructor(t,r){this.config=t,this.error=r}stripPII(t=""){return t.replace(/\/(.*)webflow-cli/gi,"/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi,"/REDACTED_PII/node_modules")}sendTelemetry(){let t=this.config,r=this.error;K(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:r.cause,message:r.message,name:r.name,stack:this.stripPII(r.stack),platform:fo.default.platform,node:fo.default.version})})}async storeChoice(t){try{return Se({devlink:{allowTelemetry:t}})}catch{let n=await $i();await Gk({...n,allowTelemetry:t})}}async prompt(){let t=this.config;u.error(this.error),t.allowTelemetry===!0?this.sendTelemetry():t.allowTelemetry===void 0&&(await this.storeChoice(!0),this.sendTelemetry())}};function Wc(e){return async function(r){fo.default.removeListener("uncaughtException",Wc),fo.default.removeListener("unhandledRejection",Wc);let n=await Mc(e);if(!n)return;await new sm(n,r).prompt()}}function mD(e){fo.default.on("uncaughtException",Wc(e)),fo.default.on("unhandledRejection",Wc(e))}Z();R();Y();Pe();am();async function gD(e,t){let r=Date.now(),{manifest:n}=oe(),{accessToken:o,siteId:i}=await Je(n,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:jc(e),overwriteModule:!1}:{overwriteModule:!0}};mD(s);let a=await Mc(s);if(!a)return lm.default.exit();let l;try{l=_.forDevlinkSync(a)}catch(p){u.debug(`Failed to initialize telemetry: ${p}`)}await l?.sendUsage("devlink_sync_start",{specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot});let c=u.spinner(`Exporting components into ${a.rootDir}`);try{let{messages:p}=await im(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),Hc(p);let f=Date.now()-r;await l?.sendUsage("devlink_sync_success",{duration:f,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);c.fail(`Failed to export components: ${f}`);let m=Date.now()-r;throw await l?.sendError(p instanceof Error?p:new Error(String(p)),"devlink_sync_failure",{duration:m,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot,configOverrides:Object.keys(s),argv:lm.default.argv.slice(2)}),p}}Yc();var $n=require("commander");var ho=require("path"),Hi=require("@webflow/data-types");ke();var Xc=require("fs"),hm=w(require("md5"));function _a(e,t){try{let r=(0,Xc.statSync)(e),n=(0,Xc.readFileSync)(e);return{value:n,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,hm.default)(n),size:r.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function Aa(e,t,r){try{let n=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,hm.default)(o),size:n,...r}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var LD=w(require("node-fetch")),ND=w(require("form-data"));async function Ra(e,t){let r={...t.fields,file:e.value},n=new ND.default;Object.entries(r).forEach(([i,s])=>{n.append(i,s)});let o=await(0,LD.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:n});E0(o)}function E0(e){switch(e.status){case 200:case 201:return;case 403:throw new Error("Unauthorized. Please check your AWS access key");default:throw new Error(`Something went wrong when uploading the file: ${e.statusText}`)}}R();Pe();Z();ke();lt();me();function v0({apiToken:e=process.env.WEBFLOW_API_TOKEN??process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN,siteId:t=process.env.WEBFLOW_SITE_ID,libraryTarget:r=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(r==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${O()}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${O()}/v2/workspaces`,authToken:e}}function S0(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function x0(e){if(e.ok)return;if(e.status===401||e.status===403)throw new Error(`Your API token is invalid or not authorized to perform this action. Run ${z("webflow auth login --force")} to generate a new token.`);if(e.status===404)throw new Error("Code components are rolling out in phases. Check back soon for access.");let t=await e.json();throw new Error(t.message||e.statusText)}async function In({endpoint:e,method:t="GET",body:r,options:n}){let{baseUrl:o,authToken:i}=v0(n),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await K(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:S0(r)});return await x0(a),a.json()}async function ym({options:e}){return(await In({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function wm({name:e,description:t,slug:r,options:n}){return(await In({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:r},options:n})).payload}async function bm({resourceId:e,files:t,options:r}){return(await In({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:r})).payload}async function km({resourceId:e,codeModule:t,components:r,options:n}){return(await In({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:r},options:n})).payload}var Mi=require("path"),_E=w(require("webpack-merge")),go=require("@webflow/data-types");ke();R();var BD=require("memfs/lib/volume"),Ia=require("@webflow/data-types");var _r="./tmp_entry",jD="components";function Zc(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+|[^\p{L}\p{N}]/gu," ").toLowerCase().replace(new RegExp("(?:^|\\s)(\\p{L})","gu"),(t,r)=>r.toUpperCase()).replace(/\s+/g,"")}function C0(e){let t=Zc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function MD(e,t){let r=e.map(({name:l,path:c,isDefaultExport:p})=>p?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
170
+ in your project root.`),new d(a)}}function VS(e){if(!(e===void 0||e===!1)){if(typeof e=="string"){if(e==="/"||e.startsWith("http://")||e.startsWith("https://"))return;throw new Error(`Invalid relativeHrefRoot value "${e}". Must be false, "/" or an absolute URL starting with http:// or https://`)}throw new Error(`Invalid relativeHrefRoot type. Must be false, "/" or an absolute URL string, got: ${typeof e}`)}}function ed(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}Wg();ct();C();var Ss=class extends Error{};function KL(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function JL(e){switch(e.status){case 400:{let t=await e.text(),r=KL(t);throw new Ss(r||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new Ss("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new Ss("`webflow devlink sync` is no longer available. Run `webflow devlink export` instead \u2014 see the migration guide: https://developers.webflow.com/devlink/docs/reference/migrate-from-sync");default:throw new Ss(`Something went wrong (HTTP ${e.status}).`)}}async function zL(e){try{let{siteId:t,host:r,authToken:n,...o}=e,i=await K(`${r}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():JL(i)}catch(t){throw new d(t,{skipLogging:!0})}}async function Hg(e){try{let t=await zL(e);if(!t.files||!Array.isArray(t.files))throw new d("Invalid response format from V1 API: expected 'files' array");let r=t.metadata?.exportCoverage==="full";return await nd(t.files,e.rootDir,r),{messages:t.messages}}catch(t){throw t instanceof d?t:new d(t,{skipLogging:!0})}}var ci=w(require("process"));F();Oe();ct();var Vg=class{config;error;constructor(t,r){this.config=t,this.error=r}stripPII(t=""){return t.replace(/\/(.*)webflow-cli/gi,"/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi,"/REDACTED_PII/node_modules")}sendTelemetry(){let t=this.config,r=this.error;K(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:r.cause,message:r.message,name:r.name,stack:this.stripPII(r.stack),platform:ci.default.platform,node:ci.default.version})})}async storeChoice(t){try{return Se({devlink:{allowTelemetry:t}})}catch{let n=await vs();await vS({...n,allowTelemetry:t})}}async prompt(){let t=this.config;u.error(this.error),t.allowTelemetry===!0?this.sendTelemetry():t.allowTelemetry===void 0&&(await this.storeChoice(!0),this.sendTelemetry())}};function od(e){return async function(r){ci.default.removeListener("uncaughtException",od),ci.default.removeListener("unhandledRejection",od);let n=await td(e);if(!n)return;await new Vg(n,r).prompt()}}function KS(e){ci.default.on("uncaughtException",od(e)),ci.default.on("unhandledRejection",od(e))}X();F();z();Oe();Gg();async function JS(e,t){let r=Date.now(),{manifest:n}=oe(),{accessToken:o,siteId:i}=await Ye(n,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:ed(e),overwriteModule:!1}:{overwriteModule:!0}};KS(s);let a=await td(s);if(!a)return Kg.default.exit();let l;try{l=A.forDevlinkSync(a)}catch(p){u.debug(`Failed to initialize telemetry: ${p}`)}await l?.sendUsage("devlink_sync_start",{specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot});let c=u.spinner(`Exporting components into ${a.rootDir}`);try{let{messages:p}=await Hg(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),id(p);let f=Date.now()-r;await l?.sendUsage("devlink_sync_success",{duration:f,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);c.fail(`Failed to export components: ${f}`);let m=Date.now()-r;throw await l?.sendError(p instanceof Error?p:new Error(String(p)),"devlink_sync_failure",{duration:m,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot,configOverrides:Object.keys(s),argv:Kg.default.argv.slice(2)}),p}}pd();var Zn=require("commander");var pi=require("path"),Ts=require("@webflow/data-types");De();var fd=require("fs"),eh=w(require("md5"));function yl(e,t){try{let r=(0,fd.statSync)(e),n=(0,fd.readFileSync)(e);return{value:n,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,eh.default)(n),size:r.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function wl(e,t,r){try{let n=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,eh.default)(o),size:n,...r}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var mx=w(require("node-fetch")),gx=w(require("form-data"));async function bl(e,t){let r={...t.fields,file:e.value},n=new gx.default;Object.entries(r).forEach(([i,s])=>{n.append(i,s)});let o=await(0,mx.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:n});nN(o)}function nN(e){switch(e.status){case 200:case 201:return;case 403:throw new Error("Unauthorized. Please check your AWS access key");default:throw new Error(`Something went wrong when uploading the file: ${e.statusText}`)}}F();Oe();X();De();ct();ge();function oN({apiToken:e=process.env.WEBFLOW_API_TOKEN??process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN,siteId:t=process.env.WEBFLOW_SITE_ID,libraryTarget:r=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(r==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${O()}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${O()}/v2/workspaces`,authToken:e}}function iN(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function sN(e){if(e.ok)return;if(e.status===401||e.status===403)throw new Error(`Your API token is invalid or not authorized to perform this action. Run ${q("webflow auth login --force")} to generate a new token.`);if(e.status===404)throw new Error("Code components are rolling out in phases. Check back soon for access.");let t=await e.json();throw new Error(t.message||e.statusText)}async function qn({endpoint:e,method:t="GET",body:r,options:n}){let{baseUrl:o,authToken:i}=oN(n),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await K(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:iN(r)});return await sN(a),a.json()}async function th({options:e}){return(await qn({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function rh({name:e,description:t,slug:r,options:n}){return(await qn({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:r},options:n})).payload}async function nh({resourceId:e,files:t,options:r}){return(await qn({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:r})).payload}async function oh({resourceId:e,codeModule:t,components:r,options:n}){return(await qn({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:r},options:n})).payload}var As=require("path"),sC=w(require("webpack-merge")),di=require("@webflow/data-types");De();F();var wx=require("memfs/lib/volume"),kl=require("@webflow/data-types");var Mr="./tmp_entry",hx="components";function md(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+|[^\p{L}\p{N}]/gu," ").toLowerCase().replace(new RegExp("(?:^|\\s)(\\p{L})","gu"),(t,r)=>r.toUpperCase()).replace(/\s+/g,"")}function aN(e){let t=md(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function yx(e,t){let r=e.map(({name:l,path:c,isDefaultExport:p})=>p?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
96
171
  `),n=e.filter(l=>l.type==="internal").map(({name:l,exportKey:c})=>`${c}: ${l}`).join(", "),o=e.filter(l=>l.type==="component").map(({name:l,exportKey:c})=>`"${c}": ${l}`).join(", "),i=`env: "${t}"`,s=n,a=o?`components: { ${o} }`:void 0;return`${r}
97
172
 
98
- export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function UD(e,t,r,n){let o={},i=`${_r}/Client.js`,s=`${_r}/Server.js`;o[i]=MD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],Ia.Environment.Client);let a={},l=p=>{let f=C0(p);return a[f]?(a[f]+=1,`${f}${a[f]}`):(a[f]=1,f)};o[s]=MD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>r[p]?.ssr??!0).map(([p,f])=>{let m=l(p),g=f.startsWith(_r)?f.replace(`${_r}/`,"./"):f;return{name:m,path:g,exportKey:p,isDefaultExport:!0,type:"component"}})],Ia.Environment.Server);let c={[Ia.Environment.Client]:i,[Ia.Environment.Server]:s};return{entryPointsVolume:BD.Volume.fromJSON(o,n),paths:c}}var AE=require("memfs/lib/volume");var KD=w(require("archiver")),Li=require("path");ke();var Ta=require("@webflow/data-types");ke();R();var Tn=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var WD=2;function HD(e){let t={type:Ta.ModuleLoader.FEDERATION,version:WD,entry:yf,renderer:aa,components:e};return{title:sa,content:JSON.stringify(t)}}function VD(e){let t={type:Ta.ModuleLoader.SSR,version:WD,entry:Ei,components:e};return{title:sa,content:JSON.stringify(t)}}function GD(e){let t=`/${Ta.Environment.Client}/${yf}`;try{if(e.existsSync(t)){let r=e.readFileSync(t,"utf8"),n=JSON.parse(r.toString()),o="publicPath"in n.metaData?n.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return n.exposes.reduce((i,s)=>{let a=s.name;return a===aa||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${Tn(o)}${l}`)})),i},{})}}catch(r){u.error(r,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Qc=require("@webflow/data-types"),F0=/\.css$/i;async function JD(e,t,r){let n=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Qc.Environment.Server}/${la}`,a=(0,KD.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",f=>(n=!0,i(f))),l.on("close",()=>{if(!n)try{let f={type:"asset",name:la,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let g=(0,Li.resolve)((0,Li.join)(`/${Qc.Environment.Server}`,m.name));t.existsSync(g)&&t.rmSync(g)}),o([f])}catch(f){return i(f)}finally{n=!0}}),a.pipe(l);let{title:c,content:p}=VD(r);a.append(p,{name:c}),e.forEach(f=>{if(!F0.test(f.name))try{let m=(0,Li.resolve)((0,Li.join)(`/${Qc.Environment.Server}`,f.name)),g=t.readFileSync(m,"utf8");a.append(g,{name:f.name})}catch(m){return n=!0,i(m)}}),await a.finalize()})}var zD=require("@webflow/data-types");async function qD(e,t,r){let{title:n,content:o}=HD(r);await t.promises.writeFile(`/${zD.Environment.Client}/${n}`,o);let i={type:"asset",name:n,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var DE=require("@rspack/core"),EE=w(require("fork-ts-checker-webpack-plugin")),vE=require("ts-checker-rspack-plugin"),SE=w(require("mini-css-extract-plugin")),xE=require("@webflow/data-types");var XD=require("webpack"),Em=w(require("mini-css-extract-plugin")),ZD=w(require("tsconfig-paths-webpack-plugin")),QD=require("tsconfig-paths"),vm=require("@webflow/data-types"),eE=require("path");ke();var YD=w(require("postcss-selector-parser")),Dm=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,YD.default)(r=>{r.walkPseudos(n=>{n.value===":root"&&(n.value=":host")})}).processSync(t.selector)})}});Dm.postcss=!0;Dm.postcssPlugin="CSSinShadowDOM";var eu=Dm;function _0(e){let t=(0,QD.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function tE({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Em.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[eu]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Em.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=_0(s);return l?new ZD.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===vm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,eE.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===vm.Environment.Server)return{...a,plugins:[...a.plugins||[],new XD.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Ei,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var rE=require("@module-federation/enhanced"),Sm=require("@webflow/data-types");function nE({libraryName:e,env:t,exposes:r}){if(t===Sm.Environment.Client)return{plugins:[new rE.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Sm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function oE(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,use:[{ident:"babel-loader",loader:require.resolve("babel-loader"),options:{presets:[require.resolve("@babel/preset-env"),[require.resolve("@babel/preset-react"),{runtime:"automatic"}],require.resolve("@babel/preset-typescript")]}}]}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}function tu(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,loader:"builtin:swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{runtime:"automatic",development:!1,refresh:!1}}}}}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}var ru=require("@rspack/core"),iE=require("tsconfig-paths"),xm=require("@webflow/data-types"),sE=require("path");ke();function A0(e){let t=(0,iE.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function aE({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:ru.rspack.CssExtractRspackPlugin.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[eu]}}}],type:"javascript/auto"},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new ru.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=A0(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===xm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,sE.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===xm.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new ru.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Ei,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var lE=require("@module-federation/enhanced/rspack"),Cm=require("@webflow/data-types");function cE({libraryName:e,env:t,exposes:r}){if(t===Cm.Environment.Client)return{plugins:[new lE.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Cm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var I0=w(require("fs")),uE=require("unionfs"),dE=require("webpack");function R0(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function nu(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:r=>e.toString(r),toJson:()=>({...t,assets:(t.assets??[]).map(R0)})}}async function pE({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new uE.Union().use(I0));return new Promise((s,a)=>{let l=(0,dE.webpack)(e);l.inputFileSystem=i,r&&(l.outputFileSystem=r),n&&(l.outputPath=n),l.run((c,p)=>{l.close(f=>{c||f?a(c||f):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(nu(p)):a(new Error("Webpack stats are undefined"))})})})}var T0=w(require("fs")),Fm=w(require("webpack-merge")),fE=require("memfs"),mE=require("unionfs"),gE=require("@rspack/core");async function ou({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new mE.Union().use(T0)),s=e;return t.length>0&&(s=(0,Fm.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),r&&(s=(0,Fm.default)(s,{output:{clean:!1,...n&&{path:n}}})),new Promise((a,l)=>{let c=(0,gE.rspack)(s);c.inputFileSystem=i,r&&(c.outputFileSystem=(0,fE.createFsFromVolume)(r)),n&&(c.outputPath=n),c.run((p,f)=>{c.close(m=>{p||m?l(p||m):f?f.hasErrors()||o&&f.hasWarnings()?l(new Error(f.toString("errors-warnings"))):a(nu(f)):l(new Error("Rspack stats are undefined"))})})})}var yE=require("@module-federation/enhanced");var Ni=w(require("webpack-merge"));R();function Pn(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function hE(e,t){let r=Object.entries(e).filter(([n])=>!t.includes(n));return Object.fromEntries(r)}function P0(e,t){return e instanceof t||Pn(e)==="ModuleFederationPlugin"}function su(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:r,getPluginOptions:n,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=$0(s),f=Array.isArray(l)?iu(...l.map(p)):iu(p(l));Object.keys(f).some(U=>c.includes(U))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let g={...hE(f,[...c,"ModuleFederationPlugin","module","plugins"]),module:hE(f.module??{},["rules"])},h=(0,Ni.default)(a,g),y=f.plugins??[];o&&(y=y.filter(o));let k=a.plugins??[],F=(0,Ni.mergeWithCustomize)({customizeArray:(0,Ni.unique)("plugins",t,U=>Pn(U))})({plugins:y},{plugins:k}).plugins,E=f?.ModuleFederationPlugin?.shared,S=F?.map(U=>{if(P0(U,r)){let N=n(U);return new r({...N,...E?{shared:E}:{}})}return U});h.plugins=S;let L=f.module?.rules;if(L&&typeof L=="function"){let U=a.module?.rules??[];h.module={...h.module??{},rules:L(U)}}return h}}function iu(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let r of e){let{module:n,ModuleFederationPlugin:o,plugins:i,...s}=r;if(t={...t,...s},n){let{rules:a,...l}=n;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=p=>{let f=c(p);return a(f)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function $0(e){return t=>typeof t=="function"?t(e):t}var O0=su({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:yE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function wE(e,t,r){return O0(e,t,r)}var bE=require("@module-federation/enhanced/rspack");var L0=su({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:bE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Pn(e)!=="MiniCssExtractPlugin"});function kE(e,t,r){return L0(e,t,r)}var _m={[xE.Framework.React]:{generateWebpackBundlerConfig:oE,generateRspackBundlerConfig:tu}},N0={webpack:{generateBaseConfig:tE,getFrameworkConfig:(e,t)=>_m[e].generateWebpackBundlerConfig(t),generateFederationConfig:nE,mergeConfigs:(e,t,r)=>wE(e,t,r),bundle:e=>pE({...e,config:e.config}),typeCheckerPlugin:EE.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Pn(t)==="MiniCssExtractPlugin"?new SE.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:aE,getFrameworkConfig:(e,t)=>_m[e].generateRspackBundlerConfig(t),generateFederationConfig:cE,mergeConfigs:(e,t,r)=>kE(e,t,r),bundle:e=>ou({...e,config:e.config}),typeCheckerPlugin:vE.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Pn(t)==="CssExtractRspackPlugin"?new DE.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},ji=e=>N0[e],CE=e=>!!_m[e];var FE={colors:!0,chunks:!1,modules:!1,chunkModules:!1,reasons:!1,errorDetails:!1,assetsSpace:1/0,warnings:!1,assets:!0,entrypoints:!0,performance:!0};async function au(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:r,paths:n}=UD(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=AE.Volume.fromJSON({"/Server":null,"/Client":null});u.debug("Generating bundling config...");let i=e.overrideConfig??{};Object.keys(i).length&&u.debug("Found bundle config overrides. Merging...");let s=ji(t),a=k=>{let v=j0({env:k,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:n,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),F=s.mergeConfigs(k,v,i);return e?.debugBundler&&(u.info(`${t} config for env ${k}:`),u.dir(F)),F},l={sourceVolumes:[...e.sourceVolumes,r],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(go.Environment.Server),outputPath:`/${go.Environment.Server}`}),s.bundle({...l,config:a(go.Environment.Client),outputPath:`/${go.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(FE)}`),u.debug(`Client Bundler Stats: ${p.toString(FE)}`));let f=GD(o);u.debug("Packaging server bundle...");let m=await JD(c.toJson().assets||[],o,f);u.debug("Packaging client bundle...");let g=await qD(p.toJson().assets||[],o,f),h=k=>v=>[v,k];return{outputFiles:[...m.map(h(go.Environment.Server)),...g.map(h(go.Environment.Client))],outputVolume:o}}function j0({env:e,mode:t="production",framework:r,publicPath:n,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!CE(r))throw new Error(`Unknown framework: ${r}`);let p=Object.entries({[aa]:i[e],...o}).reduce((y,[k,v])=>{let F=(0,Mi.isAbsolute)(v)?v:(0,Mi.join)(c,v);return{...y,[`./${k}`]:`./${(0,Mi.relative)(c,F)}`}},{}),f=ji(l),m=f.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:n,outputPath:a,projectDir:c}),g=f.getFrameworkConfig(r,e),h=f.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,_E.default)(m,g,h)}var TE=w(require("path")),Rm=require("memfs/lib/volume"),Im=w(require("webpack-merge")),PE=w(require("webpack-node-externals")),Kt=require("@webflow/data-types");var M0=w(require("fs")),Bi=require("path"),Ui=require("webpack");function B0(e,t,r=M0){let n=(0,Bi.join)(t,"node_modules",e);for(;n!==(0,Bi.dirname)(n)&&n!=="node_modules";){let o=(0,Bi.join)(n,"package.json");if(r.existsSync(o))try{let{name:i,version:s}=JSON.parse(r.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}n=(0,Bi.dirname)(n)}return null}var lu=class{apply(t){let r=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(n){n.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Ui.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=n.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),f=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(h=>{if(h.startsWith("external")){let y=h.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${h}`);let k=B0(y,r,n.inputFileSystem);if(!k)throw new Error(`Could not find package information for ${y}`);k&&m.add(k)}}),i[l]={sources:{...f,[`./${l}.${p}`]:c},dependencies:m},n.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{n.emitAsset(`${s}.js.map`,new Ui.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){n.errors.push(new Ui.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var RE=w(require("module")),IE=require("jsdom"),Am="__webflowCliImportModuleWindow__";function U0(e){let r=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),n=!!r,o=`module[${JSON.stringify(Am)}]`,i=[];n||i.push('"use strict";'),i.push(`var __wfW = ${o};`,'if (__wfW == null) { throw new ReferenceError("Webflow CLI internal: missing JSDOM window on module"); }',"var window = __wfW;","var document = __wfW.document;","var navigator = __wfW.navigator;","var HTMLElement = __wfW.HTMLElement;","var localStorage = __wfW.localStorage;","var sessionStorage = __wfW.sessionStorage;","var requestAnimationFrame = __wfW.requestAnimationFrame.bind(__wfW);","var cancelAnimationFrame = __wfW.cancelAnimationFrame.bind(__wfW);","var getComputedStyle = __wfW.getComputedStyle.bind(__wfW);","var performance = __wfW.performance;","");let s=i.join(`
173
+ export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function bx(e,t,r,n){let o={},i=`${Mr}/Client.js`,s=`${Mr}/Server.js`;o[i]=yx([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],kl.Environment.Client);let a={},l=p=>{let f=aN(p);return a[f]?(a[f]+=1,`${f}${a[f]}`):(a[f]=1,f)};o[s]=yx([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>r[p]?.ssr??!0).map(([p,f])=>{let m=l(p),g=f.startsWith(Mr)?f.replace(`${Mr}/`,"./"):f;return{name:m,path:g,exportKey:p,isDefaultExport:!0,type:"component"}})],kl.Environment.Server);let c={[kl.Environment.Client]:i,[kl.Environment.Server]:s};return{entryPointsVolume:wx.Volume.fromJSON(o,n),paths:c}}var aC=require("memfs/lib/volume");var Sx=w(require("archiver")),xs=require("path");De();var Dl=require("@webflow/data-types");De();F();var Yn=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var kx=2;function Dx(e){let t={type:Dl.ModuleLoader.FEDERATION,version:kx,entry:If,renderer:wa,components:e};return{title:ya,content:JSON.stringify(t)}}function Ex(e){let t={type:Dl.ModuleLoader.SSR,version:kx,entry:$i,components:e};return{title:ya,content:JSON.stringify(t)}}function vx(e){let t=`/${Dl.Environment.Client}/${If}`;try{if(e.existsSync(t)){let r=e.readFileSync(t,"utf8"),n=JSON.parse(r.toString()),o="publicPath"in n.metaData?n.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return n.exposes.reduce((i,s)=>{let a=s.name;return a===wa||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${Yn(o)}${l}`)})),i},{})}}catch(r){u.error(r,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var gd=require("@webflow/data-types"),lN=/\.css$/i;async function xx(e,t,r){let n=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${gd.Environment.Server}/${ba}`,a=(0,Sx.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",f=>(n=!0,i(f))),l.on("close",()=>{if(!n)try{let f={type:"asset",name:ba,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let g=(0,xs.resolve)((0,xs.join)(`/${gd.Environment.Server}`,m.name));t.existsSync(g)&&t.rmSync(g)}),o([f])}catch(f){return i(f)}finally{n=!0}}),a.pipe(l);let{title:c,content:p}=Ex(r);a.append(p,{name:c}),e.forEach(f=>{if(!lN.test(f.name))try{let m=(0,xs.resolve)((0,xs.join)(`/${gd.Environment.Server}`,f.name)),g=t.readFileSync(m,"utf8");a.append(g,{name:f.name})}catch(m){return n=!0,i(m)}}),await a.finalize()})}var Cx=require("@webflow/data-types");async function _x(e,t,r){let{title:n,content:o}=Dx(r);await t.promises.writeFile(`/${Cx.Environment.Client}/${n}`,o);let i={type:"asset",name:n,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var Qx=require("@rspack/core"),eC=w(require("fork-ts-checker-webpack-plugin")),tC=require("ts-checker-rspack-plugin"),rC=w(require("mini-css-extract-plugin")),nC=require("@webflow/data-types");var Fx=require("webpack"),sh=w(require("mini-css-extract-plugin")),Ix=w(require("tsconfig-paths-webpack-plugin")),Rx=require("tsconfig-paths"),ah=require("@webflow/data-types"),Tx=require("path");De();var Ax=w(require("postcss-selector-parser")),ih=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,Ax.default)(r=>{r.walkPseudos(n=>{n.value===":root"&&(n.value=":host")})}).processSync(t.selector)})}});ih.postcss=!0;ih.postcssPlugin="CSSinShadowDOM";var hd=ih;function cN(e){let t=(0,Rx.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function Px({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:sh.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[hd]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new sh.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=cN(s);return l?new Ix.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===ah.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,Tx.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===ah.Environment.Server)return{...a,plugins:[...a.plugins||[],new Fx.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:$i,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var $x=require("@module-federation/enhanced"),lh=require("@webflow/data-types");function Ox({libraryName:e,env:t,exposes:r}){if(t===lh.Environment.Client)return{plugins:[new $x.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===lh.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function Lx(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,use:[{ident:"babel-loader",loader:require.resolve("babel-loader"),options:{presets:[require.resolve("@babel/preset-env"),[require.resolve("@babel/preset-react"),{runtime:"automatic"}],require.resolve("@babel/preset-typescript")]}}]}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}function yd(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,loader:"builtin:swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{runtime:"automatic",development:!1,refresh:!1}}}}}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}var wd=require("@rspack/core"),Nx=require("tsconfig-paths"),ch=require("@webflow/data-types"),jx=require("path");De();function uN(e){let t=(0,Nx.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function Mx({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:wd.rspack.CssExtractRspackPlugin.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[hd]}}}],type:"javascript/auto"},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new wd.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=uN(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===ch.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,jx.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===ch.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new wd.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:$i,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var Bx=require("@module-federation/enhanced/rspack"),uh=require("@webflow/data-types");function Ux({libraryName:e,env:t,exposes:r}){if(t===uh.Environment.Client)return{plugins:[new Bx.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===uh.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var pN=w(require("fs")),Wx=require("unionfs"),Hx=require("webpack");function dN(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function bd(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:r=>e.toString(r),toJson:()=>({...t,assets:(t.assets??[]).map(dN)})}}async function Vx({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new Wx.Union().use(pN));return new Promise((s,a)=>{let l=(0,Hx.webpack)(e);l.inputFileSystem=i,r&&(l.outputFileSystem=r),n&&(l.outputPath=n),l.run((c,p)=>{l.close(f=>{c||f?a(c||f):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(bd(p)):a(new Error("Webpack stats are undefined"))})})})}var fN=w(require("fs")),dh=w(require("webpack-merge")),Gx=require("memfs"),Kx=require("unionfs"),Jx=require("@rspack/core");async function kd({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new Kx.Union().use(fN)),s=e;return t.length>0&&(s=(0,dh.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),r&&(s=(0,dh.default)(s,{output:{clean:!1,...n&&{path:n}}})),new Promise((a,l)=>{let c=(0,Jx.rspack)(s);c.inputFileSystem=i,r&&(c.outputFileSystem=(0,Gx.createFsFromVolume)(r)),n&&(c.outputPath=n),c.run((p,f)=>{c.close(m=>{p||m?l(p||m):f?f.hasErrors()||o&&f.hasWarnings()?l(new Error(f.toString("errors-warnings"))):a(bd(f)):l(new Error("Rspack stats are undefined"))})})})}var qx=require("@module-federation/enhanced");var Cs=w(require("webpack-merge"));F();function Xn(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function zx(e,t){let r=Object.entries(e).filter(([n])=>!t.includes(n));return Object.fromEntries(r)}function mN(e,t){return e instanceof t||Xn(e)==="ModuleFederationPlugin"}function Ed(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:r,getPluginOptions:n,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=gN(s),f=Array.isArray(l)?Dd(...l.map(p)):Dd(p(l));Object.keys(f).some(U=>c.includes(U))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let g={...zx(f,[...c,"ModuleFederationPlugin","module","plugins"]),module:zx(f.module??{},["rules"])},h=(0,Cs.default)(a,g),y=f.plugins??[];o&&(y=y.filter(o));let k=a.plugins??[],_=(0,Cs.mergeWithCustomize)({customizeArray:(0,Cs.unique)("plugins",t,U=>Xn(U))})({plugins:y},{plugins:k}).plugins,E=f?.ModuleFederationPlugin?.shared,S=_?.map(U=>{if(mN(U,r)){let j=n(U);return new r({...j,...E?{shared:E}:{}})}return U});h.plugins=S;let L=f.module?.rules;if(L&&typeof L=="function"){let U=a.module?.rules??[];h.module={...h.module??{},rules:L(U)}}return h}}function Dd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let r of e){let{module:n,ModuleFederationPlugin:o,plugins:i,...s}=r;if(t={...t,...s},n){let{rules:a,...l}=n;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=p=>{let f=c(p);return a(f)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function gN(e){return t=>typeof t=="function"?t(e):t}var hN=Ed({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:qx.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function Yx(e,t,r){return hN(e,t,r)}var Xx=require("@module-federation/enhanced/rspack");var yN=Ed({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:Xx.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Xn(e)!=="MiniCssExtractPlugin"});function Zx(e,t,r){return yN(e,t,r)}var ph={[nC.Framework.React]:{generateWebpackBundlerConfig:Lx,generateRspackBundlerConfig:yd}},wN={webpack:{generateBaseConfig:Px,getFrameworkConfig:(e,t)=>ph[e].generateWebpackBundlerConfig(t),generateFederationConfig:Ox,mergeConfigs:(e,t,r)=>Yx(e,t,r),bundle:e=>Vx({...e,config:e.config}),typeCheckerPlugin:eC.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Xn(t)==="MiniCssExtractPlugin"?new rC.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:Mx,getFrameworkConfig:(e,t)=>ph[e].generateRspackBundlerConfig(t),generateFederationConfig:Ux,mergeConfigs:(e,t,r)=>Zx(e,t,r),bundle:e=>kd({...e,config:e.config}),typeCheckerPlugin:tC.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Xn(t)==="CssExtractRspackPlugin"?new Qx.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},_s=e=>wN[e],oC=e=>!!ph[e];var iC={colors:!0,chunks:!1,modules:!1,chunkModules:!1,reasons:!1,errorDetails:!1,assetsSpace:1/0,warnings:!1,assets:!0,entrypoints:!0,performance:!0};async function vd(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:r,paths:n}=bx(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=aC.Volume.fromJSON({"/Server":null,"/Client":null});u.debug("Generating bundling config...");let i=e.overrideConfig??{};Object.keys(i).length&&u.debug("Found bundle config overrides. Merging...");let s=_s(t),a=k=>{let v=bN({env:k,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:n,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),_=s.mergeConfigs(k,v,i);return e?.debugBundler&&(u.info(`${t} config for env ${k}:`),u.dir(_)),_},l={sourceVolumes:[...e.sourceVolumes,r],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(di.Environment.Server),outputPath:`/${di.Environment.Server}`}),s.bundle({...l,config:a(di.Environment.Client),outputPath:`/${di.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(iC)}`),u.debug(`Client Bundler Stats: ${p.toString(iC)}`));let f=vx(o);u.debug("Packaging server bundle...");let m=await xx(c.toJson().assets||[],o,f);u.debug("Packaging client bundle...");let g=await _x(p.toJson().assets||[],o,f),h=k=>v=>[v,k];return{outputFiles:[...m.map(h(di.Environment.Server)),...g.map(h(di.Environment.Client))],outputVolume:o}}function bN({env:e,mode:t="production",framework:r,publicPath:n,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!oC(r))throw new Error(`Unknown framework: ${r}`);let p=Object.entries({[wa]:i[e],...o}).reduce((y,[k,v])=>{let _=(0,As.isAbsolute)(v)?v:(0,As.join)(c,v);return{...y,[`./${k}`]:`./${(0,As.relative)(c,_)}`}},{}),f=_s(l),m=f.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:n,outputPath:a,projectDir:c}),g=f.getFrameworkConfig(r,e),h=f.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,sC.default)(m,g,h)}var uC=w(require("path")),mh=require("memfs/lib/volume"),gh=w(require("webpack-merge")),dC=w(require("webpack-node-externals")),er=require("@webflow/data-types");var kN=w(require("fs")),Fs=require("path"),Is=require("webpack");function DN(e,t,r=kN){let n=(0,Fs.join)(t,"node_modules",e);for(;n!==(0,Fs.dirname)(n)&&n!=="node_modules";){let o=(0,Fs.join)(n,"package.json");if(r.existsSync(o))try{let{name:i,version:s}=JSON.parse(r.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}n=(0,Fs.dirname)(n)}return null}var Sd=class{apply(t){let r=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(n){n.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Is.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=n.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),f=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(h=>{if(h.startsWith("external")){let y=h.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${h}`);let k=DN(y,r,n.inputFileSystem);if(!k)throw new Error(`Could not find package information for ${y}`);k&&m.add(k)}}),i[l]={sources:{...f,[`./${l}.${p}`]:c},dependencies:m},n.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{n.emitAsset(`${s}.js.map`,new Is.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){n.errors.push(new Is.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var lC=w(require("module")),cC=require("jsdom"),fh="__webflowCliImportModuleWindow__";function EN(e){let r=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),n=!!r,o=`module[${JSON.stringify(fh)}]`,i=[];n||i.push('"use strict";'),i.push(`var __wfW = ${o};`,'if (__wfW == null) { throw new ReferenceError("Webflow CLI internal: missing JSDOM window on module"); }',"var window = __wfW;","var document = __wfW.document;","var navigator = __wfW.navigator;","var HTMLElement = __wfW.HTMLElement;","var localStorage = __wfW.localStorage;","var sessionStorage = __wfW.sessionStorage;","var requestAnimationFrame = __wfW.requestAnimationFrame.bind(__wfW);","var cancelAnimationFrame = __wfW.cancelAnimationFrame.bind(__wfW);","var getComputedStyle = __wfW.getComputedStyle.bind(__wfW);","var performance = __wfW.performance;","");let s=i.join(`
99
174
  `)+`
100
- `;return r?e.slice(0,r[0].length)+s+e.slice(r[0].length):s+e}function Pa(e,t){let r=e.readFileSync(t,"utf-8"),o=new IE.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=U0(r),s=new RE.default(t,module);Object.defineProperty(s,Am,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Am),o.close()}}function W0(e,t){let r=`/${t}.js`,n=Pa(e,r),o=n.exports.default||n.exports;if(o&&typeof o=="object")try{return(0,Kt.parseComponentMetadata)(o)}catch(i){let s=i instanceof Error?i.stack:String(i);throw new Error(`Error parsing component data for '${t}': ${s}`)}throw new Error(`Could not get declaration for '${t}'`)}async function H0({declarations:e,sources:t,overrideConfig:r={},performTypeCheck:n,bundler:o="webpack",projectDir:i}){let s=new Rm.Volume,a=ji(o),l=(0,Im.default)(a.generateBaseConfig({entry:e,env:Kt.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(Kt.Framework.React,Kt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:n?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(Kt.Environment.Client,l,r);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function V0({declarations:e,sources:t,overrideConfig:r={},bundler:n,projectDir:o}){let i=new Rm.Volume,s=ji(n),a=(0,Im.default)(s.generateBaseConfig({entry:e,env:Kt.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(Kt.Framework.React,Kt.Environment.Client),{entry:e,mode:"production",optimization:{mangleExports:"deterministic",moduleIds:"deterministic",chunkIds:"deterministic"},output:{filename:"[name].[contenthash].js",path:"/",library:{type:"commonjs2"},devtoolModuleFilenameTemplate:"[resource-path]",hashFunction:s.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new lu],externals:[(0,PE.default)()]}),l=s.mergeConfigs(Kt.Environment.Client,a,r);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function G0(e){return Object.entries(e.toJSON()).reduce((t,[r,n])=>{if(r.endsWith(".map")&&n?.length){let o=TE.default.basename(r).split(".")[0];t[o]=n}return t},{})}async function cu({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([H0({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):V0({declarations:e,sources:t,overrideConfig:r,bundler:i,projectDir:s})]),{metadata:c,options:p}=Object.keys(e).reduce((m,g)=>{let h=W0(a,g);return m.metadata[g]=h,m.options[g]=h.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?G0(l):{},metadata:c,options:p}}function $E(e,{framework:t,sourceMaps:r}){return Object.fromEntries(Object.keys(e).map(n=>[n,{...e[n],id:n,framework:t,exportPath:"default",hash:r[n]}]))}Oe();var LE=w(require("md5"));we();me();j();var Tm=" ",NE=`${Tm}${lc} `;function K0(e){return e==="added"?` ${z("(Added)")}`:e==="removed"?` ${ue("(Removed)")}`:e==="changed"?` ${Ne("(Changed)")}`:""}function OE(e){if(!e)return"";let t=JSON.parse(e);return(0,LE.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(r=>!r.includes("@webflow/data-types")&&!r.includes("@webflow/react"))].sort()))}function J0({componentsMetadata:e,latestVersion:t,sourceMaps:r}){let n=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(n).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=OE(r[s]),p=a.displayName&&l.displayName!==a.displayName,f=c&&a.hash&&c!==OE(a.hash),m=p||f;o[s]={component:l,status:m?"changed":"unchanged",previousName:p?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{n[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",p=l?`${l} ${rt} ${c}`:c;return`${P(`${NE}${p}`)}${K0(a)}`}).sort().join(`
101
- `)}function z0({componentsMetadata:e}){return Object.values(e).map(r=>`${P(NE+(r.displayName??"Unknown Component"))}`).sort().join(`
102
- `)}async function jE({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:r,sourceMaps:n,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?r.find(({profile:p})=>p.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?J0({componentsMetadata:t,latestVersion:i,sourceMaps:n}):z0({componentsMetadata:t}),l=s?`Ready to update ${Ne(e.name)} on ${yp(o.name)}?`:`Ready to share ${Ne(e.name)} with ${yp(o.name)}?`;return await $e({message:`${l}
175
+ `;return r?e.slice(0,r[0].length)+s+e.slice(r[0].length):s+e}function El(e,t){let r=e.readFileSync(t,"utf-8"),o=new cC.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=EN(r),s=new lC.default(t,module);Object.defineProperty(s,fh,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,fh),o.close()}}function vN(e,t){let r=`/${t}.js`,n=El(e,r),o=n.exports.default||n.exports;if(o&&typeof o=="object")try{return(0,er.parseComponentMetadata)(o)}catch(i){let s=i instanceof Error?i.stack:String(i);throw new Error(`Error parsing component data for '${t}': ${s}`)}throw new Error(`Could not get declaration for '${t}'`)}async function SN({declarations:e,sources:t,overrideConfig:r={},performTypeCheck:n,bundler:o="webpack",projectDir:i}){let s=new mh.Volume,a=_s(o),l=(0,gh.default)(a.generateBaseConfig({entry:e,env:er.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(er.Framework.React,er.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:n?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(er.Environment.Client,l,r);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function xN({declarations:e,sources:t,overrideConfig:r={},bundler:n,projectDir:o}){let i=new mh.Volume,s=_s(n),a=(0,gh.default)(s.generateBaseConfig({entry:e,env:er.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(er.Framework.React,er.Environment.Client),{entry:e,mode:"production",optimization:{mangleExports:"deterministic",moduleIds:"deterministic",chunkIds:"deterministic"},output:{filename:"[name].[contenthash].js",path:"/",library:{type:"commonjs2"},devtoolModuleFilenameTemplate:"[resource-path]",hashFunction:s.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new Sd],externals:[(0,dC.default)()]}),l=s.mergeConfigs(er.Environment.Client,a,r);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function CN(e){return Object.entries(e.toJSON()).reduce((t,[r,n])=>{if(r.endsWith(".map")&&n?.length){let o=uC.default.basename(r).split(".")[0];t[o]=n}return t},{})}async function xd({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([SN({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):xN({declarations:e,sources:t,overrideConfig:r,bundler:i,projectDir:s})]),{metadata:c,options:p}=Object.keys(e).reduce((m,g)=>{let h=vN(a,g);return m.metadata[g]=h,m.options[g]=h.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?CN(l):{},metadata:c,options:p}}function pC(e,{framework:t,sourceMaps:r}){return Object.fromEntries(Object.keys(e).map(n=>[n,{...e[n],id:n,framework:t,exportPath:"default",hash:r[n]}]))}Fe();var mC=w(require("md5"));he();ge();N();var hh=" ",gC=`${hh}${mc} `;function _N(e){return e==="added"?` ${q("(Added)")}`:e==="removed"?` ${de("(Removed)")}`:e==="changed"?` ${je("(Changed)")}`:""}function fC(e){if(!e)return"";let t=JSON.parse(e);return(0,mC.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(r=>!r.includes("@webflow/data-types")&&!r.includes("@webflow/react"))].sort()))}function AN({componentsMetadata:e,latestVersion:t,sourceMaps:r}){let n=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(n).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=fC(r[s]),p=a.displayName&&l.displayName!==a.displayName,f=c&&a.hash&&c!==fC(a.hash),m=p||f;o[s]={component:l,status:m?"changed":"unchanged",previousName:p?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{n[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",p=l?`${l} ${nt} ${c}`:c;return`${P(`${gC}${p}`)}${_N(a)}`}).sort().join(`
176
+ `)}function FN({componentsMetadata:e}){return Object.values(e).map(r=>`${P(gC+(r.displayName??"Unknown Component"))}`).sort().join(`
177
+ `)}async function hC({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:r,sourceMaps:n,workspaceInfo:o}){if(W())return Promise.resolve(!0);let i=e.id?r.find(({profile:p})=>p.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?AN({componentsMetadata:t,latestVersion:i,sourceMaps:n}):FN({componentsMetadata:t}),l=s?`Ready to update ${je(e.name)} on ${Ip(o.name)}?`:`Ready to share ${je(e.name)} with ${Ip(o.name)}?`;return await Ce({message:`${l}
103
178
 
104
- ${Tm}${P("Code components:")}
179
+ ${hh}${P("Code components:")}
105
180
  ${a}
106
181
 
107
- ${Tm}Confirm to proceed`})}var uu=require("path"),UE=require("memfs/lib/volume");var ME=w(require("fast-glob")),q0=e=>{let t=e.split("/");return t[t.length-1]},Y0=e=>q0(e).split(".")[0];async function BE(e,t){return(await ME.default.glob(e,{absolute:!0,...t||{}})).reduce((n,o)=>{let i=Y0(o);if(n[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${n[i]}, but also found at ${o}.`);return{...n,[i]:o}},{})}function It(e){return e.replace(/\\/g,"/")}async function du(e,t){let r=await BE(e.components,{cwd:(0,uu.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(r).length)throw new Error("No declaration files found");let{componentsFiles:n,componentsVolume:o}=X0(r,e.renderer.client,e.globals,t);return{componentsFiles:n,componentsVolume:o}}function X0(e,t,r,n){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,uu.extname)(a),c=`${_r}/${jD}/${s}${l}`;o[s]=c,i[c]=Z0(t,a,r)}),{componentsFiles:o,componentsVolume:UE.Volume.fromJSON(i,n)}}function Z0(e,t,r){let n=JSON.stringify(It(t)),o=JSON.stringify(It(e));if(!r)return`
182
+ ${hh}Confirm to proceed`})}var Cd=require("path"),bC=require("memfs/lib/volume");var yC=w(require("fast-glob")),IN=e=>{let t=e.split("/");return t[t.length-1]},RN=e=>IN(e).split(".")[0];async function wC(e,t){return(await yC.default.glob(e,{absolute:!0,...t||{}})).reduce((n,o)=>{let i=RN(o);if(n[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${n[i]}, but also found at ${o}.`);return{...n,[i]:o}},{})}function jt(e){return e.replace(/\\/g,"/")}async function _d(e,t){let r=await wC(e.components,{cwd:(0,Cd.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(r).length)throw new Error("No declaration files found");let{componentsFiles:n,componentsVolume:o}=TN(r,e.renderer.client,e.globals,t);return{componentsFiles:n,componentsVolume:o}}function TN(e,t,r,n){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,Cd.extname)(a),c=`${Mr}/${hx}/${s}${l}`;o[s]=c,i[c]=PN(t,a,r)}),{componentsFiles:o,componentsVolume:bC.Volume.fromJSON(i,n)}}function PN(e,t,r){let n=JSON.stringify(jt(t)),o=JSON.stringify(jt(e));if(!r)return`
108
183
  import componentDefinition from ${n};
109
184
  export default {...componentDefinition};
110
- `.trim();let i=JSON.stringify(It(r));return`
185
+ `.trim();let i=JSON.stringify(jt(r));return`
111
186
  import { applyDecorators } from ${o};
112
187
  import componentDefinition from ${n};
113
188
  const globals = require(${i}) || {};
@@ -126,173 +201,100 @@ if (componentDefinition?.component) {
126
201
  }
127
202
 
128
203
  export default decoratedDefinition;
129
- `.trim()}Y();Gc();var fu=require("path");var WE=require("@webflow/data-types"),pu={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:WE.Framework.React};var en=require("path"),Wi=require("fs");Oe();R();Pe();we();C();me();j();function HE(e,t){let r={...e};if(e.globals){let n=(0,en.resolve)(t,e.globals);if(!(0,Wi.existsSync)(n))throw new Error(`Globals file not found: ${e.globals}
204
+ `.trim()}z();ad();var Fd=require("path");var kC=require("@webflow/data-types"),Ad={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:kC.Framework.React};var gn=require("path"),Rs=require("fs");Fe();F();Oe();he();C();ge();N();function DC(e,t){let r={...e};if(e.globals){let n=(0,gn.resolve)(t,e.globals);if(!(0,Rs.existsSync)(n))throw new Error(`Globals file not found: ${e.globals}
130
205
  Resolved path: ${n}
131
- Please ensure the file exists or remove the 'globals' field from your manifest.`);r.globals=It(n)}if(e.bundleConfig){let n=(0,en.resolve)(t,e.bundleConfig);if(!(0,Wi.existsSync)(n))throw new Error(`Bundle config file not found: ${e.bundleConfig}
206
+ Please ensure the file exists or remove the 'globals' field from your manifest.`);r.globals=jt(n)}if(e.bundleConfig){let n=(0,gn.resolve)(t,e.bundleConfig);if(!(0,Rs.existsSync)(n))throw new Error(`Bundle config file not found: ${e.bundleConfig}
132
207
  Resolved path: ${n}
133
- Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);r.bundleConfig=It(n)}if(typeof e.renderer=="string"){let n=(0,en.resolve)(t,e.renderer);(0,Wi.existsSync)(n)&&(r.renderer=It(n))}else if(typeof e.renderer=="object"&&typeof r.renderer=="object"){if(typeof e.renderer.client=="string"){let n=(0,en.resolve)(t,e.renderer.client);(0,Wi.existsSync)(n)&&(r.renderer={...r.renderer,client:It(n)})}if(typeof e.renderer.server=="string"){let n=(0,en.resolve)(t,e.renderer.server);(0,Wi.existsSync)(n)&&(r.renderer={...r.renderer,server:It(n)})}}return r}async function Q0({initialData:e}){let t=await Ge({message:"Enter a name for your code library",validate:o=>o.trim()===""?"The library name cannot be empty.":!0,default:e?.name});if(t==null)throw new d("When --no-input mode is enabled please provide a name in your library manifest");let r=await Ge({message:"Enter a description for your code library",default:e?.description??""});if(!await $e({message:"Is the code (including 3rd party packages) you are uploading to Webflow trusted and secure?"}))throw new Error("Code library is not trusted and secure");return{name:t,description:r}}async function eT({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},n=[...e].sort((i,s)=>{let a=i.resource.codeLibraryResource.manifest.name??"",l=s.resource.codeLibraryResource.manifest.name??"",c=a.localeCompare(l,void 0,{sensitivity:"base"});return c!==0?c:i.profile.slug.localeCompare(s.profile.slug,void 0,{sensitivity:"base"})}).map(({resource:i,profile:s})=>{let a=`${i.codeLibraryResource.manifest.name} (${s.slug})`;s.status==="ARCHIVED"&&(a+=` ${ue("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await pc({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...n];let s=i.toLowerCase(),a=n.filter(l=>{let c=l.value?.id??"",p=l.value?.name??"",f=l.value?.description??"";return c.toLowerCase().includes(s)||p.toLowerCase().includes(s)||f.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Pm({initialData:e,existingCodeLibraries:t}){let r,n={components:pu.components},o=t.length>0?await eT({existingCodeLibraries:t}):null;if(o)r={...n,...o,...e,id:o.id};else{let a=await Q0({initialData:e});r={...n,...e,...a}}let{path:i}=cr(),s=HE(r,(0,en.dirname)(i));return Se({library:s}),u.info(`${$} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function VE({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:r,manifestPath:n}=oe(),o=ea(r,"library");if(!o.id){if(lr())return t.succeed(),Pm({initialData:o,existingCodeLibraries:e});throw new Error("Library manifest does not have an id")}let i=o.name??e.find(({profile:a})=>a.slug===o.id)?.resource.codeLibraryResource.manifest.name;if(!i&&lr())return t.succeed(),Pm({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=HE({...o,name:i},(0,en.dirname)(n));return Promise.resolve({libraryManifest:s,manifestPath:n})}catch(r){if(r instanceof oo&&lr())return t.info(r.message),Pm({existingCodeLibraries:e});throw t.fail(),r}}var $m=require("memfs/lib/volume"),JE=w(require("webpack-merge"));var zE="/client-renderer.js",qE="/server-renderer.js",GE=`${_r}/test-renderers${zE}`,KE=`${_r}/test-renderers${qE}`,tT=new Set(["@webflow/react"]),rT=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function YE(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(tT.has(e.client)&&rT.has(e.server))return;let r=await iT(e,t);nT(e.client,r),oT(e.server,r)}function nT(e,t){let r=Pa(t,zE);if(typeof r.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof r.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let n=()=>null,o=r.exports.ClientRenderer(n),i=["mount","hydrate","render","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid client renderer: ${e} ClientRenderer must return an object with a '${s}' function.`)}function oT(e,t){let r=Pa(t,qE);if(typeof r.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let n=()=>null,o=r.exports.ServerRenderer(n),i=["renderToStream","renderToString","prerenderToString","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid server renderer: ${e} ServerRenderer must return an object with a '${s}' function.`)}async function iT(e,t){let r=new $m.Volume,n=It(e.client),o=It(e.server),i={[GE]:`
208
+ Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);r.bundleConfig=jt(n)}if(typeof e.renderer=="string"){let n=(0,gn.resolve)(t,e.renderer);(0,Rs.existsSync)(n)&&(r.renderer=jt(n))}else if(typeof e.renderer=="object"&&typeof r.renderer=="object"){if(typeof e.renderer.client=="string"){let n=(0,gn.resolve)(t,e.renderer.client);(0,Rs.existsSync)(n)&&(r.renderer={...r.renderer,client:jt(n)})}if(typeof e.renderer.server=="string"){let n=(0,gn.resolve)(t,e.renderer.server);(0,Rs.existsSync)(n)&&(r.renderer={...r.renderer,server:jt(n)})}}return r}async function $N({initialData:e}){let t=await qe({message:"Enter a name for your code library",validate:o=>o.trim()===""?"The library name cannot be empty.":!0,default:e?.name});if(t==null)throw new d("When --no-input mode is enabled please provide a name in your library manifest");let r=await qe({message:"Enter a description for your code library",default:e?.description??""});if(!await Ce({message:"Is the code (including 3rd party packages) you are uploading to Webflow trusted and secure?"}))throw new Error("Code library is not trusted and secure");return{name:t,description:r}}async function ON({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},n=[...e].sort((i,s)=>{let a=i.resource.codeLibraryResource.manifest.name??"",l=s.resource.codeLibraryResource.manifest.name??"",c=a.localeCompare(l,void 0,{sensitivity:"base"});return c!==0?c:i.profile.slug.localeCompare(s.profile.slug,void 0,{sensitivity:"base"})}).map(({resource:i,profile:s})=>{let a=`${i.codeLibraryResource.manifest.name} (${s.slug})`;s.status==="ARCHIVED"&&(a+=` ${de("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await wc({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...n];let s=i.toLowerCase(),a=n.filter(l=>{let c=l.value?.id??"",p=l.value?.name??"",f=l.value?.description??"";return c.toLowerCase().includes(s)||p.toLowerCase().includes(s)||f.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function yh({initialData:e,existingCodeLibraries:t}){let r,n={components:Ad.components},o=t.length>0?await ON({existingCodeLibraries:t}):null;if(o)r={...n,...o,...e,id:o.id};else{let a=await $N({initialData:e});r={...n,...e,...a}}let{path:i}=dr(),s=DC(r,(0,gn.dirname)(i));return Se({library:s}),u.info(`${$} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function EC({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:r,manifestPath:n}=oe(),o=pa(r,"library");if(!o.id){if(ur())return t.succeed(),yh({initialData:o,existingCodeLibraries:e});throw new Error("Library manifest does not have an id")}let i=o.name??e.find(({profile:a})=>a.slug===o.id)?.resource.codeLibraryResource.manifest.name;if(!i&&ur())return t.succeed(),yh({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=DC({...o,name:i},(0,gn.dirname)(n));return Promise.resolve({libraryManifest:s,manifestPath:n})}catch(r){if(r instanceof fo&&ur())return t.info(r.message),yh({existingCodeLibraries:e});throw t.fail(),r}}var wh=require("memfs/lib/volume"),xC=w(require("webpack-merge"));var CC="/client-renderer.js",_C="/server-renderer.js",vC=`${Mr}/test-renderers${CC}`,SC=`${Mr}/test-renderers${_C}`,LN=new Set(["@webflow/react"]),NN=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function AC(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(LN.has(e.client)&&NN.has(e.server))return;let r=await BN(e,t);jN(e.client,r),MN(e.server,r)}function jN(e,t){let r=El(t,CC);if(typeof r.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof r.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let n=()=>null,o=r.exports.ClientRenderer(n),i=["mount","hydrate","render","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid client renderer: ${e} ClientRenderer must return an object with a '${s}' function.`)}function MN(e,t){let r=El(t,_C);if(typeof r.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let n=()=>null,o=r.exports.ServerRenderer(n),i=["renderToStream","renderToString","prerenderToString","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid server renderer: ${e} ServerRenderer must return an object with a '${s}' function.`)}async function BN(e,t){let r=new wh.Volume,n=jt(e.client),o=jt(e.server),i={[vC]:`
134
209
  export * from "${n}";
135
- `,[KE]:`
210
+ `,[SC]:`
136
211
  export * from "${o}";
137
- `},s=(0,JE.default)(tu(),{context:t,entry:{"client-renderer":GE,"server-renderer":KE},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await ou({config:s,sourceVolumes:[$m.Volume.fromJSON(i,t)],outputVolume:r,failOnWarnings:!1}),r}async function mu({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:r}=await VE({existingCodeLibraries:e}),n=(0,fu.resolve)((0,fu.dirname)(r)),{renderer:o,...i}=pu,s=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??o.client,server:t.renderer?.server??o.server};return s.server==="@webflow/react"&&(s.server="@webflow/react/server"),await YE(s,n),{...i,...t,renderer:s,manifestPath:r}}C();j();async function sT(e,t){let{trackPerformance:r,libraryConfig:n,projectDir:o}=e;return await r("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await du(n,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await cu({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:Vc(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
212
+ `},s=(0,xC.default)(yd(),{context:t,entry:{"client-renderer":vC,"server-renderer":SC},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await kd({config:s,sourceVolumes:[wh.Volume.fromJSON(i,t)],outputVolume:r,failOnWarnings:!1}),r}async function Id({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:r}=await EC({existingCodeLibraries:e}),n=(0,Fd.resolve)((0,Fd.dirname)(r)),{renderer:o,...i}=Ad,s=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??o.client,server:t.renderer?.server??o.server};return s.server==="@webflow/react"&&(s.server="@webflow/react/server"),await AC(s,n),{...i,...t,renderer:s,manifestPath:r}}C();N();async function UN(e,t){let{trackPerformance:r,libraryConfig:n,projectDir:o}=e;return await r("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await _d(n,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await xd({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:sd(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
138
213
 
139
214
  ${Object.entries(a).reduce((p,[f,m])=>(p+=`${f}: ${JSON.stringify(JSON.parse(m),null,2)}
140
215
 
141
- `,p),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function aT(e,t,r,n,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await au({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:Tn(i[Hi.Environment.Client]),sourceVolumes:[r],componentsFiles:t,componentsOptions:n,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler,projectDir:c}))}async function lT(e,t,r,n){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let p=(0,ho.resolve)((0,ho.join)(`/${c}`,`${l.name}`));return Aa(r.readFileSync(p,"utf8").toString(),p,{bundleEnvironment:c})}),{signatures:a}=await bm({resourceId:n,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(p=>p.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await Ra(c,l.value)}))})}async function cT(e,t,r,n,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:Tn(o[Hi.Environment.Client])+sa,loaderType:Hi.ModuleLoader.FEDERATION},serverModule:{bundleUrl:Tn(o[Hi.Environment.Server])+la}},c=$E(t,{framework:s.framework,sourceMaps:r}),{taskId:p}=await km({resourceId:n,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:p},null,2))})}async function Om(e){e?.verbose&&(process.env.DEBUG="true");let t,r=Date.now(),n=await T({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=_.forCodeLibraries({authToken:n}),i=Bb(o,"share_library");try{u.debug("Checking dependencies versions..."),new ao().run();let s={apiToken:n};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await ym({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let p=await mu({existingCodeLibraries:c}),f=p.bundleConfig?require(p.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:p,overrideConfig:f,projectDir:(0,ho.resolve)((0,ho.dirname)(p.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:g,componentsVolume:h,componentsMetadata:y,componentsOptions:k,sourceMaps:v}=await sT(m,e);if(t.succeed(),!await jE({libraryConfig:p,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:v,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:E,profileSlug:S,workspace:L,s3Urls:U,cdnUrls:N}=await i("init_code_library",async()=>await wm({name:p.name,slug:p.id,description:p.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:E,profileSlug:S,s3Urls:U,cdnUrls:N},null,2)),await o.sendUsage("library_initialized",{libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S}),p.id||(Se({library:{id:S}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:te,outputVolume:G}=await aT(m,g,h,k,E,N,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:p.name,componentCount:Object.keys(g).length,resourceId:E,profileSlug:S}),t=u.spinner("Uploading files"),await lT(m,te,G,E),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:p.name,fileCount:te.length,resourceId:E,profileSlug:S}),t=u.spinner("Sharing library"),await cT(m,y,v,E,N),t.succeed(),u.success(`Code library shared successfully${L?.slug?`: ${xr()}/dashboard/workspace/${L?.slug}/shared-libraries-and-templates`:"!"}`);let ce=Date.now()-r;await o.sendUsage("share_library",{duration:ce,componentCount:Object.keys(g).length,libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S})}catch(s){t?.fail();let a=Date.now()-r;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new d(s)}}var gu=w(require("fs")),Ar=require("path");R();Gc();C();var uT="CodeLibrary",dT="dist",pT="http://localhost/";async function Lm(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new ao().run(),u.debug("Looking for manifest...");let r=await mu({existingCodeLibraries:[]}),n=Zc(r.name)||uT,o=`_${e.libraryId||n}`,i=(0,Ar.resolve)((0,Ar.dirname)(r.manifestPath));e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(r,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:s,componentsVolume:a}=await du(r,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=r.bundleConfig?require(r.bundleConfig):{},{sourceMaps:c,metadata:p,options:f}=await cu({declarations:s,sources:a,overrideConfig:l,performTypeCheck:Vc(s,e,i),skipSourceMaps:!e?.debugBundler,bundler:e.bundler,projectDir:i});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(p,null,2)}`),u.debug(`Source Maps:
216
+ `,p),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function WN(e,t,r,n,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await vd({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:Yn(i[Ts.Environment.Client]),sourceVolumes:[r],componentsFiles:t,componentsOptions:n,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler,projectDir:c}))}async function HN(e,t,r,n){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let p=(0,pi.resolve)((0,pi.join)(`/${c}`,`${l.name}`));return wl(r.readFileSync(p,"utf8").toString(),p,{bundleEnvironment:c})}),{signatures:a}=await nh({resourceId:n,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(p=>p.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await bl(c,l.value)}))})}async function VN(e,t,r,n,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:Yn(o[Ts.Environment.Client])+ya,loaderType:Ts.ModuleLoader.FEDERATION},serverModule:{bundleUrl:Yn(o[Ts.Environment.Server])+ba}},c=pC(t,{framework:s.framework,sourceMaps:r}),{taskId:p}=await oh({resourceId:n,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:p},null,2))})}async function bh(e){e?.verbose&&(process.env.DEBUG="true");let t,r=Date.now(),n=await R({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=A.forCodeLibraries({authToken:n}),i=ak(o,"share_library");try{u.debug("Checking dependencies versions..."),new ho().run();let s={apiToken:n};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await th({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let p=await Id({existingCodeLibraries:c}),f=p.bundleConfig?require(p.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:p,overrideConfig:f,projectDir:(0,pi.resolve)((0,pi.dirname)(p.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:g,componentsVolume:h,componentsMetadata:y,componentsOptions:k,sourceMaps:v}=await UN(m,e);if(t.succeed(),!await hC({libraryConfig:p,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:v,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:E,profileSlug:S,workspace:L,s3Urls:U,cdnUrls:j}=await i("init_code_library",async()=>await rh({name:p.name,slug:p.id,description:p.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:E,profileSlug:S,s3Urls:U,cdnUrls:j},null,2)),await o.sendUsage("library_initialized",{libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S}),p.id||(Se({library:{id:S}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:re,outputVolume:G}=await WN(m,g,h,k,E,j,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:p.name,componentCount:Object.keys(g).length,resourceId:E,profileSlug:S}),t=u.spinner("Uploading files"),await HN(m,re,G,E),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:p.name,fileCount:re.length,resourceId:E,profileSlug:S}),t=u.spinner("Sharing library"),await VN(m,y,v,E,j),t.succeed(),u.success(`Code library shared successfully${L?.slug?`: ${Ar()}/dashboard/workspace/${L?.slug}/shared-libraries-and-templates`:"!"}`);let ue=Date.now()-r;await o.sendUsage("share_library",{duration:ue,componentCount:Object.keys(g).length,libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S})}catch(s){t?.fail();let a=Date.now()-r;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new d(s)}}var Rd=w(require("fs")),Br=require("path");F();ad();C();var GN="CodeLibrary",KN="dist",JN="http://localhost/";async function kh(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new ho().run(),u.debug("Looking for manifest...");let r=await Id({existingCodeLibraries:[]}),n=md(r.name)||GN,o=`_${e.libraryId||n}`,i=(0,Br.resolve)((0,Br.dirname)(r.manifestPath));e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(r,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:s,componentsVolume:a}=await _d(r,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=r.bundleConfig?require(r.bundleConfig):{},{sourceMaps:c,metadata:p,options:f}=await xd({declarations:s,sources:a,overrideConfig:l,performTypeCheck:sd(s,e,i),skipSourceMaps:!e?.debugBundler,bundler:e.bundler,projectDir:i});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(p,null,2)}`),u.debug(`Source Maps:
142
217
 
143
218
  ${Object.entries(c).reduce((h,[y,k])=>(h+=`${y}: ${JSON.stringify(JSON.parse(k),null,2)}
144
219
 
145
- `,h),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:g}=await au({libraryIdentifier:o,renderer:r.renderer,framework:r.framework,publicPath:Tn(e.publicPath||pT),sourceVolumes:[a],componentsFiles:s,componentsOptions:f,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:l,failOnWarnings:!e.force,bundler:e.bundler,projectDir:i});t.succeed(),t=u.spinner("Writing to disk"),m.forEach(([h,y])=>{let k=(0,Ar.join)(`/${y}`,`${h.name}`),v=Aa(g.readFileSync(k,"utf8").toString(),k,{bundleEnvironment:y}),F=(0,Ar.join)(i,e.outputPath||dT);gu.default.existsSync((0,Ar.join)(F,`${y}`))||gu.default.mkdirSync((0,Ar.join)(F,`${y}`),{recursive:!0}),gu.default.writeFileSync((0,Ar.join)(F,y,h.name),v.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(r){throw t?.fail(),new d(r)}}R();j();var $a=w(require("fs-extra")),Nm=w(require("path"));R();j();function fT(){try{if(!$a.default.existsSync(At))return null;let e=$a.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:Nm.default.join(At,t),time:$a.default.statSync(Nm.default.join(At,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);if(e.length===0)return null;for(let t of e)try{let n=$a.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(n){let o=n[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function jm(){let e=fT();e&&u.info(`${ki} Latest log: ${e}`),u.info(`${ki} All logs: ${At}`)}async function XE(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(jm)}me();var mT=`${ue("[Deprecated]")} The 'library' commands will be removed in the next major release.`,gT=()=>{u.warn(`${X} ${ue("webflow library share")} is deprecated and will be removed in the next major release.
146
- Use ${z("webflow devlink import")} instead.
147
- `)},hT=()=>{u.warn(`${X} ${ue("webflow library bundle")} is deprecated and will be removed in the next major release.
148
- Use ${z("webflow devlink bundle")} instead.
149
- `)},yT=()=>{u.warn(`${X} ${ue("webflow library log")} is deprecated and will be removed in the next major release.
150
- Use ${z("webflow log")} instead.
151
- `)},wT="Import a library of Code Components into your Webflow Workspace.",bT="Bundle a library of Code Components for local development.",ZE=()=>new $n.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),QE=()=>new $n.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),ev=()=>new $n.Option("--dev","Bundle in development mode for debugging purposes."),tv=()=>new $n.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),kT=()=>new $n.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),DT=()=>new $n.Option("--public-path <path>","Set the public path for the bundle."),ET=()=>new $n.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function Mm(e,t){return e.command(t).description(wT).addOption(Xr()).addOption(ZE()).addOption(QE()).addOption(ev()).addOption(tv()).action(Sa(Om))}function Bm(e,t){return e.command(t).description(bT).addOption(kT()).addOption(DT()).addOption(ET()).addOption(ZE()).addOption(QE()).addOption(ev()).addOption(tv()).action(Sa(Lm))}var rv=e=>{let t=e.command("library").description(mT);Mm(t,"share").description(`${ue("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",gT),Bm(t,"bundle").description(`${ue("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",hT),t.command("log").description(`${ue("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",yT).action(jm)};me();var nv=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${ue("[Deprecated]")} Use 'webflow devlink export' instead. Sync your Webflow components to your filesystem.`).argument("[components...]","A list of components to sync. If none is provided, all components will be synced.").addOption(Xr()).addOption(Rt()).action(gD),Mm(t,"import"),Bm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(Xr()).addOption(Rt()).action(Sa(qc))};var tn=w(require("fs")),qt=w(require("path"));R();Y();var Ce={New:"new",Existing:"existing"},ov="cli",Jt=3,zt=39,hu="astro",iv="cloud-scaffolds";var sv="package.json",yo="webflow.json",yu="wf-placeholder-name",av="CLOUD_MOUNT_PATH",lv="gitignore";function Um(e){return!e.siteId}var Oa=async(e,t,r=hu,n,o,i)=>{try{let s,a;if("content"in n){let l=n.content;s=l.files,a=c=>qt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=n[r];if(!c)throw new Error(`Scaffold "${r}" not found`);s=c;let p=qt.join(iv,r);a=f=>f.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=qt.join(e,a(l)),p=l.includes("next.config.ts"),f=l.includes("astro.config.mjs"),m=p||f;if(l.includes(yo)&&tn.existsSync(c))continue;if(l.includes(sv)||l.includes(yo)){let h=(await tn.promises.readFile(l,"utf8")).replace(yu,e);await wu(c,h)}else if(m){let g=await tn.promises.readFile(l,"utf8");await wu(c,g.replace(av,t))}else if(qt.basename(c).toLowerCase()===lv){let g=await tn.promises.readFile(l,"utf8"),h=qt.join(qt.dirname(c),".gitignore");await wu(h,g)}else{let g=await tn.promises.readFile(l);await wu(c,g)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Yr({siteId:o,apiToken:i,directory:e})}catch(l){u.error(`Error creating .env file: ${l}`)}}catch(s){throw u.error(`Error applying scaffold: ${s}`),s}};var wu=async(e,t)=>{try{await tn.promises.mkdir(qt.dirname(e),{recursive:!0}),await tn.promises.writeFile(e,t)}catch(r){throw u.error(`Error writing file ${e}: ${r}`),r}};var On=w(require("fs")),cv=w(require("fs-extra")),Ln=w(require("path")),Km=w(require("os")),uv=w(require("tar"));var et=class extends Error{constructor(r,n,o){super(r);this.scaffoldId=n;this.supportedIds=o;this.name="ScaffoldError"}};var La={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v3"}},"nextjs-minimal":{id:"nextjs-minimal",name:"Next.js",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs",ref:"v1"}},astro:{id:"astro",name:"Astro (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-astro-devlink",ref:"v3"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function Na(e){let t=La[e];if(!t){let r=Object.keys(La);throw new et(`Unsupported framework: "${e}". Supported: ${r.join(", ")}`,e,r)}return t}function Wm(){return Object.keys(La)}function Hm(){return[...new Set(Wm().map(e=>e.replace(/-minimal$/,"")))]}function Vm(){return["astro","nextjs"]}function Gm(e){let r=`${e.replace(/-minimal$/,"")}-minimal`;if(!La[r]){let n=Wm();throw new et(`No minimal scaffold for "${e}". Supported: ${n.join(", ")}`,r,n)}return r}R();qr();var vT="https://github.com";async function Jm(e){let t=e.endsWith("-minimal")?e:Gm(e);return bu(t)}async function bu(e){return Na(e).source.type==="github"?ST(e):dv(e)}async function dv(e){let t=Na(e);if(t.source.type!=="local")throw new et(`Scaffold "${e}" does not have a local source`,e);let r=Ln.isAbsolute(t.source.path)?t.source.path:Ln.join(__dirname,t.source.path);if(!On.existsSync(r))throw new et(`Scaffold directory not found: ${r}`,e);let n=await zm(r);return{scaffoldId:e,files:n,extractionRoot:r}}async function ST(e){let t=Na(e);if(t.source.type!=="github")throw new et(`Scaffold "${e}" does not have a GitHub source`,e);let r=(Ke()?t.source.betaRef:void 0)??t.source.ref??"main",n=`${vT}/${t.source.repo}/archive/${r}.tar.gz`,o=await On.promises.mkdtemp(Ln.join(Km.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${r})`);try{let s;try{s=await fetch(n,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(g){throw i.fail("Download failed"),new et(`Failed to fetch scaffold from GitHub: ${g instanceof Error?g.message:String(g)}. Repo: ${t.source.repo}, ref: ${r}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new et(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${r}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await xT(a,o),l.succeed("Scaffold ready")}catch(g){throw l.fail("Unpack failed"),g}let c=await On.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new et(`Unexpected tarball structure for ${t.source.repo}`,e);let f=Ln.join(o,p),m=await zm(f);return{scaffoldId:e,files:m,extractionRoot:f}}catch(s){try{cv.default.removeSync(o)}catch{}throw s instanceof et?s:new et(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function xT(e,t){let r=Ln.join(Km.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await On.promises.writeFile(r,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await uv.extract({file:r,cwd:t})}finally{await On.promises.unlink(r).catch(()=>{})}}async function zm(e){let t=[],r=await On.promises.readdir(e,{withFileTypes:!0});for(let n of r){let o=Ln.join(e,n.name);n.isDirectory()?t.push(...await zm(o)):t.push(o)}return t}var Tg=w(require("fs-extra"));Y();Z();hg();el();Pe();ke();R();var c$="DUPLICATE_ENVIRONMENT_MOUNT",u$="ENVIRONMENT_MOUNT_MISMATCH",d$="DUPLICATE_ENVIRONMENT_BRANCH",p$="INVALID_MOUNT_PATH_FORMAT",f$="INVALID_PROJECT_ID",m$="DUPLICATE_PROJECT_NAME",g$="MAX_PROJECTS_PER_SITE",FS={[c$]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[u$]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[d$]:"An environment with this branch already exists for this app.",[p$]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[f$]:"Invalid app ID. This app may have been deleted or belongs to a different site. Please remove the 'app_id' field (or the legacy 'project_id' field) from your webflow.json and redeploy to create a new app.",[m$]:"An app with this name already exists on this site, usually because 'app_id' is missing from your webflow.json. To deploy to the existing app, provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json \u2014 you can find the ID in the Webflow Cloud dashboard.",[g$]:"This site has reached its limit of Cloud apps, so no new app can be created. Deploy to one of its existing apps, or delete an app you no longer need from the Webflow Cloud dashboard."};function _S(e){let t={timestamp:new Date().toISOString()};if(e instanceof Error)t.code=e.name,t.msg=e.message,t.stack=e.stack;else if(typeof e=="object"&&e!==null){let i=e;t.code=typeof i.code=="string"?i.code:void 0,t.msg=typeof i.msg=="string"?i.msg:void 0,t.status=typeof i.status=="number"?i.status:void 0}let r=t.msg||"",n=t.status??t.code,o=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):void 0;if(u.error(`Error Details: ${JSON.stringify({timestamp:t.timestamp,code:t.code,message:t.msg,status:t.status,stack:t.stack},null,2)}`),o===401)return"Your access token is expired or invalid. Run 'webflow auth login' to re-authenticate.";if(o===403)return"Your access token is missing required permissions. Run 'webflow auth login' to re-authenticate with the necessary scopes.";for(let i in FS)if(r.includes(i))return FS[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var us=w(require("fs")),kg=require("child_process"),IS=w(require("semver"));R();C();j();C();we();R();C();function cs(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0})}var h$={siteId:{missingFlag:"siteId",flagHint:"--site",env:"WEBFLOW_SITE_ID",manifest:e=>e.siteId},appId:{missingFlag:"appId",flagHint:"--app-id",env:"WEBFLOW_APP_ID",manifest:e=>e.cloud?.app_id??e.cloud?.project_id},environmentId:{missingFlag:"environmentId",flagHint:"--environment-id",env:"WEBFLOW_APP_ENVIRONMENT_ID",manifest:e=>e.cloud?.environment_id},workspaceId:{missingFlag:"workspaceId",flagHint:"--workspace-id",env:"WEBFLOW_WORKSPACE_ID",manifest:e=>e.cloud?.workspace_id}};function bg(e){return typeof e=="string"&&e.trim()!==""}async function Mo(e,t={}){let r=h$[e],{flagValue:n,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??Xe();if(bg(n))return cs(n,e),n;let c=process.env[r.env];if(bg(c))return cs(c,e),c;let p=r.manifest(o??{});if(bg(p))return l||u.info(`Using ${e} from webflow.json`),cs(p,e),p;if(!a&&s){let m=await s();return cs(m,e),m}let f=i??r.flagHint;throw new d(`Missing required ${e}. Pass ${f}, set ${r.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:r.missingFlag})}async function Hn(e,t={}){try{return await Mo(e,t)}catch(r){if(r instanceof d&&r.missingFlag===e)return;throw r}}C();var y$=/[\x00-\x1f?#%/\\]/;function Vn(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0});if(y$.test(e)||e.includes(".."))throw new d(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Vn(e,t)}function w$(e){if(!e)return"unknown";let t=IS.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var AS=104857600;function RS(e){if(e===0)return"0 B";let t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${r[n]}`}function b$(){try{let e=(0,kg.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(!/^[0-9a-f]{40}$/.test(e))throw new Error("Invalid commit hash format");try{return(0,kg.execSync)("git status --porcelain --untracked-files=no",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0?`git@${e}+dirty`:`git@${e}`}catch{return`git@${e}`}}catch{return`noversion@${new Date().toISOString()}`}}async function Dg(e,t,r){let n=await fetch(`${O()}${t}`,{method:r.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:r.body?JSON.stringify(r.body):void 0});if(!n.ok){let o=await n.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=_S(i);throw new Error(s)}return n.json()}async function TS(e,t,r,n){let{manifest:o}=oe(),i=o.cloud||{},s=i.framework,a=await Hn("appId",{flagValue:n?.appId,manifest:o});if(!s)throw new d("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=w$(i.framework_version),c=await k$({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:r,environment:t,projectId:a,projectName:n?.projectName,description:n?.description,directory:n?.directory,version:b$()});return!a&&c.project_id&&(Se({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function k$(e){let{siteId:t,framework:r,frameworkVersion:n,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,f={framework:r,framework_version:n,mount_path:o,environment:i,version:s};a&&(f.project_id=a),l&&(f.project_name=l),c&&(f.description=c),p&&(f.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Dg(e.apiToken,m,{method:"POST",body:f})}async function PS(e,t){let{siteId:r,accessToken:n}=e,o=r?`/cosmic/${r}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Dg(n,o,{method:"GET"})}async function $S(e){let{siteId:t,accessToken:r}=e,n=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Dg(r,n,{method:"GET"})}async function OS(e,t){if(!us.existsSync(e))throw new Error(`Tarball not found at ${e}`);let r=us.statSync(e);if(r.size>AS)throw new Error(`Build output is too large (${RS(r.size)}). Maximum allowed size is ${RS(AS)}.`);let n=us.readFileSync(e),o=JSON.parse(t);if(!o.fields)throw new Error("Upload URL is missing fields property");let i=new FormData;Object.entries(o.fields).forEach(([l,c])=>{i.append(l,c)});let s=new Blob([n],{type:"application/gzip"});i.append("file",s,"output.tar.gz");let a=await fetch(o.url,{method:"POST",body:i});if(!a.ok){let l=await a.text();throw new d(l,{prefix:`${D} Upload failed with response:`})}}async function LS(e,t){if(!e||e==="undefined")throw new d("Completion URL is undefined or invalid");let r=new URL(e);t&&r.searchParams.set("failed","true");let n=await fetch(r.toString(),{method:"GET"});if(!n.ok)throw new d(`Failed to trigger deployment: ${n.status} ${n.statusText}`)}var NS=require("webflow-api");ke();ke();C();function Eg(e){return new NS.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Di()}/v2`}})}async function rl(e,t){try{let n=await Eg(e).sites.get(t);return{id:n.id||t,displayName:n.displayName||"Unknown Site",shortName:n.shortName||"unknown-site",customDomains:n.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching site details:"})}}async function vg(e,t){try{return{customDomains:(await Eg(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching custom domains:"})}}async function Sg(e){try{let t=await fetch(`https://${e}/manifest.json`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){throw new d(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function xg(e,t,r){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(n=>{if(n.mountPath!==t)return!1;if(!r)return!0;if(n.workerUrl)try{return new URL(n.workerUrl).hostname.split(".")[0]===r}catch{return!1}return!1}):!1}async function jS(e,t,r){try{let n=Eg(e),o=await rl(e,t),i=[];if(r?.domains&&r.domains.length>0)for(let s of r.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await n.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:r?.publishToWebflowSubdomain??!0})}catch(n){throw new d(n,{prefix:"Error publishing site:"})}}Oe();R();async function MS(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)throw new Error("Site ID is required for mount path validation. Apps without a connected site skip this step.");let i=u.spinner("Validating mount path configuration");try{let s=await rl(o,n),a=await vg(o,n),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(h=>h.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let p=l.map(async h=>{try{let y=await Sg(h),k=Array.isArray(y.cosmic)?y.cosmic.map(F=>F.mountPath).filter(F=>typeof F=="string"):[],v=xg(y,t,r);return{domain:h,mountPaths:k,isValid:v===!0}}catch(y){return{domain:h,mountPaths:[],isValid:!1,error:y instanceof Error?y.message:String(y)}}finally{c++,i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (${c}/${l.length})`)}}),f=await Promise.all(p),m=f.some(h=>!h.isValid),g=f.every(h=>h.isValid);return i.succeed("Mount path validation completed"),{isValid:g,domains:f,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function BS(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)return[];try{let i=await rl(o,n),s=await vg(o,n),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let f=await Sg(p),m=xg(f,t,r);return{domain:p,isValid:m}}catch(f){return u.debug(`Could not verify mount path for ${p}: ${f}`),{domain:p,isValid:!1}}});return(await Promise.all(l)).filter(p=>p.isValid).map(p=>p.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function US(e,t){return e.map(r=>`${r.startsWith("localhost")||r.startsWith("127.0.0.1")?"http":"https"}://${r}${t}`)}async function WS(e){let t=e.map(n=>({name:n,value:n,checked:!0})),r=await Cr({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:n=>n.length===0?"Please select at least one domain to publish to.":!0});return r??[]}async function HS(){return await $e({message:"The mount path doesn't match on some domains. Would you like to publish the site to update the configuration?",default:!0})}async function Cg(e,t){let{siteId:r,accessToken:n}=e;if(!r)throw new Error("Site ID is required to publish. Apps without a connected site do not use this.");let o=u.spinner(`Publishing site to ${t.length} domain(s)`);try{let s=`${(await rl(n,r)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await jS(n,r,{domains:l,publishToWebflowSubdomain:a}),o.succeed(`Site published successfully to selected domains: ${t.join(", ")}`)}catch{throw o.fail("Failed to publish site"),new Error("Failed to publish site")}}R();me();var Uo=w(require("path"));Pe();ke();we();var VS="apps";function Fg(e){VS=e}function ds(){return VS}var Gu=w(require("fs"));C();ke();Oe();C();R();async function ps(e){let t=await fetch(`${O()}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let n=await t.text(),o={};try{o=JSON.parse(n)}catch{}throw t.status===403&&o.code==="missing_scopes"?new d(`Missing required scopes for workspace access.
220
+ `,h),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:g}=await vd({libraryIdentifier:o,renderer:r.renderer,framework:r.framework,publicPath:Yn(e.publicPath||JN),sourceVolumes:[a],componentsFiles:s,componentsOptions:f,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:l,failOnWarnings:!e.force,bundler:e.bundler,projectDir:i});t.succeed(),t=u.spinner("Writing to disk"),m.forEach(([h,y])=>{let k=(0,Br.join)(`/${y}`,`${h.name}`),v=wl(g.readFileSync(k,"utf8").toString(),k,{bundleEnvironment:y}),_=(0,Br.join)(i,e.outputPath||KN);Rd.default.existsSync((0,Br.join)(_,`${y}`))||Rd.default.mkdirSync((0,Br.join)(_,`${y}`),{recursive:!0}),Rd.default.writeFileSync((0,Br.join)(_,y,h.name),v.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(r){throw t?.fail(),new d(r)}}F();N();var vl=w(require("fs-extra")),Dh=w(require("path"));F();N();function zN(){try{if(!vl.default.existsSync(Rt))return null;let e=vl.default.readdirSync(Rt).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:Dh.default.join(Rt,t),time:vl.default.statSync(Dh.default.join(Rt,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);if(e.length===0)return null;for(let t of e)try{let n=vl.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(n){let o=n[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function Eh(){let e=zN();e&&u.info(`${Ti} Latest log: ${e}`),u.info(`${Ti} All logs: ${Rt}`)}async function FC(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(Eh)}ge();var qN=`${de("[Deprecated]")} The 'library' commands will be removed in the next major release.`,YN=()=>{u.warn(`${Z} ${de("webflow library share")} is deprecated and will be removed in the next major release.
221
+ Use ${q("webflow devlink import")} instead.
222
+ `)},XN=()=>{u.warn(`${Z} ${de("webflow library bundle")} is deprecated and will be removed in the next major release.
223
+ Use ${q("webflow devlink bundle")} instead.
224
+ `)},ZN=()=>{u.warn(`${Z} ${de("webflow library log")} is deprecated and will be removed in the next major release.
225
+ Use ${q("webflow log")} instead.
226
+ `)},QN="Import a library of Code Components into your Webflow Workspace.",ej="Bundle a library of Code Components for local development.",IC=()=>new Zn.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),RC=()=>new Zn.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),TC=()=>new Zn.Option("--dev","Bundle in development mode for debugging purposes."),PC=()=>new Zn.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),tj=()=>new Zn.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),rj=()=>new Zn.Option("--public-path <path>","Set the public path for the bundle."),nj=()=>new Zn.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function vh(e,t){return e.command(t).description(QN).addOption(pn()).addOption(IC()).addOption(RC()).addOption(TC()).addOption(PC()).action(fl(bh))}function Sh(e,t){return e.command(t).description(ej).addOption(tj()).addOption(rj()).addOption(nj()).addOption(IC()).addOption(RC()).addOption(TC()).addOption(PC()).action(fl(kh))}var $C=e=>{let t=e.command("library").description(qN);vh(t,"share").description(`${de("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",YN),Sh(t,"bundle").description(`${de("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",XN),t.command("log").description(`${de("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",ZN).action(Eh)};ge();var OC=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${de("[Deprecated]")} Use 'webflow devlink export' instead. Sync your Webflow components to your filesystem.`).argument("[components...]","A list of components to sync. If none is provided, all components will be synced.").addOption(pn()).addOption(Nt()).action(JS),vh(t,"import"),Sh(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(pn()).addOption(Nt()).action(fl(dd)),Zt(t)};var hn=w(require("fs")),nr=w(require("path"));F();z();var Ae={New:"new",Existing:"existing"},LC="cli",tr=3,rr=39,Td="astro",NC="cloud-scaffolds";var jC="package.json",fi="webflow.json",Pd="wf-placeholder-name",MC="CLOUD_MOUNT_PATH",BC="gitignore";function xh(e){return!e.siteId}var Sl=async(e,t,r=Td,n,o,i)=>{try{let s,a;if("content"in n){let l=n.content;s=l.files,a=c=>nr.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=n[r];if(!c)throw new Error(`Scaffold "${r}" not found`);s=c;let p=nr.join(NC,r);a=f=>f.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=nr.join(e,a(l)),p=l.includes("next.config.ts"),f=l.includes("astro.config.mjs"),m=p||f;if(l.includes(fi)&&hn.existsSync(c))continue;if(l.includes(jC)||l.includes(fi)){let h=(await hn.promises.readFile(l,"utf8")).replace(Pd,e);await $d(c,h)}else if(m){let g=await hn.promises.readFile(l,"utf8");await $d(c,g.replace(MC,t))}else if(nr.basename(c).toLowerCase()===BC){let g=await hn.promises.readFile(l,"utf8"),h=nr.join(nr.dirname(c),".gitignore");await $d(h,g)}else{let g=await hn.promises.readFile(l);await $d(c,g)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{tn({siteId:o,apiToken:i,directory:e})}catch(l){u.error(`Error creating .env file: ${l}`)}}catch(s){throw u.error(`Error applying scaffold: ${s}`),s}};var $d=async(e,t)=>{try{await hn.promises.mkdir(nr.dirname(e),{recursive:!0}),await hn.promises.writeFile(e,t)}catch(r){throw u.error(`Error writing file ${e}: ${r}`),r}};var Qn=w(require("fs")),UC=w(require("fs-extra")),eo=w(require("path")),Ih=w(require("os")),WC=w(require("tar"));var rt=class extends Error{constructor(r,n,o){super(r);this.scaffoldId=n;this.supportedIds=o;this.name="ScaffoldError"}};var xl={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v3"}},"nextjs-minimal":{id:"nextjs-minimal",name:"Next.js",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs",ref:"v1"}},astro:{id:"astro",name:"Astro (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-astro-devlink",ref:"v3"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function Cl(e){let t=xl[e];if(!t){let r=Object.keys(xl);throw new rt(`Unsupported framework: "${e}". Supported: ${r.join(", ")}`,e,r)}return t}function Ch(){return Object.keys(xl)}function _h(){return[...new Set(Ch().map(e=>e.replace(/-minimal$/,"")))]}function Ah(){return["astro","nextjs"]}function Fh(e){let r=`${e.replace(/-minimal$/,"")}-minimal`;if(!xl[r]){let n=Ch();throw new rt(`No minimal scaffold for "${e}". Supported: ${n.join(", ")}`,r,n)}return r}F();en();var oj="https://github.com";async function Rh(e){let t=e.endsWith("-minimal")?e:Fh(e);return Od(t)}async function Od(e){return Cl(e).source.type==="github"?ij(e):HC(e)}async function HC(e){let t=Cl(e);if(t.source.type!=="local")throw new rt(`Scaffold "${e}" does not have a local source`,e);let r=eo.isAbsolute(t.source.path)?t.source.path:eo.join(__dirname,t.source.path);if(!Qn.existsSync(r))throw new rt(`Scaffold directory not found: ${r}`,e);let n=await Th(r);return{scaffoldId:e,files:n,extractionRoot:r}}async function ij(e){let t=Cl(e);if(t.source.type!=="github")throw new rt(`Scaffold "${e}" does not have a GitHub source`,e);let r=(Ve()?t.source.betaRef:void 0)??t.source.ref??"main",n=`${oj}/${t.source.repo}/archive/${r}.tar.gz`,o=await Qn.promises.mkdtemp(eo.join(Ih.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${r})`);try{let s;try{s=await fetch(n,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(g){throw i.fail("Download failed"),new rt(`Failed to fetch scaffold from GitHub: ${g instanceof Error?g.message:String(g)}. Repo: ${t.source.repo}, ref: ${r}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new rt(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${r}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await sj(a,o),l.succeed("Scaffold ready")}catch(g){throw l.fail("Unpack failed"),g}let c=await Qn.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new rt(`Unexpected tarball structure for ${t.source.repo}`,e);let f=eo.join(o,p),m=await Th(f);return{scaffoldId:e,files:m,extractionRoot:f}}catch(s){try{UC.default.removeSync(o)}catch{}throw s instanceof rt?s:new rt(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function sj(e,t){let r=eo.join(Ih.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await Qn.promises.writeFile(r,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await WC.extract({file:r,cwd:t})}finally{await Qn.promises.unlink(r).catch(()=>{})}}async function Th(e){let t=[],r=await Qn.promises.readdir(e,{withFileTypes:!0});for(let n of r){let o=eo.join(e,n.name);n.isDirectory()?t.push(...await Th(o)):t.push(o)}return t}var uy=w(require("fs-extra"));z();X();zh();Ml();Oe();De();F();var $j="DUPLICATE_ENVIRONMENT_MOUNT",Oj="ENVIRONMENT_MOUNT_MISMATCH",Lj="DUPLICATE_ENVIRONMENT_BRANCH",Nj="INVALID_MOUNT_PATH_FORMAT",jj="INVALID_PROJECT_ID",Mj="DUPLICATE_PROJECT_NAME",Bj="MAX_PROJECTS_PER_SITE",G_={[$j]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[Oj]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[Lj]:"An environment with this branch already exists for this app.",[Nj]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[jj]:"Invalid app ID. This app may have been deleted or belongs to a different site. Please remove the 'app_id' field (or the legacy 'project_id' field) from your webflow.json and redeploy to create a new app.",[Mj]:"An app with this name already exists on this site, usually because 'app_id' is missing from your webflow.json. To deploy to the existing app, provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json \u2014 you can find the ID in the Webflow Cloud dashboard.",[Bj]:"This site has reached its limit of Cloud apps, so no new app can be created. Deploy to one of its existing apps, or delete an app you no longer need from the Webflow Cloud dashboard."};function K_(e){let t={timestamp:new Date().toISOString()};if(e instanceof Error)t.code=e.name,t.msg=e.message,t.stack=e.stack;else if(typeof e=="object"&&e!==null){let i=e;t.code=typeof i.code=="string"?i.code:void 0,t.msg=typeof i.msg=="string"?i.msg:void 0,t.status=typeof i.status=="number"?i.status:void 0}let r=t.msg||"",n=t.status??t.code,o=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):void 0;if(u.error(`Error Details: ${JSON.stringify({timestamp:t.timestamp,code:t.code,message:t.msg,status:t.status,stack:t.stack},null,2)}`),o===401)return"Your access token is expired or invalid. Run 'webflow auth login' to re-authenticate.";if(o===403)return"Your access token is missing required permissions. Run 'webflow auth login' to re-authenticate with the necessary scopes.";for(let i in G_)if(r.includes(i))return G_[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var Vs=w(require("fs")),Zh=require("child_process"),q_=w(require("semver"));F();C();N();C();he();F();C();function Hs(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0})}var Uj={siteId:{missingFlag:"siteId",flagHint:"--site",env:"WEBFLOW_SITE_ID",manifest:e=>e.siteId},appId:{missingFlag:"appId",flagHint:"--app-id",env:"WEBFLOW_APP_ID",manifest:e=>e.cloud?.app_id??e.cloud?.project_id},environmentId:{missingFlag:"environmentId",flagHint:"--environment-id",env:"WEBFLOW_APP_ENVIRONMENT_ID",manifest:e=>e.cloud?.environment_id},workspaceId:{missingFlag:"workspaceId",flagHint:"--workspace-id",env:"WEBFLOW_WORKSPACE_ID",manifest:e=>e.cloud?.workspace_id}};function Xh(e){return typeof e=="string"&&e.trim()!==""}async function bi(e,t={}){let r=Uj[e],{flagValue:n,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??W(),l=t.json??He();if(Xh(n))return Hs(n,e),n;let c=process.env[r.env];if(Xh(c))return Hs(c,e),c;let p=r.manifest(o??{});if(Xh(p))return l||u.info(`Using ${e} from webflow.json`),Hs(p,e),p;if(!a&&s){let m=await s();return Hs(m,e),m}let f=i??r.flagHint;throw new d(`Missing required ${e}. Pass ${f}, set ${r.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:r.missingFlag})}async function no(e,t={}){try{return await bi(e,t)}catch(r){if(r instanceof d&&r.missingFlag===e)return;throw r}}C();var Wj=/[\x00-\x1f?#%/\\]/;function oo(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0});if(Wj.test(e)||e.includes(".."))throw new d(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function le(e,t){oo(e,t)}function Hj(e){if(!e)return"unknown";let t=q_.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var J_=104857600;function z_(e){if(e===0)return"0 B";let t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${r[n]}`}function Vj(){try{let e=(0,Zh.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(!/^[0-9a-f]{40}$/.test(e))throw new Error("Invalid commit hash format");try{return(0,Zh.execSync)("git status --porcelain --untracked-files=no",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0?`git@${e}+dirty`:`git@${e}`}catch{return`git@${e}`}}catch{return`noversion@${new Date().toISOString()}`}}async function Qh(e,t,r){let n=await fetch(`${O()}${t}`,{method:r.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:r.body?JSON.stringify(r.body):void 0});if(!n.ok){let o=await n.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=K_(i);throw new Error(s)}return n.json()}async function Y_(e,t,r,n){let{manifest:o}=oe(),i=o.cloud||{},s=i.framework,a=await no("appId",{flagValue:n?.appId,manifest:o});if(!s)throw new d("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=Hj(i.framework_version),c=await Gj({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:r,environment:t,projectId:a,projectName:n?.projectName,description:n?.description,directory:n?.directory,version:Vj()});return!a&&c.project_id&&(Se({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function Gj(e){let{siteId:t,framework:r,frameworkVersion:n,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,f={framework:r,framework_version:n,mount_path:o,environment:i,version:s};a&&(f.project_id=a),l&&(f.project_name=l),c&&(f.description=c),p&&(f.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Qh(e.apiToken,m,{method:"POST",body:f})}async function X_(e,t){let{siteId:r,accessToken:n}=e,o=r?`/cosmic/${r}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Qh(n,o,{method:"GET"})}async function Z_(e){let{siteId:t,accessToken:r}=e,n=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Qh(r,n,{method:"GET"})}async function Q_(e,t){if(!Vs.existsSync(e))throw new Error(`Tarball not found at ${e}`);let r=Vs.statSync(e);if(r.size>J_)throw new Error(`Build output is too large (${z_(r.size)}). Maximum allowed size is ${z_(J_)}.`);let n=Vs.readFileSync(e),o=JSON.parse(t);if(!o.fields)throw new Error("Upload URL is missing fields property");let i=new FormData;Object.entries(o.fields).forEach(([l,c])=>{i.append(l,c)});let s=new Blob([n],{type:"application/gzip"});i.append("file",s,"output.tar.gz");let a=await fetch(o.url,{method:"POST",body:i});if(!a.ok){let l=await a.text();throw new d(l,{prefix:`${D} Upload failed with response:`})}}async function eA(e,t){if(!e||e==="undefined")throw new d("Completion URL is undefined or invalid");let r=new URL(e);t&&r.searchParams.set("failed","true");let n=await fetch(r.toString(),{method:"GET"});if(!n.ok)throw new d(`Failed to trigger deployment: ${n.status} ${n.statusText}`)}var tA=require("webflow-api");De();De();C();function ey(e){return new tA.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Pi()}/v2`}})}async function Ul(e,t){try{let n=await ey(e).sites.get(t);return{id:n.id||t,displayName:n.displayName||"Unknown Site",shortName:n.shortName||"unknown-site",customDomains:n.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching site details:"})}}async function ty(e,t){try{return{customDomains:(await ey(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching custom domains:"})}}async function ry(e){try{let t=await fetch(`https://${e}/manifest.json`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){throw new d(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function ny(e,t,r){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(n=>{if(n.mountPath!==t)return!1;if(!r)return!0;if(n.workerUrl)try{return new URL(n.workerUrl).hostname.split(".")[0]===r}catch{return!1}return!1}):!1}async function rA(e,t,r){try{let n=ey(e),o=await Ul(e,t),i=[];if(r?.domains&&r.domains.length>0)for(let s of r.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await n.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:r?.publishToWebflowSubdomain??!0})}catch(n){throw new d(n,{prefix:"Error publishing site:"})}}Fe();F();async function nA(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)throw new Error("Site ID is required for mount path validation. Apps without a connected site skip this step.");let i=u.spinner("Validating mount path configuration");try{let s=await Ul(o,n),a=await ty(o,n),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(h=>h.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let p=l.map(async h=>{try{let y=await ry(h),k=Array.isArray(y.cosmic)?y.cosmic.map(_=>_.mountPath).filter(_=>typeof _=="string"):[],v=ny(y,t,r);return{domain:h,mountPaths:k,isValid:v===!0}}catch(y){return{domain:h,mountPaths:[],isValid:!1,error:y instanceof Error?y.message:String(y)}}finally{c++,i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (${c}/${l.length})`)}}),f=await Promise.all(p),m=f.some(h=>!h.isValid),g=f.every(h=>h.isValid);return i.succeed("Mount path validation completed"),{isValid:g,domains:f,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function oA(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)return[];try{let i=await Ul(o,n),s=await ty(o,n),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let f=await ry(p),m=ny(f,t,r);return{domain:p,isValid:m}}catch(f){return u.debug(`Could not verify mount path for ${p}: ${f}`),{domain:p,isValid:!1}}});return(await Promise.all(l)).filter(p=>p.isValid).map(p=>p.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function iA(e,t){return e.map(r=>`${r.startsWith("localhost")||r.startsWith("127.0.0.1")?"http":"https"}://${r}${t}`)}async function sA(e){let t=e.map(n=>({name:n,value:n,checked:!0})),r=await Fr({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:n=>n.length===0?"Please select at least one domain to publish to.":!0});return r??[]}async function aA(){return await Ce({message:"The mount path doesn't match on some domains. Would you like to publish the site to update the configuration?",default:!0})}async function oy(e,t){let{siteId:r,accessToken:n}=e;if(!r)throw new Error("Site ID is required to publish. Apps without a connected site do not use this.");let o=u.spinner(`Publishing site to ${t.length} domain(s)`);try{let s=`${(await Ul(n,r)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await rA(n,r,{domains:l,publishToWebflowSubdomain:a}),o.succeed(`Site published successfully to selected domains: ${t.join(", ")}`)}catch{throw o.fail("Failed to publish site"),new Error("Failed to publish site")}}F();ge();var ki=w(require("path"));Oe();De();he();var lA="apps";function iy(e){lA=e}function Gs(){return lA}var ep=w(require("fs"));C();De();Fe();C();F();async function Ks(e){let t=await fetch(`${O()}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let n=await t.text(),o={};try{o=JSON.parse(n)}catch{}throw t.status===403&&o.code==="missing_scopes"?new d(`Missing required scopes for workspace access.
152
227
  ${o.message??""}
153
228
  Re-run 'webflow auth login' to grant the necessary permissions.`):new d(`Failed to fetch workspaces: ${t.status} ${t.statusText}`+(o.message?`
154
- ${o.message}`:""))}return(await t.json()).workspaces}async function fs(e){if(e.length===1)return e[0];let t=await je({message:"Select the workspace for this app:",choices:e.map(r=>({name:r.name,value:r}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}Yc();j();R();j();me();async function _g(e,t){u.warn(`${X} ${ue("webflow cloud create")} is deprecated and will be removed in the next major release.
155
- Use ${z("webflow cloud init")} instead.
156
- `);let{framework:r}=t;if(!(await ms()).find(i=>i===r)){u.error(`Framework ${r} not found`);return}await Vu(e,"/app",r,void 0,Ce.Existing,void 0)}R();me();j();qr();async function Ag(){let e=Ke()?"webflow apps init":"webflow cloud init",t=Ke()?`
157
- To list your Cloud apps, use ${z("webflow apps list")}.`:"";u.warn(`${X} ${ue("webflow cloud list")} is deprecated and will be removed in the next major release.
229
+ ${o.message}`:""))}return(await t.json()).workspaces}async function Js(e){if(e.length===1)return e[0];let t=await Me({message:"Select the workspace for this app:",choices:e.map(r=>({name:r.name,value:r}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}pd();N();F();N();ge();async function sy(e,t){u.warn(`${Z} ${de("webflow cloud create")} is deprecated and will be removed in the next major release.
230
+ Use ${q("webflow cloud init")} instead.
231
+ `);let{framework:r}=t;if(!(await zs()).find(i=>i===r)){u.error(`Framework ${r} not found`);return}await Qd(e,"/app",r,void 0,Ae.Existing,void 0)}F();ge();N();en();async function ay(){let e=Ve()?"webflow apps init":"webflow cloud init",t=Ve()?`
232
+ To list your Cloud apps, use ${q("webflow apps list")}.`:"";u.warn(`${Z} ${de("webflow cloud list")} is deprecated and will be removed in the next major release.
158
233
  It lists scaffold templates, not your apps.
159
- Use ${z(`${e} --framework`)} / ${z("--help")} for available templates.${t}
160
- `);let r=await ms();u.info("Available app templates:"),r.length>0?r.forEach(n=>u.info(`- ${n}`)):u.info("No templates found.")}Y();C();we();Oe();R();j();var GS=w(require("path"));function dn(e){if(!e||e.trim()==="")return"/";let t=GS.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((n,o)=>o===0?n:encodeURIComponent(n)).join("/"),t}var D$=/^\/([a-zA-Z0-9_.~-]+(\/[a-zA-Z0-9_.~-]+)*)?$/;function Bo(e){return!e||e.trim()===""||!e.startsWith("/")||e.includes("..")?!1:D$.test(e)}me();R();j();function nl(e,t){u.warn(`${X} ${ue(e)} is deprecated; use ${z(t)} instead.`)}async function Rg(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");e.projectName!==void 0&&nl("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new d("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let r=process.stdin.isTTY,n;r&&lr()&&(n=await T());let o=!1;if(n&&!e.new&&!e.siteId)try{(await xn(n)).length===0&&(u.info(`${xe} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(g){u.debug(`Skipped sites lookup in cloud init preflight: ${g}`)}let i=await ms(),s={};if(r&&lr()){if(!e.new&&!o&&(s.initMode=await je({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Ce.New},{name:"Existing site",value:Ce.Existing}],default:Ce.New})),e?.framework||(s.scaffoldName=await je({message:"Which framework would you like to use?",choices:i.map(h=>({name:h,value:h})),default:"astro"})),!t){let h=await Ge({message:"What would you like to name your app?",validate:y=>{let k=y.trim();return k===""?"App name cannot be empty":k.length<Jt||k.length>zt?`App name must be between ${Jt} and ${zt} characters`:!0}});if(h==null)throw new d("When --no-input mode is enabled please provide the --app-name option.");s.appName=h}let g=e.new||o||s.initMode===Ce.New;!e.mount&&!g&&(s.mountPath=await Ge({message:"What path do you want to use locally? (e.g., /app)",default:"/app"}))}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?Ce.New:s.initMode??(e.siteId?Ce.Existing:V()?Ce.New:Ce.Existing),p=c===Ce.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",f=e.siteId,m=dn(p);if(!a||typeof a!="string"||a.trim()==="")throw new d("--app-name cannot be empty");if(a.length<Jt||a.length>zt)throw new d(`--app-name must be between ${Jt} and ${zt} characters`);if(!l)throw new d("--framework is required");if(!i.includes(l)){let g=i.join(`
234
+ Use ${q(`${e} --framework`)} / ${q("--help")} for available templates.${t}
235
+ `);let r=await zs();u.info("Available app templates:"),r.length>0?r.forEach(n=>u.info(`- ${n}`)):u.info("No templates found.")}z();C();he();Fe();F();N();var cA=w(require("path"));function xr(e){if(!e||e.trim()==="")return"/";let t=cA.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((n,o)=>o===0?n:encodeURIComponent(n)).join("/"),t}var Kj=/^\/([a-zA-Z0-9_.~-]+(\/[a-zA-Z0-9_.~-]+)*)?$/;function Dn(e){return!e||e.trim()===""||!e.startsWith("/")||e.includes("..")?!1:Kj.test(e)}ge();F();N();function Wl(e,t){u.warn(`${Z} ${de(e)} is deprecated; use ${q(t)} instead.`)}async function ly(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");e.projectName!==void 0&&Wl("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new d("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let r=process.stdin.isTTY,n;r&&ur()&&(n=await R());let o=!1;if(n&&!e.new&&!e.siteId&&!e.dryRun)try{(await Tn(n)).length===0&&(u.info(`${xe} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(g){u.debug(`Skipped sites lookup in cloud init preflight: ${g}`)}let i=await zs(),s={};if(r&&ur()){if(!e.new&&!o&&(s.initMode=await Me({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Ae.New},{name:"Existing site",value:Ae.Existing}],default:Ae.New})),e?.framework||(s.scaffoldName=await Me({message:"Which framework would you like to use?",choices:i.map(h=>({name:h,value:h})),default:"astro"})),!t){let h=await qe({message:"What would you like to name your app?",validate:y=>{let k=y.trim();return k===""?"App name cannot be empty":k.length<tr||k.length>rr?`App name must be between ${tr} and ${rr} characters`:!0}});if(h==null)throw new d("When --no-input mode is enabled please provide the --app-name option.");s.appName=h}let g=e.new||o||s.initMode===Ae.New;!e.mount&&!g&&(s.mountPath=await qe({message:"What path do you want to use locally? (e.g., /app)",default:"/app"}))}let a=(t||s.appName)?.trim(),l=e.framework||s.scaffoldName,c=e.new||o?Ae.New:s.initMode??(e.siteId?Ae.Existing:W()?Ae.New:Ae.Existing),p=c===Ae.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",f=e.siteId,m=xr(p);if(!a)throw new d("--app-name cannot be empty");if(a.length<tr||a.length>rr)throw new d(`--app-name must be between ${tr} and ${rr} characters`);if(!l)throw new d("--framework is required");if(!i.includes(l)){let g=i.join(`
161
236
  - `);throw new d(`--framework "${l}" not found
162
237
 
163
238
  Available frameworks:
164
- - ${g}`)}if(typeof m!="string"||!Bo(m))throw new d(`Invalid mount path: ${JSON.stringify(p)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);if(c===Ce.Existing&&!f&&(!r||V()))throw new d("--site-id is required when connecting to an existing site in non-interactive mode.");await Vu(a,m,l,f,c,e.workspaceId)}var XS=w(require("path"));Y();C();we();Oe();R();j();Pe();Z();el();var KS=require("crypto");ke();C();async function JS(e){let{accessToken:t,workspaceId:r,displayName:n,description:o,appPath:i}=e,a={requestId:(0,KS.randomUUID)(),cloudApp:{displayName:n,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:ov}}}},l=`${O()}/cosmic/workspaces/${r}/cloudApps`,c=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Version":"1.0.0"},body:JSON.stringify(a)});if(!c.ok){let p=await c.text();throw E$(c.status,c.statusText,p)}return c.json()}function E$(e,t,r){let n={};try{n=JSON.parse(r)}catch{}return e===403?n.publicErrorCode==="missing_scopes"?new d(`Missing required scopes to create a Cloud app.
239
+ - ${g}`)}if(typeof m!="string"||!Dn(m))throw new d(`Invalid mount path: ${JSON.stringify(p)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);if(c===Ae.Existing&&!f&&(!r||W()))throw new d("--site-id is required when connecting to an existing site in non-interactive mode.");if(e.dryRun){await R();let g=c===Ae.New?"New (standalone)":e.siteId?"Existing site":"Existing site (subject to workspace site lookup on real run)";u.info(`Dry run \u2014 would scaffold app "${a}"`),u.info(` Framework: ${l}`),u.info(` Mode: ${g}`),u.info(` Site: ${f??"(none \u2014 standalone / picker on real run)"}`),u.info(` Mount: ${m}`),u.info(` Directory: ./${a}`),u.info(` Workspace: ${e.workspaceId??"(picker / derived from token on real run)"}`),u.info("Dry run complete \u2014 no changes made.");return}await Qd(a,m,l,f,c,e.workspaceId)}var gA=w(require("path"));z();C();he();Fe();F();N();Oe();X();Ml();var uA=require("crypto");De();C();async function dA(e){let{accessToken:t,workspaceId:r,displayName:n,description:o,appPath:i}=e,a={requestId:(0,uA.randomUUID)(),cloudApp:{displayName:n,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:LC}}}},l=`${O()}/cosmic/workspaces/${r}/cloudApps`,c=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Version":"1.0.0"},body:JSON.stringify(a)});if(!c.ok){let p=await c.text();throw Jj(c.status,c.statusText,p)}return c.json()}function Jj(e,t,r){let n={};try{n=JSON.parse(r)}catch{}return e===403?n.publicErrorCode==="missing_scopes"?new d(`Missing required scopes to create a Cloud app.
165
240
  ${n.msg??""}
166
- Re-run 'webflow auth login' to grant the necessary permissions.`):new d(n.msg??"You don't have permission to create apps in this workspace."):e===404?new d("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?n.publicErrorCode==="workspace_unhosted_project_limit"?new d(v$(n.planName,n.limit)):n.msg?.includes("No new sites can be created")?new d(`Failed to create app: your workspace has reached its app limit.
241
+ Re-run 'webflow auth login' to grant the necessary permissions.`):new d(n.msg??"You don't have permission to create apps in this workspace."):e===404?new d("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?n.publicErrorCode==="workspace_unhosted_project_limit"?new d(zj(n.planName,n.limit)):n.msg?.includes("No new sites can be created")?new d(`Failed to create app: your workspace has reached its app limit.
167
242
  Upgrade your plan or remove unused apps to create a new one.`):new d(n.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new d(`Failed to create app: ${e} ${t}`+(n.msg?`
168
- ${n.msg}`:""))}function v$(e,t){let r="Upgrade your plan or remove unused apps to create a new one.",n=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${n}.
243
+ ${n.msg}`:""))}function zj(e,t){let r="Upgrade your plan or remove unused apps to create a new one.",n=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${n}.
169
244
  ${r}`:typeof t=="number"&&t>0?`Your workspace is limited to ${t} ${n}.
170
245
  ${r}`:e?`Your "${e}" workspace has reached its Cloud app limit.
171
246
  ${r}`:`Failed to create app: your workspace has reached its app limit.
172
- `+r}Pe();C();we();Oe();Y();async function YS(e={}){S$(e);let t=await x$(e,oe().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:oe().manifest}}function S$(e){if(e.siteId&&e.workspaceId)throw new d("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function x$(e,t){if(e.siteId)return zS(t,e.siteId);if(e.workspaceId)return qS(e.workspaceId);let r=await Hn("siteId",{manifest:t});if(r)return zS(t,r);let n=await Hn("workspaceId",{manifest:t});if(n)return qS(n);if(V()||!lr())throw new d(`No identity configured for this app.
247
+ `+r}Oe();C();he();Fe();z();async function mA(e={}){qj(e);let t=await Yj(e,oe().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:oe().manifest}}function qj(e){if(e.siteId&&e.workspaceId)throw new d("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function Yj(e,t){if(e.siteId)return pA(t,e.siteId);if(e.workspaceId)return fA(e.workspaceId);let r=await no("siteId",{manifest:t});if(r)return pA(t,r);let n=await no("workspaceId",{manifest:t});if(n)return fA(n);if(W()||!ur())throw new d(`No identity configured for this app.
173
248
  Pass one of:
174
249
  --site-id <id> (deploy to an existing Webflow site)
175
250
  --workspace-id <id> (create a new Cloud app)
176
- Or run 'webflow cloud init' to scaffold a new app.`);return F$(t)}async function zS(e,t){return{credentials:await Je(e,{site:t})}}async function qS(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function C$(){let e=await T(),t=await ps(e);if(t.length===0)throw new Cn("No workspaces found in your account. Please make sure you have at least one workspace.");let r=await fs(t);return Se({cloud:{workspace_id:r.id}}),{workspaceId:r.id,credentials:{accessToken:e,siteId:""}}}async function F$(e){let t=await je({message:"This app isn't initialized for Webflow Cloud. How would you like to deploy?",choices:[{name:"Create a new app",value:"standalone"},{name:"Attach to an existing Webflow site",value:"site-attached"},{name:"Cancel",value:"cancel"}]});if(t==="cancel"||!t)throw new d("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?C$():{credentials:await Je(e,{})}}async function Ig(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");if(e.appId!==void 0&&e.projectId!==void 0)throw new d("--app-id and --project-id are aliases of the same option. Pass exactly one (--app-id is preferred; --project-id is deprecated).");e.projectName!==void 0&&nl("--project-name","--app-name"),e.projectId!==void 0&&nl("--project-id","--app-id");let t=e.appName??e.projectName,r=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(y){throw u.error(`Error: Could not change to directory ${e.directory}`),new d(y)}if(e.framework){if(!Za.includes(e.framework))throw new d(`Framework "${e.framework}" is not supported. Allowed: ${Za.join(", ")}.`);Se({cloud:{framework:e.framework}})}let n=await YS({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=n,{credentials:i,manifest:s}=n,a=!!o;if(o){let y=XS.default.basename(process.cwd()).trim(),k=y.length>=Jt&&y.length<=zt,v=t??(k?y:"Cloud App");if(v.length<Jt||v.length>zt)throw new d(`App name must be between ${Jt} and ${zt} characters (got ${v.length}).
177
- Use --app-name to provide a valid name.`);let F=u.spinner("Creating Cloud app...");try{let S=await JS({accessToken:i.accessToken,workspaceId:o,displayName:v});F.succeed(`Cloud app created: ${S.cloudApp.displayName}`),Se({siteId:S.cloudApp.siteId,cloud:{...s.cloud,app_id:S.cloudApp.project.id,environment_id:S.cloudApp.environment.id}}),Yr({siteId:S.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=S.cloudApp.siteId,{manifest:s}=oe()}catch(S){throw F.fail("Failed to create app"),new d(S,{prefix:"Could not create app:"})}let E=s.siteId;if(!E)throw new d("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:E}}let l;try{l=_.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(y){u.debug(`Failed to initialize telemetry: ${y}`)}let c=await Hn("appId",{flagValue:r,manifest:s}),p,f,m,g=t,h=e.description;if(e.environment&&e.mount){if(p=e.environment,m=e.mount,f=dn(e.mount),!Bo(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`)}else{let y=[];if(!c){if(!g&&V())throw new d("When --no-input mode is enabled, provide --app-name to create an app, or provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json to deploy to an existing app.");try{let v=await $S(i);if(v.projects.length>0){let F=await je({message:"Select an app to deploy to:",choices:[...v.projects.map(E=>({name:`${E.name} (${E.description||"No description"})`,value:E.id})),{name:"Create new app",value:null}]});F?(c=F,Se({cloud:{app_id:F}}),u.info(`${$} App ID updated in webflow.json`)):u.info("Creating a new app will be handled during deployment.")}else u.info(`
178
- No existing apps found. A new app will be created during deployment.`)}catch(v){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(v instanceof Error?v.message:String(v))}}if(!c&&!g&&(g=await Ge({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:v=>v.trim()===""?"App name cannot be empty":!0})),c)try{let F=(await PS(i,c)).environments.map(E=>({name:`${E.branch} (${E.mount})`,value:{branch:E.branch,mount:E.mount}}));y.push(...F)}catch(v){throw new d(v,{prefix:"Error fetching app environments:"})}y.push({name:"Create new environment",value:null});let k=await je({message:"Select an environment to deploy to:",choices:y});k?(p=k.branch,m=k.mount,f=dn(k.mount)):(e.environment?p=e.environment:p=await Ge({message:"What environment would you like to deploy to?",default:"main",validate:v=>v.trim()===""?"Environment cannot be empty":!0}),e.mount?(m=e.mount,f=dn(e.mount)):(m=await Ge({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"}),f=dn(m)))}if(!Bo(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);await ZS(i,p,f,{projectName:g,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new d(t,{prefix:"Error during deployment setup:"})}}var ol=null;process.once("exit",()=>ol?.());var QS=(e,t,r)=>t instanceof po?"no-sites":t instanceof Cn?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&r===Ce.New?"no-workspaces":"unknown",ms=async()=>{try{let e=Hm(),t=Vm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},_$=async(e,t,r)=>{let n;if("content"in r)n=r.content.files;else{let l=r[t];if(!l)throw new Error(`Scaffold "${t}" not found`);n=l}let o=n.find(l=>l.includes(yo));if(!o)throw new Error(`No ${yo} found in scaffold "${t}"`);await Gu.promises.mkdir(e,{recursive:!0});let s=(await Gu.promises.readFile(o,"utf8")).replace(yu,e),a=Uo.join(e,yo);await Gu.promises.writeFile(a,s,"utf8")},Vu=async(e,t,r=hu,n,o=Ce.Existing,i)=>{if(o===Ce.New){try{let s=await Jm(r);await A$(e,t,s.scaffoldId,{content:s},r,i)}catch(s){if(s instanceof et){let a=s.message;throw s.supportedIds?.length&&(a+=`
179
- Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}return}try{let s=await bu(r);await R$(e,t,r,{content:s},n)}catch(s){if(s instanceof et){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
- Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}},A$=async(e,t,r,n,o,i)=>{let s=`./${e}`,a="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,l=a?Uo.dirname(a.extractionRoot):null,c="auth",p=!1,f=!1,m=null;try{let g=Date.now(),h=await T();c="workspaces";let y;if(i)y={id:i};else{let F=await ps(h);if(F.length===0)throw new Cn("No workspaces found in your account. Please make sure you have at least one workspace.");y=await fs(F)}c="scaffold",await Oa(e,t,r,n,void 0,void 0),f=!0,process.chdir(s);let k=o??r;Se({cloud:{framework:k,workspace_id:y.id}}),Yr({apiToken:h,directory:"."}),process.env.WEBFLOW_API_TOKEN=h;let v=Date.now()-g;try{await _.forCloud({authToken:h}).sendUsage("project_init",{scaffold:k,scaffoldName:k,initMode:Ce.New,workspaceId:y.id,totalDuration:v,mountPath:t,namespace:ds()})}catch{}p=!0}catch(g){if(m=g,g instanceof d||g instanceof Error&&g.message.includes("OAuth")){try{await Oa(e,t,r,n),process.chdir(s),Se({cloud:{framework:o??r}}),Yr({directory:"."}),f=!0}catch{}throw u.error(g),new d(g,{skipLogging:!0})}throw g}finally{if(l)try{Tg.default.removeSync(l)}catch{}if(p){let g=tx(e,Ce.New);ol=()=>u.info(g)}else{let g=QS(c,m,Ce.New),h=rx(e,Ce.New,g,f);ol=()=>u.info(h)}}},R$=async(e,t,r,n,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,c=l?Uo.dirname(l.extractionRoot):null,p="auth",f=!1,m=!1,g=null;try{let h=Date.now();await _$(e,r,n),process.chdir(i);let{manifest:y}=oe(),k=await Je(y,{site:o}),v=k.accessToken,F=k.siteId;if(s=_.forCloud({authToken:v,siteId:F}),p="scaffold",await Oa(".",t,r,n,F,v),m=!0,p="devlink",F){u.info(`${xe} Running devlink export to fetch your Webflow components`);try{await I$({site:F,apiToken:v}),a=!0}catch(S){mo(S)?u.info(`${xe} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(S,{prefix:"Failed to run devlink export:"})}}let E=Date.now()-h;await s?.sendUsage("project_init",{scaffold:r,scaffoldName:r,devlinkSyncStatus:a,totalDuration:E,mountPath:t,namespace:ds()}),f=!0}catch(h){g=h,u.error(h);try{await Oa(".",t,r,n),m=!0}catch{}throw new d(h,{skipLogging:!0})}finally{if(c)try{Tg.default.removeSync(c)}catch{}if(f){let h=tx(e,Ce.Existing);ol=()=>u.info(h)}else{let h=QS(p,g,Ce.Existing),y=rx(e,Ce.Existing,h,m);ol=()=>u.info(y)}}},I$=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Yc(),OD));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},T$=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=oe();return Um(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},P$=async(e,t,r,n)=>{u.info(Ne("Validating mount path configuration..."));let o=await MS(e,t,r);if(o.isValid)u.info(z("Mount path validation passed"));else if(u.info(P(`
181
- Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:X,a=i.isValid?z(`${i.domain} (mountPath: ${i.mountPaths[0]})`):ue(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(n){u.info("\u{1F680} Auto-publishing site to update mount path configuration...");let i=o.domains.filter(s=>!s.isValid).map(s=>s.domain);await Cg(e,i)}else if(await HS()&&lr()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await WS(s);await Cg(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},$$=async(e,t,r,n)=>{yg("\u{1F3D7}\uFE0F ","Building app");let o=await SS(e,{mountPath:r,telemetry:n?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id,serverBuildEngine:t.build_engine});yg("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await OS(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},O$=async(e,t,r,n)=>{u.success(`
182
- \u{1F310} Your cloud app will soon be available at:`);try{let o=n?.domainsOverride??await BS(e,t,r),i=US(o??[],t);i?.length>0?i.forEach(s=>{u.info(` ${s}`)}):u.warn(" No domains found with the correct mount path configuration yet.")}catch(o){u.warn(` Could not determine deployment links: ${o instanceof Error?o.message:o}`)}},L$=e=>{e.site_slug?u.success(`Visit your deployment:
251
+ Or run 'webflow cloud init' to scaffold a new app.`);return Zj(t)}async function pA(e,t){return{credentials:await Ye(e,{site:t})}}async function fA(e){let t=await R();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function Xj(){let e=await R(),t=await Ks(e);if(t.length===0)throw new Pn("No workspaces found in your account. Please make sure you have at least one workspace.");let r=await Js(t);return Se({cloud:{workspace_id:r.id}}),{workspaceId:r.id,credentials:{accessToken:e,siteId:""}}}async function Zj(e){let t=await Me({message:"This app isn't initialized for Webflow Cloud. How would you like to deploy?",choices:[{name:"Create a new app",value:"standalone"},{name:"Attach to an existing Webflow site",value:"site-attached"},{name:"Cancel",value:"cancel"}]});if(t==="cancel"||!t)throw new d("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?Xj():{credentials:await Ye(e,{})}}async function cy(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");if(e.appId!==void 0&&e.projectId!==void 0)throw new d("--app-id and --project-id are aliases of the same option. Pass exactly one (--app-id is preferred; --project-id is deprecated).");e.projectName!==void 0&&Wl("--project-name","--app-name"),e.projectId!==void 0&&Wl("--project-id","--app-id");let t=e.appName??e.projectName,r=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(y){throw u.error(`Error: Could not change to directory ${e.directory}`),new d(y)}if(e.framework){if(!Nl.includes(e.framework))throw new d(`Framework "${e.framework}" is not supported. Allowed: ${Nl.join(", ")}.`);Se({cloud:{framework:e.framework}})}let n=await mA({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=n,{credentials:i,manifest:s}=n,a=!!o;if(o){let y=gA.default.basename(process.cwd()).trim(),k=y.length>=tr&&y.length<=rr,v=t??(k?y:"Cloud App");if(v.length<tr||v.length>rr)throw new d(`App name must be between ${tr} and ${rr} characters (got ${v.length}).
252
+ Use --app-name to provide a valid name.`);let _=u.spinner("Creating Cloud app...");try{let S=await dA({accessToken:i.accessToken,workspaceId:o,displayName:v});_.succeed(`Cloud app created: ${S.cloudApp.displayName}`),Se({siteId:S.cloudApp.siteId,cloud:{...s.cloud,app_id:S.cloudApp.project.id,environment_id:S.cloudApp.environment.id}}),tn({siteId:S.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=S.cloudApp.siteId,{manifest:s}=oe()}catch(S){throw _.fail("Failed to create app"),new d(S,{prefix:"Could not create app:"})}let E=s.siteId;if(!E)throw new d("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:E}}let l;try{l=A.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(y){u.debug(`Failed to initialize telemetry: ${y}`)}let c=await no("appId",{flagValue:r,manifest:s}),p,f,m,g=t,h=e.description;if(e.environment&&e.mount){if(p=e.environment,m=e.mount,f=xr(e.mount),!Dn(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`)}else{let y=[];if(!c){if(!g&&W())throw new d("When --no-input mode is enabled, provide --app-name to create an app, or provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json to deploy to an existing app.");try{let v=await Z_(i);if(v.projects.length>0){let _=await Me({message:"Select an app to deploy to:",choices:[...v.projects.map(E=>({name:`${E.name} (${E.description||"No description"})`,value:E.id})),{name:"Create new app",value:null}]});_?(c=_,Se({cloud:{app_id:_}}),u.info(`${$} App ID updated in webflow.json`)):u.info("Creating a new app will be handled during deployment.")}else u.info(`
253
+ No existing apps found. A new app will be created during deployment.`)}catch(v){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(v instanceof Error?v.message:String(v))}}if(!c&&!g&&(g=await qe({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:v=>v.trim()===""?"App name cannot be empty":!0})),c)try{let _=(await X_(i,c)).environments.map(E=>({name:`${E.branch} (${E.mount})`,value:{branch:E.branch,mount:E.mount}}));y.push(..._)}catch(v){throw new d(v,{prefix:"Error fetching app environments:"})}y.push({name:"Create new environment",value:null});let k=await Me({message:"Select an environment to deploy to:",choices:y});k?(p=k.branch,m=k.mount,f=xr(k.mount)):(e.environment?p=e.environment:p=await qe({message:"What environment would you like to deploy to?",default:"main",validate:v=>v.trim()===""?"Environment cannot be empty":!0}),e.mount?(m=e.mount,f=xr(e.mount)):(m=await qe({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"}),f=xr(m)))}if(!Dn(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);await hA(i,p,f,{projectName:g,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new d(t,{prefix:"Error during deployment setup:"})}}var Hl=null;process.once("exit",()=>Hl?.());var yA=(e,t,r)=>t instanceof ko?"no-sites":t instanceof Pn?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&r===Ae.New?"no-workspaces":"unknown",zs=async()=>{try{let e=_h(),t=Ah();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},Qj=async(e,t,r)=>{let n;if("content"in r)n=r.content.files;else{let l=r[t];if(!l)throw new Error(`Scaffold "${t}" not found`);n=l}let o=n.find(l=>l.includes(fi));if(!o)throw new Error(`No ${fi} found in scaffold "${t}"`);await ep.promises.mkdir(e,{recursive:!0});let s=(await ep.promises.readFile(o,"utf8")).replace(Pd,e),a=ki.join(e,fi);await ep.promises.writeFile(a,s,"utf8")},Qd=async(e,t,r=Td,n,o=Ae.Existing,i)=>{if(o===Ae.New){try{let s=await Rh(r);await e1(e,t,s.scaffoldId,{content:s},r,i)}catch(s){if(s instanceof rt){let a=s.message;throw s.supportedIds?.length&&(a+=`
254
+ Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}return}try{let s=await Od(r);await t1(e,t,r,{content:s},n)}catch(s){if(s instanceof rt){let a=s.message;throw s.supportedIds?.length&&(a+=`
255
+ Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}},e1=async(e,t,r,n,o,i)=>{let s=`./${e}`,a="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,l=a?ki.dirname(a.extractionRoot):null,c="auth",p=!1,f=!1,m=null;try{let g=Date.now(),h=await R();c="workspaces";let y;if(i)y={id:i};else{let _=await Ks(h);if(_.length===0)throw new Pn("No workspaces found in your account. Please make sure you have at least one workspace.");y=await Js(_)}c="scaffold",await Sl(e,t,r,n,void 0,void 0),f=!0,process.chdir(s);let k=o??r;Se({cloud:{framework:k,workspace_id:y.id}}),tn({apiToken:h,directory:"."}),process.env.WEBFLOW_API_TOKEN=h;let v=Date.now()-g;try{await A.forCloud({authToken:h}).sendUsage("project_init",{scaffold:k,scaffoldName:k,initMode:Ae.New,workspaceId:y.id,totalDuration:v,mountPath:t,namespace:Gs()})}catch{}p=!0}catch(g){if(m=g,g instanceof d||g instanceof Error&&g.message.includes("OAuth")){try{await Sl(e,t,r,n),process.chdir(s),Se({cloud:{framework:o??r}}),tn({directory:"."}),f=!0}catch{}throw u.error(g),new d(g,{skipLogging:!0})}throw g}finally{if(l)try{uy.default.removeSync(l)}catch{}if(p){let g=bA(e,Ae.New);Hl=()=>u.info(g)}else{let g=yA(c,m,Ae.New),h=kA(e,Ae.New,g,f);Hl=()=>u.info(h)}}},t1=async(e,t,r,n,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,c=l?ki.dirname(l.extractionRoot):null,p="auth",f=!1,m=!1,g=null;try{let h=Date.now();await Qj(e,r,n),process.chdir(i);let{manifest:y}=oe(),k=await Ye(y,{site:o}),v=k.accessToken,_=k.siteId;if(s=A.forCloud({authToken:v,siteId:_}),p="scaffold",await Sl(".",t,r,n,_,v),m=!0,p="devlink",_){u.info(`${xe} Running devlink export to fetch your Webflow components`);try{await r1({site:_,apiToken:v}),a=!0}catch(S){ui(S)?u.info(`${xe} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(S,{prefix:"Failed to run devlink export:"})}}let E=Date.now()-h;await s?.sendUsage("project_init",{scaffold:r,scaffoldName:r,devlinkSyncStatus:a,totalDuration:E,mountPath:t,namespace:Gs()}),f=!0}catch(h){g=h,u.error(h);try{await Sl(".",t,r,n),m=!0}catch{}throw new d(h,{skipLogging:!0})}finally{if(c)try{uy.default.removeSync(c)}catch{}if(f){let h=bA(e,Ae.Existing);Hl=()=>u.info(h)}else{let h=yA(p,g,Ae.Existing),y=kA(e,Ae.Existing,h,m);Hl=()=>u.info(y)}}},r1=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(pd(),fx));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},n1=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=oe();return xh(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},o1=async(e,t,r,n)=>{u.info(je("Validating mount path configuration..."));let o=await nA(e,t,r);if(o.isValid)u.info(q("Mount path validation passed"));else if(u.info(P(`
256
+ Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:Z,a=i.isValid?q(`${i.domain} (mountPath: ${i.mountPaths[0]})`):de(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(n){u.info("\u{1F680} Auto-publishing site to update mount path configuration...");let i=o.domains.filter(s=>!s.isValid).map(s=>s.domain);await oy(e,i)}else if(await aA()&&ur()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await sA(s);await oy(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},i1=async(e,t,r,n)=>{qh("\u{1F3D7}\uFE0F ","Building app");let o=await W_(e,{mountPath:r,telemetry:n?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id,serverBuildEngine:t.build_engine});qh("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await Q_(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},s1=async(e,t,r,n)=>{u.success(`
257
+ \u{1F310} Your cloud app will soon be available at:`);try{let o=n?.domainsOverride??await oA(e,t,r),i=iA(o??[],t);i?.length>0?i.forEach(s=>{u.info(` ${s}`)}):u.warn(" No domains found with the correct mount path configuration yet.")}catch(o){u.warn(` Could not determine deployment links: ${o instanceof Error?o.message:o}`)}},a1=e=>{e.site_slug?u.success(`Visit your deployment:
183
258
 
184
- ${xr()}/dashboard/sites/${e.site_slug}/webflow-cloud/projects/${e.project_id}/environments/${e.environment_id}/deployments/${e.deployment_id}`):u.info(`
185
- Visit the webflow Cloud dashboard to view your deployment: https://webflow.com/dashboard/sites`)},N$=async(e,t,r,n,o)=>{try{if(await LS(t.completion_url,!!n),n)u.error(`
259
+ ${Ar()}/dashboard/sites/${e.site_slug}/webflow-cloud/projects/${e.project_id}/environments/${e.environment_id}/deployments/${e.deployment_id}`):u.info(`
260
+ Visit the webflow Cloud dashboard to view your deployment: https://webflow.com/dashboard/sites`)},l1=async(e,t,r,n,o)=>{try{if(await eA(t.completion_url,!!n),n)u.error(`
186
261
  ${D} Deployment failed due to build error.`);else{u.success(`
187
- ${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=oe();Um(s)&&(i=[`${o?.projectName??Uo.basename(process.cwd())}.webflow.io`])}catch(s){u.debug(`Could not read manifest for standalone deploy link hint: ${s instanceof Error?s.message:String(s)}`)}await O$(e,r,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),L$(t)}}catch(i){throw new d(i,{prefix:"Failed to trigger deployment:"})}},j$=(e,t)=>{e&&CS(process.cwd(),e),t&&xS(t)},ZS=async(e,t,r,n)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=wg(process.cwd()),p=n?.telemetry;await p?.sendUsage("cloud_deploy_start",{environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,cloudflareBindings:c,namespace:ds()});try{sS(u,process.cwd()),o=await TS(e,t,r,n),u.info("\u{1F527} Detecting framework..."),a=await vS(process.cwd(),o.deploy_url,o.environment_id,r,o.build_engine),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),T$(n)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await P$(e,r,o.environment_id,n?.autoPublish),i=await $$(a,o,r,n),u.info(`Starting deployment process for environment: ${t} at mount path: ${r}`);let f=Date.now()-s;await p?.sendUsage("cloud_deploy_success",{duration:f,environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:ds()})}catch(f){l=f instanceof Error?f:new Error(String(f)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await p?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:r,projectName:n?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:ds()})}finally{if(j$(a,i),o&&await N$(e,o,r,l,{projectName:n?.projectName}),l)throw new d(l,{skipLogging:!0})}},ex=e=>{let t=Math.max(...e.map(i=>bt(i).length)),r=P(`\u250C${"\u2500".repeat(t+2)}\u2510`),n=P(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-bt(i).length);return`${P("\u2502")} ${i}${s} ${P("\u2502")}`});return[r,...o,n].join(`
188
- `)},tx=(e,t)=>{let r=[_t(`${rt} Get started with the following commands:`),z(`cd ${e}`),z("npm install"),z("npm run dev"),z("webflow cloud deploy")];return t!==Ce.New&&(r.push(""),r.push(_t(`${rt} Run the following command to export Webflow components when they update:`)),r.push(z("webflow devlink export"))),ex(r)},rx=(e,t,r,n=!0)=>{let o=[],i=t===Ce.New?"webflow cloud init --new":"webflow cloud init",s=l=>n?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=n?[z(`cd ${e}`)]:[];switch(r){case"auth":o.push(_t(`${rt} ${s("Webflow authentication did not complete.")}`),"",_t(n?"To finish setup:":"To retry:"),...a,z("webflow auth login"),z(i));break;case"no-sites":o.push(_t(`${rt} ${s("no Webflow sites were found in your account.")}`),"",_t(n?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,z("webflow cloud init"));break;case"no-workspaces":o.push(_t(`${rt} ${s("no Webflow workspaces were found in your account.")}`),"",_t(n?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,z("webflow cloud init --new"));break;default:o.push(_t(`${rt} ${s("setup did not complete.")}`),"",_t(n?"To retry setup:":"To retry:"),...a,z(i));break}return ex(o)};j();qr();var pn=require("commander");Y();C();R();j();Z();ke();C();lt();lt();C();async function il(e,t,r,n){let o=[],i=0,s=100;for(;;){let a=new URL(e);a.searchParams.set("limit",String(s)),a.searchParams.set("offset",String(i));let l=await K(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new d(`${n}: ${l.status} ${l.statusText}`);let c=await l.json(),p=c[r]??[];o.push(...p);let f=c.pagination?.total??p.length;if(i+=p.length,i>=f||p.length<s)break}return o}function Gn(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let r=e;return{items:r[t]??[],nextCursor:r.nextCursor??null}}return{items:[],nextCursor:null}}var M$=100;async function gs(e,t){let r=[],n=t?.maxPages??M$,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(r.push(...a),s+=1,t?.stopWhen?.(r)||!l)break;if(o.has(l))throw new d("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=n)throw new d(`Pagination aborted after ${n} pages (safety cap). The result set is larger than expected.`);i=l}return r}C();var nx="GITHUB_APP_NOT_INSTALLED",ox="GITHUB_REPO_NOT_CONNECTED",hs=class extends d{code;installUrl;constructor(t,{code:r,installUrl:n}){super(t,{isUserError:!0}),this.name="GithubConnectionError",this.code=r,this.installUrl=n}};function B$(e){let t=e.meta,r=e.extras,n=t?.installUrl??e.installUrl??r?.installUrl;if(typeof n=="string")try{let o=new URL(n);return o.protocol==="https:"&&o.hostname==="github.com"?n:void 0}catch{return}}function ix(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function sx(e){if(!e||typeof e!="object")return null;let t=e,r=t.message??t.msg;if(typeof r!="string")return null;let n=B$(t),o=n?`
262
+ ${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=oe();xh(s)&&(i=[`${o?.projectName??ki.basename(process.cwd())}.webflow.io`])}catch(s){u.debug(`Could not read manifest for standalone deploy link hint: ${s instanceof Error?s.message:String(s)}`)}await s1(e,r,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),a1(t)}}catch(i){throw new d(i,{prefix:"Failed to trigger deployment:"})}},c1=(e,t)=>{e&&V_(process.cwd(),e),t&&H_(t)},hA=async(e,t,r,n)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=Yh(process.cwd()),p=n?.telemetry;await p?.sendUsage("cloud_deploy_start",{environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,cloudflareBindings:c,namespace:Gs()});try{S_(u,process.cwd()),o=await Y_(e,t,r,n),u.info("\u{1F527} Detecting framework..."),a=await U_(process.cwd(),o.deploy_url,o.environment_id,r,o.build_engine),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),n1(n)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await o1(e,r,o.environment_id,n?.autoPublish),i=await i1(a,o,r,n),u.info(`Starting deployment process for environment: ${t} at mount path: ${r}`);let f=Date.now()-s;await p?.sendUsage("cloud_deploy_success",{duration:f,environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:Gs()})}catch(f){l=f instanceof Error?f:new Error(String(f)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await p?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:r,projectName:n?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:Gs()})}finally{if(c1(a,i),o&&await l1(e,o,r,l,{projectName:n?.projectName}),l)throw new d(l,{skipLogging:!0})}},wA=e=>{let t=Math.max(...e.map(i=>bt(i).length)),r=P(`\u250C${"\u2500".repeat(t+2)}\u2510`),n=P(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-bt(i).length);return`${P("\u2502")} ${i}${s} ${P("\u2502")}`});return[r,...o,n].join(`
263
+ `)},bA=(e,t)=>{let r=[It(`${nt} Get started with the following commands:`),q(`cd ${e}`),q("npm install"),q("npm run dev"),q("webflow cloud deploy")];return t!==Ae.New&&(r.push(""),r.push(It(`${nt} Run the following command to export Webflow components when they update:`)),r.push(q("webflow devlink export"))),wA(r)},kA=(e,t,r,n=!0)=>{let o=[],i=t===Ae.New?"webflow cloud init --new":"webflow cloud init",s=l=>n?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=n?[q(`cd ${e}`)]:[];switch(r){case"auth":o.push(It(`${nt} ${s("Webflow authentication did not complete.")}`),"",It(n?"To finish setup:":"To retry:"),...a,q("webflow auth login"),q(i));break;case"no-sites":o.push(It(`${nt} ${s("no Webflow sites were found in your account.")}`),"",It(n?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,q("webflow cloud init"));break;case"no-workspaces":o.push(It(`${nt} ${s("no Webflow workspaces were found in your account.")}`),"",It(n?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,q("webflow cloud init --new"));break;default:o.push(It(`${nt} ${s("setup did not complete.")}`),"",It(n?"To retry setup:":"To retry:"),...a,q(i));break}return wA(o)};N();en();var En=require("commander");z();C();F();N();X();De();C();ct();C();var u1=/[^\x20-\x7e]/,tp="--idempotency-key";function Gr(e){if(e===void 0)return;let t=e.trim();if(t==="")throw new d(`${tp} was passed with an empty value. Pass a retry-stable key unique to this operation, or omit the flag entirely to run without deduplication.`,{isUserError:!0,missingFlag:tp});if(u1.test(t))throw new d(`${tp} must be printable ASCII only \u2014 no control characters, newlines, or non-ASCII.`,{isUserError:!0,missingFlag:tp});return t}ct();C();async function Vl(e,t,r,n){let o=[],i=0,s=100;for(;;){let a=new URL(e);a.searchParams.set("limit",String(s)),a.searchParams.set("offset",String(i));let l=await K(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new d(`${n}: ${l.status} ${l.statusText}`);let c=await l.json(),p=c[r]??[];o.push(...p);let f=c.pagination?.total??p.length;if(i+=p.length,i>=f||p.length<s)break}return o}function io(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let r=e;return{items:r[t]??[],nextCursor:r.nextCursor??null}}return{items:[],nextCursor:null}}var d1=100;async function qs(e,t){let r=[],n=t?.maxPages??d1,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(r.push(...a),s+=1,t?.stopWhen?.(r)||!l)break;if(o.has(l))throw new d("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=n)throw new d(`Pagination aborted after ${n} pages (safety cap). The result set is larger than expected.`);i=l}return r}C();var DA="GITHUB_APP_NOT_INSTALLED",EA="GITHUB_REPO_NOT_CONNECTED",Kr=class extends d{code;installUrl;constructor(t,{code:r,installUrl:n}){super(t,{isUserError:!0}),this.name="GithubConnectionError",this.code=r,this.installUrl=n}};function p1(e){let t=e.meta,r=e.extras,n=t?.installUrl??e.installUrl??r?.installUrl;if(typeof n=="string")try{let o=new URL(n);return o.protocol==="https:"&&o.hostname==="github.com"?n:void 0}catch{return}}function vA(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function rp(e){if(!e||typeof e!="object")return null;let t=e,r=t.message??t.msg;if(typeof r!="string")return null;let n=p1(t),o=n?`
189
264
 
190
265
  ${n}
191
266
 
192
- The link is signed and expires; re-run this command to get a fresh one.`:"";return ix(r,nx)?new hs(`The Webflow GitHub App is not installed on the account that owns this repository. Install it, then re-run this command.${o}`,{code:nx,installUrl:n}):ix(r,ox)?new hs(`The Webflow GitHub App is installed on this repository, but that installation is not connected to your workspace yet. Authorize the connection, then re-run this command.${o}`,{code:ox,installUrl:n}):null}var sl=100;function ys(e){return Object.values(e).some(t=>t!==void 0)}function Wo(e,t={}){let r=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&r.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&r.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[n,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new d(`List filter "${n}" must be a non-empty value.`,{isUserError:!0});r.push(`${n}=${encodeURIComponent(i)}`)}return r.length>0?`${e}?${r.join("&")}`:e}var U$="1.0.0";function tt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":U$}}async function ht(e,t={}){let{scopeLabel:r="apps",fallbackPrefix:n,userErrorOn4xx:o=!1}=t,i={};try{let c=JSON.parse(await e.text());c!==null&&typeof c=="object"&&(i=c)}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new d(`Missing required scopes for ${r}.
267
+ The link is signed and expires; re-run this command to get a fresh one.`:"";return vA(r,DA)?new Kr(`The Webflow GitHub App is not installed on the account that owns this repository. Install it, then re-run this command.${o}`,{code:DA,installUrl:n}):vA(r,EA)?new Kr(`The Webflow GitHub App is installed on this repository, but that installation is not connected to your workspace yet. Authorize the connection, then re-run this command.${o}`,{code:EA,installUrl:n}):null}var Gl=100;function so(e){return Object.values(e).some(t=>t!==void 0)}function Di(e,t={}){let r=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&r.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&r.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[n,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new d(`List filter "${n}" must be a non-empty value.`,{isUserError:!0});r.push(`${n}=${encodeURIComponent(i)}`)}return r.length>0?`${e}?${r.join("&")}`:e}var f1="1.0.0";function ze(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":f1}}async function tt(e,t={}){let{scopeLabel:r="apps",fallbackPrefix:n,userErrorOn4xx:o=!1}=t,i={};try{let c=JSON.parse(await e.text());c!==null&&typeof c=="object"&&(i=c)}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new d(`Missing required scopes for ${r}.
193
268
  ${s??""}
194
269
  Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=n?`${n}: `:"",l=o&&e.status>=400&&e.status<500;return new d(`${a}${e.status} ${e.statusText}`+(s?`
195
- ${s}`:""),l?{isUserError:!0}:void 0)}async function ax(e,t){let r=await K(`${O()}/cosmic/apps`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let n=await r.text(),o;try{o=JSON.parse(n)}catch{}let i=sx(o);throw i||await ht({status:r.status,statusText:r.statusText,text:async()=>n},{fallbackPrefix:"Failed to create app",userErrorOn4xx:!0})}return await r.json()}async function W$(e,t){let r=await K(Wo(`${O()}/cosmic/github/repositories`,{limit:sl,cursor:t}),{headers:tt(e)});if(!r.ok)throw await ht(r);return Gn(await r.json(),"repositories")}async function lx(e,t){let r=t.toLowerCase(),n=i=>i.fullName.toLowerCase()===r;return(await gs(i=>W$(e,i),{stopWhen:i=>i.some(n)})).find(n)??null}async function H$(e,t,r={}){let n=await K(Wo(`${O()}/cosmic/apps`,{limit:sl,cursor:t,filters:r}),{headers:tt(e)});if(!n.ok)throw await ht(n);return Gn(await n.json(),"apps")}async function Ku(e,t={}){return gs(r=>H$(e,r,t))}async function Ju(e,t){ve(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:tt(e)});if(!r.ok)throw await ht(r);return await r.json()}async function cx(e,t,r){ve(t,"appId");let n=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await ht(n);return await n.json()}async function ux(e,t){ve(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:tt(e)});if(!r.ok)throw await ht(r);return await r.json()}async function dx(e,t,r={}){ve(t,"appId");let n=Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:r.limit,cursor:r.cursor}),o=await K(n,{headers:tt(e)});if(!o.ok)throw await ht(o);let{items:i,nextCursor:s}=Gn(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function V$(e,t,r,n={}){let o=await K(Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:sl,cursor:r,filters:n}),{headers:tt(e)});if(!o.ok)throw await ht(o);return Gn(await o.json(),"environments")}async function Kn(e,t,r={}){return ve(t,"appId"),gs(n=>V$(e,t,n,r))}function px(e={}){let t=[];return e.limit!==void 0&&Number.isFinite(e.limit)&&t.push(`limit=${encodeURIComponent(String(e.limit))}`),e.cursor!==void 0&&t.push(`cursor=${encodeURIComponent(e.cursor)}`),e.since!==void 0&&t.push(`since=${encodeURIComponent(e.since)}`),e.q!==void 0&&t.push(`q=${encodeURIComponent(e.q)}`),t.length>0?`?${t.join("&")}`:""}async function fx(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/buildLogs${px(o)}`,{headers:tt(e)});if(!i.ok)throw await ht(i);return await i.json()}async function mx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/logs${px(n)}`,{headers:tt(e)});if(!o.ok)throw await ht(o);return await o.json()}async function gx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{limit:n.limit,cursor:n.cursor}),{headers:tt(e)});if(!o.ok)throw await ht(o);let{items:i,nextCursor:s}=Gn(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function zu(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}`,{headers:tt(e),signal:o.signal});if(!i.ok)throw await ht(i);return await i.json()}async function hx(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/redeploy`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await ht(i);return await i.json()}async function yx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json",...n.idempotencyKey?{"Idempotency-Key":n.idempotencyKey}:{}},body:JSON.stringify({})});if(!o.ok)throw await ht(o);return await o.json()}async function Pg(e){let t=await T(),r=_.forApps({authToken:t}),n=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=ys(o),s=await Ku(t,o);if(await r.sendUsage("apps_list",{duration:Date.now()-n,count:s.length,filtered:i}),e.json){u.info(JSON.stringify(s,null,2));return}if(s.length===0){u.info(i?"No apps matched the given filters.":"No apps found.");return}let a=Fe(e.fields,bc,Fn());u.info(kc(s,a))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list apps:`}))}}var Ax=require("crypto"),Rx=require("fs"),ws=w(require("path"));Y();C();R();j();we();Pe();var G$=[/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,/\x1b[P^_][\s\S]*?\x1b\\/g,/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,/\x1b[\x20-\x7e]/g,/[\x80-\x9f]/g,/[\x00-\x08\x0b-\x1f\x7f]/g,/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g],K$=/[\r\n\u2028\u2029]+/g;function al(e){if(e==null)return"";let t=String(e);for(let r of G$)t=t.replace(r,"");return t}function b(e){return al(e).replace(K$," ").trim()}Z();C();function Q(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new d(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}var wx=require("child_process"),bx=require("crypto"),qu=require("fs"),kx=require("os"),Dx=w(require("path")),Ex=require("util");C();var $g=(0,Ex.promisify)(wx.execFile);function J$(){return Dx.default.resolve((0,kx.tmpdir)(),`webflow-cli-disabled-askpass-${(0,bx.randomUUID)()}`)}function vx(e){return{...process.env,...e.nonInteractive&&{GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:J$()}}}async function Og(e){try{await $g("git",["check-ref-format","--branch",e],{})}catch(t){throw t?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):typeof t?.code!="number"?new d(`Could not validate the branch name with git: ${t instanceof Error?t.message:String(t)}`,{isUserError:!0}):new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}}async function Lg(e,t,r={}){try{return await $g("git",["ls-remote","--exit-code","--heads","--",e,`refs/heads/${t}`],{env:vx(r)}),"exists"}catch(n){if(n?.code==="ENOENT")throw new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0});return n?.code===2?"missing":"unverifiable"}}async function Sx(e,t,r={}){let n=await Lg(e,t,r);if(n==="missing")throw new d("The repository does not contain the requested branch.",{isUserError:!0,missingFlag:"--branch"});if(n==="unverifiable")throw new d("Could not verify the requested branch before creating an app. Ensure git can access the repository, then retry.",{isUserError:!0,missingFlag:"--branch"})}function xx(e){let t;try{t=(0,qu.lstatSync)(e)}catch(n){if(n.code==="ENOENT")return;throw new d(`Cannot inspect the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(t.isSymbolicLink())throw new d(`${e} already exists as a symbolic link. Move or remove it, or run this command from a different directory.`,{isUserError:!0});let r;try{r=(0,qu.readdirSync)(e)}catch(n){throw new d(`Cannot read the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(r.length>0)throw new d(`${e} already exists and is not empty. Move or remove it, or run this command from a different directory.`,{isUserError:!0})}async function Cx(e,t,r,n={}){let o=["clone"];r&&o.push("--branch",r),o.push("--",e,t);try{await $g("git",o,{env:vx(n)})}catch(i){let s=typeof i?.stderr=="string"?al(i.stderr).trim():"";throw i?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):new d(`Failed to clone repository${s?`:
196
- ${s}`:"."}`,{isUserError:!0})}}C();var Yu="github.com",z$=/^[A-Za-z0-9][A-Za-z0-9-]*$/,q$=/^[A-Za-z0-9._-]+$/,Y$=/[\x00-\x1f\x7f]/;function $t(e){throw new d(`Invalid --import repository URL: ${e}`,{isUserError:!0,missingFlag:"--import"})}function ll(e){return b(e)}function X$(e){let t=e.match(/^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#]*([^?#]*)/)?.[1];return t?t.split("/").some(r=>{try{let n=decodeURIComponent(r);return n==="."||n===".."}catch{return!1}}):!1}function Fx(e){let t=e.trim();t===""&&$t("value is empty."),Y$.test(t)&&$t("value contains control characters."),t.startsWith("-")&&$t("value must not start with '-'."),X$(t)&&$t("path must not contain '.' or '..' segments.");let r;try{r=new URL(t)}catch{$t(`value is not a URL. Expected https://${Yu}/<owner>/<repo>.`)}r.protocol!=="https:"&&$t(`only https:// URLs are supported (got "${ll(r.protocol)}").`),(r.username!==""||r.password!=="")&&$t("URLs must not embed credentials."),r.hostname.toLowerCase()!==Yu&&$t(`only ${Yu} repositories are supported.`),(r.search!==""||r.hash!=="")&&$t("URLs must not contain a query string or fragment.");let n=r.pathname.split("/").filter(s=>s!=="");n.length!==2&&$t(`expected exactly <owner>/<repo> in the path (got "${ll(r.pathname)}").`);let o=n[0],i=n[1].replace(/\.git$/i,"");return z$.test(o)||$t(`"${ll(o)}" is not a valid owner.`),(i===""||!q$.test(i))&&$t(`"${ll(n[1])}" is not a valid repository name.`),/^\.+$/.test(i)&&$t(`"${ll(n[1])}" is not a valid repository name.`),{url:`https://${Yu}/${o}/${i}`,owner:o,repo:i,fullName:`${o}/${i}`}}var Z$="main",Q$="CLONE_FAILED";function eO(e,t,r){let n=r?` and cloud.environment_id "${r}"`:"";return`write cloud.app_id "${e}"${n} to ${ws.default.join(t,"webflow.json")}, then deploy with git push to the tracked branch`}var tO=/[\x00-\x1f\x7f]/;function Ix(e){return tO.test(e)||b(e)!==e}function Tx(e){if(e.startsWith("-")||Ix(e))throw new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}function rO(e,t){let r=t?.trim(),n=r&&r!==""?r:e,o=r?"--app-name":`repository name "${e}"`;if(Ix(n))throw new d("App name must not contain terminal control or formatting characters.",{isUserError:!0,missingFlag:"--app-name"});if(n.length<Jt||n.length>zt)throw new d(`App name must be between ${Jt} and ${zt} characters, but ${o} is ${n.length}. Pass --app-name with a name in that range.`,{isUserError:!0,missingFlag:"--app-name"});return n}async function nO(e,t,r){if(r)return{branch:r,source:"flag"};let n;try{n=await lx(e,t)}catch(o){throw new d(`Could not look up the default branch for ${t}: ${o instanceof Error?o.message:String(o)}
197
- Pass --branch to skip the lookup.`,{isUserError:!0,missingFlag:"--branch"})}return n?.defaultBranch?(Tx(n.defaultBranch),await Og(n.defaultBranch),{branch:n.defaultBranch,source:"resolved"}):{branch:Z$,source:"fallback"}}function oO(e){try{Q(e,"siteId")}catch(t){throw t instanceof d?new d(b(t.message),{isUserError:!0,missingFlag:"--site-id"}):t}}function iO(e){if(e==="/")throw new d(`Mount path cannot be "/" when attaching to an existing site: the root is served by the site's own pages, so an app there would take the site over. Pick a path such as --mount /app, or pass --new to create a standalone app that owns its root.`,{isUserError:!0,missingFlag:"--mount"})}function sO(e){let t=e.siteId!==void 0;if(t&&e.newSite)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!t&&!e.newSite)throw new d("--import requires exactly one target: pass --site-id <siteId> to attach to an existing site or --new to create a standalone app.",{isUserError:!0,missingFlag:"--site-id"});return t?{siteId:e.siteId,source:"flag"}:{source:"new"}}function aO(e){return e.siteId??"(a new site would be created)"}async function _x(e,t){try{let r=await Kn(e,t);return r.length===1?r[0].id:void 0}catch(r){u.debug(`Could not read environments for app ${t}: ${r}`);return}}function lO(e){let t=ws.default.join(e,"webflow.json"),r;try{r=(0,Rx.lstatSync)(t)}catch(n){if(n.code==="ENOENT")return;throw n}if(!r.isFile())throw new Error(`${t} is a symbolic link or another non-regular file, so reading or writing it could touch a file outside the clone`)}function cO(e,t){let r;try{return lO(e),r=process.cwd(),process.chdir(e),uO(t),{written:!0}}catch(n){return{written:!1,reason:n instanceof Error?n.message:String(n)}}finally{if(r!==void 0)try{process.chdir(r)}catch(n){u.warn(`${X} Could not return to ${r}: ${n instanceof Error?n.message:String(n)}`)}}}function uO(e){Se({...e.siteId?{siteId:e.siteId}:{},cloud:{app_id:e.appId,environment_id:e.environmentId,project_id:void 0,workspace_id:void 0}})}function dO(e,t){u.info(`${$} App created: ${e.id}`),u.info(` Name: ${e.name}`),u.info(` Branch: ${t.branch}`),u.info(` Directory: ${t.directory}`),t.mount!==void 0&&u.warn(`${X} Requested mount ${t.mount} is not honored by the server yet \u2014 this app is currently served at its default mount instead.`),t.linkage.written?t.environmentId||u.warn(`${X} Could not read this app's environment, so only app_id was written to webflow.json. Commands that need an environment will ask for --environment-id until the app is readable.`):u.warn(`${X} The app was created and cloned, but writing the linkage into ${t.directory}/webflow.json failed: ${b(t.linkage.reason)}. Nothing needs re-running \u2014 ${eO(e.id,t.directory,t.environmentId)}.`),e.deployStatus==="triggered"&&e.deployment?u.info(`${xe} Initial deploy queued: ${e.deployment.dashboardUrl}`):e.message&&u.warn(`${X} ${e.message}`)}async function Ng(e){let t=Fx(e.import),r=rO(t.repo,e.appName),n=e.branch?.trim()||void 0;n&&(Tx(n),await Og(n)),e.siteId!==void 0&&oO(e.siteId);let o=sO(e),i=e.mount!==void 0?dn(e.mount):void 0;if(i!==void 0){if(!Bo(i))throw new d(`Invalid mount path: ${JSON.stringify(e.mount)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`,{isUserError:!0,missingFlag:"--mount"});if(o.source==="new")throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});iO(i)}if(o.source==="flag"&&i===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"});let s=ws.default.resolve(process.cwd(),t.repo);if(xx(s),ic())throw new d(`--manifest cannot be combined with --import: the linkage is written into the repository being cloned, at ${ws.default.join(s,"webflow.json")}. Re-run without --manifest.`,{isUserError:!0,missingFlag:"--manifest"});let a=e.idempotencyKey?.trim()||void 0;if(V()&&!a)throw new d("--idempotency-key is required for non-interactive --import creates so a retry can safely replay the same create.",{isUserError:!0,missingFlag:"--idempotency-key"});let l=await T();if(e.dryRun){let G={repoUrl:t.url,branch:n??null,appName:r,siteId:o.siteId??null,siteSource:o.source,mount:i??null,directory:s,dryRun:!0};e.json?u.info(JSON.stringify(G,null,2)):(u.info(`Dry run \u2014 would create app "${r}"`),u.info(` Repository: ${G.repoUrl}`),u.info(` Branch: ${G.branch??"(default branch of the repo)"}`),u.info(` Site: ${aO(e)}`),u.info(` Mount: ${G.mount===null?"(server default: /)":`${G.mount} (requested \u2014 the server does not honor this field yet, so the app will mount at its current default until that ships)`}`),u.info(` Clone into: ${s}`),u.info("Dry run complete \u2014 no changes made."));return}if(n){let G=e.json?void 0:u.spinner("Checking requested branch");try{await Sx(t.url,n,{nonInteractive:V()}),G?.succeed(`Using branch "${n}"`)}catch(ce){throw G?.fail("Requested branch is unavailable"),ce}}let c=_.forApps({authToken:l,suppressCommand:!0}),p=Date.now(),f=G=>e.json?void 0:u.spinner(G),m=n?void 0:f("Looking up repository"),g,h;try{({branch:g,source:h}=await nO(l,t.fullName,n)),m?.succeed(`Using branch "${g}"`)}catch(G){throw m?.fail("Could not look up repository"),G}let y;if(h!=="flag"){let G=e.json?void 0:u.spinner(`Confirming "${g}" still exists on the remote`);try{y=await Lg(t.url,g,{nonInteractive:V()})}catch(ce){throw G?.fail("Could not check the resolved branch"),ce}if(y==="missing")throw G?.fail("Resolved branch is unavailable"),new d(`${h==="fallback"?"No branch was given and the repository is not visible to discovery, so":"The repository's default branch resolved to"} "${g}", which does not exist on the remote. Pass --branch <name> with the branch to build.`,{isUserError:!0,missingFlag:"--branch"});y==="unverifiable"?G?.warn(`Could not confirm "${g}" exists on the remote \u2014 continuing`):G?.succeed(`Branch "${g}" exists on the remote`)}let k=y??"exists",v=a??(0,Ax.randomUUID)(),F,E=f("Creating app");try{F=await ax(l,{cloudApp:{displayName:r,siteId:o.siteId,...i!==void 0&&{mount:i},source:{type:"GITHUB",github:{sourceUrl:t.url,branch:g}}},requestId:v}),E?.succeed("App created")}catch(G){throw E?.fail("Could not create app"),G instanceof hs&&e.json?(u.info(JSON.stringify({error:{message:G.message,code:G.code,installUrl:G.installUrl??null}},null,2)),new d(G.message,{isUserError:!0,skipLogging:!0})):G instanceof d&&G.isUserError?G:(await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"create"}),new d(`${G instanceof Error?G.message:String(G)}
198
- The create may still have succeeded server-side with its response lost. Retry with --idempotency-key ${v} to replay this exact attempt instead of creating a second app.`,{prefix:"Failed to create app:"}))}let S=h==="fallback"&&y!=="exists"?void 0:g,L=f("Cloning repository");try{await Cx(t.url,s,S,{nonInteractive:V()}),L?.succeed("Repository cloned")}catch(G){L?.fail("Could not clone repository");let ce=await _x(l,F.id),Be={clone:{repositoryUrl:t.url,directory:s,branch:S??null},linkage:{manifestPath:ws.default.join(s,"webflow.json"),cloud:{app_id:F.id,environment_id:ce??null}},deploy:{command:"git push",description:"Push to the tracked branch after restoring the linkage."}},A=a?"Do not re-run --import unless you reuse the exact idempotency key supplied to this invocation.":"Do not re-run --import: this invocation used a generated idempotency key that cannot be reused, so a retry would create a second app.",q=`App ${F.id} was created, but cloning ${t.url} failed. ${A} Clone the repository, restore the linkage in webflow.json, then deploy with git push.`,W=G instanceof Error?G.message:String(G);throw await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"clone"}),e.json?(u.info(JSON.stringify({error:{message:q,code:Q$,appId:F.id,recoveryInstructions:Be,branchVerification:k,mount:i??null,reason:W}},null,2)),new d(`${q}
199
- ${W}`,{isUserError:!0,skipLogging:!0})):(u.warn(`${X} ${q}`),G)}let U=f("Linking app to repository"),N=await _x(l,F.id),te=cO(s,{siteId:F.siteId,appId:F.id,environmentId:N});if(te.written?U?.succeed(N?"Webflow linkage written":"Webflow linkage written (app_id only)"):U?.warn("Could not write Webflow linkage"),await c.sendUsage("apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,deployStatus:F.deployStatus,linkageWritten:te.written}),e.json){u.info(JSON.stringify({...F,deployStatus:F.deployStatus??null,message:F.message??null,siteSource:o.source,branch:g,branchVerification:k,mount:i??null,directory:s,environmentId:N??null,linkageWritten:te.written,linkageError:te.written?null:te.reason},null,2));return}dO(F,{directory:s,branch:g,mount:i,environmentId:N,linkage:te})}Y();C();R();j();Z();Pe();C();we();Oe();async function Xu(e,t={}){let r=await Ku(e);if(r.length===0)throw new d("No apps found in this workspace.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||t.json){let o=r.map(i=>` ${i.id} (${i.name})`).join(`
270
+ ${s}`:""),l?{isUserError:!0}:void 0)}async function SA(e,t){let r=await K(`${O()}/cosmic/apps`,{method:"POST",headers:{...ze(e),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let n=await r.text(),o;try{o=JSON.parse(n)}catch{}let i=rp(o);throw i||await tt({status:r.status,statusText:r.statusText,text:async()=>n},{fallbackPrefix:"Failed to create app",userErrorOn4xx:!0})}return await r.json()}async function m1(e,t){let r=await K(Di(`${O()}/cosmic/github/repositories`,{limit:Gl,cursor:t}),{headers:ze(e)});if(!r.ok)throw await tt(r);return io(await r.json(),"repositories")}async function xA(e,t){let r=t.toLowerCase(),n=i=>i.fullName.toLowerCase()===r;return(await qs(i=>m1(e,i),{stopWhen:i=>i.some(n)})).find(n)??null}async function g1(e,t,r={}){let n=await K(Di(`${O()}/cosmic/apps`,{limit:Gl,cursor:t,filters:r}),{headers:ze(e)});if(!n.ok)throw await tt(n);return io(await n.json(),"apps")}async function np(e,t={}){return qs(r=>g1(e,r,t))}async function op(e,t){le(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:ze(e)});if(!r.ok)throw await tt(r);return await r.json()}async function CA(e,t,r){le(t,"appId");let n=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...ze(e),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await tt(n);return await n.json()}async function _A(e,t){le(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:ze(e)});if(!r.ok)throw await tt(r);return await r.json()}async function AA(e,t,r={}){le(t,"appId");let n=Di(`${O()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:r.limit,cursor:r.cursor}),o=await K(n,{headers:ze(e)});if(!o.ok)throw await tt(o);let{items:i,nextCursor:s}=io(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function h1(e,t,r,n={}){let o=await K(Di(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:Gl,cursor:r,filters:n}),{headers:ze(e)});if(!o.ok)throw await tt(o);return io(await o.json(),"environments")}async function Jr(e,t,r={}){return le(t,"appId"),qs(n=>h1(e,t,n,r))}async function FA(e,t,r){le(t,"appId");let n=Gr(r.requestId),o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{method:"POST",headers:{...ze(e),"Content-Type":"application/json"},body:JSON.stringify({branch:r.branch,mount:r.mount,...n?{requestId:n}:{}})});if(!o.ok){let i=await o.text(),s;try{s=JSON.parse(i)}catch{}let a=rp(s);if(a)throw a;let l=s&&typeof s=="object"?s:{},c=typeof l.msg=="string"?l.msg:typeof l.message=="string"?l.message:"";throw o.status===409&&n!==void 0&&/already being processed/i.test(c)?new d("A create with this --idempotency-key is still being processed. Retry with the same key to get the original result; a different key would create a second environment.",{isUserError:!0}):await tt({status:o.status,statusText:o.statusText,text:async()=>i},{fallbackPrefix:"Failed to create environment",userErrorOn4xx:!0})}return await o.json()}async function IA(e,t,r,n){if(le(t,"appId"),le(r,"environmentId"),n.branch===void 0&&n.mount===void 0)throw new d("Updating an environment requires at least one of branch or mount.",{isUserError:!0});let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}`,{method:"PATCH",headers:{...ze(e),"Content-Type":"application/json"},body:JSON.stringify({...n.branch!==void 0?{branch:n.branch}:{},...n.mount!==void 0?{mount:n.mount}:{}})});if(!o.ok){let i=await o.text(),s;try{s=JSON.parse(i)}catch{}let a=rp(s);throw a||await tt({status:o.status,statusText:o.statusText,text:async()=>i},{fallbackPrefix:"Failed to update environment",userErrorOn4xx:!0})}return await o.json()}async function RA(e,t,r){le(t,"appId"),le(r,"environmentId");let n=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}`,{method:"DELETE",headers:ze(e)});if(!n.ok)throw await tt(n,{fallbackPrefix:"Failed to delete environment",userErrorOn4xx:!0});return await n.json()}function TA(e={}){let t=[];return e.limit!==void 0&&Number.isFinite(e.limit)&&t.push(`limit=${encodeURIComponent(String(e.limit))}`),e.cursor!==void 0&&t.push(`cursor=${encodeURIComponent(e.cursor)}`),e.since!==void 0&&t.push(`since=${encodeURIComponent(e.since)}`),e.q!==void 0&&t.push(`q=${encodeURIComponent(e.q)}`),t.length>0?`?${t.join("&")}`:""}async function PA(e,t,r,n,o={}){le(t,"appId"),le(r,"environmentId"),oo(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/buildLogs${TA(o)}`,{headers:ze(e)});if(!i.ok)throw await tt(i);return await i.json()}async function $A(e,t,r,n={}){le(t,"appId"),le(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/logs${TA(n)}`,{headers:ze(e)});if(!o.ok)throw await tt(o);return await o.json()}async function OA(e,t,r,n={}){le(t,"appId"),le(r,"environmentId");let o=await K(Di(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{limit:n.limit,cursor:n.cursor,filters:{status:n.status}}),{headers:ze(e)});if(!o.ok)throw await tt(o);let{items:i,nextCursor:s}=io(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function ip(e,t,r,n,o={}){le(t,"appId"),le(r,"environmentId"),oo(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}`,{headers:ze(e),signal:o.signal});if(!i.ok)throw await tt(i);return await i.json()}async function LA(e,t,r,n,o={}){le(t,"appId"),le(r,"environmentId"),oo(n,"deploymentId");let i=Gr(o.idempotencyKey),s=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/redeploy`,{method:"POST",headers:{...ze(e),"Content-Type":"application/json",...i?{"Idempotency-Key":i}:{}},body:JSON.stringify({})});if(!s.ok)throw await tt(s);return await s.json()}async function NA(e,t,r,n={}){le(t,"appId"),le(r,"environmentId");let o=Gr(n.idempotencyKey),i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{method:"POST",headers:{...ze(e),"Content-Type":"application/json",...o?{"Idempotency-Key":o}:{}},body:JSON.stringify({})});if(!i.ok)throw await tt(i);return await i.json()}async function dy(e){let t=await R(),r=A.forApps({authToken:t}),n=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=so(o),s=await np(t,o);if(await r.sendUsage("apps_list",{duration:Date.now()-n,count:s.length,filtered:i}),e.json){u.info(JSON.stringify(s,null,2));return}if(s.length===0){u.info(i?"No apps matched the given filters.":"No apps found.");return}let a=Re(e.fields,Ou,Gn());u.info(Lu(s,a))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list apps:`}))}}var qA=require("crypto"),YA=require("fs"),Ys=w(require("path"));z();C();F();N();he();Oe();X();C();function Q(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new d(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}var jA=require("child_process"),MA=require("crypto"),sp=require("fs"),BA=require("os"),UA=w(require("path")),WA=require("util");C();var py=(0,WA.promisify)(jA.execFile);function y1(){return UA.default.resolve((0,BA.tmpdir)(),`webflow-cli-disabled-askpass-${(0,MA.randomUUID)()}`)}function HA(e){return{...process.env,...e.nonInteractive&&{GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:y1()}}}async function fy(e){try{await py("git",["check-ref-format","--branch",e],{})}catch(t){throw t?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):typeof t?.code!="number"?new d(`Could not validate the branch name with git: ${t instanceof Error?t.message:String(t)}`,{isUserError:!0}):new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}}async function my(e,t,r={}){try{return await py("git",["ls-remote","--exit-code","--heads","--",e,`refs/heads/${t}`],{env:HA(r)}),"exists"}catch(n){if(n?.code==="ENOENT")throw new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0});return n?.code===2?"missing":"unverifiable"}}async function VA(e,t,r={}){let n=await my(e,t,r);if(n==="missing")throw new d("The repository does not contain the requested branch.",{isUserError:!0,missingFlag:"--branch"});if(n==="unverifiable")throw new d("Could not verify the requested branch before creating an app. Ensure git can access the repository, then retry.",{isUserError:!0})}function GA(e){let t;try{t=(0,sp.lstatSync)(e)}catch(n){if(n.code==="ENOENT")return;throw new d(`Cannot inspect the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(t.isSymbolicLink())throw new d(`${e} already exists as a symbolic link. Move or remove it, or run this command from a different directory.`,{isUserError:!0});let r;try{r=(0,sp.readdirSync)(e)}catch(n){throw new d(`Cannot read the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(r.length>0)throw new d(`${e} already exists and is not empty. Move or remove it, or run this command from a different directory.`,{isUserError:!0})}async function KA(e,t,r,n={}){let o=["clone"];r&&o.push("--branch",r),o.push("--",e,t);try{await py("git",o,{env:HA(n)})}catch(i){let s=typeof i?.stderr=="string"?Ca(i.stderr).trim():"";throw i?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):new d(`Failed to clone repository${s?`:
271
+ ${s}`:"."}`,{isUserError:!0})}}C();var ap="github.com",w1=/^[A-Za-z0-9][A-Za-z0-9-]*$/,b1=/^[A-Za-z0-9._-]+$/,k1=/[\x00-\x1f\x7f]/;function Ut(e){throw new d(`Invalid --import repository URL: ${e}`,{isUserError:!0,missingFlag:"--import"})}function Kl(e){return b(e)}function D1(e){let t=e.match(/^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#]*([^?#]*)/)?.[1];return t?t.split("/").some(r=>{try{let n=decodeURIComponent(r);return n==="."||n===".."}catch{return!1}}):!1}function JA(e){let t=e.trim();t===""&&Ut("value is empty."),k1.test(t)&&Ut("value contains control characters."),t.startsWith("-")&&Ut("value must not start with '-'."),D1(t)&&Ut("path must not contain '.' or '..' segments.");let r;try{r=new URL(t)}catch{Ut(`value is not a URL. Expected https://${ap}/<owner>/<repo>.`)}r.protocol!=="https:"&&Ut(`only https:// URLs are supported (got "${Kl(r.protocol)}").`),(r.username!==""||r.password!=="")&&Ut("URLs must not embed credentials."),r.hostname.toLowerCase()!==ap&&Ut(`only ${ap} repositories are supported.`),(r.search!==""||r.hash!=="")&&Ut("URLs must not contain a query string or fragment.");let n=r.pathname.split("/").filter(s=>s!=="");n.length!==2&&Ut(`expected exactly <owner>/<repo> in the path (got "${Kl(r.pathname)}").`);let o=n[0],i=n[1].replace(/\.git$/i,"");return w1.test(o)||Ut(`"${Kl(o)}" is not a valid owner.`),(i===""||!b1.test(i))&&Ut(`"${Kl(n[1])}" is not a valid repository name.`),/^\.+$/.test(i)&&Ut(`"${Kl(n[1])}" is not a valid repository name.`),{url:`https://${ap}/${o}/${i}`,owner:o,repo:i,fullName:`${o}/${i}`}}var E1="main",v1="CLONE_FAILED";function S1(e,t,r){let n=r?` and cloud.environment_id "${r}"`:"";return`write cloud.app_id "${e}"${n} to ${Ys.default.join(t,"webflow.json")}, then deploy with git push to the tracked branch`}var x1=/[\x00-\x1f\x7f]/;function XA(e){return x1.test(e)||b(e)!==e}function ZA(e){if(e.startsWith("-")||XA(e))throw new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}function C1(e,t){let r=t?.trim(),n=r&&r!==""?r:e,o=r?"--app-name":`repository name "${e}"`;if(XA(n))throw new d("App name must not contain terminal control or formatting characters.",{isUserError:!0,missingFlag:"--app-name"});if(n.length<tr||n.length>rr)throw new d(`App name must be between ${tr} and ${rr} characters, but ${o} is ${n.length}. Pass --app-name with a name in that range.`,{isUserError:!0,missingFlag:"--app-name"});return n}async function _1(e,t,r){if(r)return{branch:r,source:"flag"};let n;try{n=await xA(e,t)}catch(o){throw new d(`Could not look up the default branch for ${t}: ${o instanceof Error?o.message:String(o)}
272
+ Pass --branch to skip the lookup.`,{isUserError:!0,missingFlag:"--branch"})}return n?.defaultBranch?(ZA(n.defaultBranch),await fy(n.defaultBranch),{branch:n.defaultBranch,source:"resolved"}):{branch:E1,source:"fallback"}}function A1(e){try{Q(e,"siteId")}catch(t){throw t instanceof d?new d(b(t.message),{isUserError:!0,missingFlag:"--site-id"}):t}}function F1(e){if(e==="/")throw new d(`Mount path cannot be "/" when attaching to an existing site: the root is served by the site's own pages, so an app there would take the site over. Pick a path such as --mount /app, or pass --new to create a standalone app that owns its root.`,{isUserError:!0,missingFlag:"--mount"})}function I1(e){let t=e.siteId!==void 0;if(t&&e.newSite)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!t&&!e.newSite)throw new d("--import requires exactly one target: pass --site-id <siteId> to attach to an existing site or --new to create a standalone app.",{isUserError:!0,missingFlag:"--site-id"});return t?{siteId:e.siteId,source:"flag"}:{source:"new"}}function R1(e){return e.siteId??"(a new site would be created)"}async function zA(e,t){try{let r=await Jr(e,t);return r.length===1?r[0].id:void 0}catch(r){u.debug(`Could not read environments for app ${t}: ${r}`);return}}function T1(e){let t=Ys.default.join(e,"webflow.json"),r;try{r=(0,YA.lstatSync)(t)}catch(n){if(n.code==="ENOENT")return;throw n}if(!r.isFile())throw new Error(`${t} is a symbolic link or another non-regular file, so reading or writing it could touch a file outside the clone`)}function P1(e,t){let r;try{return T1(e),r=process.cwd(),process.chdir(e),$1(t),{written:!0}}catch(n){return{written:!1,reason:n instanceof Error?n.message:String(n)}}finally{if(r!==void 0)try{process.chdir(r)}catch(n){u.warn(`${Z} Could not return to ${r}: ${n instanceof Error?n.message:String(n)}`)}}}function $1(e){Se({...e.siteId?{siteId:e.siteId}:{},cloud:{app_id:e.appId,environment_id:e.environmentId,project_id:void 0,workspace_id:void 0}})}function O1(e,t){u.info(`${$} App created: ${e.id}`),u.info(` Name: ${e.name}`),u.info(` Branch: ${t.branch}`),u.info(` Directory: ${t.directory}`),t.mount!==void 0&&u.info(` Mount: ${t.mount}`),t.linkage.written?t.environmentId||u.warn(`${Z} Could not read this app's environment, so only app_id was written to webflow.json. Commands that need an environment will ask for --environment-id until the app is readable.`):u.warn(`${Z} The app was created and cloned, but writing the linkage into ${t.directory}/webflow.json failed: ${b(t.linkage.reason)}. Nothing needs re-running \u2014 ${S1(e.id,t.directory,t.environmentId)}.`),e.deployStatus==="triggered"&&e.deployment?u.info(`${xe} Initial deploy queued: ${e.deployment.dashboardUrl}`):e.message&&u.warn(`${Z} ${e.message}`)}async function gy(e){let t=JA(e.import),r=C1(t.repo,e.appName),n=e.branch?.trim()||void 0;n&&(ZA(n),await fy(n)),e.siteId!==void 0&&A1(e.siteId);let o=I1(e),i=e.mount!==void 0?xr(e.mount):void 0;if(i!==void 0){if(!Dn(i))throw new d(`Invalid mount path: ${JSON.stringify(e.mount)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`,{isUserError:!0,missingFlag:"--mount"});if(o.source==="new")throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});F1(i)}if(o.source==="flag"&&i===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"});let s=Ys.default.resolve(process.cwd(),t.repo);if(GA(s),dc())throw new d(`--manifest cannot be combined with --import: the linkage is written into the repository being cloned, at ${Ys.default.join(s,"webflow.json")}. Re-run without --manifest.`,{isUserError:!0,missingFlag:"--manifest"});let a=e.idempotencyKey?.trim()||void 0;if(W()&&!a)throw new d("--idempotency-key is required for non-interactive --import creates so a retry can safely replay the same create.",{isUserError:!0,missingFlag:"--idempotency-key"});let l=await R();if(e.dryRun){let G={repoUrl:t.url,branch:n??null,appName:r,siteId:o.siteId??null,siteSource:o.source,mount:i??null,directory:s,dryRun:!0};e.json?u.info(JSON.stringify(G,null,2)):(u.info(`Dry run \u2014 would create app "${r}"`),u.info(` Repository: ${G.repoUrl}`),u.info(` Branch: ${G.branch??"(default branch of the repo)"}`),u.info(` Site: ${R1(e)}`),u.info(` Mount: ${G.mount===null?"(server default: /)":G.mount}`),u.info(` Clone into: ${s}`),u.info("Dry run complete \u2014 no changes made."));return}if(n){let G=e.json?void 0:u.spinner("Checking requested branch");try{await VA(t.url,n,{nonInteractive:W()}),G?.succeed(`Using branch "${n}"`)}catch(ue){throw G?.fail("Requested branch is unavailable"),ue}}let c=A.forApps({authToken:l,suppressCommand:!0}),p=Date.now(),f=G=>e.json?void 0:u.spinner(G),m=n?void 0:f("Looking up repository"),g,h;try{({branch:g,source:h}=await _1(l,t.fullName,n)),m?.succeed(`Using branch "${g}"`)}catch(G){throw m?.fail("Could not look up repository"),G}let y;if(h!=="flag"){let G=e.json?void 0:u.spinner(`Confirming "${g}" still exists on the remote`);try{y=await my(t.url,g,{nonInteractive:W()})}catch(ue){throw G?.fail("Could not check the resolved branch"),ue}if(y==="missing")throw G?.fail("Resolved branch is unavailable"),new d(`${h==="fallback"?"No branch was given and the repository is not visible to discovery, so":"The repository's default branch resolved to"} "${g}", which does not exist on the remote. Pass --branch <name> with the branch to build.`,{isUserError:!0,missingFlag:"--branch"});y==="unverifiable"?G?.warn(`Could not confirm "${g}" exists on the remote \u2014 continuing`):G?.succeed(`Branch "${g}" exists on the remote`)}let k=y??"exists",v=a??(0,qA.randomUUID)(),_,E=f("Creating app");try{_=await SA(l,{cloudApp:{displayName:r,siteId:o.siteId,...i!==void 0&&{mount:i},source:{type:"GITHUB",github:{sourceUrl:t.url,branch:g}}},requestId:v}),E?.succeed("App created")}catch(G){throw E?.fail("Could not create app"),G instanceof Kr&&e.json?(u.info(JSON.stringify({error:{message:G.message,code:G.code,installUrl:G.installUrl??null}},null,2)),new d(G.message,{isUserError:!0,skipLogging:!0})):G instanceof d&&G.isUserError?G:(await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"create"}),new d(`${G instanceof Error?G.message:String(G)}
273
+ The create may still have succeeded server-side with its response lost. Retry with --idempotency-key ${v} to replay this exact attempt instead of creating a second app.`,{prefix:"Failed to create app:"}))}let S=h==="fallback"&&y!=="exists"?void 0:g,L=f("Cloning repository");try{await KA(t.url,s,S,{nonInteractive:W()}),L?.succeed("Repository cloned")}catch(G){L?.fail("Could not clone repository");let ue=await zA(l,_.id),Ue={clone:{repositoryUrl:t.url,directory:s,branch:S??null},linkage:{manifestPath:Ys.default.join(s,"webflow.json"),cloud:{app_id:_.id,environment_id:ue??null}},deploy:{command:"git push",description:"Push to the tracked branch after restoring the linkage."}},I=a?"Do not re-run --import unless you reuse the exact idempotency key supplied to this invocation.":"Do not re-run --import: this invocation used a generated idempotency key that cannot be reused, so a retry would create a second app.",Y=`App ${_.id} was created, but cloning ${t.url} failed. ${I} Clone the repository, restore the linkage in webflow.json, then deploy with git push.`,H=G instanceof Error?G.message:String(G);throw await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"clone"}),e.json?(u.info(JSON.stringify({error:{message:Y,code:v1,appId:_.id,recoveryInstructions:Ue,branchVerification:k,mount:i??null,reason:H}},null,2)),new d(`${Y}
274
+ ${H}`,{isUserError:!0,skipLogging:!0})):(u.warn(`${Z} ${Y}`),G)}let U=f("Linking app to repository"),j=await zA(l,_.id),re=P1(s,{siteId:_.siteId,appId:_.id,environmentId:j});if(re.written?U?.succeed(j?"Webflow linkage written":"Webflow linkage written (app_id only)"):U?.warn("Could not write Webflow linkage"),await c.sendUsage("apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,deployStatus:_.deployStatus,linkageWritten:re.written}),e.json){u.info(JSON.stringify({..._,deployStatus:_.deployStatus??null,message:_.message??null,siteSource:o.source,branch:g,branchVerification:k,mount:i??null,directory:s,environmentId:j??null,linkageWritten:re.written,linkageError:re.written?null:re.reason},null,2));return}O1(_,{directory:s,branch:g,mount:i,environmentId:j,linkage:re})}z();C();F();N();X();Oe();C();he();Fe();async function lp(e,t={}){let r=await np(e);if(r.length===0)throw new d("No apps found in this workspace.",{isUserError:!0});if(r.length===1)return r[0].id;if(W()||t.json){let o=r.map(i=>` ${i.id} (${i.name})`).join(`
200
275
  `);throw new d(`This workspace has multiple apps. Pass the app id to choose one:
201
- ${o}`,{isUserError:!0,missingFlag:"appId"})}let n=await je({message:"Select an app:",choices:r.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!n)throw new d("No app selected.",{isUserError:!0});return n}async function Nr(e,t,r){let{manifest:n}=oe();return Mo("appId",{flagValue:t,manifest:n,isNoInput:!1,json:r.json,prompt:()=>Xu(e,{json:r.json})})}async function jg(e,t){let r=await T(),n=await Nr(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await Ju(r,n);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=Fe(t.fields,bc,Fn());u.info(kc([s],a))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app:`}))}}Y();C();R();j();Z();async function Mg(e,t){let r=await T(),n=await Nr(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await dx(r,n,{limit:t.limit,cursor:t.cursor});if(await o.sendUsage("apps_domains",{duration:Date.now()-i,count:s.customDomains.length}),t.json){u.info(JSON.stringify(s,null,2));return}if(s.customDomains.length===0){u.info("No domains found.");return}let a=Fe(t.fields,Ek,ha());u.info(Sk(s.customDomains,a)+Ai(s.nextCursor))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app domains:`}))}}Y();C();R();j();Z();async function Bg(e,t){let r=await T(),n=await Nr(r,e,t),o=t.json?void 0:Fe(t.fields,vk,ya()),i=_.forApps({authToken:r}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=ys(a),c=await Kn(r,n,a);if(await i.sendUsage("apps_environments_list",{duration:Date.now()-s,count:c.length,filtered:l}),t.json){u.info(JSON.stringify(c,null,2));return}if(c.length===0){u.info(l?"No environments matched the given filters.":"No environments found.");return}u.info(xk(c,o))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list app environments:`}))}}Y();C();R();j();Z();me();var Ug=["timestamp","message","phase"],cl="timestamp,message",Zu=dt(Ug);function Jn(){return Ug}function pO(e,t){return e==null||e===""?P("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function fO(e,t=cl.split(",")){return e.map(r=>t.map(n=>pO(r[n],n)).join(" ")).join(`
202
- `)}function Qu(e,t,r){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":fO(e.logs,r)+Ai(e.nextCursor)}Pe();C();we();Oe();async function Px(e,t,r={}){let n=await Kn(e,t);if(n.length===0)throw new d("No environments found for this app.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||r.json){let i=n.map(s=>` ${s.id} (${s.branch})`).join(`
276
+ ${o}`,{isUserError:!0,missingFlag:"appId"})}let n=await Me({message:"Select an app:",choices:r.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!n)throw new d("No app selected.",{isUserError:!0});return n}async function sr(e,t,r){let{manifest:n}=oe();return bi("appId",{flagValue:t,manifest:n,isNoInput:!1,json:r.json,prompt:()=>lp(e,{json:r.json})})}async function hy(e,t){let r=await R(),n=await sr(r,e,t),o=A.forApps({authToken:r}),i=Date.now();try{let s=await op(r,n);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=Re(t.fields,Ou,Gn());u.info(Lu([s],a))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app:`}))}}z();C();F();N();X();async function yy(e,t){let r=await R(),n=await sr(r,e,t),o=A.forApps({authToken:r}),i=Date.now();try{let s=await AA(r,n,{limit:t.limit,cursor:t.cursor});if(await o.sendUsage("apps_domains",{duration:Date.now()-i,count:s.customDomains.length}),t.json){u.info(JSON.stringify(s,null,2));return}if(s.customDomains.length===0){u.info("No domains found.");return}let a=Re(t.fields,Qv,ll()),l=[...t.limit!==void 0?["--limit",String(t.limit)]:[],...ws(a,bs)];u.info(tS(s.customDomains,a)+ys(s.nextCursor,l))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app domains:`}))}}z();C();F();N();X();async function wy(e,t){let r=await R(),n=await sr(r,e,t),o=t.json?void 0:Re(t.fields,eS,cl()),i=A.forApps({authToken:r}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=so(a),c=await Jr(r,n,a);if(await i.sendUsage("apps_environments_list",{duration:Date.now()-s,count:c.length,filtered:l}),t.json){u.info(JSON.stringify(c,null,2));return}if(c.length===0){u.info(l?"No environments matched the given filters.":"No environments found.");return}u.info(rS(c,o))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list app environments:`}))}}z();C();F();N();X();C();function QA(e){if(e===void 0||e.trim()==="")throw new d("--branch is required and must be a non-empty branch name (for example, --branch main).",{isUserError:!0,missingFlag:"--branch"});return e}function eF(e){if(e!==void 0){if(e.trim()==="")throw new d("--branch must be a non-empty branch name when provided (for example, --branch main).",{isUserError:!0,missingFlag:"--branch"});return e}}function by(e){if(e===void 0||e.trim()==="")throw new d("--mount is required and must be a URL path (for example, --mount /app).",{isUserError:!0,missingFlag:"--mount"});let t=xr(e);if(!Dn(t))throw new d(`Invalid mount path: ${JSON.stringify(e)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`,{isUserError:!0,missingFlag:"--mount"});return t}function tF(e){if(e!==void 0){if(e.trim()==="")throw new d("--mount must be a non-empty URL path when provided (for example, --mount /app).",{isUserError:!0,missingFlag:"--mount"});return by(e)}}function rF(e,t){if(e===void 0&&t===void 0)throw new d("At least one of --branch or --mount is required to update an environment.",{isUserError:!0,missingFlag:"--branch"})}async function ky(e,t){let r=Gr(t.idempotencyKey),n=QA(t.branch),o=by(t.mount),i=await R(),s=await sr(i,e,t);if(le(s,"appId"),t.dryRun){t.json?u.info(JSON.stringify({appId:s,branch:n,mount:o,dryRun:!0},null,2)):(u.info(`Would create environment for branch \`${n}\` at ${o} in app ${s}.`),u.info("Dry run \u2014 no changes made."));return}let a=A.forApps({authToken:i,suppressCommand:!!r}),l=Date.now();try{let c=await FA(i,s,{branch:n,mount:o,...r?{requestId:r}:{}});if(await a.sendUsage("apps_environments_create",{duration:Date.now()-l,dryRun:!1,mountRefreshStatus:c.mountRefreshStatus}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(`${$} Created environment ${c.id} \u2014 branch \`${c.branch}\` at ${c.mount}`),c.deployUrl&&u.info(` URL: ${c.deployUrl}`),c.mountRefreshStatus==="failed"&&u.warn(`${Z} ${c.message??"The mount refresh could not be queued, so this environment may not be reachable yet."}`)}catch(c){throw c instanceof Kr&&t.json?(u.info(JSON.stringify({error:{message:c.message,code:c.code,installUrl:c.installUrl??null}},null,2)),new d(c.message,{isUserError:!0,skipLogging:!0})):c instanceof d&&c.isUserError?c:(await a.sendError(c instanceof Error?c:new Error(String(c)),"apps_environments_create",{duration:Date.now()-l}),new d(c,{prefix:`${D} Failed to create environment:`}))}}z();C();F();N();X();Oe();C();he();Fe();async function nF(e,t,r={}){let n=await Jr(e,t);if(n.length===0)throw new d("No environments found for this app.",{isUserError:!0});if(n.length===1)return n[0].id;if(W()||r.json){let i=n.map(s=>` ${s.id} (${s.branch})`).join(`
203
277
  `);throw new d(`This app has multiple environments. Pass the environment id to choose one:
204
- ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await je({message:"Select an environment:",choices:n.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new d("No environment selected.",{isUserError:!0});return o}async function qe(e,t){let{manifest:r}=oe(),n=await Mo("appId",{flagValue:t.appId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Xu(e,{json:t.json})}),o=await Mo("environmentId",{flagValue:t.environmentId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Px(e,n,{json:t.json})});return{appId:n,envId:o}}async function Wg(e,t){if(!e)throw new d("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json}),i=t.json?void 0:Fe(t.fields,Zu,Jn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await fx(r,n,o,e,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_build",{duration:Date.now()-a,count:l.logs.length}),u.info(Qu(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read build logs:`}))}}Y();C();R();j();Z();async function Hg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{environmentId:e,json:t.json}),i=t.json?void 0:Fe(t.fields,Zu,Jn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await mx(r,n,o,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_runtime",{duration:Date.now()-a,count:l.logs.length}),u.info(Qu(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read runtime logs:`}))}}Y();C();R();j();Z();async function Vg(e){let t=await T(),{appId:r,envId:n}=await qe(t,{json:e.json}),o=e.json?void 0:Fe(e.fields,vc,_n()),i=_.forApps({authToken:t}),s=Date.now();try{let a=await gx(t,r,n,{limit:e.limit,cursor:e.cursor});if(await i.sendUsage("apps_deployments_list",{duration:Date.now()-s,count:a.deployments.length}),e.json){u.info(JSON.stringify(a,null,2));return}if(a.deployments.length===0){u.info("No deployments found.");return}u.info(ba(a.deployments,o)+Ai(a.nextCursor))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list deployments:`}))}}Y();me();C();we();R();j();Z();var mO=5,$x=1800;function gO(e){return new Promise(t=>setTimeout(t,e))}async function Ox(e,t,r,n,o={}){let i=Math.min($x,Math.max(mO,o.interval??Dc)),s=Math.min($x,Math.max(1,o.timeout??Ec)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let f=new AbortController,m=setTimeout(()=>f.abort(),Math.max(0,a-Date.now())),g;try{g=await zu(e,t,r,n,{signal:f.signal})}catch(k){if(f.signal.aborted){p=!0;break}throw k}finally{clearTimeout(m)}c=g;let h=g.status;if(Fk(h))break;let y=a-Date.now();if(y<=0){p=!0;break}if(h!==l&&o.onStatusChange?.(l,h),l=h,await gO(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function Gg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json}),i=t.json?void 0:Fe(t.fields,vc,_n()),s=_.forApps({authToken:r}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!V(),{deployment:f,timedOut:m,timeoutSeconds:g}=await Ox(r,n,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,k)=>u.info(P(y===void 0?k:`${y} \u2192 ${k}`)):void 0}),h=m?"timeout":f?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:h}),process.exitCode=!m&&f?.status==="success"?0:1,t.json){u.info(JSON.stringify(f??null,null,2));return}f&&u.info(ba([f],i)),m&&u.warn(`Timed out after ${g}s waiting for a terminal status (last status: ${f?.status??"unknown"}).`);return}let c=await zu(r,n,o,e);if(await s.sendUsage("apps_deployments_get",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(ba([c],i))}catch(c){throw c instanceof d&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new d(c,{prefix:`${D} Failed to ${t.wait?"watch":"get"} deployment:`}))}}Y();me();C();R();j();Z();async function Kg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json});if(t.dryRun){ve(n,"appId"),ve(o,"environmentId"),Vn(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:n,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${n}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=_.forApps({authToken:r,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await hx(r,n,o,e,{idempotencyKey:t.idempotencyKey});if(await i.sendUsage("apps_deployments_redeploy",{duration:Date.now()-s}),t.json){u.info(JSON.stringify(a,null,2));return}let l=a.commitSha.slice(0,7);a.status==="queued"?u.info(`${$} Redeploy queued \u2014 commit ${l}`):u.info(`${xe} Redeploy in progress \u2014 commit ${l} ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to redeploy deployment:`}))}}Y();me();C();var Lx=require("child_process");function Nx(){try{let e=(0,Lx.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}R();j();Z();function hO(e){let t=Nx();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function yO(e,t,r){try{return(await Kn(e,t)).find(o=>o.id===r)}catch{return}}async function Jg(e){let t=await T(),{appId:r,envId:n}=await qe(t,{json:e.json}),o=await yO(t,r,n);if(hO(o?.branch),e.dryRun){ve(r,"appId"),ve(n,"environmentId"),e.json?u.info(JSON.stringify({appId:r,environmentId:n,branch:o?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${o?.branch?`\`${o.branch}\` `:""}in app ${r}, environment ${n}.`),u.info("Dry run \u2014 no changes made."));return}let i=_.forApps({authToken:t,suppressCommand:!!e.idempotencyKey}),s=Date.now();try{let a=await yx(t,r,n,{idempotencyKey:e.idempotencyKey});if(await i.sendUsage("apps_deployments_trigger",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}a.status==="queued"?u.info(`${$} Trigger queued${o?.branch?` for \`${o.branch}\``:""}.`):a.status==="skipped"?u.info(`${xe} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${xe} Trigger in progress ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_trigger",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to trigger deployment:`}))}}Y();C();R();j();Z();async function zg(e,t){if(t.name===void 0&&t.description===void 0)throw new d("Provide --name or --description",{isUserError:!0});let r=await T(),n=await Nr(r,e,t);if(ve(n,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${n}`),t.name!==void 0&&u.info(` Name: ${t.name}`),t.description!==void 0&&u.info(` Description: ${t.description}`),u.info("Dry run complete \u2014 no changes made.");return}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await cx(r,n,{name:t.name,description:t.description});if(await o.sendUsage("apps_update",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to update app:`}))}}Y();C();we();Oe();R();j();Z();async function qg(e,t){let r=await T(),n=await Nr(r,e,t);if(ve(n,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new d("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await Ju(r,n),a=Ck(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${n}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await $e({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await ux(r,n);if(await o.sendUsage("apps_delete",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(s.message)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to delete app:`}))}}Y();C();R();j();Z();ke();C();lt();var bs=100;function Yg(e,t){return`${O()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function Xg(e,t){return ht(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function wO(e,t,r,n,o={}){let i=Wo(Yg(t,r),{limit:sl,cursor:n,filters:o}),s=await K(i,{headers:tt(e)});if(!s.ok)throw await Xg(s,"Failed to list environment variables");return Gn(await s.json(),"variables")}async function Zg(e,t,r,n={}){return gs(o=>wO(e,t,r,o,n))}async function Qg(e,t,r,n){let o=await K(`${Yg(t,r)}/${encodeURIComponent(n)}`,{method:"DELETE",headers:tt(e)});if(!o.ok)throw await Xg(o,"Failed to delete environment variable")}async function ul(e,t,r,n,o){let i=Object.keys(n).length;if(i>bs)throw new d(`Cannot import more than ${bs} variables at once (received ${i}).`,{isUserError:!0});let s=await K(`${Yg(t,r)}/bulk`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:n,overwriteExisting:o})});if(!s.ok)throw await Xg(s,"Failed to import environment variables");return await s.json()}var jx=require("dotenv");me();var Mx=["key","isSecret","value","id","environmentId"],dl=["key","isSecret"];function ks(){return Mx}var eh=dt(Mx);function bO(e,t){switch(t){case"value":return e.isSecret?P("(secret)"):e.value!==""?e.value:P("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):P("\u2014")}}function th(e,t=dl){if(e.length===0)return P("No environment variables found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>bO(o,i)));return ze(r,n)}function rh(e){let t=e.split(/\r?\n/).map(r=>r.replace(/^\s*export\s+/,"")).join(`
205
- `);return(0,jx.parse)(t)}async function nh(e){let t=await T(),r=_.forAppsEnvVars({authToken:t}),n=Date.now();try{let{appId:o,envId:i}=await qe(t,e),s={key:e.key,q:e.q},a=ys(s),l=await Zg(t,o,i,s);if(await r.sendUsage("apps_env_vars_list",{duration:Date.now()-n,variableCount:l.length,filtered:a}),e.json){u.info(JSON.stringify(l,null,2));return}if(l.length===0){u.info(a?"No environment variables matched the given filters.":"No environment variables found.");return}let c=Fe(e.fields,eh,ks());u.info(th(l,c))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list environment variables:`}))}}Y();C();R();j();Z();C();we();Oe();R();j();async function Bx(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}function oh(e){u.warn(`${X} Passing a secret as a command-line argument exposes it in your shell history and process list. Pipe it via stdin (e.g. \`printf %s "$VALUE" | webflow apps env-vars set ${e} --secret\`) or omit the value to be prompted.`)}async function Ux(e,t){if(e!==void 0)return t.secret&&!t.json&&oh(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let r=await Bx();if(r==="")throw new d(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:r,source:"stdin"}}if(!V()){let r=t.secret?await Xb({message:`Enter the value for ${t.key}:`}):await Ge({message:`Enter the value for ${t.key}:`});if(r===null||r==="")throw new d(`No value provided for ${t.key}.`,{isUserError:!0});return{value:r,source:"prompt"}}throw new d(`No value provided for ${t.key}. Pass it as an argument, pipe it via stdin, or run interactively (without --no-input).`,{isUserError:!0})}async function ih(e,t,r){let n=r.secret?" (secret)":"",o=await T(),i=_.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await qe(o,r);if(r.dryRun){t!==void 0&&r.secret&&!r.json&&oh(e),r.json?u.info(JSON.stringify({key:e,...r.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${n} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:p}=await Ux(t,{key:e,secret:r.secret,json:r.json}),f={[e]:{value:c,...r.secret?{isSecret:!0}:{}}},m=await ul(o,a,l,f,!0),g=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!g){let y=m.errors.find(k=>k.key===e);throw new d(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let h=g.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:r.secret?"secret":"plain",valueSource:p}),r.json){u.info(JSON.stringify({key:e,isSecret:h,status:"set"},null,2));return}u.info(`${$} Set ${e}${h?" (secret)":""}`)}catch(c){throw c instanceof d&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new d(c,{prefix:`${D} Failed to set environment variable:`}))}}Y();C();R();j();Z();async function sh(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await qe(r,t);if(t.dryRun){t.json?u.info(JSON.stringify({key:e,appId:i,environmentId:s,dryRun:!0},null,2)):(u.info(`Would delete ${e} from app ${i}, environment ${s}.`),u.info("Dry run \u2014 no changes made."));return}try{if(await Qg(r,i,s,e),await n.sendUsage("apps_env_vars_delete",{duration:Date.now()-o}),t.json){u.info(JSON.stringify({key:e,status:"deleted"},null,2));return}u.info(`${$} Deleted ${e}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await n.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new d(a,{prefix:`${D} Failed to delete environment variable:`}))}}var Wx=require("fs"),Hx=require("path");Y();C();R();j();Z();function ah(e){return e.map(({id:t,environmentId:r,key:n,isSecret:o})=>({id:t,environmentId:r,key:n,isSecret:o}))}async function lh(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await qe(r,t),a;try{a=(0,Wx.readFileSync)((0,Hx.resolve)(e),"utf8")}catch{throw new d(`Could not read file: ${e}`,{isUserError:!0})}let l=rh(a),c=Object.keys(l);if(c.length===0)throw new d(`No variables found in ${e}.`,{isUserError:!0});if(c.length>bs)throw new d(`Cannot import more than ${bs} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let f of c)p[f]={value:l[f],...t.secret?{isSecret:!0}:{}};if(t.dryRun){if(t.json)u.info(JSON.stringify({appId:i,environmentId:s,secret:!!t.secret,variables:c,dryRun:!0},null,2));else{u.info(`Would import ${c.length} variable(s)${t.secret?" as secrets":""} into app ${i}, environment ${s}:`);for(let f of c)u.info(` ${f}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let f=await ul(r,i,s,p,!0);if(await n.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:f.created.length,updatedCount:f.updated.length,skippedCount:f.skipped.length,errorCount:f.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:ah(f.created),updated:ah(f.updated),skipped:ah(f.skipped),errors:f.errors},null,2));else{u.info(`${$} Imported: ${f.created.length} created, ${f.updated.length} updated, ${f.skipped.length} skipped, ${f.errors.length} failed`);for(let m of f.errors)u.warn(` ${m.key}: ${m.error}`)}if(f.errors.length>0)throw new d(`Import completed with ${f.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(f){throw f instanceof d&&f.isUserError?f:(await n.sendError(f instanceof Error?f:new Error(String(f)),"apps_env_vars_import",{duration:Date.now()-o}),new d(f,{prefix:`${D} Failed to import environment variables:`}))}}me();C();R();j();qr();function Jx(e,t,r){Ke()&&e==="cloud"&&(r.json||u.warn(`${X} ${ue(`webflow cloud ${t}`)} is deprecated \u2014 use ${ue(`webflow apps ${t}`)} instead.`))}var Vx={branch:"--branch selects which branch of the repository to build",idempotencyKey:"--idempotency-key dedupes a retried create from a repository",json:"--json describes the app created from a repository",dryRun:"--dry-run previews the app that would be created from a repository"},Gx={framework:"--framework selects a starter template",workspaceId:"--workspace-id is derived from your token when using --import",projectName:"--project-name is deprecated \u2014 use --app-name"};function kO(e){if(e.import===void 0){for(let t of Object.keys(Vx))if(e[t]!==void 0){let r=Kx(t);throw new d(`${r} is only supported together with --import <repo-url> (${Vx[t]}).`,{isUserError:!0,missingFlag:"--import"})}return}if(e.import.trim()==="")throw new d("--import requires a repository URL.",{isUserError:!0,missingFlag:"--import"});for(let t of Object.keys(Gx))if(e[t]!==void 0){let r=Kx(t);throw new d(`${r} cannot be combined with --import (${Gx[t]}).`,{isUserError:!0,missingFlag:r})}if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!e.new&&!e.siteId)throw new d("--import requires either --site-id <siteId> to attach to an existing site or --new to create a standalone app. A siteId from the repository is not used to choose the mutation target.",{isUserError:!0,missingFlag:"--site-id"});if(e.new&&e.mount!==void 0)throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});if(e.siteId&&e.mount===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"})}function Kx(e){return`--${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function ed(e,{namespace:t}){let r=t==="apps",n=e.command("init").description(r?"Bootstrap a new Webflow Cloud app, from a starter template or from an existing GitHub repository (--import)":"Bootstrap a new Webflow Cloud app from a starter template").addOption(new pn.Option("-n, --app-name <name>","App name")).addOption(new pn.Option("--project-name <name>",`${Kr} Use --app-name instead.`)).option("-f, --framework <framework>","Framework to use (e.g., astro, nextjs)").option("-m, --mount <mount>","Mount path (default: '/' for new domain, '/app' for existing site). With --import: required (non-root) when attaching to a site with --site-id, not allowed with --new").option("-s, --site-id <siteId>","Webflow site ID to connect to").option("--new","Create an app without connecting to an existing site").option("-w, --workspace-id <workspaceId>","Workspace ID where the app should be deployed (skips workspace picker)");r&&n.option("--import <repo-url>","Create the app from an existing GitHub repository (https://github.com/<owner>/<repo>) and clone it locally. Requires --site-id to attach to an existing site or --new to create a standalone app. The Webflow GitHub App must be installed on the repository and connected to your workspace.").option("--branch <branch>","Branch to build when using --import. Defaults to the repository's default branch.").option("--idempotency-key <key>","Required for non-interactive runs (CI, --no-input). Reuse a retry-stable key unique to this repository and target (for example, $GITHUB_RUN_ID-$REPOSITORY-$SITE_ID) so a retry replays the original app instead of creating a second one").addOption(new pn.Option("--json","Output as JSON when using --import")).addOption(new pn.Option("--dry-run","Preview the repository import without executing")),n.action(async(o,i)=>{if(Fg(t),Jx(t,"init",o),kO(o),r&&o.import!==void 0){await Ng({import:o.import,branch:o.branch,appName:o.appName,siteId:o.siteId,newSite:o.new,mount:o.mount,idempotencyKey:o.idempotencyKey,json:o.json,dryRun:o.dryRun});return}await DO(o,i)})}function td(e,{namespace:t}){e.command("deploy").description("Deploy your Webflow Cloud app").option("-e, --environment <environment>","Environment name").option("-m, --mount <mount>","Mount path (e.g., /app)").addOption(new pn.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new pn.Option("--project-name <name>",`${Kr} Use --app-name instead.`)).option("-d, --directory <path>","App directory path (for new apps)").option("--description <description>","App description (for new apps)").option("--skip-mount-path-check","Skip mount path checking").option("--auto-publish","Automatically publish site for mount path updates").option("-s, --site-id <siteId>","Webflow site ID for site-attached deploys (skips site picker)").addOption(new pn.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new pn.Option("--project-id <appId>",`${Kr} Use --app-id instead.`)).option("-f, --framework <framework>","Override framework detection (e.g., nextjs, astro)").option("-w, --workspace-id <workspaceId>","Workspace ID where the app will be deployed (skips workspace picker)").action(async(r,n)=>{Fg(t),Jx(t,"deploy",r),await EO(r,n)})}var DO=Rg,EO=Ig;var zx=e=>{let t=Ke(),r=e.command("cloud").description(t?`${Kr} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");r.command("create").description(`${Kr} Use 'webflow ${t?"apps":"cloud"} init' instead. Quick non-interactive scaffold for site-attached apps (hardcoded to /app).`).argument("<name>","App name").option("-f, --framework <framework>","Framework to use","nextjs").action(_g),r.command("list").description(t?`${Kr} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Kr} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(Ag),ed(r,{namespace:"cloud"}),td(r,{namespace:"cloud"})};var qx=require("commander");qr();var Yx=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");ed(t,{namespace:"apps"}),td(t,{namespace:"apps"}),t.command("list").description(`List all apps in your Webflow workspace. Optional filters: --site (exact site id), --name (exact, case-sensitive), and --q (case-insensitive substring on name). App names are unique only within a site, so pass --site AND --name together to resolve to at most one app; --site alone can match many apps and --name alone can match apps across sites. ${Sc("app","an exact filter")}`).option("-s, --site <site-id>","Filter apps to an exact Webflow site id. Combine with --name to resolve to at most one app. Does not default from webflow.json.",Ri).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ri).addOption(xc("the app name")).addOption(re()).addOption(We([...Fn()]).default(hc)).action(Pg),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(re()).addOption(We([...Fn()]).default(Bf)).action(jg),t.command("domains").description("List domains and live URLs for an app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(We([...ha()]).default(yc)).addOption(re()).option("--limit <n>","Max number of domains to return (server caps at 100)",Ac).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Mg),Ke()&&(t.command("update").description("Update an app's name or description. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--name <name>","New app name").option("--description <description>","New app description").addOption(re()).addOption(_e()).action(zg),t.command("delete").description("Delete (or archive) an app. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Ii()).addOption(re()).addOption(_e()).action(qg)),t.command("environments").description("Manage the environments of a Webflow Cloud app").command("list").description(`List the environments of an app. Optional filters: --branch (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on branch, for discovery). ${Sc("environment","--branch")}`).argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--branch <branch>","Filter environments by exact branch name (case-sensitive) \u2014 resolves to at most one environment.",Ri).addOption(xc("the environment branch")).addOption(We([...ya()]).default(wc)).addOption(re()).action(Bg);let n=t.command("deployments").description("Inspect Webflow Cloud deployments");n.command("list").description("List the most recent deployments of an environment (newest first). Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").addOption(Rk()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(re()).addOption(We([..._n()]).default(wa)).action(Vg),n.command("get").description("Get details for a specific deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Pass --wait to poll until the deployment reaches a terminal status (exit 0 on success, 1 otherwise); --interval is floored at 5s and --timeout capped at 30min.").argument("<depId>","Deployment ID").addOption(new qx.Option("--wait","Poll until the deployment reaches a terminal status (success/failed/canceled/unstaged) or the timeout elapses, then exit 0 on success or 1 otherwise")).addOption(Tk()).addOption(Pk()).addOption(re()).addOption(We([..._n()]).default(wa)).action(Gg),n.command("redeploy").description("Re-run a deployment at its SAME commit (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. To roll back, redeploy an earlier successful deployment's ID. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("<depId>","Deployment ID to re-run").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(re()).addOption(_e()).action(Kg),n.command("trigger").description("Build a GitHub-connected environment's current HEAD on demand (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker; builds whatever branch that environment is configured for. Warns (without blocking) if that branch differs from your current local branch. Use --dry-run to preview.").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(re()).addOption(_e()).action(Jg);let o=t.command("logs").description("Read Webflow Cloud app logs");o.command("build").description("Read the build logs of a deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").argument("[depId]","Deployment ID (required) \u2014 run 'webflow apps deployments list' to find one").addOption(re()).addOption(We([...Jn()]).default(cl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Jf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Wg),o.command("runtime").description("Read the runtime logs of an environment. Resolves the app from WEBFLOW_APP_ID / webflow.json (or a picker); the environment from the [envId] argument, WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or a picker.").argument("[envId]","Environment ID (defaults to the only env; required if the app has several)").addOption(re()).addOption(We([...Jn()]).default(cl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Jf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Hg);let i=t.command("env-vars").description("Manage Webflow Cloud app environment variables");i.command("list").description(`List environment variables for a Cloud app environment. Optional filters: --key (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on key, for discovery \u2014 --q never searches values). ${Sc("variable","--key")} Secret values are never returned.`).addOption(ka()).addOption(Da()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ri).addOption(xc("the variable key")).addOption(re()).addOption(We([...ks()]).default(dl.join(","))).action(nh),i.command("set").description("Create or update an environment variable. Use --secret to encrypt the value. Use --dry-run to preview.").argument("<key>","Variable name").argument("[value]","Variable value. Omit to read from piped stdin or be prompted (recommended for secrets, keeps them out of shell history).").addOption(ka()).addOption(Da()).addOption(Kf()).addOption(_e()).addOption(re()).action(ih),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ka()).addOption(Da()).addOption(_e()).addOption(re()).action(sh),i.command("import").description("Bulk import environment variables from a .env file. Use --secret to mark every key secret. Use --dry-run to preview.").argument("<file>","Path to a .env (KEY=value) file").addOption(ka()).addOption(Da()).addOption(Kf()).addOption(_e()).addOption(re()).action(lh)};ke();C();lt();async function jr(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function Xx(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok){let o=await jr(r);throw r.status>=400&&r.status<500?new d(o,{isUserError:!0}):new d(`Failed to list collections: ${o}`)}return(await r.json()).collections??[]}async function Zx(e,t){Q(t,"collectionId");let r=await K(`${O()}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!r.ok)throw new d(`Failed to get collection: ${await jr(r)}`);let n=await r.json();return{...n,fields:n.fields??[]}}async function Qx(e,t,r){Q(t,"siteId");let n={displayName:r.displayName,singularName:r.singularName};r.slug&&(n.slug=r.slug);let o=await K(`${O()}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!o.ok){let i=await jr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create collection: ${i}`)}return await o.json()}async function eC(e,t,r){Q(t,"collectionId");let n=await K(`${O()}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:r.displayName,type:r.type,isRequired:r.isRequired??!1})});if(!n.ok){let o=await jr(n);throw n.status===404?new d(`Collection "${t}" not found`,{isUserError:!0}):n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to create field: ${o}`)}return await n.json()}async function ch(e,t,r={}){Q(t,"collectionId");let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset)),r.cmsLocaleId&&n.set("cmsLocaleId",r.cmsLocaleId);let o=n.toString()?`?${n.toString()}`:"",i=await K(`${O()}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to list items: ${await jr(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??r.limit??100,offset:s.offset??r.offset??0}}async function tC(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=n?`?cmsLocaleId=${encodeURIComponent(n)}`:"",i=await K(`${O()}/v2/collections/${t}/items/${r}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to get item: ${await jr(i)}`);return await i.json()}async function uh(e,t,r,n=!1){Q(t,"collectionId");let o=await K(`${O()}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r,isDraft:n})});if(!o.ok){let i=await jr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create item: ${i}`)}return await o.json()}async function dh(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n})});if(o.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!o.ok)throw new d(`Failed to update item: ${await jr(o)}`);return await o.json()}async function rC(e,t,r){Q(t,"collectionId"),Q(r,"itemId");let n=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!n.ok)throw new d(`Failed to delete item: ${await jr(n)}`)}async function nC(e,t,r){Q(t,"collectionId"),r.forEach(o=>Q(o,"itemId"));let n=await K(`${O()}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:r})});if(!n.ok){let o=await jr(n);throw n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to publish items: ${o}`)}return await n.json()}me();Y();Pe();async function rd(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=oe(),r=await Je(t);return{token:r.accessToken,siteId:r.siteId}}function oC(e,t=["id","displayName","slug"]){if(e.length===0)return P("No collections found.");let r=["id","displayName","singularName","slug","lastUpdated"],n=Object.fromEntries(r.map(a=>[a.toLowerCase(),a])),o=t.map(a=>n[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Ut(`Invalid fields. Available: ${r.join(", ")}`);let i=o.map(a=>se(a)),s=e.map(a=>o.map(l=>{let c=a[l];return c?l==="lastUpdated"?new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c:P("\u2014")}));return ze(i,s)}function iC(e){let t=[`${se("Collection:")} ${e.displayName}`,`${se("ID:")} ${e.id}`,`${se("Slug:")} ${e.slug}`,`${se("Singular:")} ${e.singularName}`,`${se("Updated:")} ${new Date(e.lastUpdated).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,"",se("Fields:")];if(e.fields.length===0)return t.push(P(" No fields defined.")),t.join(`
206
- `);let r=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),n=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(ze(r,n)),t.join(`
207
- `)}function sC(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return P("No items found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?ue("draft"):z("live");if(i==="isArchived")return o.isArchived?P("archived"):"";if(i==="lastUpdated"||i==="lastPublished"||i==="createdOn"){let a=o[i];return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")}let s=o[i];return s==null?P("\u2014"):String(s)}));return ze(r,n)}C();R();j();function nd(e,t,r="asc"){return[...e].sort((n,o)=>{let i=n[t],s=o[t];if(i==null&&s==null)return 0;if(i==null)return 1;if(s==null)return-1;let a=0;return typeof i=="string"&&typeof s=="string"?a=i.localeCompare(s):typeof i=="number"&&typeof s=="number"?a=i-s:a=String(i).localeCompare(String(s)),r==="desc"?-a:a})}Z();async function ph(e){let{token:t,siteId:r}=await rd(e),n=_.forCms({authToken:t,siteId:r}),o=Date.now();try{let i=await Xx(t,r);if(await n.sendUsage("cms_collections_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No collections found.");return}let s=["displayName","slug","lastUpdated"];if(s.includes(e.sortBy)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${s.join(", ")}. Defaulting to displayName.`),e.sortBy="displayName"),!["asc","desc"].includes(e.order))throw new d(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=nd(i,e.sortBy,e.order);if(e.json){u.info(JSON.stringify(a,null,2));return}let l=e.fields.split(",").map(c=>c.trim());u.info(oC(a,l))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list collections:`})}}Y();C();R();j();Z();async function fh(e,t){let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await Zx(r,e);if(await n.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(iC(i))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get collection:`})}}C();R();j();Z();async function mh(e){let t=e.singularName??e.name,r=e.slug??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(e.dryRun){u.info("Dry run \u2014 would create collection:"),u.info(JSON.stringify({displayName:e.name,singularName:t,slug:r},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:n,siteId:o}=await rd(e),i=_.forCms({authToken:n,siteId:o}),s=Date.now();try{let a=await Qx(n,o,{displayName:e.name,singularName:t,slug:r});if(await i.sendUsage("cms_collections_create",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
208
- Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof d&&a.isUserError){u.info(`${D} ${a.message}`),process.exitCode=1;return}throw await i.sendError(a instanceof Error?a:new Error(String(a)),"cms_collections_create",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to create collection:`})}}Y();C();R();j();Z();async function gh(e){if(e.dryRun){u.info("Dry run \u2014 would create field:"),u.info(JSON.stringify({collectionId:e.collection,displayName:e.name,type:e.type,isRequired:e.required??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await eC(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await r.sendUsage("cms_fields_create",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(`${$} Field created: ${o.id}`),u.info(` Name: ${o.displayName}`),u.info(` Type: ${o.type}`),u.info(` Slug: ${o.slug}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to create field:`})}}Y();C();R();j();Z();async function hh(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await ch(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await r.sendUsage("cms_items_list",{duration:Date.now()-n,count:s.items.length}),s.items.length===0){u.info("No items found.");return}if(e.json){u.info(JSON.stringify(s,null,2));return}let a=e.fields.split(",").map(f=>f.trim());u.info(sC(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let f=s.total>0?` of ${s.total}`:"";u.info(`
209
- Showing ${l}\u2013${c}${f} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof d&&s.isUserError){u.info(`${D} ${s.message}`),process.exitCode=1;return}throw await r.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-n}),new d(s,{prefix:`${D} Failed to list items:`})}}Y();C();R();j();Z();async function yh(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await tC(t,e.collection,e.item,e.locale);if(await r.sendUsage("cms_items_get",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}let i=o.isArchived?"archived":o.isDraft?"draft":"live";u.info(`${o.id} [${i}]`),u.info(` Last updated: ${new Date(o.lastUpdated).toLocaleString()}`),o.lastPublished&&u.info(` Last published: ${new Date(o.lastPublished).toLocaleString()}`),u.info(" Fields:"),u.info(JSON.stringify(o.fieldData,null,4).replace(/^/gm," "))}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get item:`})}}Y();C();R();j();Z();async function wh(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would create item:"),u.info(JSON.stringify({fieldData:t,isDraft:e.draft??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await uh(r,e.collection,t,e.draft??!1);if(await n.sendUsage("cms_items_create",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item created: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to create item:`})}}Y();C();R();j();Z();async function bh(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would update item:"),u.info(JSON.stringify({collectionId:e.collection,itemId:e.item,fieldData:t},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await dh(r,e.collection,e.item,t);if(await n.sendUsage("cms_items_update",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item updated: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to update item:`})}}Y();C();R();j();Z();async function kh(e){if(e.dryRun){u.info(`Dry run \u2014 would delete item ${e.item} from collection ${e.collection}`),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{await rC(t,e.collection,e.item),await r.sendUsage("cms_items_delete",{duration:Date.now()-n,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to delete item:`})}}Y();C();R();j();Z();async function Dh(e){let t=e.items.split(",").map(i=>i.trim());if(e.dryRun){u.info(`Dry run \u2014 would publish ${t.length} item(s) in collection ${e.collection}:`),t.forEach(i=>u.info(` ${i}`)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await nC(r,e.collection,t);if(await n.sendUsage("cms_items_publish",{duration:Date.now()-o,itemCount:t.length,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishedItemIds?.length??0;u.info(`${$} Published ${s} item(s)`),i.errors?.length&&i.errors.forEach(a=>u.warn(` ${a.itemId}: ${a.message}`))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to publish items:`})}}var aC=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),r=t.command("collections").description("Manage CMS collections");r.command("list").description("List all CMS collections for a site").addOption(Rt()).addOption(re()).addOption(We(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Pi(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ti()).action(ph),r.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(re()).action(fh),r.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Rt()).requiredOption("--name <displayName>","Collection display name").option("--singular-name <singularName>","Singular name (defaults to --name)").option("--slug <slug>","URL slug for the collection (auto-derived from --name if omitted)").addOption(_e()).addOption(re()).action(mh),t.command("fields").description("Manage CMS collection fields").command("create").description("Add a field to a CMS collection. Use --dry-run to preview.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--name <displayName>","Field display name").requiredOption("--type <type>","Field type (e.g. PlainText, RichText, Number, DateTime, Link, Image, Video, Color, Bool, Option, ItemRef, ItemRefSet)").option("--required","Mark field as required").addOption(_e()).addOption(re()).action(gh);let o=t.command("items").description("Manage CMS items");o.command("list").description("List items in a CMS collection").requiredOption("--collection <collectionId>","Collection ID").option("--locale <cmsLocaleId>","CMS locale ID to filter by").addOption(Fc()).addOption(_c()).addOption(re()).addOption(We(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(hh),o.command("get").description("Get a single CMS item by ID").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").option("--locale <cmsLocaleId>","CMS locale ID to retrieve content for").addOption(re()).action(yh),o.command("create").description("Create a new CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--data <json>","Item field data as a JSON string").option("--draft","Create as draft (not published)").addOption(_e()).addOption(re()).action(wh),o.command("update").description("Update an existing CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").requiredOption("--data <json>","Updated field data as a JSON string").addOption(_e()).addOption(re()).action(bh),o.command("delete").description("Delete a CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").addOption(_e()).action(kh),o.command("publish").description("Publish one or more CMS items. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--items <itemIds>","Comma-separated item IDs to publish").addOption(_e()).addOption(re()).action(Dh)};Y();me();C();R();j();Pe();Z();ke();lt();C();C();me();var lC={png:{category:"image",maxBytes:4*1024*1024},jpeg:{category:"image",maxBytes:4*1024*1024},jpg:{category:"image",maxBytes:4*1024*1024},gif:{category:"image",maxBytes:4*1024*1024},svg:{category:"image",maxBytes:4*1024*1024},webp:{category:"image",maxBytes:4*1024*1024},avif:{category:"image",maxBytes:4*1024*1024},pdf:{category:"document",maxBytes:10*1024*1024},doc:{category:"document",maxBytes:10*1024*1024},docx:{category:"document",maxBytes:10*1024*1024},xls:{category:"document",maxBytes:10*1024*1024},xlsx:{category:"document",maxBytes:10*1024*1024},ppt:{category:"document",maxBytes:10*1024*1024},pptx:{category:"document",maxBytes:10*1024*1024},txt:{category:"document",maxBytes:10*1024*1024},csv:{category:"document",maxBytes:10*1024*1024},odt:{category:"document",maxBytes:10*1024*1024},ods:{category:"document",maxBytes:10*1024*1024},odp:{category:"document",maxBytes:10*1024*1024},json:{category:"lottie",maxBytes:10*1024*1024},lottie:{category:"lottie",maxBytes:10*1024*1024}};function od(e,t){let r=e.split(".").pop()?.toLowerCase()??"",n=lC[r];if(!n){let o=Object.keys(lC).join(", ");throw new d(`Unsupported file type ".${r}". Allowed types: ${o}`,{isUserError:!0})}if(t>n.maxBytes){let o=n.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new d(`File too large: ${i} MB exceeds the ${o} MB limit for ${n.category} files.`,{isUserError:!0})}}var Eh=["id","displayName","originalFileName","contentType","size","lastUpdated"];function cC(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return P("No assets found.");let r=Object.fromEntries(Eh.map(l=>[l.toLowerCase(),l])),n=t.map(l=>r[l.toLowerCase()]).filter(l=>l!=null);if(n.length===0)return Ut(`Invalid fields. Available: ${Eh.join(", ")}`);let o=t.filter(l=>r[l.toLowerCase()]==null),i=o.length>0?ue(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Eh.join(", ")}
210
- `):"",s=n.map(l=>se(l)),a=e.map(l=>n.map(c=>{let p=l[c];if(p==null||c==="size"&&p===0)return P("\u2014");if(c==="size")return vO(Number(p));if(c==="lastUpdated"){let m=new Date(String(p)),g=String(m.getMonth()+1).padStart(2,"0"),h=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),k=String(m.getHours()).padStart(2,"0"),v=String(m.getMinutes()).padStart(2,"0");return`${g}/${h}/${y} ${k}:${v}`}let f=String(p);return c==="displayName"&&f.length>40?P("\u2026")+f.slice(-39):f}));return i+ze(s,a)}function vO(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function uC(e){if(e.length===0)return P("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),r=["id","displayName","assets","lastUpdated"].map(o=>se(o)),n=t.map(o=>[o.id,o.displayName,String(o.assets.length),new Date(o.lastUpdated).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]);return ze(r,n)}async function dC(e,t,r={}){if(Q(t,"siteId"),r.folderId){Q(r.folderId,"folderId");let a=await SO(e,r.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],p=0,f=100;for(;;){let k=await K(`${O()}/v2/sites/${t}/assets?limit=${f}&offset=${p}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!k.ok)throw new d(`Failed to list assets: ${k.status} ${k.statusText}`);let v=await k.json(),F=v.assets??[];c.push(...F);let E=v.pagination?.total??0;if(p+=F.length,p>=E||F.length===0)break}let m=c.filter(k=>l.has(k.id)),g=r.offset??0,h=r.limit??m.length,y=m.slice(g,g+h);return{assets:y,pagination:{total:m.length,limit:y.length,offset:g}}}let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset));let o=n.toString(),i=await K(`${O()}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new d(`Failed to list assets: ${i.status} ${i.statusText}`);let s=await i.json();return{assets:s.assets??[],pagination:s.pagination??{total:0,limit:100,offset:0}}}async function pC(e,t,r,n,o){Q(t,"siteId"),o&&Q(o,"folderId");let i=_a(r);od(i.meta.title,i.meta.size);let s=n??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await K(`${O()}/v2/sites/${t}/assets`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new d(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),p={fields:c.uploadDetails,_id:c.id,s3Url:c.hostedUrl??"",url:c.uploadUrl??"",contentType:c.contentType??"",origFileName:c.originalFileName??i.meta.title,success_action_redirect:"",createdOn:"",updatedOn:""};try{await Ra(i,p)}catch(f){throw await K(`${O()}/v2/assets/${p._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),f}return{id:p._id,hostedUrl:p.s3Url,displayName:s,originalFileName:i.meta.title}}async function fC(e,t,r){Q(t,"assetId");let n=await K(`${O()}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new d(`Failed to update asset: ${n.status} ${n.statusText}`);return await n.json()}async function SO(e,t){Q(t,"folderId");let r=await K(`${O()}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get folder: ${r.status} ${r.statusText}`);return await r.json()}async function mC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to list folders: ${r.status} ${r.statusText}`);return(await r.json()).assetFolders??[]}async function gC(e,t,r,n){Q(t,"siteId"),n&&Q(n,"parentFolderId");let o={displayName:r};n&&(o.parentFolder=n);let i=await K(`${O()}/v2/sites/${t}/asset_folders`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new d(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function vh(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=oe(),s=await Je(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let{assets:i,pagination:s}=await dC(t,r,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await n.sendUsage("assets_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No assets found.");return}let a=["displayName","originalFileName","contentType","size","lastUpdated"],l=e.sortBy;a.includes(l)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${a.join(", ")}. Defaulting to displayName.`),l="displayName");let c=e.order;["asc","desc"].includes(e.order)||(u.warn(`Unknown --order "${e.order}". Valid values: asc, desc. Defaulting to asc.`),c="asc");let p=nd(i,l,c);if(e.json){u.info(JSON.stringify({assets:p,pagination:s},null,2));return}let f=e.fields.split(",").map(g=>g.trim());u.info(cC(p,f));let m=(e.offset??0)+i.length;m<s.total&&u.info(P(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list assets:`})}}Y();C();R();j();Pe();Z();async function Sh(e,t){let r=_a(e);if(od(r.meta.title,r.meta.size),t.dryRun){u.info(`Dry run \u2014 would upload: ${e} (validated)`),t.name&&u.info(` Display name: ${t.name}`),t.folder&&u.info(` Folder: ${t.folder}`),u.info("Dry run complete \u2014 no changes made.");return}let n,o;if(t.site)n=await T(),o=t.site;else{let{manifest:a}=oe(),l=await Je(a);n=l.accessToken,o=l.siteId}let i=_.forAssets({authToken:n,siteId:o}),s=Date.now();try{let a=await pC(n,o,e,t.name,t.folder);if(await i.sendUsage("assets_upload",{duration:Date.now()-s,dryRun:!1}),t.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Asset uploaded: ${a.id}`),a.hostedUrl&&u.info(` URL: ${a.hostedUrl}`)}catch(a){throw await i.sendError(a instanceof Error?a:new Error(String(a)),"assets_upload",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to upload asset:`})}}Y();C();R();j();Z();async function xh(e,t){if(!t.altText&&!t.displayName)throw new d("Provide at least one of --alt-text or --display-name.",{isUserError:!0});if(t.dryRun){u.info(`Dry run \u2014 would update asset: ${e}`),t.altText&&u.info(` Alt text: ${t.altText}`),t.displayName&&u.info(` Display name: ${t.displayName}`),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forAssets({authToken:r}),o=Date.now();try{let i=await fC(r,e,{altText:t.altText,displayName:t.displayName});if(await n.sendUsage("assets_update",{duration:Date.now()-o,dryRun:!1}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Asset updated: ${i.id}`),i.displayName&&u.info(` Display name: ${i.displayName}`),i.altText&&u.info(` Alt text: ${i.altText}`)}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to update asset:`})}}Y();C();R();j();Pe();Z();async function Ch(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=oe(),s=await Je(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let i=await mC(t,r);if(await n.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(uC(i))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list folders:`})}}Y();C();R();j();Qs();Z();async function Fh(e,t){let r,n;if(t.site)r=await T(),n=t.site;else{let{manifest:s}=oe(),a=await Je(s);r=a.accessToken,n=a.siteId}let o=_.forAssets({authToken:r,siteId:n}),i=Date.now();try{let s=await gC(r,n,e,t.parent);if(await o.sendUsage("assets_folders_create",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} Folder created: ${s.id}`),u.info(` Name: ${s.displayName}`),s.parentFolder&&u.info(` Parent: ${s.parentFolder}`)}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"assets_folders_create",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to create folder:`})}}var hC=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Rt()).option("--folder <folderId>","Filter by folder ID").addOption(re()).addOption(We(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(Fc()).addOption(_c()).addOption(Pi(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ti()).action(vh),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
211
- Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(Rt()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(_e()).addOption(re()).action(Sh),t.command("update").description("Update an asset's metadata. Use --dry-run to preview.").argument("<assetId>","Asset ID to update").option("--alt-text <text>","Alt text for the asset").option("--display-name <name>","New display name for the asset").addOption(_e()).addOption(re()).action(xh);let r=t.command("folders").description("Manage asset folders");r.command("list").description("List all asset folders for a site").addOption(Rt()).addOption(re()).action(Ch),r.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Rt()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(re()).action(Fh)};Y();C();R();j();Z();ke();C();lt();async function yC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get site: ${r.status} ${r.statusText}`);return await r.json()}async function wC(e){return il(`${O()}/v2/sites`,e,"sites","Failed to list sites")}async function bC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get custom domains: ${r.status} ${r.statusText}`);return(await r.json()).customDomains??[]}async function kC(e,t,r=[],n){Q(t,"siteId"),n&&Q(n,"pageId");let o=r.length>0?{customDomains:r}:{publishToWebflowSubdomain:!0};n&&(o.pageId=n);let i=await K(`${O()}/v2/sites/${t}/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new d(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();me();var _h=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],DC=dt(_h);function EC(){return _h}function vC(e,t=["id","displayName","lastPublished"]){if(e.length===0)return P("No sites found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${_h.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="lastPublished"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:P("\u2014")}));return ze(r,n)}function SC(e){if(e.length===0)return P("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],r=e.map(n=>[n.id,n.url,n.lastPublished?new Date(n.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")]);return ze(t,r)}async function Ah(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await wC(t);if(await r.sendUsage("sites_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No sites found.");return}let i=Fe(e.fields,DC,EC());u.info(vC(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list sites:`}))}}Y();C();R();j();Z();async function Rh(e,t){let r=await T(),n=_.forSites({authToken:r}),o=Date.now();try{let i=await yC(r,e);if(await n.sendUsage("sites_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${i.displayName} (${i.id})`),u.info(` Short name: ${i.shortName}`),u.info(` Time zone: ${i.timeZone}`),i.lastPublished&&u.info(` Published: ${new Date(i.lastPublished).toLocaleString()}`),i.previewUrl&&u.info(` Preview: ${i.previewUrl}`)}catch(i){throw i instanceof d&&i.isUserError?i:(await n.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get site:`}))}}Y();C();R();j();Z();async function Ih(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await bC(t,e.site);if(await r.sendUsage("sites_domains",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(SC(o))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get custom domains:`}))}}Y();C();R();j();Z();async function Th(e){if(Q(e.site,"siteId"),e.dryRun){u.info(`Would publish ${e.page?`page ${e.page} on`:"site"} ${e.site}`),e.domains?u.info(` Custom domains: ${e.domains}`):u.info(" Domains: Webflow subdomain");return}let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await kC(t,e.site,o,e.page);if(await r.sendUsage("sites_publish",{duration:Date.now()-n,dryRun:!1,publishScope:i.publishScope}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishScope==="page"?"Page":"Site";u.info(`${$} ${s} published successfully`);let a=i.customDomains??[];a.length>0?a.forEach(l=>{let c=l.lastPublished?` (${new Date(l.lastPublished).toLocaleString()})`:"";u.info(` Live at: https://${l.url}${c}`)}):i.publishToWebflowSubdomain&&u.info(" Published to Webflow subdomain")}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to publish site:`}))}}Y();Y();ke();C();we();Oe();R();j();Pe();Z();ke();lt();C();var id="not_enterprise_plan_workspace";async function xC(e,t,r){Q(t,"workspaceId");let n=r.trim();if(!n)throw new d("Site name cannot be empty.",{isUserError:!0});let o=await K(`${O()}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:n})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===id?new d("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:id}):a==="missing_scopes"?new d(`Your token is missing the 'workspace:write' scope.
212
- Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new d(`Failed to create site "${n}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new d("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??n,shortName:i.shortName??""}}function xO(e){Se({siteId:e.id});let{manifestPath:t}=oe();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function CO(e,t){let r=new Map;for(let i of t)i.workspaceId&&r.set(i.workspaceId,(r.get(i.workspaceId)??0)+1);let n=[...r.keys()];if(n.length===1)return n[0];if(n.length===0){let i=await ps(e);if(i.length===0)throw new d("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new d(`This token can access ${i.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});return(await fs(i)).id}if(V())throw new d(`This token's sites span ${n.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});let o=await je({message:"Which workspace should the new site be created in?",choices:n.map(i=>({name:`${i} (${r.get(i)} site${r.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new d("No workspace selected.",{isUserError:!0});return o}async function FO(e,t){if(u.warn(`${D} ${t.message}
213
- Create the site in the Webflow dashboard: ${xr()}/dashboard
214
- then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await $e({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let n=await xn(e);if(n.length===0)throw new d("No existing sites are accessible with this token yet. Create one in the Webflow dashboard, then re-run `webflow sites init`.",{isUserError:!0});return{site:await _i(n),created:!1}}async function _O(e,t,r){let n=await CO(e,t),o=r.name;if(o||(o=await Ge({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new d("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await xC(e,n,o)}catch(s){if(s instanceof d&&s.code===id)return FO(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function sd(e={}){let t=await T({apiToken:e.apiToken}),r=_.forSites({authToken:t}),n=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new d("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await xn(t),s;if(e.siteId){Q(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new d(`Site "${e.siteId}" is not among the ${i.length} site(s) this token can access.`,{isUserError:!0});s=a}else{let a=!!(e.create||e.name);if(!a&&V())throw new d("`webflow sites init` needs an explicit target when prompts are unavailable. Pass --site-id <siteId> to bind, or --create --name <name> to create a new site.",{isUserError:!0,missingFlag:"site-id"});if(a||(i.length===0?(u.info("No sites are accessible with this token."),a=!0):a=await je({message:"How do you want to connect this project?",choices:[{name:"Bind to an existing Webflow site",value:"bind"},{name:"Create a new Webflow site",value:"create"}],default:"bind"})==="create"),a){let l=await _O(t,i,e);s=l.site,o=l.created}else s=await _i(i)}xO(s),await r.sendUsage("site_init",{duration:Date.now()-n,created:o})}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-n}),i instanceof d?i:new d(i,{prefix:`${D} Failed to initialize site:`})}}Y();me();C();R();j();Z();ke();lt();C();function AO(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function RO(e,t){let r=await t.text(),n;try{n=JSON.parse(r)}catch{}throw t.status===404&&n?.error==="Not found"&&!n.code?new d(`Failed to ${e}: WFS Sync is not enabled on this environment (the server feature flag is off, or the host does not serve /api/ai/wfs).`,{isUserError:!0}):n?.code==="SCHEMA_STALE"?new d(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):n?.code&&n.error?new d(`Failed to ${e}: ${n.error} (${n.code})`,{isUserError:t.status<500}):new d(`Failed to ${e}: ${t.status} ${t.statusText}${AO(r)}`)}async function CC(e,t,r,n){let o=await K(`${xr()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});o.ok||await RO(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new d(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function Ph(e,t,r){Q(t,"siteId");let n=await CC("pull the site files","pull",e,{siteId:t,identityMode:"clean",...r?.pageIds&&r.pageIds.length>0?{pageIds:r.pageIds}:{},...r?.manifestOnly?{manifestOnly:!0}:{}});if(n.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});return{...n,pages:n.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function FC(e,t,r,n){Q(t,"siteId");let o=await CC("push the site files","push",e,{siteId:t,identityMode:"clean",changes:r,...n?.conflictPolicy?{conflictPolicy:n.conflictPolicy}:{},...n?.schemaHash?{schemaHash:n.schemaHash}:{}});if(o.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});if(!Array.isArray(o.results))throw new d("Invalid response from the WFS Sync API: expected a `results` array.");return o}Pe();Y();C();var ad=require("path");function $h(e){return e.split(ad.sep).join("/").replace(/\\/g,"/")}function fn(e){if(e===""||e.includes("\0")||(0,ad.isAbsolute)(e))return!1;let t=$h(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(r=>r==="..")}var IO={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},_C={library:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},astro:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},nextjs:{pagesRoot:"src/app",componentsRoot:"src/components",pagesShape:"nested"},"nextjs-pages":{pagesRoot:"pages",componentsRoot:"src/components",pagesShape:"flat"}};function TO(e){return e.endsWith("/")?e.slice(0,-1):e}function AC(e,t,r){let n=e.trim();if(!fn(n))throw new d(`"site.layout.${t}" in ${r} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=n.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new d(`"site.layout.${t}" in ${r} must name a directory inside the project, not "${e}".`,{isUserError:!0});return TO(o)}function PO(e,t,r){let n=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(n.length,o.length)-1&&n[s]===o[s];s++)i.push(n[s]);return i.length>0?`${i.join("/")}/${r}`:r}function $O(e,t){let r=e?.layout;if(!r)return IO;let n=r.preset?_C[r.preset]:void 0;if(r.preset&&!n)throw new d(`Unknown "site.layout.preset" value "${r.preset}" in ${t}. Known presets: ${Object.keys(_C).join(", ")}.`,{isUserError:!0});let o=r.pagesRoot??n?.pagesRoot,i=r.componentsRoot??n?.componentsRoot;if(!o||!i)throw new d(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=r.pagesShape??n?.pagesShape??"flat",a=AC(o,"pagesRoot",t),l=AC(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:PO(a,l,"theme")}}function Ds(e){let{manifest:t,manifestPath:r}=oe(),n=e?.trim();n&&Q(n,"site-id");let o=n||uo(t);if(!o||o.trim()==="")throw new d(`Missing "siteId" in ${r}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=$O(t.site,r);return{siteId:o,layout:i}}var qn=require("fs"),Es=require("path"),WC=w(require("fast-glob"));C();var RC=require("crypto"),yt=require("fs"),Ho=require("path");C();var zn=".webflow/wfs";function hr(e){return(0,RC.createHash)("sha256").update(e,"utf8").digest("hex")}function IC(e){let{nodeIds:t,styleIds:r,...n}=e;return n}function TC(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function OO(e){return TC(e)&&typeof e.wirePath=="string"&&fn(e.wirePath)&&typeof e.localPath=="string"&&fn(e.localPath)}function LO(e){return TC(e)?typeof e.serverHash=="string"&&typeof e.contentSha256=="string"&&(e.componentId===void 0||typeof e.componentId=="string"&&e.componentId.length>0)&&(e.localPath===void 0||typeof e.localPath=="string"&&fn(e.localPath)):!1}function PC(e){return(0,Ho.join)(e,zn,"index.json")}function Oh(e,t){return fn(t)?(0,Ho.join)(e,zn,`${t}.json`):void 0}function $C(e){let t=PC(e);if((0,yt.existsSync)(t))try{let r=JSON.parse((0,yt.readFileSync)(t,"utf8"));return!r||typeof r.schemaHash!="string"||!Array.isArray(r.files)||!r.files.every(OO)?"corrupt":{...typeof r.siteId=="string"?{siteId:r.siteId}:{},...r.identityMode==="clean"?{identityMode:"clean"}:{},schemaHash:r.schemaHash,files:r.files}}catch{return"corrupt"}}function ld(e=process.cwd()){let t=$C(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${zn}/index.json could not be read`};let r={},n=[];for(let{wirePath:o}of t.files){let i=Oh(e,o);if(!i){n.push(o);continue}if(!(0,yt.existsSync)(i)){n.push(o);continue}try{let s=JSON.parse((0,yt.readFileSync)(i,"utf8"));if(!LO(s)){n.push(o);continue}r[o]=IC(s)}catch{n.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},...t.identityMode?{identityMode:t.identityMode}:{},schemaHash:t.schemaHash,files:r},corruptPaths:n}}function cd(e,t=process.cwd()){let r=$C(t),n=new Set(r&&r!=="corrupt"?r.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=Oh(t,s);if(!a)throw new d(`Refusing to write a lock entry outside ${zn}: "${s}"`);(0,yt.mkdirSync)((0,Ho.dirname)(a),{recursive:!0}),(0,yt.writeFileSync)(a,`${JSON.stringify(IC(e.files[s]),null,2)}
215
- `,"utf8")}for(let s of n){if(s in e.files)continue;let a=Oh(t,s);a&&(0,yt.existsSync)(a)&&(0,yt.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},...e.identityMode?{identityMode:e.identityMode}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=PC(t);(0,yt.mkdirSync)((0,Ho.dirname)(i),{recursive:!0}),(0,yt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
216
- `,"utf8")}function OC(e=process.cwd()){(0,yt.rmSync)((0,Ho.join)(e,zn),{recursive:!0,force:!0})}C();function LC(e){if(!fn(e))throw new d(`Refusing to write unsafe path from server: "${e}"`)}var NO=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function pl(e){return NO.exec(e)?.[1]}var NC=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function jO(e){return NC.exec(e)?.[2]}function MO(e){let t=NC.exec(e);return t?t[1]??"":void 0}function Nh(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function jh(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function Mh(e,t){let n=e.slice(t.length+1).split("/");if(n.length===1)return"";if(n.length===2)return n[0]}function jC(e,t){if(t.pagesShape==="nested"){let n=e.isDefault?[]:[...e.folderSegments,e.slug];return n.length>0?`${t.pagesRoot}/${n.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let r=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${r.join("/")}.tsw`}function Bh(e,t,r){if(r)return r;let n=jO(e);if(!n)return;let o=MO(e)??"";return o?`${t.componentsRoot}/${o}/${n}.tsw`:`${t.componentsRoot}/${n}.tsw`}function MC(e,t){let r=jh(e,t);if(!r)return;let n=Mh(e,t);if(n!==void 0)return Nh(r,n)}var Lh="site/theme/";function BC(e,t){if(e.startsWith(Lh))return`${t.themeRoot}/${e.slice(Lh.length)}`}function ud(e,t){let r=`${t}/`;if(e.startsWith(r))return`${Lh}${e.slice(r.length)}`}async function HC(e,t,r=process.cwd(),n=!1){let o=[],i=[],s=[],a=[],l=[],c=[],p={},f=new Map,m=new Map;for(let[y,k]of Object.entries(e.files)){let v=k.localPath??y;f.set(y,v),m.set(v,y)}let g=new Set((await(0,WC.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:r,onlyFiles:!0,dot:!1})).map($h)),h=new Map;for(let y of Object.keys(e.files).sort()){let k=e.files[y],v=f.get(y);if(k.deletedUpstream){(0,qn.existsSync)((0,Es.join)(r,v))&&c.push(v);continue}if(!(0,qn.existsSync)((0,Es.join)(r,v))){i.push(v),h.set(k.contentSha256,v);continue}p[y]=v;let F=(0,qn.readFileSync)((0,Es.join)(r,v),"utf8");(n||hr(F)!==k.contentSha256)&&o.push({path:y,content:F,baseHash:k.serverHash})}for(let y of[...g].sort()){if(m.has(y))continue;let k=(0,qn.readFileSync)((0,Es.join)(r,y),"utf8"),v=h.get(hr(k));if(v!==void 0){s.push({oldPath:v,newPath:y});continue}let F=UO(y,t);if(F.kind==="unmappable"){a.push(y);continue}let{wirePath:E}=F,S=f.get(E);if(S!==void 0&&S!==y){l.push(y);continue}p[E]=y;let L=e.files[E];o.push(L?{path:E,content:k,baseHash:L.serverHash}:{path:E,content:k})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:p}}function UO(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let n=jh(e,t.componentsRoot);if(!n)return{kind:"unmappable"};let o=Mh(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:Nh(n,o)}}let r=ud(e,t.themeRoot);return r!==void 0?{kind:"theme",wirePath:r}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function VC(e){let t=[];for(let r=0;r<e.length;r+=20)t.push(e.slice(r,r+20));return t}function GC(e){let t=e.filter(a=>!pl(a.path)),r=new Map;for(let a of e){let l=pl(a.path);if(!l)continue;let c=r.get(l)??[];c.push(a),r.set(l,c)}let n=r.size>0?199:200;if(t.length>n)throw new d(`Too many changed site-global files to push in one request (${t.length} > ${n}). Run \`webflow sites push\` without --force to send only the files that changed, then use --force just for the ones that still conflict.`,{isUserError:!0});let o=[],i=[...t],s=0;for(let[,a]of r)!(s<20&&i.length+a.length<=200)&&(i.length>0||s>0)&&(o.push(i),i=[],s=0),i.push(...a),s+=1;return i.length>0&&o.push(i),o}function dd(e,t=process.cwd()){let r=(0,Es.join)(t,e);if((0,qn.existsSync)(r))return(0,qn.readFileSync)(r,"utf8")}var KC=require("@babel/parser");function JC(e){try{return(0,KC.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function zC(e,t){if(t.length===0)return e;let r=e;for(let{start:n,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))r=r.slice(0,n)+i+r.slice(o);return r}var WO="site/current-page.tsw";function pd(e){return pl(e)!==void 0?WO:e}function HO(e,t){let r=e.split("/").slice(0,-1);for(let n of t.split("/"))if(!(n===""||n===".")){if(n===".."){r.length>0&&r.pop();continue}r.push(n)}return r.join("/")}function VO(e,t){let r=e.split("/").slice(0,-1),n=t.split("/"),o=0;for(;o<r.length&&o<n.length-1&&r[o]===n[o];)o++;let i=r.length-o,s=n.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function fd(e,t,r,n){let o=JC(e);if(!o)return e;let i=[];for(let s of o.program.body){if(s.type!=="ImportDeclaration")continue;let a=s.source;if(a.start==null||a.end==null)continue;let l=a.value;if(!l.endsWith(".tsw")||!l.startsWith("./")&&!l.startsWith("../"))continue;let c=n(HO(t,l));if(c===void 0)continue;let p=VO(r,c);if(p===l)continue;let f=e[a.start],m=f==="'"||f==='"'?`${f}${p}${f}`:JSON.stringify(p);i.push({start:a.start,end:a.end,text:m})}return zC(e,i)}function GO(e,t){return r=>t[r]??e.files[r]?.localPath??r}function KO(e,t){let r=e.outcome==="committed"||e.outcome==="noop"?$:D,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${r} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(P(` ${t(a)} changed upstream \u2014 run \`webflow sites pull\`, re-apply your edit, and push again (or push with --force to overwrite).`));e.outcome==="skipped"&&s.push(P(" an earlier change carrying site-global files failed to commit in this push, so this page was never attempted \u2014 resolve the issue above and push again.")),e.error&&s.push(P(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${X} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
217
- `)}function JO(e,t,r,n){let o=new Map;for(let[i,s]of Object.entries(t.files))o.set(s.localPath??i,i);for(let i of e)o.set(r[i.path]??i.path,i.path);return e.map(i=>{let s=r[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=fd(i.content,s,pd(i.path),l=>o.get(l)??ud(l,n.themeRoot)??MC(l,n.componentsRoot));return{...i,content:a}})}function zO(e,t){return e.map(r=>{if(!r.path.startsWith("site/components/")||!r.path.endsWith(".tsw")||r.content===void 0)return r;let n=t.files[r.path]?.componentId;if(n)return{...r,componentId:n};if(r.baseHash===void 0)return{...r,create:!0};throw new d(`Tracked component ${r.path} has no component id in sync state. Run \`webflow sites pull\` before pushing it.`,{isUserError:!0})})}function qO(e,t,r,n){return zO(JO(e,t,r,n),t)}async function YO(e,t,r,n,o){let i=[],s=!1,a=!1;for(let[l,c]of r.entries()){let p;try{p=await FC(e,t,c,{conflictPolicy:n,schemaHash:o})}catch(m){return s&&u.warn(`${X} The push failed after ${l} of ${r.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),{results:i,schemaHash:o,aborted:!0,failed:!0,failure:m}}o=p.schemaHash,i.push(...p.results);let f=p.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(p.results.some(m=>m.outcome==="committed")&&(s=!0),f&&l<r.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function XO(e){let t=[];for(let r of e)if(r.outcome==="committed")for(let[n,o]of Object.entries(r.createdComponents??{}))t.push({path:n,componentId:o,hash:r.hashes?.[n]});return t}function ZO(e,t,r,n,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,p]of Object.entries(l.hashes??{})){let f=n.get(c);if(!f||f.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:hr(f.content),...m?{localPath:m}:{}}}let a=XO(i);for(let{path:l,componentId:c,hash:p}of a){let f=n.get(l)?.content;if(f===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:hr(f),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{...e,siteId:e.siteId??t,schemaHash:r,files:s},created:a}}function QO(e,t){for(let{path:r,componentId:n}of e)u.info(`${$} Created component ${t(r)} (id ${n})`),u.info(P(" id tracked locally \u2014 it will be sent as metadata on future pushes without changing this file"))}function eL({missing:e,renameCandidates:t,unmappable:r,stale:n,orphanedUpstream:o},i){for(let s of e)u.warn(`${X} ${s} is tracked but missing on disk \u2014 deletions are not supported by the WFS Sync API; the file is skipped. Restore it with \`webflow sites pull\`.`);for(let{oldPath:s,newPath:a}of t){let l=s.startsWith(`${i.pagesRoot}/`),c=l?`Webflow doesn't support renaming a page's file directly: restore ${s}, then rename or move the page in the Designer instead, push, then \`webflow sites pull\` to get the file moved automatically.`:`Webflow doesn't support renaming a component's file directly: restore ${s}, edit its \`name:\` meta in place instead, push, then \`webflow sites pull\` to get the file moved automatically.`;u.warn(`${X} ${a} looks like ${s} renamed locally \u2014 skipped, since its content is byte-for-byte unchanged. ${c} (If you also edited the content before this push, this warning won't catch it \u2014 rename first, push, THEN make content edits, or the push may create a duplicate ${l?"page":"component"} instead of updating the original.)`)}for(let s of o)u.warn(`${X} ${s} was deleted or renamed in the Designer, but still has local edits \u2014 skipped. Pushing it would re-create it. Merge anything you need elsewhere, then delete it.`);for(let s of n)u.warn(`${X} ${s} is a leftover copy of a file that now lives elsewhere \u2014 skipped. Pushing it would overwrite the current version with this stale content. Delete it, or merge anything you still need into the tracked file first.`);for(let s of r){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${X} ${s} doesn't match a tracked page \u2014 creating a page via push isn't supported yet. Create it in the Designer, then \`webflow sites pull\`.`:`${X} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function tL(e){let t=ld();if(t.kind==="missing")throw new d("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new d(`This project's sync state is unreadable (${t.reason}), so push can't tell which files are tracked. Run \`webflow sites pull\` to rebuild it (add --reset to discard it first).`,{isUserError:!0});if(t.corruptPaths.length>0)throw new d(`${t.corruptPaths.length} tracked file(s) have unreadable sync state (${t.corruptPaths.slice(0,3).join(", ")}${t.corruptPaths.length>3?", \u2026":""}). Pushing now would re-create them as new objects instead of updating them. Run \`webflow sites pull\` to rebuild the state first.`,{isUserError:!0});let r=t.lockfile;if(r.siteId!==void 0&&r.siteId!==e)throw new d(`This project's sync state was pulled from site ${r.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return r}function rL(e,t,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(n=>({path:n.path,localPath:r[n.path]??n.path,isNew:n.baseHash===void 0}))},null,2)}function nL(e,t,r){u.info(`Would push ${e.length} file(s) to site ${r}:`);for(let n of e){let o=t[n.path]??n.path,i=n.create?P(" (new component)"):n.baseHash?"":P(" (new)");u.info(` ${o}${i}`)}u.info("Dry run \u2014 no changes made.")}async function md(e={}){let t=Ds(),r=tL(t.siteId),n=await HC(r,t.layout,void 0,e.force),{changes:o,localPaths:i}=n;if(eL(n,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:r.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=_.forSites({authToken:s}),l=Date.now(),c=GO(r,i);try{let p=qO(o,r,i,t.layout);if(e.dryRun){e.json?u.info(rL(t.siteId,o,i)):nL(p,i,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let f=GC(p),{results:m,schemaHash:g,aborted:h,failed:y,failure:k}=await YO(s,t.siteId,f,e.force?"rebase":void 0,r.schemaHash),v=new Map(o.map(te=>[te.path,te])),{lockfile:F,created:E}=ZO(r,t.siteId,g,v,i,m);if(m.some(te=>te.outcome==="committed")&&cd(F),y)throw k;let S=m.filter(te=>te.outcome==="conflict"),L=m.filter(te=>te.outcome==="error"),U=m.filter(te=>te.outcome==="skipped"),N=m.flatMap(te=>te.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:g,results:m},null,2));else{QO(E,c);for(let ce of m)u.info(KO(ce,c));let te=m.filter(ce=>ce.outcome==="committed").length,G=E.length>0?` Created ${E.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length} file(s) across ${m.length} page group(s): ${te} committed, ${S.length} conflicted, ${L.length} failed, ${U.length} skipped.${G}`),h&&u.warn(`${X} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(S.length>0||L.length>0||U.length>0||N.length>0)throw new d(`${X} Push finished with ${S.length} conflict(s), ${L.length} error(s), ${U.length} skipped page(s), ${N.length} rejected file(s). Resolve the issues above and try again.`,{isUserError:!0,skipLogging:!!e.json});await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,createdComponents:E.length,dryRun:!1})}catch(p){throw await a.sendError(p instanceof Error?p:new Error(String(p)),"site_push",{duration:Date.now()-l}),p instanceof d?p:new d(p,{prefix:`${D} Failed to push site files:`})}}var Go=require("fs"),qC=require("module"),Vo=require("path");Y();me();C();R();j();Z();function oL(e,t,r,n){let o=r.get(e.path);if(o)return jC(o,t);let i=BC(e.path,t);if(i)return i;let s=n?.files[e.path]?.localPath;return Bh(e.path,t,s)??e.path}function iL(e,t,r){if(!Array.isArray(e)||e.length===0)return;let n=(0,qC.createRequire)((0,Vo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(n.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${r} without it.`)}}return o}async function sL(e,t){try{let{format:r,resolveConfig:n}=await import("prettier"),o=await n(t,{editorconfig:!0}),i=iL(o?.plugins,process.cwd(),t);return await r(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(r){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${r instanceof Error?r.message:String(r)}`),e}}function aL(e,t){if(t){OC();return}let r=ld();if(r.kind==="missing")return;if(r.kind==="corrupt")throw new d(`This project's sync state is unreadable (${r.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${zn}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(r.corruptPaths.length>0)throw new d(`${r.corruptPaths.length} tracked file(s) have unreadable sync state (${r.corruptPaths.slice(0,3).join(", ")}${r.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${zn}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let n=r.lockfile;if(n?.siteId!==void 0&&n.siteId!==e&&Object.keys(n.files).length>0)throw new d(`This project's sync state was pulled from site ${n.siteId}, but this pull targets ${e}. Pulling a second site into the same project would leave \`webflow sites push\` (which always targets the site in webflow.json) applying it to the wrong one. Re-run with --reset to discard the existing state and pull ${e} from scratch.`,{isUserError:!0});return n}async function gd(e={}){let t=Ds(e.siteId),r=aL(t.siteId,!!e.reset),n=await T({apiToken:e.apiToken}),o=_.forSites({authToken:n}),i=Date.now();try{let s=await Ph(n,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new d("This site is served as a WFDL projection, which `webflow sites pull` doesn't support \u2014 it reads and writes `.tsw` modules. No files were written.",{isUserError:!0});let a=s.pages.map(A=>A.pageId);if(a.length===0){await o.sendUsage("site_pull",{duration:Date.now()-i,count:0}),u.info(e.json?JSON.stringify({schemaHash:s.schemaHash,pages:[],files:[]},null,2):"The site has no static pages to pull.");return}let l=new Map,c=s.schemaHash,p={},f=[];for(let A of VC(a)){let q=await Ph(n,t.siteId,{pageIds:A});c=q.schemaHash,p=q.componentIds??p,q.warnings&&f.push(...q.warnings);for(let W of q.files)l.set(W.path,W)}let m=[...l.values()].sort((A,q)=>A.path.localeCompare(q.path)),g=new Map(s.pages.map(A=>[A.path,A])),h=new Map;for(let A of m){let q=r?.files[A.path];if(!q)continue;let W=q.localPath??A.path,he=dd(W),Vr=he!==void 0&&hr(he)!==q.contentSha256,Gr=A.hash!==q.serverHash;Vr&&Gr&&h.set(A.path,W)}let y=!e.force,k=[...h.values()],v=process.cwd(),F=new Map(m.map(A=>[A.path,oL(A,t.layout,g,r)])),E=new Map;for(let[A,q]of F)E.set(q,[...E.get(q)??[],A]);let S=[...E.entries()].filter(([,A])=>A.length>1);if(S.length>0){let A=S.map(([q,W])=>`${q} \u2190 ${W.join(", ")}`).join("; ");throw new d(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${A}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let L={siteId:t.siteId,identityMode:"clean",schemaHash:c,files:{}},U=new Set(F.values()),N=[],te=[],G=[],ce=[];for(let A of m){let q=r?.files[A.path];if(y&&h.has(A.path)){q&&(L.files[A.path]=q);continue}let W=F.get(A.path);LC(W);let he=(0,Vo.join)(v,W);(0,Go.mkdirSync)((0,Vo.dirname)(he),{recursive:!0});let Vr=W.endsWith(".tsw")?fd(A.content,pd(A.path),W,fi=>F.get(fi)??Bh(fi,t.layout,r?.files[fi]?.localPath)):A.content,Gr=W.endsWith(".tsw")?await sL(Vr,he):Vr;(0,Go.writeFileSync)(he,Gr,"utf8"),N.push(A);let ro=q?q.localPath??A.path:void 0;if(q&&ro&&ro!==W&&!U.has(ro)){let fi=dd(ro);fi===void 0||(hr(fi)===q.contentSha256?((0,Go.rmSync)((0,Vo.join)(v,ro),{force:!0}),te.push({from:ro,to:W})):G.push({from:ro,to:W}))}let cw=p[A.path],Vl=g.get(A.path);L.files[A.path]={serverHash:A.hash,contentSha256:hr(Gr),localPath:W,...cw?{componentId:cw}:{},...Vl?{slug:Vl.slug,isDefault:Vl.isDefault,folderSegments:Vl.folderSegments}:{}}}let Be=new Set(m.map(A=>A.path));for(let[A,q]of Object.entries(r?.files??{})){if(Be.has(A))continue;let W=q.localPath??A;if(U.has(W))continue;let he=dd(W);he!==void 0&&(hr(he)===q.contentSha256?((0,Go.rmSync)((0,Vo.join)(v,W),{force:!0}),ce.push(W)):(G.push({from:W,to:"(no longer on the site)"}),L.files[A]={...q,deletedUpstream:!0}))}if(cd(L),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:A,slug:q,title:W,path:he,folderSegments:Vr})=>({pageId:A,slug:q,title:W,path:he,folderSegments:Vr})),files:N.map(A=>({path:A.path,hash:A.hash,size:A.size,localPath:L.files[A.path]?.localPath})),...y&&k.length>0?{skipped:k}:{},...ce.length>0?{removed:ce}:{},...te.length>0?{relocated:te}:{},...G.length>0?{orphaned:G}:{}},null,2));else{for(let A of N){let q=g.get(A.path),W=L.files[A.path]?.localPath??A.path,he=q?P(` (page, slug: "${q.slug}")`):"";u.info(`${$} ${W}${he}`)}u.info(`Pulled ${N.length} file(s) across ${a.length} page(s).`);for(let A of ce)u.info(P(` removed ${A} (no longer on the site)`));for(let{from:A,to:q}of te)u.info(P(` moved ${A} \u2192 ${q}`))}for(let A of k)u.warn(y?`${X} ${A} changed both locally and in the Designer since the last sync \u2014 left as-is, so your local edit is intact. Commit or move it, then pull again (or pull with --force to take the Designer's version).`:`${X} ${A} changed both locally and in the Designer since the last sync \u2014 the local edit was overwritten by --force; recover it from git if needed.`);for(let{from:A,to:q}of G)u.warn(`${X} ${A} is now at ${q}, but the old file has local edits so it was left in place. \`sites push\` will skip it \u2014 merge anything you still need into ${q} and delete ${A}, since while it's there the two copies disagree.`);for(let{path:A,reason:q}of f){let W=L.files[A]?.localPath??A;u.warn(`${X} ${W}: ${q}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:N.length,skipped:y?k.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof d?s:new d(s,{prefix:`${D} Failed to pull site files:`})}}qr();var YC=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(re()).addOption(We(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Ah),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(re()).action(Rh),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(re()).action(Ih),t.command("publish").description("Publish a Webflow site (defaults to Webflow subdomain)").requiredOption("--site <siteId>","Site ID to publish").option("--domains <domains>","Comma-separated custom domain IDs to publish to").option("--page <pageId>","Publish a single page instead of the whole site").addOption(_e()).addOption(re()).action(Th),Ke()&&(t.command("init").description("Bind this project to an existing Webflow site or create a new one, saving its ID as `siteId` in webflow.json.").addOption(Xr()).option("--site-id <siteId>","Skip the interactive picker and bind to this site ID (CI/scripted setup).").option("--create","Create a new Webflow site instead of binding.").option("--name <name>","Name for the new site (implies --create; skips the prompt).").action(sd),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(Xr()).addOption(_e()).addOption(re()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(md),t.command("pull").description("Pull your Webflow Site's source files. Files edited both locally and in the Designer are left alone unless --force.").addOption(Xr()).addOption(re()).option("--site-id <siteId>","Pull from this site only, bypassing (and not modifying) the siteId in webflow.json. Needs --reset when the project is already synced with another site.").option("--force","Overwrite local files that changed both here and in the Designer since the last sync.").option("--reset","Discard the existing local sync state and pull from scratch.").action(gd))};Y();C();R();j();Z();ke();async function XC(e,t){return Q(t,"siteId"),il(`${O()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function ZC(e,t,r){return Q(t,"siteId"),Q(r,"formId"),il(`${O()}/v2/sites/${t}/forms/${r}/submissions`,e,"formSubmissions","Failed to list submissions")}C();me();var Wh=["id","displayName","name","slug","createdOn","lastUpdated"],QC=dt(Wh);function eF(){return Wh}function tF(e,t=["id","displayName","slug"]){if(e.length===0)return P("No forms found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${Wh.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="createdOn"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:P("\u2014")}));return ze(r,n)}function rF(e){if(e.length===0)return P("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),r=["id","dateSubmitted",...t].map(o=>se(o)),n=e.map(o=>[o.id,new Date(o.dateSubmitted).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),...t.map(i=>{let s=o.formResponse[i];return s==null?P("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return ze(r,n)}function nF(e){if(e.length===0)return"";let r=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],n=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
278
+ ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await Me({message:"Select an environment:",choices:n.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new d("No environment selected.",{isUserError:!0});return o}async function Ne(e,t){let{manifest:r}=oe(),n=await bi("appId",{flagValue:t.appId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>lp(e,{json:t.json})}),o=await bi("environmentId",{flagValue:t.environmentId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>nF(e,n,{json:t.json})});return{appId:n,envId:o}}async function Dy(e,t,r){let n=eF(r.branch),o=tF(r.mount);rF(n,o);let i=await R(),s=await Ne(i,{appId:e??r.appId,environmentId:t??r.environmentId,json:r.json});if(le(s.appId,"appId"),le(s.envId,"environmentId"),r.dryRun){if(r.json)u.info(JSON.stringify({appId:s.appId,environmentId:s.envId,...n!==void 0?{branch:n}:{},...o!==void 0?{mount:o}:{},dryRun:!0},null,2));else{let c=[];n!==void 0&&c.push(`branch to \`${n}\``),o!==void 0&&c.push(`mount to ${o}`),u.info(`Would update environment ${s.envId} in app ${s.appId}: ${c.join(", ")}.`),u.info("Dry run \u2014 no changes made.")}return}let a=A.forApps({authToken:i}),l=Date.now();try{let c=await IA(i,s.appId,s.envId,{...n!==void 0?{branch:n}:{},...o!==void 0?{mount:o}:{}});if(await a.sendUsage("apps_environments_update",{duration:Date.now()-l,dryRun:!1,mountRefreshStatus:c.mountRefreshStatus}),r.json){u.info(JSON.stringify(c,null,2));return}if(c.mountRefreshStatus==="skipped"){let p=[];n!==void 0&&p.push("branch"),o!==void 0&&p.push("mount"),u.info(`No changes \u2014 ${p.join(" and ")} already ${p.length===1?"matches":"match"}.`);return}u.info(`${$} Updated environment ${c.id} \u2014 branch \`${c.branch}\` at ${c.mount}`),c.deployUrl&&u.info(` URL: ${c.deployUrl}`),c.mountRefreshStatus==="failed"&&u.warn(`${Z} ${c.message??"The mount refresh could not be queued, so this environment may not be reachable yet."}`)}catch(c){throw c instanceof Kr&&r.json?(u.info(JSON.stringify({error:{message:c.message,code:c.code,installUrl:c.installUrl??null}},null,2)),new d(c.message,{isUserError:!0,skipLogging:!0})):c instanceof d&&c.isUserError?c:(await a.sendError(c instanceof Error?c:new Error(String(c)),"apps_environments_update",{duration:Date.now()-l}),new d(c,{prefix:`${D} Failed to update environment:`}))}}z();C();he();Fe();F();N();X();async function Ey(e,t,r){let n=await R(),o=await Ne(n,{appId:e??r.appId,environmentId:t??r.environmentId,json:r.json});if(le(o.appId,"appId"),le(o.envId,"environmentId"),!r.dryRun&&!r.yes&&(W()||r.json))throw new d("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(r.dryRun||!r.yes){let a=await Jr(n,o.appId),l=a.find(f=>f.id===o.envId),c=l?oS(l,a.length):`Delete environment ${o.envId}. Environment not found in this app's list \u2014 the server may return 404.`;if(r.dryRun){r.json?u.info(JSON.stringify({appId:o.appId,environmentId:o.envId,...l?{branch:l.branch,mount:l.mount}:{},found:!!l,environmentCount:a.length,onlyEnvironment:!!l&&a.length===1,dryRun:!0},null,2)):(u.info(`Dry run \u2014 would delete environment ${o.envId} in app ${o.appId}.`),u.info(` ${c}`),u.info("Dry run complete \u2014 no changes made."));return}if(!await Ce({message:`${c} Continue?`})){u.info("Aborted.");return}}let i=A.forApps({authToken:n}),s=Date.now();try{let a=await RA(n,o.appId,o.envId);if(await i.sendUsage("apps_environments_delete",{duration:Date.now()-s,dryRun:!1,mountRefreshStatus:a.mountRefreshStatus}),r.json){u.info(JSON.stringify(a,null,2));return}u.info(a.message)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_delete",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to delete environment:`}))}}z();C();F();N();X();ge();var vy=["timestamp","message","phase"],Xs="timestamp,message",cp=ft(vy);function ao(){return vy}function L1(e,t){return e==null||e===""?P("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function N1(e,t=Xs.split(",")){return e.map(r=>t.map(n=>L1(r[n],n)).join(" ")).join(`
279
+ `)}function up(e,t,r){if(t.json)return JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2);if(e.logs.length===0)return"No logs found.";let n=[...t.limit!==void 0?["--limit",String(t.limit)]:[],...ws(r,Xs),...t.since!==void 0?["--since",t.since]:[],...t.q!==void 0?["--q",t.q]:[]];return N1(e.logs,r)+ys(e.nextCursor,n)}async function Sy(e,t){if(!e)throw new d("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let r=await R(),{appId:n,envId:o}=await Ne(r,{json:t.json}),i=t.json?void 0:Re(t.fields,cp,ao()),s=A.forApps({authToken:r}),a=Date.now();try{let l=await PA(r,n,o,e,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_build",{duration:Date.now()-a,count:l.logs.length}),u.info(up(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read build logs:`}))}}z();C();F();N();X();async function xy(e,t){let r=await R(),{appId:n,envId:o}=await Ne(r,{environmentId:e,json:t.json}),i=t.json?void 0:Re(t.fields,cp,ao()),s=A.forApps({authToken:r}),a=Date.now();try{let l=await $A(r,n,o,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_runtime",{duration:Date.now()-a,count:l.logs.length}),u.info(up(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read runtime logs:`}))}}z();C();F();N();X();async function Cy(e){let t=await R(),{appId:r,envId:n}=await Ne(t,{json:e.json}),o=e.json?void 0:Re(e.fields,Mu,Kn()),i=A.forApps({authToken:t}),s=Date.now();try{let a=so({status:e.status}),l=[...e.limit!==void 0?["--limit",String(e.limit)]:[],...ws(o,ii),...e.status?["--status",e.status]:[]],c=await OA(t,r,n,{limit:e.limit,cursor:e.cursor,status:e.status});if(await i.sendUsage("apps_deployments_list",{duration:Date.now()-s,count:c.deployments.length,filtered:a}),e.json){u.info(JSON.stringify(c,null,2));return}if(c.deployments.length===0){u.info(a?"No deployments matched the given filters.":"No deployments found.");return}u.info(ul(c.deployments,o)+ys(c.nextCursor,l))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list deployments:`}))}}z();ge();C();he();F();N();X();var j1=5,oF=1800;function M1(e){return new Promise(t=>setTimeout(t,e))}async function iF(e,t,r,n,o={}){let i=Math.min(oF,Math.max(j1,o.interval??Nu)),s=Math.min(oF,Math.max(1,o.timeout??ju)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let f=new AbortController,m=setTimeout(()=>f.abort(),Math.max(0,a-Date.now())),g;try{g=await ip(e,t,r,n,{signal:f.signal})}catch(k){if(f.signal.aborted){p=!0;break}throw k}finally{clearTimeout(m)}c=g;let h=g.status;if(iS(h))break;let y=a-Date.now();if(y<=0){p=!0;break}if(h!==l&&o.onStatusChange?.(l,h),l=h,await M1(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function _y(e,t){let r=await R(),{appId:n,envId:o}=await Ne(r,{json:t.json}),i=t.json?void 0:Re(t.fields,Mu,Kn()),s=A.forApps({authToken:r}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!W(),{deployment:f,timedOut:m,timeoutSeconds:g}=await iF(r,n,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,k)=>u.info(P(y===void 0?k:`${y} \u2192 ${k}`)):void 0}),h=m?"timeout":f?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:h}),process.exitCode=!m&&f?.status==="success"?0:1,t.json){u.info(JSON.stringify(f??null,null,2));return}f&&u.info(ul([f],i)),m&&u.warn(`Timed out after ${g}s waiting for a terminal status (last status: ${f?.status??"unknown"}).`);return}let c=await ip(r,n,o,e);if(await s.sendUsage("apps_deployments_get",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(ul([c],i))}catch(c){throw c instanceof d&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new d(c,{prefix:`${D} Failed to ${t.wait?"watch":"get"} deployment:`}))}}z();ge();C();F();N();X();async function Ay(e,t){let r=Gr(t.idempotencyKey),n=await R(),{appId:o,envId:i}=await Ne(n,{json:t.json});if(t.dryRun){le(o,"appId"),le(i,"environmentId"),oo(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:o,environmentId:i,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${o}, environment ${i}.`),u.info("Dry run \u2014 no changes made."));return}let s=A.forApps({authToken:n,suppressCommand:!!r}),a=Date.now();try{let l=await LA(n,o,i,e,{idempotencyKey:r});if(await s.sendUsage("apps_deployments_redeploy",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(l,null,2));return}let c=l.commitSha.slice(0,7);l.status==="queued"?u.info(`${$} Redeploy queued \u2014 commit ${c}`):u.info(`${xe} Redeploy in progress \u2014 commit ${c} ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_deployments_redeploy",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to redeploy deployment:`}))}}z();ge();C();var sF=require("child_process");function aF(){try{let e=(0,sF.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}F();N();X();function B1(e){let t=aF();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function U1(e,t,r){try{return(await Jr(e,t)).find(o=>o.id===r)}catch{return}}async function Fy(e){let t=Gr(e.idempotencyKey),r=await R(),{appId:n,envId:o}=await Ne(r,{json:e.json}),i=await U1(r,n,o);if(B1(i?.branch),e.dryRun){le(n,"appId"),le(o,"environmentId"),e.json?u.info(JSON.stringify({appId:n,environmentId:o,branch:i?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${i?.branch?`\`${i.branch}\` `:""}in app ${n}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let s=A.forApps({authToken:r,suppressCommand:!!t}),a=Date.now();try{let l=await NA(r,n,o,{idempotencyKey:t});if(await s.sendUsage("apps_deployments_trigger",{duration:Date.now()-a}),e.json){u.info(JSON.stringify(l,null,2));return}l.status==="queued"?u.info(`${$} Trigger queued${i?.branch?` for \`${i.branch}\``:""}.`):l.status==="skipped"?u.info(`${xe} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${xe} Trigger in progress ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_deployments_trigger",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to trigger deployment:`}))}}z();C();F();N();X();async function Iy(e,t){if(t.name===void 0&&t.description===void 0)throw new d("Provide --name or --description",{isUserError:!0});let r=await R(),n=await sr(r,e,t);if(le(n,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${n}`),t.name!==void 0&&u.info(` Name: ${t.name}`),t.description!==void 0&&u.info(` Description: ${t.description}`),u.info("Dry run complete \u2014 no changes made.");return}let o=A.forApps({authToken:r}),i=Date.now();try{let s=await CA(r,n,{name:t.name,description:t.description});if(await o.sendUsage("apps_update",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to update app:`}))}}z();C();he();Fe();F();N();X();async function Ry(e,t){let r=await R(),n=await sr(r,e,t);if(le(n,"appId"),!t.dryRun&&!t.yes&&(W()||t.json))throw new d("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await op(r,n),a=nS(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${n}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await Ce({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=A.forApps({authToken:r}),i=Date.now();try{let s=await _A(r,n);if(await o.sendUsage("apps_delete",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(s.message)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to delete app:`}))}}z();C();F();N();X();De();C();ct();var Zs=100;function Ty(e,t){return`${O()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function Py(e,t){return tt(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function W1(e,t,r,n,o={}){let i=Di(Ty(t,r),{limit:Gl,cursor:n,filters:o}),s=await K(i,{headers:ze(e)});if(!s.ok)throw await Py(s,"Failed to list environment variables");return io(await s.json(),"variables")}async function $y(e,t,r,n={}){return qs(o=>W1(e,t,r,o,n))}async function Oy(e,t,r,n){let o=await K(`${Ty(t,r)}/${encodeURIComponent(n)}`,{method:"DELETE",headers:ze(e)});if(!o.ok)throw await Py(o,"Failed to delete environment variable")}async function Jl(e,t,r,n,o){let i=Object.keys(n).length;if(i>Zs)throw new d(`Cannot import more than ${Zs} variables at once (received ${i}).`,{isUserError:!0});let s=await K(`${Ty(t,r)}/bulk`,{method:"POST",headers:{...ze(e),"Content-Type":"application/json"},body:JSON.stringify({variables:n,overwriteExisting:o})});if(!s.ok)throw await Py(s,"Failed to import environment variables");return await s.json()}var lF=require("dotenv");ge();var cF=["key","isSecret","value","id","environmentId"],zl=["key","isSecret"];function Qs(){return cF}var Ly=ft(cF);function H1(e,t){switch(t){case"value":return e.isSecret?P("(secret)"):e.value!==""?e.value:P("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):P("\u2014")}}function Ny(e,t=zl){if(e.length===0)return P("No environment variables found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>H1(o,i)));return Ze(r,n)}function jy(e){let t=e.split(/\r?\n/).map(r=>r.replace(/^\s*export\s+/,"")).join(`
280
+ `);return(0,lF.parse)(t)}async function My(e){let t=await R(),r=A.forAppsEnvVars({authToken:t}),n=Date.now();try{let{appId:o,envId:i}=await Ne(t,e),s={key:e.key,q:e.q},a=so(s),l=await $y(t,o,i,s);if(await r.sendUsage("apps_env_vars_list",{duration:Date.now()-n,variableCount:l.length,filtered:a}),e.json){u.info(JSON.stringify(l,null,2));return}if(l.length===0){u.info(a?"No environment variables matched the given filters.":"No environment variables found.");return}let c=Re(e.fields,Ly,Qs());u.info(Ny(l,c))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list environment variables:`}))}}z();C();F();N();X();C();he();Fe();F();N();async function uF(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}function By(e){u.warn(`${Z} Passing a secret as a command-line argument exposes it in your shell history and process list. Pipe it via stdin (e.g. \`printf %s "$VALUE" | webflow apps env-vars set ${e} --secret\`) or omit the value to be prompted.`)}async function dF(e,t){if(e!==void 0)return t.secret&&!t.json&&By(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let r=await uF();if(r==="")throw new d(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:r,source:"stdin"}}if(!W()){let r=t.secret?await bk({message:`Enter the value for ${t.key}:`}):await qe({message:`Enter the value for ${t.key}:`});if(r===null||r==="")throw new d(`No value provided for ${t.key}.`,{isUserError:!0});return{value:r,source:"prompt"}}throw new d(`No value provided for ${t.key}. Pass it as an argument, pipe it via stdin, or run interactively (without --no-input).`,{isUserError:!0})}async function Uy(e,t,r){let n=r.secret?" (secret)":"",o=await R(),i=A.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await Ne(o,r);if(r.dryRun){t!==void 0&&r.secret&&!r.json&&By(e),r.json?u.info(JSON.stringify({key:e,...r.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${n} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:p}=await dF(t,{key:e,secret:r.secret,json:r.json}),f={[e]:{value:c,...r.secret?{isSecret:!0}:{}}},m=await Jl(o,a,l,f,!0),g=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!g){let y=m.errors.find(k=>k.key===e);throw new d(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let h=g.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:r.secret?"secret":"plain",valueSource:p}),r.json){u.info(JSON.stringify({key:e,isSecret:h,status:"set"},null,2));return}u.info(`${$} Set ${e}${h?" (secret)":""}`)}catch(c){throw c instanceof d&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new d(c,{prefix:`${D} Failed to set environment variable:`}))}}z();C();F();N();X();async function Wy(e,t){let r=await R(),n=A.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await Ne(r,t);if(t.dryRun){t.json?u.info(JSON.stringify({key:e,appId:i,environmentId:s,dryRun:!0},null,2)):(u.info(`Would delete ${e} from app ${i}, environment ${s}.`),u.info("Dry run \u2014 no changes made."));return}try{if(await Oy(r,i,s,e),await n.sendUsage("apps_env_vars_delete",{duration:Date.now()-o}),t.json){u.info(JSON.stringify({key:e,status:"deleted"},null,2));return}u.info(`${$} Deleted ${e}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await n.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new d(a,{prefix:`${D} Failed to delete environment variable:`}))}}var pF=require("fs"),fF=require("path");z();C();F();N();X();function Hy(e){return e.map(({id:t,environmentId:r,key:n,isSecret:o})=>({id:t,environmentId:r,key:n,isSecret:o}))}async function Vy(e,t){let r=await R(),n=A.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await Ne(r,t),a;try{a=(0,pF.readFileSync)((0,fF.resolve)(e),"utf8")}catch{throw new d(`Could not read file: ${e}`,{isUserError:!0})}let l=jy(a),c=Object.keys(l);if(c.length===0)throw new d(`No variables found in ${e}.`,{isUserError:!0});if(c.length>Zs)throw new d(`Cannot import more than ${Zs} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let f of c)p[f]={value:l[f],...t.secret?{isSecret:!0}:{}};if(t.dryRun){if(t.json)u.info(JSON.stringify({appId:i,environmentId:s,secret:!!t.secret,variables:c,dryRun:!0},null,2));else{u.info(`Would import ${c.length} variable(s)${t.secret?" as secrets":""} into app ${i}, environment ${s}:`);for(let f of c)u.info(` ${f}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let f=await Jl(r,i,s,p,!0);if(await n.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:f.created.length,updatedCount:f.updated.length,skippedCount:f.skipped.length,errorCount:f.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:Hy(f.created),updated:Hy(f.updated),skipped:Hy(f.skipped),errors:f.errors},null,2));else{u.info(`${$} Imported: ${f.created.length} created, ${f.updated.length} updated, ${f.skipped.length} skipped, ${f.errors.length} failed`);for(let m of f.errors)u.warn(` ${m.key}: ${m.error}`)}if(f.errors.length>0)throw new d(`Import completed with ${f.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(f){throw f instanceof d&&f.isUserError?f:(await n.sendError(f instanceof Error?f:new Error(String(f)),"apps_env_vars_import",{duration:Date.now()-o}),new d(f,{prefix:`${D} Failed to import environment variables:`}))}}var Gy=["success","failed","starting","building","deploying","canceled","unstaged"];ge();C();F();N();en();function yF(e,t,r){Ve()&&e==="cloud"&&(r.json||u.warn(`${Z} ${de(`webflow cloud ${t}`)} is deprecated \u2014 use ${de(`webflow apps ${t}`)} instead.`))}var mF={branch:"--branch selects which branch of the repository to build",idempotencyKey:"--idempotency-key dedupes a retried create from a repository",json:"--json describes the app created from a repository"},gF={framework:"--framework selects a starter template",workspaceId:"--workspace-id is derived from your token when using --import",projectName:"--project-name is deprecated \u2014 use --app-name"};function V1(e){if(e.import===void 0){for(let t of Object.keys(mF))if(e[t]!==void 0){let r=hF(t);throw new d(`${r} is only supported together with --import <repo-url> (${mF[t]}).`,{isUserError:!0,missingFlag:"--import"})}return}if(e.import.trim()==="")throw new d("--import requires a repository URL.",{isUserError:!0,missingFlag:"--import"});for(let t of Object.keys(gF))if(e[t]!==void 0){let r=hF(t);throw new d(`${r} cannot be combined with --import (${gF[t]}).`,{isUserError:!0,missingFlag:r})}if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!e.new&&!e.siteId)throw new d("--import requires either --site-id <siteId> to attach to an existing site or --new to create a standalone app. A siteId from the repository is not used to choose the mutation target.",{isUserError:!0,missingFlag:"--site-id"});if(e.new&&e.mount!==void 0)throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});if(e.siteId&&e.mount===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"})}function hF(e){return`--${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function dp(e,{namespace:t}){let r=t==="apps",n=e.command("init").description(r?"Bootstrap a new Webflow Cloud app, from a starter template or from an existing GitHub repository (--import)":"Bootstrap a new Webflow Cloud app from a starter template").addOption(new En.Option("-n, --app-name <name>","App name")).addOption(new En.Option("--project-name <name>",`${Xr} Use --app-name instead.`)).option("-f, --framework <framework>","Framework to use (e.g., astro, nextjs)").option("-m, --mount <mount>","Mount path (default: '/' for new domain, '/app' for existing site). With --import: required (non-root) when attaching to a site with --site-id, not allowed with --new").option("-s, --site-id <siteId>","Webflow site ID to connect to").option("--new","Create an app without connecting to an existing site").option("-w, --workspace-id <workspaceId>","Workspace ID where the app should be deployed (skips workspace picker)");r&&n.option("--import <repo-url>","Create the app from an existing GitHub repository (https://github.com/<owner>/<repo>) and clone it locally. Requires --site-id to attach to an existing site or --new to create a standalone app. The Webflow GitHub App must be installed on the repository and connected to your workspace.").option("--branch <branch>","Branch to build when using --import. Defaults to the repository's default branch.").option("--idempotency-key <key>","Required for non-interactive runs (CI, --no-input). Reuse a retry-stable key unique to this repository and target (for example, $GITHUB_RUN_ID-$REPOSITORY-$SITE_ID) so a retry replays the original app instead of creating a second one").addOption(new En.Option("--json","Output as JSON when using --import")).addOption(new En.Option("--dry-run","Preview without executing (scaffold or --import)")),n.action(async(o,i)=>{if(iy(t),yF(t,"init",o),V1(o),r&&o.import!==void 0){await gy({import:o.import,branch:o.branch,appName:o.appName,siteId:o.siteId,newSite:o.new,mount:o.mount,idempotencyKey:o.idempotencyKey,json:o.json,dryRun:o.dryRun});return}await G1(o,i)})}function pp(e,{namespace:t}){e.command("deploy").description("Deploy your Webflow Cloud app").option("-e, --environment <environment>","Environment name").option("-m, --mount <mount>","Mount path (e.g., /app)").addOption(new En.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new En.Option("--project-name <name>",`${Xr} Use --app-name instead.`)).option("-d, --directory <path>","App directory path (for new apps)").option("--description <description>","App description (for new apps)").option("--skip-mount-path-check","Skip mount path checking").option("--auto-publish","Automatically publish site for mount path updates").option("-s, --site-id <siteId>","Webflow site ID for site-attached deploys (skips site picker)").addOption(new En.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new En.Option("--project-id <appId>",`${Xr} Use --app-id instead.`)).option("-f, --framework <framework>","Override framework detection (e.g., nextjs, astro)").option("-w, --workspace-id <workspaceId>","Workspace ID where the app will be deployed (skips workspace picker)").action(async(r,n)=>{iy(t),yF(t,"deploy",r),await K1(r,n)})}var G1=ly,K1=cy;var wF=e=>{let t=Ve(),r=e.command("cloud").description(t?`${Xr} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");r.command("create").description(`${Xr} Use 'webflow ${t?"apps":"cloud"} init' instead. Quick non-interactive scaffold for site-attached apps (hardcoded to /app).`).argument("<name>","App name").option("-f, --framework <framework>","Framework to use","nextjs").action(sy),r.command("list").description(t?`${Xr} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Xr} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(ay),dp(r,{namespace:"cloud"}),pp(r,{namespace:"cloud"}),Zt(r)};var Ky=require("commander");en();var bF=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");dp(t,{namespace:"apps"}),pp(t,{namespace:"apps"}),t.command("list").description(`List all apps in your Webflow workspace. Optional filters: --site (exact site id), --name (exact, case-sensitive), and --q (case-insensitive substring on name). App names are unique only within a site, so pass --site AND --name together to resolve to at most one app; --site alone can match many apps and --name alone can match apps across sites. ${Bu("app","an exact filter")}`).option("-s, --site <site-id>","Filter apps to an exact Webflow site id. Combine with --name to resolve to at most one app. Does not default from webflow.json.",ks).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",ks).addOption(Uu("the app name")).addOption(ee()).addOption(Ke([...Gn()]).default(Pu)).action(dy),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(ee()).addOption(Ke([...Gn()]).default(Sg)).action(hy),t.command("domains").description("List domains and live URLs for an app. Pagination: pass --cursor from a previous nextCursor and resend the same --limit and non-default --fields on every page.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Ke([...ll()]).default(bs)).addOption(ee()).option("--limit <n>","Max number of domains to return (server caps at 100)",Gu).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(yy),Ve()&&(t.command("update").description("Update an app's name or description. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--name <name>","New app name").option("--description <description>","New app description").addOption(ee()).addOption(_e()).action(Iy),t.command("delete").description("Delete (or archive) an app. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(li()).addOption(ee()).addOption(_e()).action(Ry));let r=t.command("environments").description("Manage the environments of a Webflow Cloud app");r.command("list").description(`List the environments of an app. Optional filters: --branch (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on branch, for discovery). ${Bu("environment","--branch")}`).argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--branch <branch>","Filter environments by exact branch name (case-sensitive) \u2014 resolves to at most one environment.",ks).addOption(Uu("the environment branch")).addOption(Ke([...cl()]).default($u)).addOption(ee()).action(wy),Ve()&&(r.command("create").description("Create an environment on an app, bound to a branch and served at a mount path. Does NOT deploy it \u2014 the environment starts empty; run `apps deployments trigger` to build it. Resolves the app from WEBFLOW_APP_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").requiredOption("--branch <branch>","Git branch this environment builds from. Must be a valid Git branch name and not already used by another environment of this app").requiredOption("--mount <path>","URL path the environment is served at (for example, /app). Must be unique across the site").option("--idempotency-key <key>","Optional retry-stable key sent as the request's requestId to dedupe a retried create. When passed, must be non-empty and printable ASCII (no control characters, newlines, or non-ASCII) \u2014 omit the flag to run without deduplication").addOption(ee()).addOption(_e()).action(ky),r.command("update").description("Update an environment's branch and/or mount (at least one of --branch or --mount is required). Does NOT deploy it \u2014 run `apps deployments trigger` afterwards to build a branch change. Resolves the app and environment from positional args, WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or interactive pickers. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").argument("[envId]","Environment ID (defaults to webflow.json or WEBFLOW_APP_ENVIRONMENT_ID)").option("--branch <branch>","Git branch this environment builds from. Must be a valid Git branch name and not already used by another environment of this app").option("--mount <path>","URL path the environment is served at (for example, /app). Must be unique across the site").addOption(si()).addOption(ai()).addOption(ee()).addOption(_e()).action(Dy),r.command("delete").description("Delete an environment from an app. Resolves the app and environment from positional args, WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or interactive pickers. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").argument("[envId]","Environment ID (defaults to webflow.json or WEBFLOW_APP_ENVIRONMENT_ID)").addOption(si()).addOption(ai()).addOption(li()).addOption(ee()).addOption(_e()).action(Ey));let n=t.command("deployments").description("Inspect Webflow Cloud deployments");n.command("list").description("List the most recent deployments of an environment (newest first). Optional filter: --status (exact, one of the values below). Pagination: pass --cursor from a previous nextCursor and resend the same --limit, --status, and non-default --fields on every page. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").addOption(lS()).addOption(new Ky.Option("--status <status>","Filter deployments by exact status").choices([...Gy])).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(ee()).addOption(Ke([...Kn()]).default(ii)).action(Cy),n.command("get").description("Get details for a specific deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Pass --wait to poll until the deployment reaches a terminal status (exit 0 on success, 1 otherwise); --interval is floored at 5s and --timeout capped at 30min.").argument("<depId>","Deployment ID").addOption(new Ky.Option("--wait","Poll until the deployment reaches a terminal status (success/failed/canceled/unstaged) or the timeout elapses, then exit 0 on success or 1 otherwise")).addOption(uS()).addOption(dS()).addOption(ee()).addOption(Ke([...Kn()]).default(ii)).action(_y),n.command("redeploy").description("Re-run a deployment at its SAME commit (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. To roll back, redeploy an earlier successful deployment's ID. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("<depId>","Deployment ID to re-run").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue. When passed, must be non-empty and printable ASCII (no control characters, newlines, or non-ASCII) \u2014 omit the flag to run without deduplication").addOption(ee()).addOption(_e()).action(Ay),n.command("trigger").description("Build a GitHub-connected environment's current HEAD on demand (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker; builds whatever branch that environment is configured for. Warns (without blocking) if that branch differs from your current local branch. Use --dry-run to preview.").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue. When passed, must be non-empty and printable ASCII (no control characters, newlines, or non-ASCII) \u2014 omit the flag to run without deduplication").addOption(ee()).addOption(_e()).action(Fy);let o=t.command("logs").description("Read Webflow Cloud app logs");o.command("build").description("Read the build logs of a deployment. Pagination: pass --cursor from a previous nextCursor and resend the same --limit, non-default --fields, --since, and --q on every page. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").argument("[depId]","Deployment ID (required) \u2014 run 'webflow apps deployments list' to find one").addOption(ee()).addOption(Ke([...ao()]).default(Xs)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Rg()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Sy),o.command("runtime").description("Read the runtime logs of an environment. Pagination: pass --cursor from a previous nextCursor and resend the same --limit, non-default --fields, --since, and --q on every page. Resolves the app from WEBFLOW_APP_ID / webflow.json (or a picker); the environment from the [envId] argument, WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or a picker.").argument("[envId]","Environment ID (defaults to the only env; required if the app has several)").addOption(ee()).addOption(Ke([...ao()]).default(Xs)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Rg()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(xy);let i=t.command("env-vars").description("Manage Webflow Cloud app environment variables");i.command("list").description(`List environment variables for a Cloud app environment. Optional filters: --key (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on key, for discovery \u2014 --q never searches values). ${Bu("variable","--key")} Secret values are never returned.`).addOption(si()).addOption(ai()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",ks).addOption(Uu("the variable key")).addOption(ee()).addOption(Ke([...Qs()]).default(zl.join(","))).action(My),i.command("set").description("Create or update an environment variable. Use --secret to encrypt the value. Use --dry-run to preview.").argument("<key>","Variable name").argument("[value]","Variable value. Omit to read from piped stdin or be prompted (recommended for secrets, keeps them out of shell history).").addOption(si()).addOption(ai()).addOption(Ig()).addOption(_e()).addOption(ee()).action(Uy),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(si()).addOption(ai()).addOption(_e()).addOption(ee()).action(Wy),i.command("import").description("Bulk import environment variables from a .env file. Use --secret to mark every key secret. Use --dry-run to preview.").argument("<file>","Path to a .env (KEY=value) file").addOption(si()).addOption(ai()).addOption(Ig()).addOption(_e()).addOption(ee()).action(Vy),Zt(t)};De();C();ct();async function zr(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function kF(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok){let o=await zr(r);throw r.status>=400&&r.status<500?new d(o,{isUserError:!0}):new d(`Failed to list collections: ${o}`)}return(await r.json()).collections??[]}async function DF(e,t){Q(t,"collectionId");let r=await K(`${O()}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!r.ok)throw new d(`Failed to get collection: ${await zr(r)}`);let n=await r.json();return{...n,fields:n.fields??[]}}async function EF(e,t,r){Q(t,"siteId");let n={displayName:r.displayName,singularName:r.singularName};r.slug&&(n.slug=r.slug);let o=await K(`${O()}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!o.ok){let i=await zr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create collection: ${i}`)}return await o.json()}async function vF(e,t,r){Q(t,"collectionId");let n=await K(`${O()}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:r.displayName,type:r.type,isRequired:r.isRequired??!1})});if(!n.ok){let o=await zr(n);throw n.status===404?new d(`Collection "${t}" not found`,{isUserError:!0}):n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to create field: ${o}`)}return await n.json()}async function Jy(e,t,r={}){Q(t,"collectionId");let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset)),r.cmsLocaleId&&n.set("cmsLocaleId",r.cmsLocaleId);let o=n.toString()?`?${n.toString()}`:"",i=await K(`${O()}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to list items: ${await zr(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??r.limit??100,offset:s.offset??r.offset??0}}async function SF(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=n?`?cmsLocaleId=${encodeURIComponent(n)}`:"",i=await K(`${O()}/v2/collections/${t}/items/${r}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to get item: ${await zr(i)}`);return await i.json()}async function zy(e,t,r,n=!1){Q(t,"collectionId");let o=await K(`${O()}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r,isDraft:n})});if(!o.ok){let i=await zr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create item: ${i}`)}return await o.json()}async function qy(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n})});if(o.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!o.ok)throw new d(`Failed to update item: ${await zr(o)}`);return await o.json()}async function xF(e,t,r){Q(t,"collectionId"),Q(r,"itemId");let n=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!n.ok)throw new d(`Failed to delete item: ${await zr(n)}`)}async function CF(e,t,r){Q(t,"collectionId"),r.forEach(o=>Q(o,"itemId"));let n=await K(`${O()}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:r})});if(!n.ok){let o=await zr(n);throw n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to publish items: ${o}`)}return await n.json()}ge();z();Oe();async function fp(e){if(e.site)return{token:await R(),siteId:e.site};let{manifest:t}=oe(),r=await Ye(t);return{token:r.accessToken,siteId:r.siteId}}function _F(e,t=["id","displayName","slug"]){if(e.length===0)return P("No collections found.");let r=["id","displayName","singularName","slug","lastUpdated"],n=Object.fromEntries(r.map(a=>[a.toLowerCase(),a])),o=t.map(a=>n[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Wt(`Invalid fields. Available: ${r.join(", ")}`);let i=o.map(a=>se(a)),s=e.map(a=>o.map(l=>{let c=a[l];return c?l==="lastUpdated"?new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c:P("\u2014")}));return Ze(i,s)}function AF(e){let t=[`${se("Collection:")} ${e.displayName}`,`${se("ID:")} ${e.id}`,`${se("Slug:")} ${e.slug}`,`${se("Singular:")} ${e.singularName}`,`${se("Updated:")} ${new Date(e.lastUpdated).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,"",se("Fields:")];if(e.fields.length===0)return t.push(P(" No fields defined.")),t.join(`
281
+ `);let r=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),n=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(Ze(r,n)),t.join(`
282
+ `)}function FF(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return P("No items found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?de("draft"):q("live");if(i==="isArchived")return o.isArchived?P("archived"):"";if(i==="lastUpdated"||i==="lastPublished"||i==="createdOn"){let a=o[i];return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")}let s=o[i];return s==null?P("\u2014"):String(s)}));return Ze(r,n)}C();F();N();function mp(e,t,r="asc"){return[...e].sort((n,o)=>{let i=n[t],s=o[t];if(i==null&&s==null)return 0;if(i==null)return 1;if(s==null)return-1;let a=0;return typeof i=="string"&&typeof s=="string"?a=i.localeCompare(s):typeof i=="number"&&typeof s=="number"?a=i-s:a=String(i).localeCompare(String(s)),r==="desc"?-a:a})}X();async function Yy(e){let{token:t,siteId:r}=await fp(e),n=A.forCms({authToken:t,siteId:r}),o=Date.now();try{let i=await kF(t,r);if(await n.sendUsage("cms_collections_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No collections found.");return}let s=["displayName","slug","lastUpdated"];if(s.includes(e.sortBy)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${s.join(", ")}. Defaulting to displayName.`),e.sortBy="displayName"),!["asc","desc"].includes(e.order))throw new d(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=mp(i,e.sortBy,e.order);if(e.json){u.info(JSON.stringify(a,null,2));return}let l=e.fields.split(",").map(c=>c.trim());u.info(_F(a,l))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list collections:`})}}z();C();F();N();X();async function Xy(e,t){let r=await R(),n=A.forCms({authToken:r}),o=Date.now();try{let i=await DF(r,e);if(await n.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(AF(i))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get collection:`})}}C();F();N();X();async function Zy(e){let t=e.singularName??e.name,r=e.slug??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(e.dryRun){u.info("Dry run \u2014 would create collection:"),u.info(JSON.stringify({displayName:e.name,singularName:t,slug:r},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:n,siteId:o}=await fp(e),i=A.forCms({authToken:n,siteId:o}),s=Date.now();try{let a=await EF(n,o,{displayName:e.name,singularName:t,slug:r});if(await i.sendUsage("cms_collections_create",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
283
+ Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof d&&a.isUserError){u.info(`${D} ${a.message}`),process.exitCode=1;return}throw await i.sendError(a instanceof Error?a:new Error(String(a)),"cms_collections_create",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to create collection:`})}}z();C();F();N();X();async function Qy(e){if(e.dryRun){u.info("Dry run \u2014 would create field:"),u.info(JSON.stringify({collectionId:e.collection,displayName:e.name,type:e.type,isRequired:e.required??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let t=await R(),r=A.forCms({authToken:t}),n=Date.now();try{let o=await vF(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await r.sendUsage("cms_fields_create",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(`${$} Field created: ${o.id}`),u.info(` Name: ${o.displayName}`),u.info(` Type: ${o.type}`),u.info(` Slug: ${o.slug}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to create field:`})}}z();C();F();N();X();async function ew(e){let t=await R(),r=A.forCms({authToken:t}),n=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await Jy(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await r.sendUsage("cms_items_list",{duration:Date.now()-n,count:s.items.length}),s.items.length===0){u.info("No items found.");return}if(e.json){u.info(JSON.stringify(s,null,2));return}let a=e.fields.split(",").map(f=>f.trim());u.info(FF(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let f=s.total>0?` of ${s.total}`:"";u.info(`
284
+ Showing ${l}\u2013${c}${f} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof d&&s.isUserError){u.info(`${D} ${s.message}`),process.exitCode=1;return}throw await r.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-n}),new d(s,{prefix:`${D} Failed to list items:`})}}z();C();F();N();X();async function tw(e){let t=await R(),r=A.forCms({authToken:t}),n=Date.now();try{let o=await SF(t,e.collection,e.item,e.locale);if(await r.sendUsage("cms_items_get",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}let i=o.isArchived?"archived":o.isDraft?"draft":"live";u.info(`${o.id} [${i}]`),u.info(` Last updated: ${new Date(o.lastUpdated).toLocaleString()}`),o.lastPublished&&u.info(` Last published: ${new Date(o.lastPublished).toLocaleString()}`),u.info(" Fields:"),u.info(JSON.stringify(o.fieldData,null,4).replace(/^/gm," "))}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get item:`})}}z();C();F();N();X();async function rw(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would create item:"),u.info(JSON.stringify({fieldData:t,isDraft:e.draft??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await R(),n=A.forCms({authToken:r}),o=Date.now();try{let i=await zy(r,e.collection,t,e.draft??!1);if(await n.sendUsage("cms_items_create",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item created: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to create item:`})}}z();C();F();N();X();async function nw(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would update item:"),u.info(JSON.stringify({collectionId:e.collection,itemId:e.item,fieldData:t},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await R(),n=A.forCms({authToken:r}),o=Date.now();try{let i=await qy(r,e.collection,e.item,t);if(await n.sendUsage("cms_items_update",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item updated: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to update item:`})}}z();C();F();N();X();async function ow(e){if(e.dryRun){u.info(`Dry run \u2014 would delete item ${e.item} from collection ${e.collection}`),u.info("Dry run complete \u2014 no changes made.");return}let t=await R(),r=A.forCms({authToken:t}),n=Date.now();try{await xF(t,e.collection,e.item),await r.sendUsage("cms_items_delete",{duration:Date.now()-n,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to delete item:`})}}z();C();F();N();X();async function iw(e){let t=e.items.split(",").map(i=>i.trim());if(e.dryRun){u.info(`Dry run \u2014 would publish ${t.length} item(s) in collection ${e.collection}:`),t.forEach(i=>u.info(` ${i}`)),u.info("Dry run complete \u2014 no changes made.");return}let r=await R(),n=A.forCms({authToken:r}),o=Date.now();try{let i=await CF(r,e.collection,t);if(await n.sendUsage("cms_items_publish",{duration:Date.now()-o,itemCount:t.length,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishedItemIds?.length??0;u.info(`${$} Published ${s} item(s)`),i.errors?.length&&i.errors.forEach(a=>u.warn(` ${a.itemId}: ${a.message}`))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to publish items:`})}}var IF=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),r=t.command("collections").description("Manage CMS collections");r.command("list").description("List all CMS collections for a site").addOption(Nt()).addOption(ee()).addOption(Ke(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Es(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ds()).action(Yy),r.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(ee()).action(Xy),r.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Nt()).requiredOption("--name <displayName>","Collection display name").option("--singular-name <singularName>","Singular name (defaults to --name)").option("--slug <slug>","URL slug for the collection (auto-derived from --name if omitted)").addOption(_e()).addOption(ee()).action(Zy),t.command("fields").description("Manage CMS collection fields").command("create").description("Add a field to a CMS collection. Use --dry-run to preview.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--name <displayName>","Field display name").requiredOption("--type <type>","Field type (e.g. PlainText, RichText, Number, DateTime, Link, Image, Video, Color, Bool, Option, ItemRef, ItemRefSet)").option("--required","Mark field as required").addOption(_e()).addOption(ee()).action(Qy);let o=t.command("items").description("Manage CMS items");o.command("list").description("List items in a CMS collection").requiredOption("--collection <collectionId>","Collection ID").option("--locale <cmsLocaleId>","CMS locale ID to filter by").addOption(Hu()).addOption(Vu()).addOption(ee()).addOption(Ke(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(ew),o.command("get").description("Get a single CMS item by ID").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").option("--locale <cmsLocaleId>","CMS locale ID to retrieve content for").addOption(ee()).action(tw),o.command("create").description("Create a new CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--data <json>","Item field data as a JSON string").option("--draft","Create as draft (not published)").addOption(_e()).addOption(ee()).action(rw),o.command("update").description("Update an existing CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").requiredOption("--data <json>","Updated field data as a JSON string").addOption(_e()).addOption(ee()).action(nw),o.command("delete").description("Delete a CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").addOption(_e()).action(ow),o.command("publish").description("Publish one or more CMS items. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--items <itemIds>","Comma-separated item IDs to publish").addOption(_e()).addOption(ee()).action(iw)};z();ge();C();F();N();Oe();X();De();ct();C();C();ge();var RF={png:{category:"image",maxBytes:4*1024*1024},jpeg:{category:"image",maxBytes:4*1024*1024},jpg:{category:"image",maxBytes:4*1024*1024},gif:{category:"image",maxBytes:4*1024*1024},svg:{category:"image",maxBytes:4*1024*1024},webp:{category:"image",maxBytes:4*1024*1024},avif:{category:"image",maxBytes:4*1024*1024},pdf:{category:"document",maxBytes:10*1024*1024},doc:{category:"document",maxBytes:10*1024*1024},docx:{category:"document",maxBytes:10*1024*1024},xls:{category:"document",maxBytes:10*1024*1024},xlsx:{category:"document",maxBytes:10*1024*1024},ppt:{category:"document",maxBytes:10*1024*1024},pptx:{category:"document",maxBytes:10*1024*1024},txt:{category:"document",maxBytes:10*1024*1024},csv:{category:"document",maxBytes:10*1024*1024},odt:{category:"document",maxBytes:10*1024*1024},ods:{category:"document",maxBytes:10*1024*1024},odp:{category:"document",maxBytes:10*1024*1024},json:{category:"lottie",maxBytes:10*1024*1024},lottie:{category:"lottie",maxBytes:10*1024*1024}};function gp(e,t){let r=e.split(".").pop()?.toLowerCase()??"",n=RF[r];if(!n){let o=Object.keys(RF).join(", ");throw new d(`Unsupported file type ".${r}". Allowed types: ${o}`,{isUserError:!0})}if(t>n.maxBytes){let o=n.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new d(`File too large: ${i} MB exceeds the ${o} MB limit for ${n.category} files.`,{isUserError:!0})}}var sw=["id","displayName","originalFileName","contentType","size","lastUpdated"];function TF(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return P("No assets found.");let r=Object.fromEntries(sw.map(l=>[l.toLowerCase(),l])),n=t.map(l=>r[l.toLowerCase()]).filter(l=>l!=null);if(n.length===0)return Wt(`Invalid fields. Available: ${sw.join(", ")}`);let o=t.filter(l=>r[l.toLowerCase()]==null),i=o.length>0?de(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${sw.join(", ")}
285
+ `):"",s=n.map(l=>se(l)),a=e.map(l=>n.map(c=>{let p=l[c];if(p==null||c==="size"&&p===0)return P("\u2014");if(c==="size")return J1(Number(p));if(c==="lastUpdated"){let m=new Date(String(p)),g=String(m.getMonth()+1).padStart(2,"0"),h=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),k=String(m.getHours()).padStart(2,"0"),v=String(m.getMinutes()).padStart(2,"0");return`${g}/${h}/${y} ${k}:${v}`}let f=String(p);return c==="displayName"&&f.length>40?P("\u2026")+f.slice(-39):f}));return i+Ze(s,a)}function J1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function PF(e){if(e.length===0)return P("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),r=["id","displayName","assets","lastUpdated"].map(o=>se(o)),n=t.map(o=>[o.id,o.displayName,String(o.assets.length),new Date(o.lastUpdated).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]);return Ze(r,n)}async function $F(e,t,r={}){if(Q(t,"siteId"),r.folderId){Q(r.folderId,"folderId");let a=await z1(e,r.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],p=0,f=100;for(;;){let k=await K(`${O()}/v2/sites/${t}/assets?limit=${f}&offset=${p}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!k.ok)throw new d(`Failed to list assets: ${k.status} ${k.statusText}`);let v=await k.json(),_=v.assets??[];c.push(..._);let E=v.pagination?.total??0;if(p+=_.length,p>=E||_.length===0)break}let m=c.filter(k=>l.has(k.id)),g=r.offset??0,h=r.limit??m.length,y=m.slice(g,g+h);return{assets:y,pagination:{total:m.length,limit:y.length,offset:g}}}let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset));let o=n.toString(),i=await K(`${O()}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new d(`Failed to list assets: ${i.status} ${i.statusText}`);let s=await i.json();return{assets:s.assets??[],pagination:s.pagination??{total:0,limit:100,offset:0}}}async function OF(e,t,r,n,o){Q(t,"siteId"),o&&Q(o,"folderId");let i=yl(r);gp(i.meta.title,i.meta.size);let s=n??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await K(`${O()}/v2/sites/${t}/assets`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new d(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),p={fields:c.uploadDetails,_id:c.id,s3Url:c.hostedUrl??"",url:c.uploadUrl??"",contentType:c.contentType??"",origFileName:c.originalFileName??i.meta.title,success_action_redirect:"",createdOn:"",updatedOn:""};try{await bl(i,p)}catch(f){throw await K(`${O()}/v2/assets/${p._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),f}return{id:p._id,hostedUrl:p.s3Url,displayName:s,originalFileName:i.meta.title}}async function LF(e,t,r){Q(t,"assetId");let n=await K(`${O()}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new d(`Failed to update asset: ${n.status} ${n.statusText}`);return await n.json()}async function z1(e,t){Q(t,"folderId");let r=await K(`${O()}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get folder: ${r.status} ${r.statusText}`);return await r.json()}async function NF(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to list folders: ${r.status} ${r.statusText}`);return(await r.json()).assetFolders??[]}async function jF(e,t,r,n){Q(t,"siteId"),n&&Q(n,"parentFolderId");let o={displayName:r};n&&(o.parentFolder=n);let i=await K(`${O()}/v2/sites/${t}/asset_folders`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new d(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function aw(e){let t,r;if(e.site)t=await R(),r=e.site;else{let{manifest:i}=oe(),s=await Ye(i);t=s.accessToken,r=s.siteId}let n=A.forAssets({authToken:t,siteId:r}),o=Date.now();try{let{assets:i,pagination:s}=await $F(t,r,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await n.sendUsage("assets_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No assets found.");return}let a=["displayName","originalFileName","contentType","size","lastUpdated"],l=e.sortBy;a.includes(l)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${a.join(", ")}. Defaulting to displayName.`),l="displayName");let c=e.order;["asc","desc"].includes(e.order)||(u.warn(`Unknown --order "${e.order}". Valid values: asc, desc. Defaulting to asc.`),c="asc");let p=mp(i,l,c);if(e.json){u.info(JSON.stringify({assets:p,pagination:s},null,2));return}let f=e.fields.split(",").map(g=>g.trim());u.info(TF(p,f));let m=(e.offset??0)+i.length;m<s.total&&u.info(P(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list assets:`})}}z();C();F();N();Oe();X();async function lw(e,t){let r=yl(e);if(gp(r.meta.title,r.meta.size),t.dryRun){u.info(`Dry run \u2014 would upload: ${e} (validated)`),t.name&&u.info(` Display name: ${t.name}`),t.folder&&u.info(` Folder: ${t.folder}`),u.info("Dry run complete \u2014 no changes made.");return}let n,o;if(t.site)n=await R(),o=t.site;else{let{manifest:a}=oe(),l=await Ye(a);n=l.accessToken,o=l.siteId}let i=A.forAssets({authToken:n,siteId:o}),s=Date.now();try{let a=await OF(n,o,e,t.name,t.folder);if(await i.sendUsage("assets_upload",{duration:Date.now()-s,dryRun:!1}),t.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Asset uploaded: ${a.id}`),a.hostedUrl&&u.info(` URL: ${a.hostedUrl}`)}catch(a){throw await i.sendError(a instanceof Error?a:new Error(String(a)),"assets_upload",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to upload asset:`})}}z();C();F();N();X();async function cw(e,t){if(!t.altText&&!t.displayName)throw new d("Provide at least one of --alt-text or --display-name.",{isUserError:!0});if(t.dryRun){u.info(`Dry run \u2014 would update asset: ${e}`),t.altText&&u.info(` Alt text: ${t.altText}`),t.displayName&&u.info(` Display name: ${t.displayName}`),u.info("Dry run complete \u2014 no changes made.");return}let r=await R(),n=A.forAssets({authToken:r}),o=Date.now();try{let i=await LF(r,e,{altText:t.altText,displayName:t.displayName});if(await n.sendUsage("assets_update",{duration:Date.now()-o,dryRun:!1}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Asset updated: ${i.id}`),i.displayName&&u.info(` Display name: ${i.displayName}`),i.altText&&u.info(` Alt text: ${i.altText}`)}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to update asset:`})}}z();C();F();N();Oe();X();async function uw(e){let t,r;if(e.site)t=await R(),r=e.site;else{let{manifest:i}=oe(),s=await Ye(i);t=s.accessToken,r=s.siteId}let n=A.forAssets({authToken:t,siteId:r}),o=Date.now();try{let i=await NF(t,r);if(await n.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(PF(i))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list folders:`})}}z();C();F();N();da();X();async function dw(e,t){let r,n;if(t.site)r=await R(),n=t.site;else{let{manifest:s}=oe(),a=await Ye(s);r=a.accessToken,n=a.siteId}let o=A.forAssets({authToken:r,siteId:n}),i=Date.now();try{let s=await jF(r,n,e,t.parent);if(await o.sendUsage("assets_folders_create",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} Folder created: ${s.id}`),u.info(` Name: ${s.displayName}`),s.parentFolder&&u.info(` Parent: ${s.parentFolder}`)}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"assets_folders_create",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to create folder:`})}}var MF=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Nt()).option("--folder <folderId>","Filter by folder ID").addOption(ee()).addOption(Ke(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(Hu()).addOption(Vu()).addOption(Es(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ds()).action(aw),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
286
+ Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(Nt()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(_e()).addOption(ee()).action(lw),t.command("update").description("Update an asset's metadata. Use --dry-run to preview.").argument("<assetId>","Asset ID to update").option("--alt-text <text>","Alt text for the asset").option("--display-name <name>","New display name for the asset").addOption(_e()).addOption(ee()).action(cw);let r=t.command("folders").description("Manage asset folders");r.command("list").description("List all asset folders for a site").addOption(Nt()).addOption(ee()).action(uw),r.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Nt()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(ee()).action(dw)};z();C();F();N();X();De();C();ct();async function BF(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get site: ${r.status} ${r.statusText}`);return await r.json()}async function UF(e){return Vl(`${O()}/v2/sites`,e,"sites","Failed to list sites")}async function WF(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get custom domains: ${r.status} ${r.statusText}`);return(await r.json()).customDomains??[]}async function HF(e,t,r=[],n){Q(t,"siteId"),n&&Q(n,"pageId");let o=r.length>0?{customDomains:r}:{publishToWebflowSubdomain:!0};n&&(o.pageId=n);let i=await K(`${O()}/v2/sites/${t}/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new d(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();ge();var pw=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],VF=ft(pw);function GF(){return pw}function KF(e,t=["id","displayName","lastPublished"]){if(e.length===0)return P("No sites found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${pw.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="lastPublished"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:P("\u2014")}));return Ze(r,n)}function JF(e){if(e.length===0)return P("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],r=e.map(n=>[n.id,n.url,n.lastPublished?new Date(n.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")]);return Ze(t,r)}async function fw(e){let t=await R(),r=A.forSites({authToken:t}),n=Date.now();try{let o=await UF(t);if(await r.sendUsage("sites_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No sites found.");return}let i=Re(e.fields,VF,GF());u.info(KF(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list sites:`}))}}z();C();F();N();X();async function mw(e,t){let r=await R(),n=A.forSites({authToken:r}),o=Date.now();try{let i=await BF(r,e);if(await n.sendUsage("sites_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${i.displayName} (${i.id})`),u.info(` Short name: ${i.shortName}`),u.info(` Time zone: ${i.timeZone}`),i.lastPublished&&u.info(` Published: ${new Date(i.lastPublished).toLocaleString()}`),i.previewUrl&&u.info(` Preview: ${i.previewUrl}`)}catch(i){throw i instanceof d&&i.isUserError?i:(await n.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get site:`}))}}z();C();F();N();X();async function gw(e){let t=await R(),r=A.forSites({authToken:t}),n=Date.now();try{let o=await WF(t,e.site);if(await r.sendUsage("sites_domains",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(JF(o))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get custom domains:`}))}}z();C();F();N();X();async function hw(e){if(Q(e.site,"siteId"),e.dryRun){u.info(`Would publish ${e.page?`page ${e.page} on`:"site"} ${e.site}`),e.domains?u.info(` Custom domains: ${e.domains}`):u.info(" Domains: Webflow subdomain");return}let t=await R(),r=A.forSites({authToken:t}),n=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await HF(t,e.site,o,e.page);if(await r.sendUsage("sites_publish",{duration:Date.now()-n,dryRun:!1,publishScope:i.publishScope}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishScope==="page"?"Page":"Site";u.info(`${$} ${s} published successfully`);let a=i.customDomains??[];a.length>0?a.forEach(l=>{let c=l.lastPublished?` (${new Date(l.lastPublished).toLocaleString()})`:"";u.info(` Live at: https://${l.url}${c}`)}):i.publishToWebflowSubdomain&&u.info(" Published to Webflow subdomain")}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to publish site:`}))}}z();z();De();C();he();Fe();F();N();Oe();X();De();ct();C();var hp="not_enterprise_plan_workspace";async function zF(e,t,r){Q(t,"workspaceId");let n=r.trim();if(!n)throw new d("Site name cannot be empty.",{isUserError:!0});let o=await K(`${O()}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:n})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===hp?new d("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:hp}):a==="missing_scopes"?new d(`Your token is missing the 'workspace:write' scope.
287
+ Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new d(`Failed to create site "${n}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new d("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??n,shortName:i.shortName??""}}function q1(e){Se({siteId:e.id});let{manifestPath:t}=oe();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function Y1(e,t){let r=new Map;for(let i of t)i.workspaceId&&r.set(i.workspaceId,(r.get(i.workspaceId)??0)+1);let n=[...r.keys()];if(n.length===1)return n[0];if(n.length===0){let i=await Ks(e);if(i.length===0)throw new d("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(W())throw new d(`This token can access ${i.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});return(await Js(i)).id}if(W())throw new d(`This token's sites span ${n.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});let o=await Me({message:"Which workspace should the new site be created in?",choices:n.map(i=>({name:`${i} (${r.get(i)} site${r.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new d("No workspace selected.",{isUserError:!0});return o}async function X1(e,t){if(u.warn(`${D} ${t.message}
288
+ Create the site in the Webflow dashboard: ${Ar()}/dashboard
289
+ then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await Ce({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let n=await Tn(e);if(n.length===0)throw new d("No existing sites are accessible with this token yet. Create one in the Webflow dashboard, then re-run `webflow sites init`.",{isUserError:!0});return{site:await Bi(n),created:!1}}async function Z1(e,t,r){let n=await Y1(e,t),o=r.name;if(o||(o=await qe({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new d("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await zF(e,n,o)}catch(s){if(s instanceof d&&s.code===hp)return X1(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function yp(e={}){let t=await R({apiToken:e.apiToken}),r=A.forSites({authToken:t}),n=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new d("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await Tn(t),s;if(e.siteId){Q(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new d(`Site "${e.siteId}" is not among the ${i.length} site(s) this token can access.`,{isUserError:!0});s=a}else{let a=!!(e.create||e.name);if(!a&&W())throw new d("`webflow sites init` needs an explicit target when prompts are unavailable. Pass --site-id <siteId> to bind, or --create --name <name> to create a new site.",{isUserError:!0,missingFlag:"site-id"});if(a||(i.length===0?(u.info("No sites are accessible with this token."),a=!0):a=await Me({message:"How do you want to connect this project?",choices:[{name:"Bind to an existing Webflow site",value:"bind"},{name:"Create a new Webflow site",value:"create"}],default:"bind"})==="create"),a){let l=await Z1(t,i,e);s=l.site,o=l.created}else s=await Bi(i)}q1(s),await r.sendUsage("site_init",{duration:Date.now()-n,created:o})}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-n}),i instanceof d?i:new d(i,{prefix:`${D} Failed to initialize site:`})}}z();ge();C();F();N();X();De();ct();C();function Q1(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function eM(e,t){let r=await t.text(),n;try{n=JSON.parse(r)}catch{}throw t.status===404&&n?.error==="Not found"&&!n.code?new d(`Failed to ${e}: WFS Sync is not enabled on this environment (the server feature flag is off, or the host does not serve /api/ai/wfs).`,{isUserError:!0}):n?.code==="SCHEMA_STALE"?new d(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):n?.code&&n.error?new d(`Failed to ${e}: ${n.error} (${n.code})`,{isUserError:t.status<500}):new d(`Failed to ${e}: ${t.status} ${t.statusText}${Q1(r)}`)}async function qF(e,t,r,n){let o=await K(`${Ar()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});o.ok||await eM(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new d(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function yw(e,t,r){Q(t,"siteId");let n=await qF("pull the site files","pull",e,{siteId:t,identityMode:"clean",...r?.pageIds&&r.pageIds.length>0?{pageIds:r.pageIds}:{},...r?.manifestOnly?{manifestOnly:!0}:{}});if(n.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});return{...n,pages:n.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function YF(e,t,r,n){Q(t,"siteId");let o=await qF("push the site files","push",e,{siteId:t,identityMode:"clean",changes:r,...n?.conflictPolicy?{conflictPolicy:n.conflictPolicy}:{},...n?.schemaHash?{schemaHash:n.schemaHash}:{}});if(o.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});if(!Array.isArray(o.results))throw new d("Invalid response from the WFS Sync API: expected a `results` array.");return o}Oe();z();C();var wp=require("path");function ww(e){return e.split(wp.sep).join("/").replace(/\\/g,"/")}function vn(e){if(e===""||e.includes("\0")||(0,wp.isAbsolute)(e))return!1;let t=ww(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(r=>r==="..")}var tM={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},XF={library:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},astro:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},nextjs:{pagesRoot:"src/app",componentsRoot:"src/components",pagesShape:"nested"},"nextjs-pages":{pagesRoot:"pages",componentsRoot:"src/components",pagesShape:"flat"}};function rM(e){return e.endsWith("/")?e.slice(0,-1):e}function ZF(e,t,r){let n=e.trim();if(!vn(n))throw new d(`"site.layout.${t}" in ${r} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=n.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new d(`"site.layout.${t}" in ${r} must name a directory inside the project, not "${e}".`,{isUserError:!0});return rM(o)}function nM(e,t,r){let n=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(n.length,o.length)-1&&n[s]===o[s];s++)i.push(n[s]);return i.length>0?`${i.join("/")}/${r}`:r}function oM(e,t){let r=e?.layout;if(!r)return tM;let n=r.preset?XF[r.preset]:void 0;if(r.preset&&!n)throw new d(`Unknown "site.layout.preset" value "${r.preset}" in ${t}. Known presets: ${Object.keys(XF).join(", ")}.`,{isUserError:!0});let o=r.pagesRoot??n?.pagesRoot,i=r.componentsRoot??n?.componentsRoot;if(!o||!i)throw new d(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=r.pagesShape??n?.pagesShape??"flat",a=ZF(o,"pagesRoot",t),l=ZF(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:nM(a,l,"theme")}}function ea(e){let{manifest:t,manifestPath:r}=oe(),n=e?.trim();n&&Q(n,"site-id");let o=n||bo(t);if(!o||o.trim()==="")throw new d(`Missing "siteId" in ${r}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=oM(t.site,r);return{siteId:o,layout:i}}var co=require("fs"),ta=require("path"),dI=w(require("fast-glob"));C();var QF=require("crypto"),yt=require("fs"),Ei=require("path");C();var lo=".webflow/wfs";function Cr(e){return(0,QF.createHash)("sha256").update(e,"utf8").digest("hex")}function eI(e){let{nodeIds:t,styleIds:r,...n}=e;return n}function tI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iM(e){return tI(e)&&typeof e.wirePath=="string"&&vn(e.wirePath)&&typeof e.localPath=="string"&&vn(e.localPath)}function sM(e){return tI(e)?typeof e.serverHash=="string"&&typeof e.contentSha256=="string"&&(e.componentId===void 0||typeof e.componentId=="string"&&e.componentId.length>0)&&(e.localPath===void 0||typeof e.localPath=="string"&&vn(e.localPath)):!1}function rI(e){return(0,Ei.join)(e,lo,"index.json")}function bw(e,t){return vn(t)?(0,Ei.join)(e,lo,`${t}.json`):void 0}function nI(e){let t=rI(e);if((0,yt.existsSync)(t))try{let r=JSON.parse((0,yt.readFileSync)(t,"utf8"));return!r||typeof r.schemaHash!="string"||!Array.isArray(r.files)||!r.files.every(iM)?"corrupt":{...typeof r.siteId=="string"?{siteId:r.siteId}:{},...r.identityMode==="clean"?{identityMode:"clean"}:{},schemaHash:r.schemaHash,files:r.files}}catch{return"corrupt"}}function bp(e=process.cwd()){let t=nI(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${lo}/index.json could not be read`};let r={},n=[];for(let{wirePath:o}of t.files){let i=bw(e,o);if(!i){n.push(o);continue}if(!(0,yt.existsSync)(i)){n.push(o);continue}try{let s=JSON.parse((0,yt.readFileSync)(i,"utf8"));if(!sM(s)){n.push(o);continue}r[o]=eI(s)}catch{n.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},...t.identityMode?{identityMode:t.identityMode}:{},schemaHash:t.schemaHash,files:r},corruptPaths:n}}function kp(e,t=process.cwd()){let r=nI(t),n=new Set(r&&r!=="corrupt"?r.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=bw(t,s);if(!a)throw new d(`Refusing to write a lock entry outside ${lo}: "${s}"`);(0,yt.mkdirSync)((0,Ei.dirname)(a),{recursive:!0}),(0,yt.writeFileSync)(a,`${JSON.stringify(eI(e.files[s]),null,2)}
290
+ `,"utf8")}for(let s of n){if(s in e.files)continue;let a=bw(t,s);a&&(0,yt.existsSync)(a)&&(0,yt.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},...e.identityMode?{identityMode:e.identityMode}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=rI(t);(0,yt.mkdirSync)((0,Ei.dirname)(i),{recursive:!0}),(0,yt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
291
+ `,"utf8")}function oI(e=process.cwd()){(0,yt.rmSync)((0,Ei.join)(e,lo),{recursive:!0,force:!0})}C();function iI(e){if(!vn(e))throw new d(`Refusing to write unsafe path from server: "${e}"`)}var aM=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function ql(e){return aM.exec(e)?.[1]}var sI=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function lM(e){return sI.exec(e)?.[2]}function cM(e){let t=sI.exec(e);return t?t[1]??"":void 0}function Dw(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function Ew(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function vw(e,t){let n=e.slice(t.length+1).split("/");if(n.length===1)return"";if(n.length===2)return n[0]}function aI(e,t){if(t.pagesShape==="nested"){let n=e.isDefault?[]:[...e.folderSegments,e.slug];return n.length>0?`${t.pagesRoot}/${n.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let r=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${r.join("/")}.tsw`}function Sw(e,t,r){if(r)return r;let n=lM(e);if(!n)return;let o=cM(e)??"";return o?`${t.componentsRoot}/${o}/${n}.tsw`:`${t.componentsRoot}/${n}.tsw`}function lI(e,t){let r=Ew(e,t);if(!r)return;let n=vw(e,t);if(n!==void 0)return Dw(r,n)}var kw="site/theme/";function cI(e,t){if(e.startsWith(kw))return`${t.themeRoot}/${e.slice(kw.length)}`}function Dp(e,t){let r=`${t}/`;if(e.startsWith(r))return`${kw}${e.slice(r.length)}`}async function pI(e,t,r=process.cwd(),n=!1){let o=[],i=[],s=[],a=[],l=[],c=[],p={},f=new Map,m=new Map;for(let[y,k]of Object.entries(e.files)){let v=k.localPath??y;f.set(y,v),m.set(v,y)}let g=new Set((await(0,dI.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:r,onlyFiles:!0,dot:!1})).map(ww)),h=new Map;for(let y of Object.keys(e.files).sort()){let k=e.files[y],v=f.get(y);if(k.deletedUpstream){(0,co.existsSync)((0,ta.join)(r,v))&&c.push(v);continue}if(!(0,co.existsSync)((0,ta.join)(r,v))){i.push(v),h.set(k.contentSha256,v);continue}p[y]=v;let _=(0,co.readFileSync)((0,ta.join)(r,v),"utf8");(n||Cr(_)!==k.contentSha256)&&o.push({path:y,content:_,baseHash:k.serverHash})}for(let y of[...g].sort()){if(m.has(y))continue;let k=(0,co.readFileSync)((0,ta.join)(r,y),"utf8"),v=h.get(Cr(k));if(v!==void 0){s.push({oldPath:v,newPath:y});continue}let _=dM(y,t);if(_.kind==="unmappable"){a.push(y);continue}let{wirePath:E}=_,S=f.get(E);if(S!==void 0&&S!==y){l.push(y);continue}p[E]=y;let L=e.files[E];o.push(L?{path:E,content:k,baseHash:L.serverHash}:{path:E,content:k})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:p}}function dM(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let n=Ew(e,t.componentsRoot);if(!n)return{kind:"unmappable"};let o=vw(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:Dw(n,o)}}let r=Dp(e,t.themeRoot);return r!==void 0?{kind:"theme",wirePath:r}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function fI(e){let t=[];for(let r=0;r<e.length;r+=20)t.push(e.slice(r,r+20));return t}function mI(e){let t=e.filter(a=>!ql(a.path)),r=new Map;for(let a of e){let l=ql(a.path);if(!l)continue;let c=r.get(l)??[];c.push(a),r.set(l,c)}let n=r.size>0?199:200;if(t.length>n)throw new d(`Too many changed site-global files to push in one request (${t.length} > ${n}). Run \`webflow sites push\` without --force to send only the files that changed, then use --force just for the ones that still conflict.`,{isUserError:!0});let o=[],i=[...t],s=0;for(let[,a]of r)!(s<20&&i.length+a.length<=200)&&(i.length>0||s>0)&&(o.push(i),i=[],s=0),i.push(...a),s+=1;return i.length>0&&o.push(i),o}function Ep(e,t=process.cwd()){let r=(0,ta.join)(t,e);if((0,co.existsSync)(r))return(0,co.readFileSync)(r,"utf8")}var gI=require("@babel/parser");function hI(e){try{return(0,gI.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function yI(e,t){if(t.length===0)return e;let r=e;for(let{start:n,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))r=r.slice(0,n)+i+r.slice(o);return r}var pM="site/current-page.tsw";function vp(e){return ql(e)!==void 0?pM:e}function fM(e,t){let r=e.split("/").slice(0,-1);for(let n of t.split("/"))if(!(n===""||n===".")){if(n===".."){r.length>0&&r.pop();continue}r.push(n)}return r.join("/")}function mM(e,t){let r=e.split("/").slice(0,-1),n=t.split("/"),o=0;for(;o<r.length&&o<n.length-1&&r[o]===n[o];)o++;let i=r.length-o,s=n.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function Sp(e,t,r,n){let o=hI(e);if(!o)return e;let i=[];for(let s of o.program.body){if(s.type!=="ImportDeclaration")continue;let a=s.source;if(a.start==null||a.end==null)continue;let l=a.value;if(!l.endsWith(".tsw")||!l.startsWith("./")&&!l.startsWith("../"))continue;let c=n(fM(t,l));if(c===void 0)continue;let p=mM(r,c);if(p===l)continue;let f=e[a.start],m=f==="'"||f==='"'?`${f}${p}${f}`:JSON.stringify(p);i.push({start:a.start,end:a.end,text:m})}return yI(e,i)}function gM(e,t){return r=>t[r]??e.files[r]?.localPath??r}function hM(e,t){let r=e.outcome==="committed"||e.outcome==="noop"?$:D,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${r} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(P(` ${t(a)} changed upstream \u2014 run \`webflow sites pull\`, re-apply your edit, and push again (or push with --force to overwrite).`));e.outcome==="skipped"&&s.push(P(" an earlier change carrying site-global files failed to commit in this push, so this page was never attempted \u2014 resolve the issue above and push again.")),e.error&&s.push(P(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${Z} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
292
+ `)}function yM(e,t,r,n){let o=new Map;for(let[i,s]of Object.entries(t.files))o.set(s.localPath??i,i);for(let i of e)o.set(r[i.path]??i.path,i.path);return e.map(i=>{let s=r[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=Sp(i.content,s,vp(i.path),l=>o.get(l)??Dp(l,n.themeRoot)??lI(l,n.componentsRoot));return{...i,content:a}})}function wM(e,t){return e.map(r=>{if(!r.path.startsWith("site/components/")||!r.path.endsWith(".tsw")||r.content===void 0)return r;let n=t.files[r.path]?.componentId;if(n)return{...r,componentId:n};if(r.baseHash===void 0)return{...r,create:!0};throw new d(`Tracked component ${r.path} has no component id in sync state. Run \`webflow sites pull\` before pushing it.`,{isUserError:!0})})}function bM(e,t,r,n){return wM(yM(e,t,r,n),t)}async function kM(e,t,r,n,o){let i=[],s=!1,a=!1;for(let[l,c]of r.entries()){let p;try{p=await YF(e,t,c,{conflictPolicy:n,schemaHash:o})}catch(m){return s&&u.warn(`${Z} The push failed after ${l} of ${r.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),{results:i,schemaHash:o,aborted:!0,failed:!0,failure:m}}o=p.schemaHash,i.push(...p.results);let f=p.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(p.results.some(m=>m.outcome==="committed")&&(s=!0),f&&l<r.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function DM(e){let t=[];for(let r of e)if(r.outcome==="committed")for(let[n,o]of Object.entries(r.createdComponents??{}))t.push({path:n,componentId:o,hash:r.hashes?.[n]});return t}function EM(e,t,r,n,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,p]of Object.entries(l.hashes??{})){let f=n.get(c);if(!f||f.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:Cr(f.content),...m?{localPath:m}:{}}}let a=DM(i);for(let{path:l,componentId:c,hash:p}of a){let f=n.get(l)?.content;if(f===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:Cr(f),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{...e,siteId:e.siteId??t,schemaHash:r,files:s},created:a}}function vM(e,t){for(let{path:r,componentId:n}of e)u.info(`${$} Created component ${t(r)} (id ${n})`),u.info(P(" id tracked locally \u2014 it will be sent as metadata on future pushes without changing this file"))}function SM({missing:e,renameCandidates:t,unmappable:r,stale:n,orphanedUpstream:o},i){for(let s of e)u.warn(`${Z} ${s} is tracked but missing on disk \u2014 deletions are not supported by the WFS Sync API; the file is skipped. Restore it with \`webflow sites pull\`.`);for(let{oldPath:s,newPath:a}of t){let l=s.startsWith(`${i.pagesRoot}/`),c=l?`Webflow doesn't support renaming a page's file directly: restore ${s}, then rename or move the page in the Designer instead, push, then \`webflow sites pull\` to get the file moved automatically.`:`Webflow doesn't support renaming a component's file directly: restore ${s}, edit its \`name:\` meta in place instead, push, then \`webflow sites pull\` to get the file moved automatically.`;u.warn(`${Z} ${a} looks like ${s} renamed locally \u2014 skipped, since its content is byte-for-byte unchanged. ${c} (If you also edited the content before this push, this warning won't catch it \u2014 rename first, push, THEN make content edits, or the push may create a duplicate ${l?"page":"component"} instead of updating the original.)`)}for(let s of o)u.warn(`${Z} ${s} was deleted or renamed in the Designer, but still has local edits \u2014 skipped. Pushing it would re-create it. Merge anything you need elsewhere, then delete it.`);for(let s of n)u.warn(`${Z} ${s} is a leftover copy of a file that now lives elsewhere \u2014 skipped. Pushing it would overwrite the current version with this stale content. Delete it, or merge anything you still need into the tracked file first.`);for(let s of r){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${Z} ${s} doesn't match a tracked page \u2014 creating a page via push isn't supported yet. Create it in the Designer, then \`webflow sites pull\`.`:`${Z} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function xM(e){let t=bp();if(t.kind==="missing")throw new d("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new d(`This project's sync state is unreadable (${t.reason}), so push can't tell which files are tracked. Run \`webflow sites pull\` to rebuild it (add --reset to discard it first).`,{isUserError:!0});if(t.corruptPaths.length>0)throw new d(`${t.corruptPaths.length} tracked file(s) have unreadable sync state (${t.corruptPaths.slice(0,3).join(", ")}${t.corruptPaths.length>3?", \u2026":""}). Pushing now would re-create them as new objects instead of updating them. Run \`webflow sites pull\` to rebuild the state first.`,{isUserError:!0});let r=t.lockfile;if(r.siteId!==void 0&&r.siteId!==e)throw new d(`This project's sync state was pulled from site ${r.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return r}function CM(e,t,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(n=>({path:n.path,localPath:r[n.path]??n.path,isNew:n.baseHash===void 0}))},null,2)}function _M(e,t,r){u.info(`Would push ${e.length} file(s) to site ${r}:`);for(let n of e){let o=t[n.path]??n.path,i=n.create?P(" (new component)"):n.baseHash?"":P(" (new)");u.info(` ${o}${i}`)}u.info("Dry run \u2014 no changes made.")}async function xp(e={}){let t=ea(),r=xM(t.siteId),n=await pI(r,t.layout,void 0,e.force),{changes:o,localPaths:i}=n;if(SM(n,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:r.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await R({apiToken:e.apiToken}),a=A.forSites({authToken:s}),l=Date.now(),c=gM(r,i);try{let p=bM(o,r,i,t.layout);if(e.dryRun){e.json?u.info(CM(t.siteId,o,i)):_M(p,i,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let f=mI(p),{results:m,schemaHash:g,aborted:h,failed:y,failure:k}=await kM(s,t.siteId,f,e.force?"rebase":void 0,r.schemaHash),v=new Map(o.map(re=>[re.path,re])),{lockfile:_,created:E}=EM(r,t.siteId,g,v,i,m);if(m.some(re=>re.outcome==="committed")&&kp(_),y)throw k;let S=m.filter(re=>re.outcome==="conflict"),L=m.filter(re=>re.outcome==="error"),U=m.filter(re=>re.outcome==="skipped"),j=m.flatMap(re=>re.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:g,results:m},null,2));else{vM(E,c);for(let ue of m)u.info(hM(ue,c));let re=m.filter(ue=>ue.outcome==="committed").length,G=E.length>0?` Created ${E.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length} file(s) across ${m.length} page group(s): ${re} committed, ${S.length} conflicted, ${L.length} failed, ${U.length} skipped.${G}`),h&&u.warn(`${Z} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(S.length>0||L.length>0||U.length>0||j.length>0)throw new d(`${Z} Push finished with ${S.length} conflict(s), ${L.length} error(s), ${U.length} skipped page(s), ${j.length} rejected file(s). Resolve the issues above and try again.`,{isUserError:!0,skipLogging:!!e.json});await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,createdComponents:E.length,dryRun:!1})}catch(p){throw await a.sendError(p instanceof Error?p:new Error(String(p)),"site_push",{duration:Date.now()-l}),p instanceof d?p:new d(p,{prefix:`${D} Failed to push site files:`})}}var Si=require("fs"),wI=require("module"),vi=require("path");z();ge();C();F();N();X();function AM(e,t,r,n){let o=r.get(e.path);if(o)return aI(o,t);let i=cI(e.path,t);if(i)return i;let s=n?.files[e.path]?.localPath;return Sw(e.path,t,s)??e.path}function FM(e,t,r){if(!Array.isArray(e)||e.length===0)return;let n=(0,wI.createRequire)((0,vi.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(n.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${r} without it.`)}}return o}async function IM(e,t){try{let{format:r,resolveConfig:n}=await import("prettier"),o=await n(t,{editorconfig:!0}),i=FM(o?.plugins,process.cwd(),t);return await r(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(r){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${r instanceof Error?r.message:String(r)}`),e}}function RM(e,t){if(t){oI();return}let r=bp();if(r.kind==="missing")return;if(r.kind==="corrupt")throw new d(`This project's sync state is unreadable (${r.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${lo}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(r.corruptPaths.length>0)throw new d(`${r.corruptPaths.length} tracked file(s) have unreadable sync state (${r.corruptPaths.slice(0,3).join(", ")}${r.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${lo}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let n=r.lockfile;if(n?.siteId!==void 0&&n.siteId!==e&&Object.keys(n.files).length>0)throw new d(`This project's sync state was pulled from site ${n.siteId}, but this pull targets ${e}. Pulling a second site into the same project would leave \`webflow sites push\` (which always targets the site in webflow.json) applying it to the wrong one. Re-run with --reset to discard the existing state and pull ${e} from scratch.`,{isUserError:!0});return n}async function Cp(e={}){let t=ea(e.siteId),r=RM(t.siteId,!!e.reset),n=await R({apiToken:e.apiToken}),o=A.forSites({authToken:n}),i=Date.now();try{let s=await yw(n,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new d("This site is served as a WFDL projection, which `webflow sites pull` doesn't support \u2014 it reads and writes `.tsw` modules. No files were written.",{isUserError:!0});let a=s.pages.map(I=>I.pageId);if(a.length===0){await o.sendUsage("site_pull",{duration:Date.now()-i,count:0}),u.info(e.json?JSON.stringify({schemaHash:s.schemaHash,pages:[],files:[]},null,2):"The site has no static pages to pull.");return}let l=new Map,c=s.schemaHash,p={},f=[];for(let I of fI(a)){let Y=await yw(n,t.siteId,{pageIds:I});c=Y.schemaHash,p=Y.componentIds??p,Y.warnings&&f.push(...Y.warnings);for(let H of Y.files)l.set(H.path,H)}let m=[...l.values()].sort((I,Y)=>I.path.localeCompare(Y.path)),g=new Map(s.pages.map(I=>[I.path,I])),h=new Map;for(let I of m){let Y=r?.files[I.path];if(!Y)continue;let H=Y.localPath??I.path,we=Ep(H),qr=we!==void 0&&Cr(we)!==Y.contentSha256,Yr=I.hash!==Y.serverHash;qr&&Yr&&h.set(I.path,H)}let y=!e.force,k=[...h.values()],v=process.cwd(),_=new Map(m.map(I=>[I.path,AM(I,t.layout,g,r)])),E=new Map;for(let[I,Y]of _)E.set(Y,[...E.get(Y)??[],I]);let S=[...E.entries()].filter(([,I])=>I.length>1);if(S.length>0){let I=S.map(([Y,H])=>`${Y} \u2190 ${H.join(", ")}`).join("; ");throw new d(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${I}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let L={siteId:t.siteId,identityMode:"clean",schemaHash:c,files:{}},U=new Set(_.values()),j=[],re=[],G=[],ue=[];for(let I of m){let Y=r?.files[I.path];if(y&&h.has(I.path)){Y&&(L.files[I.path]=Y);continue}let H=_.get(I.path);iI(H);let we=(0,vi.join)(v,H);(0,Si.mkdirSync)((0,vi.dirname)(we),{recursive:!0});let qr=H.endsWith(".tsw")?Sp(I.content,vp(I.path),H,xi=>_.get(xi)??Sw(xi,t.layout,r?.files[xi]?.localPath)):I.content,Yr=H.endsWith(".tsw")?await IM(qr,we):qr;(0,Si.writeFileSync)(we,Yr,"utf8"),j.push(I);let uo=Y?Y.localPath??I.path:void 0;if(Y&&uo&&uo!==H&&!U.has(uo)){let xi=Ep(uo);xi===void 0||(Cr(xi)===Y.contentSha256?((0,Si.rmSync)((0,vi.join)(v,uo),{force:!0}),re.push({from:uo,to:H})):G.push({from:uo,to:H}))}let Iw=p[I.path],Yl=g.get(I.path);L.files[I.path]={serverHash:I.hash,contentSha256:Cr(Yr),localPath:H,...Iw?{componentId:Iw}:{},...Yl?{slug:Yl.slug,isDefault:Yl.isDefault,folderSegments:Yl.folderSegments}:{}}}let Ue=new Set(m.map(I=>I.path));for(let[I,Y]of Object.entries(r?.files??{})){if(Ue.has(I))continue;let H=Y.localPath??I;if(U.has(H))continue;let we=Ep(H);we!==void 0&&(Cr(we)===Y.contentSha256?((0,Si.rmSync)((0,vi.join)(v,H),{force:!0}),ue.push(H)):(G.push({from:H,to:"(no longer on the site)"}),L.files[I]={...Y,deletedUpstream:!0}))}if(kp(L),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:I,slug:Y,title:H,path:we,folderSegments:qr})=>({pageId:I,slug:Y,title:H,path:we,folderSegments:qr})),files:j.map(I=>({path:I.path,hash:I.hash,size:I.size,localPath:L.files[I.path]?.localPath})),...y&&k.length>0?{skipped:k}:{},...ue.length>0?{removed:ue}:{},...re.length>0?{relocated:re}:{},...G.length>0?{orphaned:G}:{}},null,2));else{for(let I of j){let Y=g.get(I.path),H=L.files[I.path]?.localPath??I.path,we=Y?P(` (page, slug: "${Y.slug}")`):"";u.info(`${$} ${H}${we}`)}u.info(`Pulled ${j.length} file(s) across ${a.length} page(s).`);for(let I of ue)u.info(P(` removed ${I} (no longer on the site)`));for(let{from:I,to:Y}of re)u.info(P(` moved ${I} \u2192 ${Y}`))}for(let I of k)u.warn(y?`${Z} ${I} changed both locally and in the Designer since the last sync \u2014 left as-is, so your local edit is intact. Commit or move it, then pull again (or pull with --force to take the Designer's version).`:`${Z} ${I} changed both locally and in the Designer since the last sync \u2014 the local edit was overwritten by --force; recover it from git if needed.`);for(let{from:I,to:Y}of G)u.warn(`${Z} ${I} is now at ${Y}, but the old file has local edits so it was left in place. \`sites push\` will skip it \u2014 merge anything you still need into ${Y} and delete ${I}, since while it's there the two copies disagree.`);for(let{path:I,reason:Y}of f){let H=L.files[I]?.localPath??I;u.warn(`${Z} ${H}: ${Y}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:j.length,skipped:y?k.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof d?s:new d(s,{prefix:`${D} Failed to pull site files:`})}}en();var bI=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(ee()).addOption(Ke(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(fw),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(ee()).action(mw),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(ee()).action(gw),t.command("publish").description("Publish a Webflow site (defaults to Webflow subdomain)").requiredOption("--site <siteId>","Site ID to publish").option("--domains <domains>","Comma-separated custom domain IDs to publish to").option("--page <pageId>","Publish a single page instead of the whole site").addOption(_e()).addOption(ee()).action(hw),Ve()&&(t.command("init").description("Bind this project to an existing Webflow site or create a new one, saving its ID as `siteId` in webflow.json.").addOption(pn()).option("--site-id <siteId>","Skip the interactive picker and bind to this site ID (CI/scripted setup).").option("--create","Create a new Webflow site instead of binding.").option("--name <name>","Name for the new site (implies --create; skips the prompt).").action(yp),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(pn()).addOption(_e()).addOption(ee()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(xp),t.command("pull").description("Pull your Webflow Site's source files. Files edited both locally and in the Designer are left alone unless --force.").addOption(pn()).addOption(ee()).option("--site-id <siteId>","Pull from this site only, bypassing (and not modifying) the siteId in webflow.json. Needs --reset when the project is already synced with another site.").option("--force","Overwrite local files that changed both here and in the Designer since the last sync.").option("--reset","Discard the existing local sync state and pull from scratch.").action(Cp))};z();C();F();N();X();De();async function kI(e,t){return Q(t,"siteId"),Vl(`${O()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function DI(e,t,r){return Q(t,"siteId"),Q(r,"formId"),Vl(`${O()}/v2/sites/${t}/forms/${r}/submissions`,e,"formSubmissions","Failed to list submissions")}C();ge();var Cw=["id","displayName","name","slug","createdOn","lastUpdated"],EI=ft(Cw);function vI(){return Cw}function SI(e,t=["id","displayName","slug"]){if(e.length===0)return P("No forms found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${Cw.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="createdOn"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:P("\u2014")}));return Ze(r,n)}function xI(e){if(e.length===0)return P("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),r=["id","dateSubmitted",...t].map(o=>se(o)),n=e.map(o=>[o.id,new Date(o.dateSubmitted).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),...t.map(i=>{let s=o.formResponse[i];return s==null?P("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return Ze(r,n)}function CI(e){if(e.length===0)return"";let r=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],n=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
218
293
  `)?`"${s.replace(/"/g,'""')}"`:s};return[r.join(","),...e.map(i=>r.map(s=>n(s==="id"?i.id:s==="formId"?i.formId:s==="displayName"?i.displayName:s==="dateSubmitted"?i.dateSubmitted:i.formResponse[s])).join(","))].join(`
219
- `)}async function Hh(e){Q(e.site,"siteId");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await XC(t,e.site);if(await r.sendUsage("forms_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No forms found.");return}let i=Fe(e.fields,QC,eF());u.info(tF(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list forms:`}))}}var oF=w(require("fs"));Y();C();R();j();Z();async function Vh(e){Q(e.site,"siteId"),Q(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await ZC(t,e.site,e.form);if(await r.sendUsage("forms_submissions",{duration:Date.now()-n,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=nF(o);oF.default.writeFileSync(e.output,i,"utf8"),u.info(`${$} ${o.length} submission${o.length===1?"":"s"} written to ${e.output}`);return}if(e.json){u.info(JSON.stringify(o,null,2));return}u.info(rF(o))}catch(o){throw await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to fetch submissions:`})}}var iF=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Rt()).addOption(re()).addOption(We(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(Hh),t.command("submissions").description("List or export form submissions").requiredOption("--site <siteId>","Site ID").requiredOption("--form <formId>","Form ID").option("--json","Output as JSON").option("--output <file>","Save submissions as CSV to a file").action(Vh)};var ay=w(require("fs")),ly=w(require("path"));R();var zo=w(require("fs")),Jo=w(require("path")),wd=w(require("tar"));C();R();var Gh=w(require("fs")),Yn=w(require("path"));C();var sF={impl:Yn.default.posix,caseInsensitive:!1},Kh={impl:Yn.default.win32,caseInsensitive:!0};function Ko(){let e=process.platform;return e==="win32"?Kh:{impl:Yn.default.posix,caseInsensitive:e==="darwin"}}function hd(e,t){let r=t.impl.resolve(e);return t.caseInsensitive?r.toLowerCase():r}function Xn(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function ot(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let n=hd(e,r),o=hd(t,r);if(n===o)return!0;let i=r.impl.relative(n,o);return i===""?!0:r.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function yd(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let[n,o]=await Promise.all([yr(e),yr(t)]);return ot(n,o,r)}function Me(e,t,r,n=Ko()){if(!ot(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside.
220
- expected inside: ${b(e)}
221
- resolved to: ${b(t)}
222
- Please report this.`)}async function vs(e,t,r,n=Ko()){if(!await yd(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside once symlinks are followed.
223
- expected inside: ${b(e)}
224
- resolved to: ${b(t)}
225
- Please report this.`)}function lL(e,t,r=Ko()){return ot(e,t,r)||ot(t,e,r)}async function Jh(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let[n,o]=await Promise.all([yr(e),yr(t)]);return lL(n,o,r)}function Ye(e,t,r=Ko()){return typeof e!="string"||typeof t!="string"||Xn(e)||Xn(t)?!1:hd(e,r)===hd(t,r)}async function yr(e){let t=Yn.default.resolve(e);try{return await Gh.default.promises.realpath(t)}catch{}try{let r=await Gh.default.promises.realpath(Yn.default.dirname(t));return Yn.default.join(r,Yn.default.basename(t))}catch{return t}}var cL=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function Ss(e){if(!e)return"empty entry path";if(e.includes("\0"))return"NUL byte in entry path";if(/[\x01-\x1f\x7f]/.test(e))return"control character in entry path";if(e.startsWith("/")||e.startsWith("\\"))return"absolute entry path";if(/^[A-Za-z]:/.test(e))return"Windows drive-relative entry path";if(e.includes("\\"))return"backslash in entry path";for(let t of e.split("/")){if(t===""||t==="."){if(t===".")return'traversal segment "." in entry path';continue}if(t==="..")return'traversal segment ".." in entry path';if(/[. ]$/.test(t))return"entry path segment ends with a dot or space";if(cL.test(t))return"Windows reserved device name in entry path"}return null}var Yh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),uL=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),dL=32,pL=512,zh=10,cF=100,aF=100;function uF(){return{retained:[],fatal:[],fatalCount:0,count:0}}function dF(e,t,r){e.count+=1;let n={code:t,message:al(r)};e.retained.length<aF&&e.retained.push(n),uL.has(t)&&(e.fatalCount+=1,e.fatal.length<aF&&e.fatal.push(n))}async function pF(e,t,r){let n=await fL(r.containmentRoot),o=await mL(n,t),i=await lF(e),s=await hL(e,r),a=await wL(e,o,r);if(a.warnings.fatal.length>0)throw wF(a.warnings.fatal,a.warnings.fatalCount);for(let c of a.warnings.retained)u.debug(`tar warning ${c.code}: ${c.message}`);if(a.refused.length>0)throw DL(a.refused,a.refusedCount);let l=await lF(e);if(i!==l)throw new d("Refusing to continue: the downloaded archive changed while it was being read, so what was validated is not what was extracted. Nothing about the extracted directory can be trusted. Please retry.");return await bL(n,o),{skipped:s.skipped,fileCount:a.fileCount,unpackedBytes:a.unpackedBytes,warnings:[...s.warnings.retained,...a.warnings.retained],warningCount:s.warnings.count+a.warnings.count}}async function lF(e){try{let t=await zo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new d(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function fL(e){try{return await zo.default.promises.realpath(Jo.default.resolve(e))}catch(t){throw new d(`Refusing to extract: the directory the extraction must stay inside ("${b(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function mL(e,t){let r=Jo.default.resolve(t);Me(e,r,"the extraction directory");let o=Jo.default.relative(e,r).split(Jo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Jo.default.join(i,s);let a=await gL(i);if(a===null){await zo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new d(`Refusing to extract: "${b(i)}" is a symbolic link, and extracting into it would write the archive somewhere other than where it was checked. Remove or replace it with a real directory and retry.`);if(!a.isDirectory())throw new d(`Refusing to extract: "${b(i)}" exists and is not a directory.`)}return r}async function gL(e){try{return await zo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new d(`Could not inspect "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function hL(e,t){let r=fF(t.limits),n=hF(t.consumedSubtrees),o=[],i=[],s=uF(),a=0,l=0,c=0,p=!1,f=!1,m=(g,h)=>{c+=1,o.length<cF&&o.push({entryPath:g,reason:h})};try{await wd.list({file:e,onReadEntry:g=>{let h=g.path,y=g.type;if(mF(y)||(a+=1,a>r.maxFiles&&!p&&(p=!0,m(h,`archive has more than ${r.maxFiles} files`))),!Yh.has(y)){let F=`unsupported entry type ${y}`;n(h)?m(h,F):p||i.push({entryPath:h,reason:F});return}let k=Ss(h)??gF(h,r);if(k){m(h,k);return}let v=g.size;v>r.maxEntryBytes&&m(h,`entry is ${xs(v)}, over the ${xs(r.maxEntryBytes)} per-file cap`),l+=v,l>r.maxUnpackedBytes&&!f&&(f=!0,m(h,`unpacked total passes the ${xs(r.maxUnpackedBytes)} cap`))},onwarn:(g,h)=>{dF(s,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not read the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}if(o.length>0)throw kL(o,c);if(s.fatal.length>0)throw wF(s.fatal,s.fatalCount);for(let g of i)u.debug(`Skipped archive entry "${b(g.entryPath)}": ${g.reason}`);return{skipped:i,warnings:s}}function yL(e,t,r,n){if(!Yh.has(t))return`unsupported entry type ${t}`;let o=Ss(e)??gF(e,n);return o||(r>n.maxEntryBytes?`entry is ${xs(r)}, over the ${xs(n.maxEntryBytes)} per-file cap`:null)}async function wL(e,t,r){let n=fF(r.limits),o=hF(r.consumedSubtrees),i=uF(),s=[],a=0,l=0,c=0,p=(g,h)=>(a+=1,s.length<cF&&s.push({entryPath:g,reason:h}),!1),f=()=>!1,m=(g,h)=>{let y="type"in h?h.type:h.isDirectory()?"Directory":"File",k=h.size;if(!Yh.has(y)&&!o(g))return f();let v=yL(g,y,k,n);if(v)return p(g,v);if(c+k>n.maxUnpackedBytes)return p(g,`unpacked total passes the ${xs(n.maxUnpackedBytes)} cap`);if(!mF(y)){if(l+1>n.maxFiles)return p(g,`archive has more than ${n.maxFiles} files`);l+=1}return c+=k,!0};try{await wd.extract({file:e,cwd:t,strip:r.strip??0,preservePaths:!1,filter:m,onwarn:(g,h)=>{dF(i,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not extract the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function bL(e,t){Me(e,await zo.default.promises.realpath(t),"the extracted directory");let r=[t];for(;r.length>0;){let n=r.pop(),o=await zo.default.promises.readdir(n,{withFileTypes:!0});for(let i of o){let s=Jo.default.join(n,i.name);if(!i.isFile()&&!i.isDirectory())throw new d(`Refusing to continue: extraction produced a non-regular entry at "${b(s)}". Please report this.`);Me(e,s,"an extracted archive entry"),i.isDirectory()&&r.push(s)}}}function fF(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??dL,maxPathLength:e.maxPathLength??pL}}function mF(e){return e==="Directory"||e==="GNUDumpDir"}function qh(e){return e.replace(/\/+$/,"")}function gF(e,t){let r=qh(e);if(r.length>t.maxPathLength)return`entry path is ${r.length} characters, over the ${t.maxPathLength}-character limit`;let n=r.split("/").filter(o=>o!=="").length;return n>t.maxPathDepth?`entry path is ${n} levels deep, over the ${t.maxPathDepth}-level limit`:null}function hF(e){let t=e.map(qh);return r=>{let n=qh(r).split("/").slice(1).join("/");return t.some(o=>n===o||n.startsWith(`${o}/`))}}function xs(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],r=e/1024,n=t[0];for(let o=1;o<t.length&&r>=1024;o+=1)r/=1024,n=t[o];return`${parseFloat(r.toFixed(1))} ${n}`}function kL(e,t){return new d(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
226
- ${yF(e,t).join(`
227
- `)}
228
- Nothing was extracted. Please report this.`)}function DL(e,t){return new d(`Refusing to continue: the downloaded archive changed while it was being read. ${t} ${t===1?"entry":"entries"} that passed validation would not have passed it on the second read.
229
- ${yF(e,t).join(`
230
- `)}
231
- The extracted directory cannot be trusted. Please retry.`)}function yF(e,t){let r=e.slice(0,zh),n=r.map(i=>` - "${b(i.entryPath)}": ${i.reason}`),o=t-r.length;return o>0&&n.push(` \u2026 and ${o} more.`),n}function wF(e,t){let r=e.slice(0,zh).map(o=>` - ${o.code}: ${o.message}`),n=t-Math.min(e.length,zh);return n>0&&r.push(` \u2026 and ${n} more.`),new d(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
232
- ${r.join(`
233
- `)}
234
- This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var EL="webflow",Xh="webflow-skills",ye=`${EL}/${Xh}`,Ve="main",bd=`plugins/${Xh}`,mn=`${bd}/.claude-plugin/plugin.json`,Zh=[`${bd}/skills`,"skills"],bF=[`${bd}/skills`,`${bd}/.claude-plugin`];function kF(e){return`${Xh}-${e}`}var tr=/^[0-9a-f]{40}$/,kd=/^[A-Za-z0-9._/-]{1,255}$/,vL=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function DF(e){let t=e.split(":",1)[0];return vL.includes(t)}var Ot="https://api.github.com",qo="https://codeload.github.com";var EF="skills",Dd="download-",Ed="extract-";var hn=w(require("fs")),xd=w(require("path"));oa();C();R();C();function SF(e){let t=r=>Math.round(r*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function wr(e){try{return new URL(e).hostname}catch{return e}}function SL(e){return new d(`Could not find ref "${b(e)}" in ${ye}.
235
- \u2022 The default branch is "${Ve}".
236
- \u2022 This repo has no tags or releases yet, so "--ref v1.0.7" will not resolve.
237
- \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function xL(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let r=new Date(t*1e3);if(Number.isNaN(r.getTime()))return"a few minutes";let n=String(r.getHours()).padStart(2,"0"),o=String(r.getMinutes()).padStart(2,"0");return`${n}:${o} local time`}function CL(e){return new d(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
238
- \u2022 Retry after ${xL(e)}.
239
- \u2022 Or set GITHUB_TOKEN / GH_TOKEN in your environment to raise the limit to 5,000/hour.
240
- \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function FL(){return new d(`GitHub refused the request (403). This is a permission error, not a rate limit.
241
- \u2022 If you are behind a proxy that filters ${wr(Ot)}, set HTTPS_PROXY.
242
- \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function _L(e,t){return new d(`${wr(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function AL(e,t,r){return new d(`${wr(e)} returned an unexpected ${t} ${b(r)} response. Please report this if it persists.`)}function Cs(e,t,r){let{status:n}=t;if(n===404)return SL(r??Ve);let o=t.headers.get("x-ratelimit-remaining");return n===429||n===403&&o==="0"?CL(t.headers.get("x-ratelimit-reset")):n===403?FL():n>=500?_L(e,n):AL(e,n,t.statusText)}function xF(e){let t=e?wr(e):"an unnamed host";return new d(`Refusing to follow a redirect to ${b(t)} while a GitHub token is attached, because the token would be re-sent to that host. Unset GITHUB_TOKEN / GH_TOKEN to retry unauthenticated, or report this if ${wr(Ot)} is genuinely redirecting.`,{isUserError:!0})}function vF(e,t){return new d(`Could not reach ${wr(e)}${t?` (${t})`:""}.
243
- \u2022 Check your network connection.
244
- \u2022 Behind a corporate proxy, set HTTPS_PROXY. Note that the CLI's HTTP client does not read proxy environment variables automatically.
245
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function vd(e,t){return new d(`Timed out after ${Math.round(t/1e3)}s waiting for ${wr(e)}.
246
- \u2022 Check your network connection, then retry.
247
- \u2022 Behind a corporate proxy, set HTTPS_PROXY.
248
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Sd(){return new d(`The skills catalog download exceeded ${SF(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function CF(e){return new d(`Commit ${b(e)} of ${ye} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
249
- \u2022 Retry without --ref to take the current "${Ve}".`,{isUserError:!0})}function FF(){return new d("The skills catalog download returned no response body. Please retry.")}function fl(e){return new d(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function _F(){return new d(`${wr(Ot)} answered the ref lookup with something that is not a 40-character commit SHA. Refusing to guess at what to install. Please report this if it persists.`)}function AF(){return new d(`${wr(Ot)} answered the ref lookup with more than ${SF(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
250
- \u2022 If a proxy is intercepting ${wr(Ot)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function Fs(e){return new d(`Expected a full 40-character commit SHA but got "${b(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function gn(e,t){return new d(`Invalid --ref "${b(e)}": ${t}.
251
- \u2022 Pass a branch name (e.g. "${Ve}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function RF(e,t){let r=t.length===0?"nothing":t.map(n=>`"${b(n)}"`).join(", ");return new d(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${r}. Please report this.`)}var RL=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function IL(e){if(typeof e!="object"||e===null)return;let t=e;if(typeof t.code=="string")return t.code;if(typeof t.errno=="string")return t.errno}function gl(e,t,r){if(r instanceof d)return r;let n=IL(r);if(n==="ENOSPC"||n==="EDQUOT"||n==="EFBIG")return fl("writing the skills catalog");if(n&&RL.has(n))return vF(e,n);let o=r?.type;if(o==="request-timeout")return vd(e,t);if(o==="max-size")return Sd();let i=r instanceof Error?r.message:String(r);return/network timeout|timed? ?out/i.test(i)?vd(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?vF(e,""):new d(`Could not fetch the skills catalog from ${wr(e)}: ${b(i)}`)}function _s(){return xd.default.join(Rb(),EF)}function ey(e){if(!tr.test(e))throw Fs(e);return xd.default.join(_s(),e)}async function hl(){let e=_s();try{return await hn.default.promises.mkdir(e,{recursive:!0,mode:448}),await hn.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?fl("creating the skills cache directory"):new d(`Could not create the skills cache directory "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function ty(e){let t=ey(e),r;try{r=await hn.default.promises.lstat(t)}catch(n){return n.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${n instanceof Error?n.message:String(n)}`),null}if(r.isSymbolicLink())throw new d(`Refusing to use the skills cache: "${b(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return r.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var PL=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function $L(e){try{return(await hn.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function ry(e,t){let r=ey(e),n=_s();await vs(n,r,"the skills cache entry"),await vs(n,t,"the extracted skills catalog being published");try{return await hn.default.promises.rename(t,r),{dir:r,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw fl("publishing the skills catalog to the cache");if(i!==void 0&&PL.has(i)&&await $L(r))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:r,published:!1};throw new d(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Yo(e){await vs(_s(),e,"the skills cache path being removed");try{await hn.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}function OL(e){return tr.test(e)||e.startsWith(Dd)||e.startsWith(Ed)}async function Cd(e){let t=_s(),r;try{r=await hn.default.promises.readdir(t,{withFileTypes:!0})}catch(o){o.code!=="ENOENT"&&u.debug(`Skills cache sweep skipped: ${o instanceof Error?o.message:String(o)}`);return}let n=Date.now()-6048e5;for(let o of r){if(o.name===e||!OL(o.name))continue;let i=xd.default.join(t,o.name);try{if((await hn.default.promises.lstat(i)).mtimeMs>=n)continue;await Yo(i),u.debug(`Swept stale skills cache entry "${o.name}".`)}catch(s){u.debug(`Skills cache sweep could not handle "${o.name}": ${s instanceof Error?s.message:String(s)}`)}}}var iy=w(require("fs")),ny=w(require("path")),PF=require("stream"),$F=require("stream/promises");lt();R();var LL="catalog.tar.gz",yl=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},Fd=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},oy=class extends PF.Transform{constructor(r){super();this.cap=r}bytes=0;_transform(r,n,o){let i=Buffer.isBuffer(r)?r:Buffer.from(r);if(this.bytes+=i.length,this.bytes>this.cap){o(new Fd);return}o(null,i)}};async function sy(e){if(!tr.test(e))throw Fs(e);let t=await hl(),r=await iy.default.promises.mkdtemp(ny.default.join(t,Dd)),n=ny.default.join(r,LL),o=`${qo}/${ye}/tar.gz/${e}`;try{let i=await NL(o,e),s=await jL(i,n);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:n,downloadDir:r,bytes:s}}catch(i){throw await Yo(r),gl(qo,6e4,i)}}async function NL(e,t){let r=0;for(let n=0;n<2;n+=1){let o=await K(e,{headers:{Accept:"application/x-gzip"},timeout:6e4});if(o.ok){let i=Number(o.headers.get("content-length"));if(Number.isFinite(i)&&i>33554432)throw Sd();return o}if(o.status>=500&&n===0){r=o.status,u.debug(`codeload.github.com returned ${o.status}; retrying once in ${1e3}ms.`),await new Promise(i=>{setTimeout(i,1e3)});continue}throw o.status===404?CF(t):Cs(qo,o)}throw Cs(qo,{status:r||500,statusText:"Server Error",headers:{get:()=>null}})}async function jL(e,t){let r=e.body;if(!r)throw FF();let n=new oy(33554432),o=setTimeout(()=>{r.destroy?.(new yl),n.destroy(new yl)},6e4);o.unref?.();try{await(0,$F.pipeline)(r,n,iy.default.createWriteStream(t,{mode:384}))}catch(i){throw TF(i,Fd)?Sd():TF(i,yl)?vd(qo,6e4):i}finally{clearTimeout(o)}return n.bytes}function TF(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let r=e.cause;if(r instanceof t||r instanceof Error&&r.name===t.name)return!0}return!1}lt();R();var ML=["GITHUB_TOKEN","GH_TOKEN"];function BL(){for(let e of ML){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function UL(e){if(e==="")throw gn(e,"it is empty");if(!kd.test(e))throw gn(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw gn(e,"it starts with '-'");if(e.includes(".."))throw gn(e,"it contains '..'");if(e.endsWith(".lock"))throw gn(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw gn(e,"it starts or ends with '/'");if(e.includes("//"))throw gn(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw gn(e,"a path component ends with '.'")}function WL(e){return e.split("/").map(encodeURIComponent).join("/")}function HL(e){return new Promise(t=>{setTimeout(t,e)})}async function kl(e=Ve){if(tr.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};UL(e);let t=BL(),r=`${Ot}/repos/${ye}/commits/${WL(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let n=await VL(r,e,t),o=await KL(n);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function VL(e,t,r){let n=null;for(let o=0;o<2;o+=1){let i;try{i=await K(e,{headers:{Accept:"application/vnd.github.sha",...r?{Authorization:`Bearer ${r}`}:{}},timeout:1e4,...r?{redirect:"manual"}:{}})}catch(s){throw gl(Ot,1e4,s)}if(r&&i.status>=300&&i.status<400)throw xF(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(n=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await HL(1e3);continue}throw Cs(Ot,i,t)}throw Cs(Ot,{status:n??500,statusText:"Server Error",headers:{get:()=>null}},t)}var Ad=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function GL(e){let t=e.body;if(!t)return"";let r=[],n=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(n+=i.length,n>4096)throw new Ad;r.push(i)}return Buffer.concat(r).toString("utf8")}async function KL(e){let t;try{t=await GL(e)}catch(n){throw n instanceof Ad?AF():gl(Ot,1e4,n)}let r=t.trim();if(!tr.test(r))throw _F();return r}async function As(e={}){let t=await JL(e),{commit:r,ref:n}=t,o=await ty(r);if(o)return u.debug(`Using cached skills catalog for ${r}.`),await Cd(r),{ref:n,commit:r,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await zL(r);return await Cd(r),{ref:n,commit:r,...i}}async function JL(e){if(e.commit!==void 0){if(!tr.test(e.commit))throw Fs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return kl(e.ref)}async function zL(e){let t=await hl(),r=await sy(e),n=await ay.default.promises.mkdtemp(ly.default.join(t,Ed));try{let o=await pF(r.tarPath,n,{strip:0,containmentRoot:t,consumedSubtrees:bF,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await qL(n,e),{dir:s,published:a}=await ry(e,i);return u.debug(`Extracted skills catalog ${e}: ${o.fileCount} files, ${o.unpackedBytes} bytes, ${o.skipped.length} entries skipped${a?"":" (another process published first)"}.`),{root:s,fromCache:!1,skippedEntries:o.skipped,downloadedBytes:r.bytes}}finally{await Yo(n),await Yo(r.downloadDir)}}async function qL(e,t){let r=kF(t),n=await ay.default.promises.readdir(e,{withFileTypes:!0}),o=n.filter(i=>i.isDirectory());if(n.length!==1||o.length!==1||o[0].name!==r)throw RF(r,n.map(i=>i.name));return ly.default.join(e,r)}var Xo=`https://github.com/${ye}/issues`,Lt="SKILL.md",Dl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Zo=new Set([".git","node_modules","__pycache__"]),Qo=new Set([".DS_Store","Thumbs.db"]),ei=8,Rd=512,Id=128,jF=1024,MF=32,BF=256,UF=64,WF=64,cy=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,HF=256,VF=4;var uy=w(require("fs")),Rs=w(require("path"));C();async function Is(e){let t=Rs.default.join(e,...mn.split("/"));Me(e,t,"the catalog plugin manifest");let r;try{r=await uy.default.promises.readFile(t,"utf8")}catch(i){if(!ZL(i))throw new d(`Failed to read the catalog manifest at ${mn}: ${i instanceof Error?i.message:String(i)}`)}if(r===void 0)return{...await GF(e),version:"",source:"fallback"};let n=XL(r);if(n.skills===void 0)return{...await GF(e),version:n.version,source:"fallback"};let o=await YL(t,n.skills,e);if(!o)throw new d(`The catalog manifest at ${mn} declares its skills directory as "${b(n.skills)}", which does not exist in the downloaded catalog. This is a bug in ${ye}. Please report it.`);return{version:n.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function YL(e,t,r){let n=Rs.default.dirname(e),o=[{base:Rs.default.dirname(n),relativeTo:"plugin root"},{base:n,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=Rs.default.resolve(s.base,t);if(Me(r,a,"the catalog skills directory"),!!await KF(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${mn} declares "skills": "${b(t)}", which only resolves relative to the ${s.relativeTo}. This means ${ye} changed its layout; please report it at ${Xo}.`]}}}function XL(e){let t;try{t=JSON.parse(e)}catch(o){throw new d(`The catalog manifest at ${mn} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${ye}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new d(`The catalog manifest at ${mn} is not a JSON object. This is a bug in ${ye}. Please report it.`);let r=t,n=r.skills;if(n!==void 0&&(typeof n!="string"||n.trim()===""))throw new d(`The catalog manifest at ${mn} declares "skills" as ${QL(n)}, but it must be a non-empty string. This is a bug in ${ye}. Please report it.`);return{version:typeof r.version=="string"?r.version.trim():"",skills:typeof n=="string"?n:void 0}}async function GF(e){for(let t of Zh){let r=Rs.default.join(e,...t.split("/"));if(Me(e,r,"the catalog skills directory"),!!await KF(r))return{skillsDir:r,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${ye} changed its layout; please report it at ${Xo}.`]}}throw new d(`The downloaded catalog has no skills directory: ${mn} is absent and none of ${Zh.join(", ")} exists. This is a bug in ${ye}. Please report it.`)}async function KF(e){try{return(await uy.default.promises.stat(e)).isDirectory()}catch{return!1}}function ZL(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function QL(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="string"?"an empty string":typeof e=="object"?"an object":`a ${typeof e}`}var JF=require("yaml");Zi();var Nt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},eN=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,tN=/^\uFEFF/,rN="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",zF="\u2014 wrap the value in double quotes",nN={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},oN=100,iN=B.object({name:B.string().trim().min(1).max(Id),description:B.string().trim().min(1).max(jF),"mcp-version":B.string().max(MF).optional(),compatibility:B.string().max(BF).optional(),license:B.string().max(UF).optional(),metadata:B.record(B.unknown()).optional()}).passthrough(),dy=["name","description"];function ti(e){let t=e.replace(tN,""),r=eN.exec(t);if(!r){if(t.trimStart().startsWith("---"))throw new Nt(rN);return{frontmatter:py({}),body:t,raw:e}}let n=r[1]??"",o=r[2]??"",i=sN(n,1);return{frontmatter:py(i),body:o,raw:e}}function sN(e,t){let r=(0,JF.parseDocument)(e,nN),[n]=r.errors;if(n)throw new Nt(aN(n,e,t));let o;try{o=r.toJS({maxAliasCount:oN})}catch(i){throw new Nt(`YAML parse error: ${i instanceof Error?i.message:String(i)}`)}if(o==null)return{};if(typeof o!="object"||Array.isArray(o)||o instanceof Date)throw new Nt(`frontmatter is not a YAML mapping (parsed as ${fy(o)})`);return o}function aN(e,t,r){let n=e.pos?.[0],o="",i="";if(typeof n=="number"&&n>=0){let a=t.slice(0,n),l=a.split(`
252
- `).length,c=n-(a.lastIndexOf(`
253
- `)+1)+1;o=` at line ${l+r}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${zF}`:"";return`YAML parse error: ${e.message}${o}${s}`}function py(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Nt(`frontmatter is not a YAML mapping (parsed as ${fy(e)})`);let t={...e},r=dy.filter(i=>!(i in t)||t[i]===void 0);if(r.length>0)throw new Nt(`missing required frontmatter field(s): ${r.join(", ")}`);let n=dy.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(n.length>0){let i=dy.map(a=>fy(t[a])).join(" and "),s=n.some(a=>cN(t[a]));throw new Nt(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${zF}`:""}`)}t.metadata=lN(t.metadata),t.metadata===void 0&&delete t.metadata;let o=iN.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Nt(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function lN(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function cN(e){return!(e==null||typeof e=="string")}function fy(e){return e===null?"null":e===void 0?"nothing":Array.isArray(e)?"list":e instanceof Date?"date":typeof e=="string"?e.trim()===""?"empty string":"string":typeof e=="object"?"mapping":typeof e}function my(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function gy(e){let t=e.metadata?.category;if(typeof t!="string")return;let r=t.trim();return r===""?void 0:r}var Td=w(require("path"));C();var uN=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),hy="/webflow-skills-store";function Ts(e){if(typeof e!="string")return;let t=qF(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,WF),r=qF(t);if(r&&!uN.has(r)&&dN(r))return r}function qF(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function dN(e){return[sF,Kh].every(r=>{let n=r.impl.join(hy,e);return!ot(hy,n,r)||r.impl.basename(n)!==e?!1:r.impl.dirname(n)===r.impl.normalize(hy)})}function yy(e){return cy.test(e)}var Zn=e=>Td.default.posix.basename(Td.default.posix.dirname(e.split(Td.default.win32.sep).join("/")));function yn(e,t){let r=typeof e=="string"?e.trim():"",n=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(r==="")return n();let o=[s=>s.name===r,s=>s.folderName===r,s=>s.dir===r],i=Ts(r);i!==void 0&&o.push(s=>s.dir===i||Ts(s.name)===i||Ts(s.folderName)===i);for(let s of o){let a=t.filter(s);if(a.length===1)return{kind:"match",skill:a[0]};if(a.length>1)return{kind:"ambiguous",matches:a}}return n()}function YF(e){return XF(e,t=>t.dir)}function wy(e){let[t]=YF(e);if(!t)return;let r=t.skills.length,n=t.skills.map(o=>` "${b(o.name)}" (${b(o.skillPath)})`);throw new d(`${r===2?"Two":String(r)} skills resolve to the same install directory "${b(t.value)}":
254
- ${n.join(`
255
- `)}
256
- This is a bug in ${ye}. Please report it.`)}function by(e){return XF(e,t=>t.name)}function ky(e){let[t,...r]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${b(e.value)}": ${e.skills.map(n=>b(n.skillPath)).join(", ")}. Using ${b(t?.skillPath??"")} and ignoring ${r.length===1?"the other":"the others"}. This is a bug in ${ye}. Please report it.`}function XF(e,t){let r=new Map;for(let n of e){let o=t(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return[...r.entries()].filter(([,n])=>n.length>1).map(([n,o])=>({value:n,skills:o}))}var Ps=w(require("fs")),rr=w(require("path"));C();async function $s(e,t){Me(t,e,"the catalog skills directory");let r=[],n=[],o=[],i=new Set,s=f=>(o.push(...f.warnings),f.kind==="skipped"?(n.push({skillPath:f.skillPath,reason:f.reason}),!1):(r.push(f.skill),!f.skill.internal));for(let f of await El(e,"the catalog skills directory")){if(Dl.has(f.name))continue;let m=rr.default.join(e,f.name);if(!await Dy(m,f))continue;let g=await QF(m);if(g.kind!=="none"&&i.add(g.path),!(g.kind!=="none"&&s(await ZF({skillDir:m,manifest:g,extractRoot:t}))))for(let h of await El(m)){if(Dl.has(h.name))continue;let y=rr.default.join(m,h.name);if(!await Dy(y,h))continue;let k=await QF(y);k.kind!=="none"&&(i.add(k.path),s(await ZF({skillDir:y,manifest:k,extractRoot:t,parentCategory:f.name})))}}let a=await fN(r),l=by(a),c=new Set;for(let f of l){o.push(ky(f));for(let m of f.skills.slice(1))c.add(m.skillPath)}let p=a.filter(f=>!c.has(f.skillPath));wy(p),o.push(...await mN(e,t,i));for(let f of n)o.push(`Skipped ${f.skillPath} \u2014 ${f.reason}`);return n.length>0&&o.push(`${n.length} skill${n.length===1?" was":"s were"} skipped. ${n.length===1?"This is a defect":"These are defects"} in ${ye} \u2014 please report ${n.length===1?"it":"them"} at ${Xo}.`),{skills:p,skipped:n,warnings:o}}async function ZF(e){let{skillDir:t,manifest:r,extractRoot:n,parentCategory:o}=e,i=r_(n,r.path),s=[],a=h=>({kind:"skipped",skillPath:i,reason:b(h),warnings:s});if(r.kind==="symlink")return a(`${Lt} is a symbolic link; skill files must be regular files`);let l;try{l=await Ps.default.promises.readFile(r.path,"utf8")}catch(h){return a(`failed to read file: ${h instanceof Error?h.message:String(h)}`)}let c;try{c=ti(l).frontmatter}catch(h){if(h instanceof Nt)return a(h.reason);throw h}let p=b(c.name),f=b(c.description);if(p==="")return a(`frontmatter name "${b(c.name)}" cannot be used as a directory name`);let m=Ts(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);yy(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${ye}.`);let g=await pN(t,r.path);return g.symlink?a(`contains a symbolic link (${g.symlink}); skill files must be regular files`):(g.truncated&&s.push(`${i} sits in a directory with more than ${Rd} files; only the first ${Rd} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Zn(i),description:f,category:gy(c)??o,internal:my(c),path:t,skillPath:i,supplementaryFiles:g.files}})}async function QF(e){let t=rr.default.join(e,Lt),r=await e_(t);if(r)return r;let n=Lt.toLowerCase();for(let o of await El(e)){if(o.name===Lt||o.name.toLowerCase()!==n)continue;let i=await e_(rr.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function e_(e){try{let t=await Ps.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Dy(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Ps.default.promises.stat(e)).isDirectory()}catch{return!1}}async function El(e,t){try{return(await Ps.default.promises.readdir(e,{withFileTypes:!0})).sort((n,o)=>n.name<o.name?-1:n.name>o.name?1:0)}catch(r){if(!t)return[];throw new d(`Failed to read ${t} (${b(e)}): ${r instanceof Error?r.message:String(r)}`)}}async function pN(e,t){let r=[],n,o=!1,i=async(s,a)=>{if(!(a>ei||n!==void 0))for(let l of await El(s)){if(n!==void 0)return;let c=rr.default.join(s,l.name);if(l.isSymbolicLink()){n=t_(e,c);return}if(l.isDirectory()){if(Zo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Qo.has(l.name)&&c!==t){if(r.length>=Rd){o=!0;return}r.push(t_(e,c))}}};return await i(e,1),{files:r.sort(),symlink:n,truncated:o}}async function fN(e){let t=new Set,r=[];for(let n of e){let o;try{o=await Ps.default.promises.realpath(n.path)}catch{o=rr.default.resolve(n.path)}t.has(o)||(t.add(o),r.push(n))}return r}async function mN(e,t,r){let n=[],o=HF,i=async(s,a)=>{if(!(a>VF||o<=0)){o-=1;for(let l of await El(s)){if(Dl.has(l.name))continue;let c=rr.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Lt.toLowerCase()){r.has(c)||n.push(r_(t,c));continue}await Dy(c,l)&&await i(c,a+1)}}};return await i(e,1),n.length===0?[]:[`${n.length} ${Lt} file(s) in the catalog sit outside the layout this CLI reads (for example ${n[0]}) and were ignored. ${ye} may have changed its layout; please report it at ${Xo}.`]}function r_(e,t){return rr.default.relative(e,t).split(rr.default.sep).join("/")}function t_(e,t){return rr.default.relative(e,t).split(rr.default.sep).join("/")}var br=w(require("os")),Mr=w(require("path"));function ri(e,t){let r=process.env[e]?.trim();return r||t}function n_(e){let t=process.env[e]?.trim();return t||void 0}var de={home:()=>br.default.homedir(),configHome:()=>ri("XDG_CONFIG_HOME",Mr.default.join(br.default.homedir(),".config")),hardcodedConfigHome:()=>Mr.default.join(br.default.homedir(),".config"),claudeHome:()=>ri("CLAUDE_CONFIG_DIR",Mr.default.join(br.default.homedir(),".claude")),codexHome:()=>ri("CODEX_HOME",Mr.default.join(br.default.homedir(),".codex")),vibeHome:()=>ri("VIBE_HOME",Mr.default.join(br.default.homedir(),".vibe")),hermesHome:()=>ri("HERMES_HOME",Mr.default.join(br.default.homedir(),".hermes")),autohandHome:()=>ri("AUTOHAND_HOME",Mr.default.join(br.default.homedir(),".autohand")),grokHome:()=>ri("GROK_HOME",Mr.default.join(br.default.homedir(),".grok")),appData:()=>n_("APPDATA"),flatpakConfigHome:()=>n_("FLATPAK_XDG_CONFIG_HOME")};function kr(...e){return Mr.default.join(br.default.homedir(),...e)}var m_=w(require("fs")),De=w(require("path"));C();j();var Ct=w(require("path"));var Ey=[".openclaw",".clawdbot",".moltbot"];function o_(e,t){let r=Ey.find(n=>t(Ct.default.join(e,n)));return Ct.default.join(e,r??Ey[0],"skills")}function i_(e,t){return Ey.some(r=>t(Ct.default.join(e,r)))}function s_(e,t,r=de.appData(),n=de.flatpakConfigHome()){return!!(t(Ct.default.join(e,"zed"))||r&&t(Ct.default.join(r,"Zed"))||n&&t(Ct.default.join(n,"zed")))}var hN="/Applications/ZCode.app";function a_(e,t){return t(Ct.default.join(e,".zcode"))||t(hN)}function l_(e,t){return t(Ct.default.join(e,"kimchi"))}var yN="/etc/codex";function c_(e,t){return t(e)||t(yN)}function u_(e,t){return t(Ct.default.join(e,".replit"))}function d_(e,t){return t(Ct.default.join(e,".promptscript"))||t(Ct.default.join(e,"promptscript.yaml"))}function p_(e,t,r){return r(Ct.default.join(t,"data","skills"))||r(Ct.default.join(e,".astrbot"))}function f_(){return!1}function wN(e){try{return m_.default.existsSync(e)}catch{return!1}}function ge(e,t,r){return{id:e,displayName:t,skillsDir:`${r}/skills`,globalSkillsDir:()=>kr(r,"skills"),detect:n=>n.pathExists(De.default.join(n.homeDir,r)),sharedStore:!1}}function it(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>kr(...e.global),detect:t=>t.pathExists(De.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",vl=[ge("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"amp")),sharedStore:!0},it({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),it({id:"antigravity-cli",displayName:"Antigravity CLI",project:Qe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>kr(".astrbot","data","skills"),detect:e=>p_(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>De.default.join(de.autohandHome(),"skills"),detect:e=>e.pathExists(de.autohandHome()),sharedStore:!1},ge("augment","Augment",".augment"),ge("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>De.default.join(de.claudeHome(),"skills"),detect:e=>e.pathExists(de.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>o_(de.home(),wN),detect:e=>i_(e.homeDir,e.pathExists),sharedStore:!1},it({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),ge("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>kr(".codebuddy","skills"),detect:e=>e.pathExists(De.default.join(e.cwd,".codebuddy"))||e.pathExists(De.default.join(e.homeDir,".codebuddy")),sharedStore:!1},ge("codemaker","Codemaker",".codemaker"),ge("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.codexHome(),"skills"),detect:e=>c_(de.codexHome(),e.pathExists),sharedStore:!0},ge("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>kr(".continue","skills"),detect:e=>e.pathExists(De.default.join(e.cwd,".continue"))||e.pathExists(De.default.join(e.homeDir,".continue")),sharedStore:!1},it({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>De.default.join(de.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(De.default.join(de.hardcodedConfigHome(),"crush")),sharedStore:!1},it({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),it({id:"deepagents",displayName:"Deep Agents",project:Qe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>De.default.join(de.configHome(),"devin","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"devin")),sharedStore:!1},it({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),ge("droid","Droid",".factory"),it({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),ge("forgecode","ForgeCode",".forge"),it({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),it({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>De.default.join(de.configHome(),"goose","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>De.default.join(de.grokHome(),"skills"),detect:e=>e.pathExists(de.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>De.default.join(de.hermesHome(),"skills"),detect:e=>e.pathExists(de.hermesHome()),sharedStore:!1},ge("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>kr(".jazz","skills"),detect:e=>e.pathExists(De.default.join(e.homeDir,".jazz"))||e.pathExists(De.default.join(e.cwd,".jazz")),sharedStore:!1},ge("junie","Junie",".junie"),ge("iflow-cli","iFlow CLI",".iflow"),ge("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>De.default.join(de.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>l_(de.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>kr(".agents","skills"),detect:e=>e.pathExists(De.default.join(e.homeDir,".kimi-code"))||e.pathExists(De.default.join(e.homeDir,".kimi")),sharedStore:!0},ge("kiro-cli","Kiro CLI",".kiro"),ge("kode","Kode",".kode"),ge("lingma","Lingma",".lingma"),it({id:"loaf",displayName:"Loaf",project:Qe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),ge("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>De.default.join(de.vibeHome(),"skills"),detect:e=>e.pathExists(de.vibeHome()),sharedStore:!1},ge("moxby","Moxby",".moxby"),ge("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"opencode","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"opencode")),sharedStore:!0},ge("openhands","OpenHands",".openhands"),ge("ona","Ona",".ona"),it({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),ge("qoder","Qoder",".qoder"),it({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),ge("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:e=>u_(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},ge("reasonix","Reasonix",".reasonix"),ge("rovodev","Rovo Dev",".rovodev"),ge("roo","Roo Code",".roo"),it({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),ge("terramind","Terramind",".terramind"),ge("tinycloud","Tinycloud",".tinycloud"),ge("trae","Trae",".trae"),it({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),it({id:"warp",displayName:"Warp",project:Qe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),it({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Qe,globalSkillsDir:()=>kr(".agents","skills"),detect:e=>s_(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>kr(".zcode","skills"),detect:e=>a_(e.homeDir,e.pathExists),sharedStore:!1},ge("zencoder","Zencoder",".zencoder"),ge("zenflow","Zenflow",".zencoder"),ge("neovate","Neovate",".neovate"),ge("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Qe,globalSkillsDir:()=>{},detect:e=>d_(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},ge("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:f_,sharedStore:!0,showInSharedList:!1}],vy=new Map(vl.map(e=>[e.id,e])),ni=vl.map(e=>e.id);function Sl(e){return vy.has(e)}function Br(e){return vy.get(e)}function Pd(e){let t=vy.get(e);if(t)return t;throw new d(`${D} Unknown agent: ${b(e)}
257
- ${ni.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function $d(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Ur(e){return vl.filter(t=>$d(t,e))}var Sy=w(require("path"));C();j();var Od=".agents",Ld="skills";function st(e,t){let r=e==="global"?de.home():t;return Sy.default.join(r,Od,Ld)}function jt(e,t,r){if(t==="global")return e.globalSkillsDir()??null;let n=Sy.default.resolve(r,...e.skillsDir.split("/"));return Me(r,n,`${e.id} project skills directory`),n}function xy(e,t,r){return Ye(jt(e,t,r),st(t,r))}var Cy=w(require("fs")),g_=w(require("path"));function bN(e){try{return Cy.default.existsSync(e)}catch{return!1}}function kN(e){try{let t=JSON.parse(Cy.default.readFileSync(g_.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function h_(e){return{homeDir:de.home(),configHome:de.configHome(),cwd:e,pathExists:bN,readPackageJson:kN}}async function xl(e,t,r=h_(t)){return y_(Ur(e),r).map(n=>n.id)}function y_(e,t){return e.filter(r=>{try{return r.detect(t)}catch{return!1}})}var w_=w(require("fs")),b_=w(require("path"));C();we();Oe();R();j();var Cl=[".git","package.json","webflow.json"];function Fl(e){for(let t of Cl)try{if(w_.default.existsSync(b_.default.join(e,t)))return t}catch{}return null}function _l(e){return Fl(e)===null?"global":"project"}function k_(e){let t=Fl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${Cl.join(", ")} found in this directory.`}async function Nd(e,t){if(e.global&&e.project)throw new d(`${D} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let r=_l(t);return e.yes||V()?(u.info(k_(t)),r):je({message:"Where should these skills be installed?",default:r,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();we();Oe();R();j();var Al="all",nr="universal",DN=6,EN=20,vN=80;function Os(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function SN(e,t){let r=Array.from({length:t.length+1},(n,o)=>o);for(let n=1;n<=e.length;n+=1){let o=[n];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(r[i]+1,o[i-1]+1,r[i-1]+(e[n-1]===t[i-1]?0:1));r=o}return r[t.length]}function v_(e){let t=e.toLowerCase(),r=Math.max(1,Math.floor(t.length/3)),n=null,o=Number.POSITIVE_INFINITY;for(let i of ni){let s=SN(t,i);s<o&&(o=s,n=i)}return o<=r?n:null}function Ls(e){let t=e.filter(r=>!Sl(r));if(t.length>0){let r=Array.from(new Set(t.map(o=>v_(o)).filter(o=>o!==null))),n=r.length>0?` Did you mean: ${r.join(", ")}?
258
- `:"";throw new d(`${D} Unknown agent(s): ${t.map(o=>b(o)).join(", ")}
259
- `+n+` ${ni.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(r=>Br(r))}function Md(e,t){return Ur(e).filter(r=>xy(r,e,t))}function S_(e,t){return Md(e,t).filter(r=>r.showInSharedList!==!1)}function x_(e,t){let n=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-n.length,i=n.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function C_(e,t,r=DN){return x_(S_(e,t),r)}function D_(e,t){let r=process.stdout.columns??vN,n=Math.max(20,r-t);return e.length<=n?e:`${e.slice(0,n-1)}\u2026`}function xN(e,t,r){return t==="project"?e.skillsDir:jt(e,t,r)??""}function jd(e,...t){let r=new Set(t.flat());return Ur(e).filter(n=>r.has(n.id))}async function E_(e,t,r){let n=Md(e,t),o=new Set(n.map(f=>f.id)),i=Ur(e).filter(f=>!o.has(f.id)),s=new Set(r),a=C_(e,t),l=st(e,t),c=[];n.length>0&&c.push({value:"",name:D_(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let f of i){let m=xN(f,e,t),g=s.has(f.id)?" (detected)":"";c.push({value:f.id,name:D_(`${f.displayName} ${m}${g}`,8),checked:s.has(f.id)})}let p=await Cr({message:n.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(EN,Math.max(4,c.length)),validate:f=>f.length>0||n.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return jd(e,n.map(f=>f.id),(p??[]).filter(Boolean))}async function Rl(e){let{scope:t,cwd:r,options:n}=e,o=Os(n.agent),i=n.allAgents===!0||o.includes(Al),s=o.filter(c=>c!==Al),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(p=>Sl(p));return{agents:jd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(p=>!Sl(p))}}if(s.length>0&&!i){let c=Ls(s),p=c.filter(f=>!$d(f,t));if(p.length>0){let f=p.map(m=>m.displayName).join(", ");throw new d(`${D} ${f} does not support global skill installation \u2014 its skills live inside a project.
260
- Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:jd(t,c.map(f=>f.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Ur(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await xl(t,r);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${st(t,r)}).`);let c=Br(nr);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await E_(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}return n.yes||V()?{agents:jd(t,Md(t,r).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await E_(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}var R_=w(require("os")),Qn=w(require("path"));me();j();var eo=1,CN=24,FN=100,I_=8,_N=5;function oi(e,t={}){if(e==="")return"";let r=Qn.default.resolve(e),n=Qn.default.resolve(t.cwd??process.cwd()),o=Qn.default.resolve(t.home??R_.default.homedir()),i=F_(n,r);if(i!==null)return b(i===""?".":`.${Qn.default.sep}${i}`);let s=F_(o,r);return s!==null?b(s===""?"~":`~${Qn.default.sep}${s}`):b(r)}function Bd(e={}){return t=>oi(t,e)}function F_(e,t){let r=Qn.default.relative(e,t);return r===""?"":r.startsWith("..")||Qn.default.isAbsolute(r)?null:r}var __={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function _y(e){let{plan:t,materialized:r,dryRun:n}=e,o=[],i=[];for(let g of t.skills){let h=__[g.storeOverwrite];h!==void 0&&!t.force&&o.push({name:g.name,dir:g.dir,overwrite:g.storeOverwrite,reason:h,requiredFlag:"--force",...g.detail!==void 0?{detail:g.detail}:{}});for(let y of g.targets){if(!y.blocked)continue;let k=__[y.overwrite];k!==void 0&&o.push({name:g.name,dir:g.dir,agent:y.agent,overwrite:y.overwrite,reason:k,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let g of t.skills)for(let h of g.targets){if(!h.blocked)continue;let y=s.get(g.name)??new Set;y.add(h.path),s.set(g.name,y)}let a=0,l=0,c=0,p=0,f=0,m=0;for(let g of r){if(g.storeAction==="written"&&(l+=1),g.storeAction==="failed"){i.push({name:g.name,message:g.error??"the canonical store could not be written"});continue}if(g.storeAction!=="blocked"){(g.storeAction==="written"||g.storeAction==="adopted"||g.storeAction==="unchanged")&&(a+=1);for(let h of g.targets){if(h.skipped===!0){m+=1;continue}if(!h.success){if(s.get(g.name)?.has(h.path))continue;i.push({name:g.name,agent:h.agent,...h.errno!==void 0?{errno:h.errno}:{},message:h.error??"the destination could not be written"});continue}h.link==="symlink"&&(c+=1),h.link==="copy"&&h.requestedMode==="copy"&&(p+=1),h.symlinkFailed===!0&&(f+=1)}}}return n&&(m=t.skills.reduce((g,h)=>g+h.targets.filter(y=>y.skipped).length,0)),{blocked:o,failures:i,summary:{requested:t.skills.length,installed:a,skipped:m,blocked:o.length,failed:i.length,storeWrites:l,symlinks:c,copies:p,symlinkFallbacks:f}}}function Ay(e,t){let r=t.display??(o=>o),n=[];n.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),n.push(` scope ${e.scope} (${r(e.root)})`),n.push(` source ${AN(e.source)}`),n.push(` store ${r(e.storeBase)}`),n.push(` mode ${e.mode}`);for(let o of e.skills)n.push(""),n.push(` ${b(o.dir)}`),n.push(` store ${r(o.storePath)}`),n.push(...RN(o,r)),o.blocked&&o.detail!==void 0&&n.push(` ${ue("blocked")} ${o.detail}`);if(e.warnings.length>0){n.push("");for(let o of e.warnings)n.push(` ${ue("\u26A0")} ${o}`)}return n.join(`
261
- `)}function AN(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${T_(e.commit)}${t}`}function T_(e){return e.slice(0,I_)}function RN(e,t){let r=[],n=e.targets.filter(s=>s.link==="canonical"),o=e.targets.filter(s=>!s.skipped&&s.link==="symlink"),i=e.targets.filter(s=>!s.skipped&&s.link==="copy");n.length>0&&r.push(` shared ${Il(n)}`),o.length>0&&r.push(` symlink \u2192 ${A_(o,t)}`),i.length>0&&r.push(` copy \u2192 ${A_(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&r.push(` ${P("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&r.push(` overwrites ${s.label} ${P(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return r}function A_(e,t){if(e.length===1){let r=e[0];return`${r.label} (${t(r.path)})`}return Il(e)}function Il(e,t=_N){let r=e.map(n=>b(n.label));return r.length<=t?r.join(", "):`${r.slice(0,t).join(", ")} +${r.length-t} more`}function P_(e,t={}){let r=t.display??(i=>i),n=[],{summary:o}=e;n.push(z(`Installed ${o.installed} ${Fy(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;n.push(` ${b(r(i.storePath))}`);let s=i.targets.filter(c=>c.success&&c.link==="canonical"),a=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="symlink"),l=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="copy");s.length>0&&n.push(` shared: ${Il(s)}`),a.length>0&&n.push(` symlinked: ${Il(a)}`),l.length>0&&n.push(` copied: ${Il(l)}`),i.detail!==void 0&&n.push(` ${P(i.detail)}`)}if(o.symlinkFallbacks>0){let i=IN(e.materialized);n.push(`${ue("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${Fy(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),n.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return n.push(...TN(e.blocked)),n.push(...PN(e.failures)),n.push(...Ud(e.plan.warnings)),n.join(`
262
- `)}function IN(e){let t=new Set;for(let r of e)for(let n of r.targets)n.symlinkFailed===!0&&n.errno!==void 0&&t.add(n.errno);return[...t].sort()}function TN(e){if(e.length===0)return[];let t=["",ue(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let r of e){let n=r.agent===void 0?"shared store":b(r.agent);t.push(` \u2022 ${b(r.name)} (${n})`),r.detail!==void 0&&t.push(` ${r.detail}`)}return t}function PN(e){if(e.length===0)return[];let t=["",Ut(`${e.length} ${Fy(e.length,"failure")}:`)];for(let r of e){let n=r.agent===void 0?"":` (${b(r.agent)})`;t.push(` \u2022 ${b(r.name)}${n}: ${b(r.message)}`)}return t}function Ud(e){return e.length===0?[]:["",...e.map(t=>`${ue("\u26A0")} ${t}`)]}function Fy(e,t){return e===1?t:`${t}s`}function Wd(e){let{plan:t}=e,r=new Map(e.materialized.map(n=>[n.name,n]));return{kind:"skills.install",schemaVersion:eo,dryRun:e.dryRun,restored:e.restored,scope:t.scope,root:t.root,store:t.storeBase,mode:t.mode,force:t.force,lockfile:e.lockfilePath,source:{...t.source,cacheHit:e.cacheHit},...e.extraSources!==void 0&&e.extraSources.length>0?{sources:[t.source,...e.extraSources]}:{},skills:t.skills.map(n=>$N(n,r.get(n.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function $N(e,t){let r=new Map((t?.targets??[]).map(n=>[n.path,n]));return{name:e.name,dir:e.dir,description:e.description,skillPath:e.skillPath,storePath:e.storePath,storeOverwrite:e.storeOverwrite,storeAction:t?.storeAction??null,contentHash:t?.hashes?.contentHash??null,modeHash:t?.hashes?.modeHash??null,upToDate:e.upToDate,fileCount:e.fileCount,byteCount:e.byteCount,blocked:e.blocked,detail:e.detail??null,targets:e.targets.map(n=>ON(n,r.get(n.path)))}}function ON(e,t){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:t?.link??e.link,overwrite:e.overwrite,blocked:e.blocked,skipped:t?.skipped??e.skipped,skipReason:t?.skipReason??e.skipReason??null,symlinkFailed:t?.symlinkFailed??!1,errno:t?.errno??null,error:t?.error??null}}var ii=["name","dir","description","status","mode","agents","scope"],Tl="name,status,agents",Ns=["name","dir","status","scope"],LN={"up-to-date":z,modified:ue,missing:Ut,unmanaged:P};function $_(e,t,r={}){let n=r.columns??process.stdout.columns??FN,o=e.map(l=>t.map(c=>NN(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((p,f,m)=>{if(m===i)return p;let g=Math.max(f.length,...o.map(h=>h[m].length),0);return p+g+2},0),c=Math.max(CN,n-l-2);for(let p of o)p[i]=MN(p[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((p,f)=>t[f]==="status"?LN[e[c].status](p):p));return ze(s,a)}function NN(e,t){switch(t){case"name":return b(e.name);case"dir":return b(e.dir);case"description":return b(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return jN(e);case"scope":return e.scope}}var O_="shared";function jN(e){let t=[],r=0;for(let n of e.agents){let o=b(n.id);if(!n.present){t.push(`${o} (missing)`);continue}if(n.link==="canonical"){r+=1;continue}t.push(o)}return r>0?[O_,...t].join(", "):t.join(", ")}function L_(e,t={}){let r=t.display??(s=>s),n=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&n.add(a.id);if(n.size===0)return"";let o=[...n].sort().join(", "),i=t.store===void 0?"":` = ${r(t.store)}`;return P(`${O_}${i}, read directly by ${n.size} agent${n.size===1?"":"s"}:
263
- ${o}`)}function MN(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function N_(e,t={}){let r=t.display??(l=>l),n=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${T_(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${n} skills \u2014 ${r(a)}${s}`)}function Ry(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let r of e)for(let n of r.skills)t.total+=1,n.status==="up-to-date"?t.upToDate+=1:n.status==="modified"?t.modified+=1:n.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function j_(e){return{kind:"skills.list",schemaVersion:eo,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(r=>({name:r.name,dir:r.dir,description:r.description,skillPath:r.skillPath??null,storePath:r.storePath,recordedHash:r.recordedHash,onDiskHash:r.onDiskHash,status:r.status,statusDetail:r.statusDetail??null,mode:r.mode,commit:r.commit??null,ref:r.ref??null,category:r.category??null,agents:r.agents.map(n=>({id:n.id,label:n.label,path:n.path,link:n.link,present:n.present,diverged:n.diverged??!1}))}))})),summary:Ry(e.inventories),warnings:[...e.warnings]}}var Iy="No skills installed. Run `webflow skills install` to get started.";function M_(e,t){let r=t==="desc"?-1:1;return(n,o)=>{let i=String(n[e]??""),s=String(o[e]??"");return i===s?n.name<o.name?-1:n.name>o.name?1:0:(i<s?-1:1)*r}}function B_(e){let t=[],{summary:r}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Iy;if(e.source.upToDate)t.push(`${$} ${b(e.source.repo)}@${b(e.source.ref)} is still ${BN(e.source.resolvedCommit)} \u2014 all ${r.checked} skill${r.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${xe} ${r.outdated+r.conflicts} of ${r.checked} skills would change.`:`${$} Updated ${r.updated} skill${r.updated===1?"":"s"}`+(r.blocked>0?`, skipped ${r.blocked}`:"")+(r.failed>0?`, ${r.failed} failed`:"");t.push(o)}let n=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[b(o.dir),o.action,o.detail?b(o.detail):""]);n.length>0&&t.push("",ze(["SKILL","ACTION","DETAIL"],n));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${b(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${b(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
264
- `)}function BN(e){return e===null?"unknown":e.slice(0,I_)}function Ty(e,t,r={}){let n=i=>b((r.display??oi)(i)),o=[];o.push(`${r.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${b(i.name)} \u2192 ${b(i.dir)}`),!i.onDisk&&i.targets.length===0){o.push(" (lockfile entry only \u2014 no directory on disk; the stale entry will be removed)");continue}i.onDisk&&o.push(` ${n(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>b(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${n(s.path)} ${b(s.label)} (unlink)`)}return r.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
265
- `)}function U_(e,t={}){let r=o=>b((t.display??oi)(o));if(e.skills.length===0)return"No skills removed.";let n=[];n.push(`${$} Removed ${e.summary.removed} skill${e.summary.removed===1?"":"s"}`+(e.summary.failed>0?`, ${e.summary.failed} failed`:""));for(let o of e.skills){let i=o.targets.filter(a=>a.action==="unlinked"),s=o.storeAction==="deleted"?"store directory deleted":o.storeAction==="kept"?`store kept \u2014 still used by ${o.keptBecause.map(a=>b(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";n.push(` ${b(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&n.push(` removed empty directories: ${e.removedDirectories.map(o=>r(o)).join(", ")}`);for(let o of e.failures)n.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.lockfileDeleted?n.push(`${xe} ${r(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&n.push(`${xe} ${r(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),n.join(`
266
- `)}Y();C();we();Oe();R();j();Z();we();R();function UN(e){let t=Fl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${Cl.join(", ")} found in this directory.`}async function Hd(e,t,r){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(r||u.info(UN(t)),_l(t)):Nd(e,t)}function js(e){return e==="locally-modified"||e==="unmanaged"}var ai=w(require("fs")),Dr=w(require("path"));C();var $y=require("crypto"),Jd=w(require("fs"));C();var si=w(require("fs")),Wr=w(require("path"));C();var Py=2e3,H_=8;async function Vd(e){let t=Wr.default.resolve(e),r=[],n=[],o=async(i,s)=>{if(s>ei)throw new d(`Skill directory ${b(t)} nests deeper than ${ei} levels at ${b(i)}. Refusing to copy or hash a tree this deep.`);let a=await si.default.promises.readdir(i,{withFileTypes:!0});a.sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0);for(let l of a){let c=Wr.default.join(i,l.name);if(Me(t,c,"a skill file"),l.isSymbolicLink()){n.push(W_(t,c));continue}if(l.isDirectory()){if(Zo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Qo.has(l.name))continue;let p=await si.default.promises.lstat(c);if(r.length>=Py)throw new d(`Skill directory ${b(t)} contains more than ${Py} files. Refusing to copy or hash it.`);let f=W_(t,c);r.push({rel:f,key:f.normalize("NFC"),abs:c,mode:p.mode&511,size:p.size})}};return await o(t,1),r.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),n.sort(),{files:r,symlinks:n}}function Gd(e,t){let[r]=t.symlinks;if(r!==void 0)throw new d(`Skill directory ${b(e)} contains a symbolic link ("${b(r)}"); skill files must be regular files. If this came from ${ye}, please report it.`)}async function Kd(e,t){let r=Wr.default.resolve(e),n=Wr.default.resolve(t),o=await Vd(r);Gd(r,o),await si.default.promises.mkdir(n,{recursive:!0});let i=new Set;for(let a of o.files){let l=Wr.default.dirname(Wr.default.join(n,...a.rel.split("/")));l!==n&&i.add(l)}for(let a of[...i].sort())Me(n,a,"a skill destination directory"),await si.default.promises.mkdir(a,{recursive:!0});let s=0;return await WN(o.files,H_,async a=>{let l=Wr.default.join(n,...a.rel.split("/"));Me(n,l,"a skill destination file"),await si.default.promises.copyFile(a.abs,l),await si.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function W_(e,t){return Wr.default.relative(e,t).split(Wr.default.sep).join("/")}async function WN(e,t,r){let n=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;n<e.length;){let i=e[n++];if(i===void 0)return;await r(i)}});await Promise.all(o)}var G_=1024*1024,K_=4294967295,Oy=Buffer.from([0]);async function zd(e){let t=await Vd(e);Gd(e,t);let r=(0,$y.createHash)("sha256"),n=(0,$y.createHash)("sha256"),o=0;for(let i of t.files)await HN(r,i),VN(n,i),o+=i.size;return{contentHash:`sha256:${r.digest("hex")}`,modeHash:`sha256:${n.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function or(e){try{return await zd(e)}catch(t){if(JN(t))return null;throw t}}function Mt(e,t,r=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:r==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function HN(e,t){if(t.size<=G_){let o=await Jd.default.promises.readFile(t.abs);return V_(e,t,o.length),e.update(o),o.length}let r=await GN(t.abs);V_(e,t,r);let n=await KN(e,t.abs,r);if(n!==r)throw new d(`${b(t.abs)} changed while it was being hashed (${r} bytes, then ${n}). Re-run the command.`);return n}function V_(e,t,r){if(r>K_)throw new d(`${b(t.abs)} is ${r} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(Oy);let n=Buffer.alloc(4);n.writeUInt32BE(r,0),e.update(n)}function VN(e,t){e.update(t.key,"utf8"),e.update(Oy),e.update((t.mode&73)!==0?"x":"-"),e.update(Oy)}async function GN(e){let t=0;for await(let r of Jd.default.createReadStream(e))t+=r.length;return t}async function KN(e,t,r){let n=0;for await(let o of Jd.default.createReadStream(t)){let i=o;if(n+=i.length,n>r)return e.update(i.subarray(0,i.length-(n-r))),n;e.update(i)}return n}function JN(e){return to(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:to(e.cause)==="ENOENT"}function to(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var q_=require("crypto"),Re=w(require("fs")),Ee=w(require("path"));C();R();var zN=/\.[0-9a-f]{6}\.tmp$/,Y_=3600*1e3;async function Ny(e,t=r=>r){let r=Ee.default.join(e,Od);for(let n of[r,Ee.default.join(r,Ld)]){if(await X_(n)==="other")throw new d(`${b(t(n))} exists but is not a directory. The Webflow CLI needs it as the shared skills store. Remove or rename it, then re-run.`,{isUserError:!0});if(await qd(e,n))throw new d(`${b(t(n))} resolves outside ${b(t(e))} once symlinks are followed. The Webflow CLI will not use it as the shared skills store. Remove or repoint it, then re-run.`,{isUserError:!0})}}async function qd(e,t){if(!ot(e,t)||await jy(e,t)!==void 0)return!0;try{await Re.default.promises.lstat(t)}catch{return!1}return!await yd(e,t)}async function jy(e,t){let r=Ee.default.resolve(e),n=Ee.default.relative(r,Ee.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(Ee.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await Re.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await yd(r,i))return i}}async function Yd(e,t){let r=Ee.default.resolve(e),n=Ee.default.relative(r,Ee.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(Ee.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await X_(i);if(a==="absent")return;if(a==="other")return i}}async function Pl(e,t={}){if(t.dryRun)return[];let r=t.maxAgeMs??Y_,n=t.now??Date.now(),o=[],i;try{i=await Re.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!zN.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Me(e,a,"a stale staging directory");let l=await Re.default.promises.lstat(a);if(n-l.mtimeMs<r)continue;await Re.default.promises.rm(a,{recursive:!0,force:!0}),o.push(a)}catch(l){u.debug(`Could not sweep staging directory ${a}: ${l instanceof Error?l.message:String(l)}`)}}return o}async function Xd(e){let{storeDir:t,slug:r,root:n,mode:o,agent:i,label:s}=e,a=e.platform??process.platform,l=Ee.default.resolve(e.linkPath),c={agent:i,label:s,path:l,canonicalPath:t,requestedMode:o},p=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==r)return p(`Refusing to write ${b(l)}: its final component is not "${b(r)}".`);let f=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${b(l)} for ${b(s)}: ${y}`});if(!ot(n,l))return f(`it resolves outside ${b(n)}.`);let m=await jy(n,l);if(m!==void 0)return f(`${b(m)} is a symbolic link that leaves ${b(n)}.`);let g=await Yd(n,l);if(g!==void 0)return p(`${b(g)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(Ye(t,l))return{...c,success:!0,link:"canonical"};let h=await XN(l,t);if(h&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!h){let[y,k]=await Promise.all([yr(t),yr(l)]);if(Ye(y,k))return{...c,success:!0,link:"canonical"};if(Ye(await z_(t),await z_(l)))return{...c,success:!0,link:"canonical"};if(await Jh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await J_(t,l,r),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:to(y),error:Ly(y)}}try{if(await ZN(l,r),await Re.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await Re.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await yr(Ee.default.dirname(l));await Re.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let k=to(y);try{return await J_(t,l,r),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:k}}catch(v){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:to(v)??k,error:Ly(v)}}}}async function $l(e,t,r={}){if(Me(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new d(`Refusing to write ${b(t.storePath)}: its final component is not "${b(t.dir)}". Please report this.`);let n={name:t.name,dir:t.dir,storePath:t.storePath};if(js(t.storeOverwrite)&&!e.force)return{...n,storeAction:"blocked",hashes:null,targets:[],success:!1,error:t.detail};let o,i,s;try{t.storeOverwrite==="adoptable"?(i="adopted",o=t.onDisk??t.upstream):t.upToDate?(i="unchanged",o=t.onDisk??t.upstream):await Jh(t.sourceDir,t.storePath)?(i="unchanged",o=t.onDisk??t.upstream,s="the extracted source and the canonical store are the same directory; nothing to copy"):(o=await qN(t),i="written")}catch(l){return{...n,storeAction:"failed",hashes:null,targets:[],success:!1,error:Ly(l)}}let a=[];for(let l of t.targets)a.push(await YN(e,t,l,r));return{...n,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function qN(e){await Re.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=By(e.storePath);try{await Kd(e.sourceDir,t),await My(e.storePath,e.dir),await Re.default.promises.rename(t,e.storePath)}finally{await Re.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return zd(e.storePath)}async function YN(e,t,r,n){let o={agent:r.agent,label:r.label,path:r.path,canonicalPath:t.storePath,requestedMode:e.mode};return r.link==="canonical"?{...o,success:!0,link:"canonical"}:r.skipped?{...o,success:!0,link:r.link,skipped:!0,skipReason:r.skipReason,error:void 0}:r.blocked?{...o,success:!1,link:r.link,error:r.detail}:Xd({storeDir:t.storePath,linkPath:r.path,slug:t.dir,root:e.root,mode:e.mode,agent:r.agent,label:r.label,platform:n.platform})}async function J_(e,t,r){await Re.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let n=By(t);try{await Kd(e,n),await My(t,r),await Re.default.promises.rename(n,t)}finally{await Re.default.promises.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}async function XN(e,t){let r;try{r=await Re.default.promises.lstat(e)}catch{return!1}if(!r.isSymbolicLink())return!1;let n=await Re.default.promises.readlink(e).catch(()=>null);if(n===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),n);if(Ye(o,t))return!0;let[i,s]=await Promise.all([yr(o),yr(t)]);return Ye(i,s)}async function ZN(e,t){let r;try{r=await Re.default.promises.lstat(e)}catch(n){to(n)==="ELOOP"&&await Re.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(r.isSymbolicLink()){await Re.default.promises.rm(e,{force:!0});return}await My(e,t)}async function My(e,t){if(Ee.default.basename(e)!==t)throw new d(`Refusing to delete ${b(e)}: its final component is not "${b(t)}". Please report this.`);let r;try{r=await Re.default.promises.lstat(e)}catch{return}if(r.isSymbolicLink()){await Re.default.promises.rm(e,{force:!0});return}await Re.default.promises.rm(e,{recursive:!0,force:!0})}function By(e){return`${e}.${(0,q_.randomBytes)(3).toString("hex")}.tmp`}async function z_(e){let t=Ee.default.resolve(e),r=await yr(Ee.default.dirname(t));return Ee.default.join(r,Ee.default.basename(t))}async function X_(e){let t;try{t=await Re.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await Re.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Ly(e){let t=e instanceof Error?e.message:String(e);return b(t)}var QN=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],ej=64;async function Ol(e){let t=e.platform??process.platform,r=e.display??(c=>c),n=Dr.default.resolve(e.root),o=st(e.scope,n),i=e.recorded??{},s=new Set(e.warnings??[]);await Ny(n,r);let a=await tj({targets:e.targets,scope:e.scope,root:n,storeBase:o,display:r,warn:c=>s.add(c)});for(let c of await ij({groups:a,skills:e.skills,display:r}))s.add(c);let l=[];for(let c of e.skills)l.push(await oj({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:r}));return{scope:e.scope,root:n,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function tj(e){let{targets:t,scope:r,root:n,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=jt(c.agent,r,n);if(p===null){s(`${b(c.agent.displayName)} does not support ${r} installation and was skipped.`);continue}let f=a.get(p);f?(f.agents.push(c.agent),f.explicit=f.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let f=p.agents.slice().sort((h,y)=>h.id<y.id?-1:h.id>y.id?1:0);if(Ye(c,o)){l.push({dir:c,agents:f,canonical:!0});continue}if(await qd(n,c)){let h=Zd(c),y=`${b(i(c))} resolves outside ${b(i(n))}`+(h?` (check $${h})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:f,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await Yd(n,c);if(m!==void 0){let h=`${b(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(h),l.push({dir:c,agents:f,canonical:!1,skipReason:"path-conflict",detail:h});continue}if(!(p.explicit||await nj(p.agents,r,n,c))){l.push({dir:c,agents:f,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${b(i(o))}`});continue}l.push({dir:c,agents:f,canonical:!1})}return l}function rj(e,t,r,n){if(t==="global")return Dr.default.dirname(n);let[o]=e.skillsDir.split(/[\\/]/);return Dr.default.join(r,o??e.skillsDir)}async function nj(e,t,r,n){for(let o of e)if(await sj(rj(o,t,r,n)))return!0;return!1}async function oj(e){let{discovered:t,groups:r,storeBase:n,mode:o,force:i,platform:s,display:a}=e,l=Dr.default.join(n,t.dir),c=await aj(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,f=e.recorded!==null&&p===null,m=await Q_({dest:l,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),g=[];for(let v of r){let F=v.canonical?l:Dr.default.join(v.dir,t.dir),E=v.canonical?"canonical":o;if(v.canonical||v.skipReason!==void 0){g.push({agent:eA(v),agents:v.agents.map(U=>U.id),label:tA(v),path:F,link:E,overwrite:v.canonical?m.overwrite:"fresh",blocked:v.canonical?m.blocked:!1,skipped:!v.canonical,...v.skipReason!==void 0?{skipReason:v.skipReason}:{},...v.detail!==void 0?{detail:v.detail}:{}});continue}let S=await Q_({dest:F,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),L=js(S.overwrite)&&!i;g.push({agent:eA(v),agents:v.agents.map(U=>U.id),label:tA(v),path:F,link:E,overwrite:S.overwrite,blocked:L,skipped:!1,...L?{detail:Z_(S,F,a)}:{}})}let h=js(m.overwrite)&&!i,y=g.find(v=>v.blocked),k=h?Z_(m,l,a):y?.detail;return{name:t.name,dir:t.dir,description:t.description,skillPath:t.skillPath,sourceDir:t.path,storePath:l,storeOverwrite:m.overwrite,upToDate:m.upToDate,targets:g,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:p,blocked:h||y!==void 0,...k!==void 0?{detail:k}:{}}}function Z_(e,t,r){return e.problem===void 0?nA(e.overwrite,t,r):`${b(r(t))} could not be verified: ${e.problem} It was not installed by the Webflow CLI, or has been changed since. Re-run with --force to replace it.`}async function Q_(e){let{dest:t,storePath:r,recorded:n,upstream:o,platform:i}=e,s=(c,p,f)=>({overwrite:c,upToDate:p,onDisk:f,blocked:!1}),a;try{a=await ai.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ai.default.promises.readlink(t).catch(()=>null),p=c===null?null:Dr.default.resolve(Dr.default.dirname(t),c);return p!==null&&Ye(p,r)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await or(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:b(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(n===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(n!==null)return Mt(l,n,i)?s("managed-update",Mt(l,o,i),l):s("locally-modified",!1,l);if(Mt(l,o,i)){let c=await rA(t);return c===void 0?s("adoptable",!0,l):{overwrite:"unmanaged",upToDate:!1,onDisk:l,blocked:!1,problem:`it matches the pinned upstream content but also contains "${b(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function rA(e,t="",r=0){if(r>ei)return;let n;try{n=await ai.default.promises.readdir(e,{withFileTypes:!0})}catch{return}n.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of n){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(Zo.has(o.name))return i;let s=await rA(Dr.default.join(e,o.name),i,r+1);if(s!==void 0)return s;continue}if(!o.isFile()||Qo.has(o.name))return i}}function nA(e,t,r=n=>n){let n=b(r(t));return e==="locally-modified"?`${n} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${n} already exists, differs from the pinned upstream content, and was not installed by the Webflow CLI (no lockfile entry). It may be managed by another tool \u2014 the Claude Code plugin marketplace installs the same skills. Re-run with --force to take ownership and replace it.`}async function ij(e){let{groups:t,skills:r,display:n}=e,o=new Map(r.map(s=>[s.name,s.dir]));if(o.size===0)return[];let i=[];for(let s of t){if(s.skipReason!==void 0)continue;let a;try{a=await ai.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,p)=>c.name<p.name?-1:c.name>p.name?1:0);let l=ej;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let p=Dr.default.join(s.dir,c.name,Lt),f;try{f=ti(await ai.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(f);m===void 0||m===c.name||i.push(`${b(n(s.dir))} already contains "${b(c.name)}", whose ${Lt} declares the name "${b(f)}" \u2014 the same skill this install writes to "${b(m)}". Your agent would load it twice; remove one of them.`)}}return i}function Zd(e){let t=Dr.default.resolve(e);for(let r of QN){let n=process.env[r]?.trim();if(n&&ot(n,t))return r}}function eA(e){return e.agents[0]?.id??""}function tA(e){let t=e.agents.map(r=>r.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function sj(e){try{return await ai.default.promises.lstat(e),!0}catch{return!1}}async function aj(e){let t=await or(e);if(t!==null)return t;throw new d(`The extracted skill directory ${b(e)} is no longer present. Re-run the command.`)}Zi();var Bt=1,lA=/^sha256:[0-9a-f]{64}$/,Uy=128,Wy=1024,oA=256,lj=/[\x00-\x1f\x7f]/;function cA(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>Uy?`must be at most ${Uy} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":Ss(e)}function Qd(e){return e.trim()===""?"must not be empty":e.length>Wy?`must be at most ${Wy} characters`:Ss(e)}function iA(e){return(t,r)=>{let n=e(t);n!==null&&r.addIssue({code:B.ZodIssueCode.custom,message:n})}}var uA=B.string().regex(tr,"must be a 40-character lowercase commit SHA"),dA=B.string().regex(kd,"is not a usable git ref for this repository"),sA=B.string().regex(lA,'must look like "sha256:<64 lowercase hex>"'),cj=B.string().min(1,"must not be empty").max(Id).refine(e=>e.trim()!=="","must not be blank").refine(e=>!lj.test(e),"must not contain control characters"),aA=B.string().datetime({offset:!0}),pA=B.object({commit:uA,dir:B.string().superRefine(iA(cA)),skillPath:B.string().superRefine(iA(Qd)).optional(),contentHash:sA.optional(),modeHash:sA.optional(),ref:dA.optional(),agents:B.array(B.string().min(1).max(64)).default([]),mode:B.enum(["symlink","copy"]).default("symlink"),category:B.string().min(1).max(64).optional(),installedAt:aA.optional(),updatedAt:aA.optional()}).passthrough(),fA=B.object({repo:B.string().min(1).max(oA).default(ye),ref:dA.default(Ve),commit:uA.optional(),pluginVersion:B.string().min(1).max(oA).optional()}).passthrough(),mA=B.object({lockfileVersion:B.number().int().min(0),source:fA.default({}),skills:B.record(cj,pA).default({})}).passthrough();function gA(e){return e.length===0?"the lockfile":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function Hy(e){let[t]=e.issues;return t?`${gA([...t.path])} ${t.message}`:"did not match the expected shape"}function ep(e){return mA.safeParse(e)}var tp=w(require("path"));oa();C();var hA="webflow-skills-lock.json",yA="skills-lock.json";function li(e){if(typeof e!="string"||e.trim()==="")throw new d("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return tp.default.join(tp.default.resolve(e),hA)}function ci(){return tp.default.join(wi(),yA)}function Ll(e,t){return e==="global"?ci():li(t??"")}var bA=w(require("fs"));var uj=/^<{7}/m,dj=/^\uFEFF/;async function Hr(e){let t;try{t=await bA.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:pj(c)}}let r=t.replace(dj,"");if(uj.test(r))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(r.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let n;try{n=JSON.parse(r)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:fj(c,r)}}if(n===null||typeof n!="object"||Array.isArray(n))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${wA(n)}, not an object`};let o=n,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${wA(i)})`};let s=typeof i=="number"?i:0;if(s>Bt){let c=ep(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Bt?{...o,lockfileVersion:Bt}:o,l=ep(a);return l.success?s<Bt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:Hy(l.error)}}function pj(e){let t=e.code,r=e instanceof Error?e.message:String(e);return t?`${{EACCES:"permission denied",EPERM:"operation not permitted",EISDIR:"the path is a directory, not a file",ELOOP:"too many symbolic links",ENOTDIR:"a parent path component is not a directory"}[t]??r} (${t})`:r}function fj(e,t){let r=e instanceof Error?e.message:String(e),n=/position (\d+)/.exec(r);if(!n)return r;let o=Number(n[1]);if(!Number.isFinite(o)||o<0)return r;let i=t.slice(0,o),s=i.split(`
267
- `).length,a=o-(i.lastIndexOf(`
268
- `)+1)+1;return`${r.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function wA(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?"a string":typeof e=="number"?"a number":typeof e=="boolean"?"a boolean":typeof e}function Nl(e,t){return e<t?-1:e>t?1:0}function Ms(e){return[...new Set(e)].sort(Nl)}function Bs(e){return{lockfileVersion:Bt,source:{repo:ye,ref:Ve,...e},skills:{}}}function Er(e){return Object.keys(e.skills).sort(Nl)}function rp(e){return Object.keys(e.skills).length===0}function jl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function Vy(e,t){return{...e,skills:{...e.skills,...t}}}function Gy(e,t){return{...e,source:{...e.source,...t}}}function Ky(e,t){let r=[],n=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],r.push(i)):n.push(i);return{lock:{...e,skills:o},removed:r,missing:n}}function Ml(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function Jy(e){let{installedAt:t,updatedAt:r,...n}=e;return n}var DA=require("crypto"),Us=w(require("fs")),Xy=w(require("path"));R();var kA=w(require("path"));C();function np(e){return b(kA.default.basename(e))}function zy(e){return b(e)}function ui(e){let t=np(e.path),r=b(e.detail);if(e.reason==="merge-conflict")return new d(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new d(`Could not read ${t}: ${r}.
269
- ${zy(e.path)}`,{isUserError:!0});let n=e.reason==="invalid-json"?`${t} is not valid JSON: ${r}`:`${t} is not a valid lockfile: ${r}`;return new d(`${n}.
270
- ${zy(e.path)}
271
- Fix the file and re-run. It is not read as empty on purpose \u2014 that would discard the record of every installed skill on the next write.`,{isUserError:!0})}function di(e){return new d(`Your ${np(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Bt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function qy(e,t){return new d(`Refusing to write ${np(e)}: it is at lockfile version ${t} and this CLI supports ${Bt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function Yy(e,t){let r=b(t instanceof Error?t.message:String(t));return new d(`Could not write ${np(e)}: ${r}.
272
- ${zy(e)}
273
- Your skills are on disk but are not recorded, so 'webflow skills update' and 'webflow skills remove' will not see them. Fix the problem and re-run the same install \u2014 it adopts the existing directories and does not need --force.`)}var EA=420,vA=448,SA=8;function op(e){if(Array.isArray(e))return e.map(op);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Nl).map(r=>[r,op(t[r])]))}return e}function mj(e,t){let r={};for(let[n,o]of Object.entries(e.skills)){let i={...o,agents:Ms(o.agents??[])};r[n]=t==="project"?Jy(i):i}return{...e,skills:r}}function xA(e,t){let r=mj(e,t.kind);return`${JSON.stringify(op(r),null,2)}
274
- `}async function CA(e,t,r){if(t.lockfileVersion>Bt)throw qy(e,t.lockfileVersion);let n=Xy.default.resolve(e),o=Xy.default.dirname(n),i=xA(t,r),s=`${n}.${(0,DA.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Us.default.promises.mkdir(o,{recursive:!0,mode:vA});let l=await Us.default.promises.open(s,"wx",EA);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Us.default.promises.rename(s,n),a=!0}catch(l){throw Yy(e,l)}finally{a||await Us.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function Zy(e){try{return await Us.default.promises.unlink(e),!0}catch(t){return t.code!=="ENOENT"&&u.debug(`Could not remove the empty skills state file: ${t instanceof Error?t.message:String(t)}`),!1}}function pi(e){let t=e.batchSize??SA,r=e.lock,n=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await CA(e.path,r,{kind:e.kind}),n=0,i=!1,o+=1)},a=async()=>{n+=1,i=!0,n>=t&&await s()};return{get lock(){return r},get pendingCount(){return n},get flushCount(){return o},async record(l,c){r=Vy(r,{[l]:c}),await a()},async forget(l){let c=Ky(r,[l]);return r=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){r=Gy(r,l),i=!0},flush:s}}var FA="skills_install";async function sp(e,t){let r=Date.now(),n=Vt(),o=n?_.forSkills({authToken:n}):null;try{let i=await gj(e??[],t);await o?.sendUsage(FA,{duration:Date.now()-r,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),FA,{duration:Date.now()-r}),new d(i,{prefix:`${D} Failed to install skills:`,...i instanceof d&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function gj(e,t){let r=t.json===!0||Xe(),n=t.dryRun===!0,o=process.cwd(),i=await Hd({global:t.global,project:t.project,yes:t.yes},o,r),s=t.global!==!0&&t.project!==!0,a=i==="global"?de.home():o,l=Bd({cwd:o,home:de.home()}),c=i==="global"?"global":"project",p=Ll(c,a),f=await Hr(p);if(f.kind==="corrupt")throw ui(f);if(f.kind==="too-new")throw di(f);let m=f.kind==="ok"?f.lock:Bs({ref:t.ref??Ve}),g=Er(m),h=e.length===0&&t.allSkills!==!0&&g.length>0&&(V()||t.yes===!0);await Pl(st(i,a),{dryRun:n});let y=h?bj(m,g,t.ref):[null],k=[],v=[],F=!1,E=[],S=0,L=0;for(let ce of y){let Be=await hj({group:ce,names:e,options:t,scope:i,root:a,lock:m,display:l,json:r});Be!==null&&(k.push(Be.plan),F=F||Be.cacheHit,E=Be.agents,S=Math.max(S,Be.detectedCount),L+=Be.duplicateNameWarnings)}if(k.length===0||k.every(ce=>ce.skills.length===0))return r?u.info(JSON.stringify(Wd(Cj({plan:k[0]??null,scope:i,root:a,lockPath:p,dryRun:n,restore:h,cacheHit:F,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L});let U=k[0];if(n){let ce=RA({plans:k,materialized:[],dryRun:!0,restore:h,cacheHit:F,lockPath:p});if(r)u.info(JSON.stringify(Wd(ce),null,2));else{for(let Be of k)u.info(Ay(Be,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L})}if(t.yes!==!0&&!V()&&r)throw new d(`Installation requires confirmation, and --json cannot prompt.
275
- Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Be of k)u.info(Ay(Be,{dryRun:!1,display:l}));if(!await $e({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L,cancelled:!0})}let N=pi({path:p,kind:c,lock:m}),te=new Date().toISOString();for(let ce of k)for(let Be of ce.skills){let A=await $l(ce,Be);v.push(A);let q=xj({plan:ce,skill:A,skillPath:Be.skillPath,existing:jl(N.lock,A.name),previousAgents:jl(m,A.name)?.agents??[],restore:h,kind:c,now:te});q!==null&&await N.record(A.name,q)}N.updateSource({repo:U.source.repo,ref:U.source.ref,commit:U.source.commit,pluginVersion:U.source.pluginVersion}),await N.flush({force:!0});let G=RA({plans:k,materialized:v,dryRun:!1,restore:h,cacheHit:F,lockPath:p});return r?u.info(JSON.stringify(Wd(G),null,2)):(u.info(P_(G,{display:l})),u.info(`Wrote ${l(p)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(G.failures.length>0||G.summary.blocked>0&&G.summary.installed===0)&&(process.exitCode=1),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:v,agents:E,detectedCount:S,duplicateNameWarnings:L})}async function hj(e){let{group:t,names:r,options:n,scope:o,root:i,lock:s,display:a}=e,l=await As(t===null||t.commit===void 0?{ref:t?.ref??n.ref}:{commit:t.commit,ref:t.ref}),c=await Is(l.root),p=await $s(c.skillsDir,l.root),f=[...c.warnings,...p.warnings],m=await kj({discovered:p.skills,names:r,allSkills:n.allSkills===!0,restoreNames:t?.names,recordedNames:Er(s),warn:E=>f.push(E)});if(m.length===0)return null;let g=t===null?void 0:Ms(t.names.flatMap(E=>jl(s,E)?.agents??[])),h=await yj({scope:o,root:i,options:n,json:e.json,...g!==void 0&&g.length>0?{recordedAgents:g}:{}});for(let E of h.unknownRecorded)f.push(`The lockfile records the agent "${b(E)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=h.source==="explicit"||h.source==="prompt",k=h.agents.map(E=>({agent:E,explicit:y})),v={repo:ye,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},F=await Ol({scope:o,root:i,mode:t?.mode??(n.copy===!0?"copy":"symlink"),force:n.force===!0,source:v,skills:m,targets:k,recorded:s.skills,warnings:f,display:a});return{plan:F,cacheHit:l.fromCache,agents:h.agents,detectedCount:h.detected.length,duplicateNameWarnings:wj(F.warnings)}}async function yj(e){let{scope:t,root:r,options:n,json:o}=e,i={scope:t,cwd:r,options:{agent:n.agent,allAgents:n.allAgents,yes:n.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(n.agent?.length??0)>0||n.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await xl(t,r);if(a.length===0){let l=Pd(nr);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return Rl({...i,detected:a})}return Rl(i)}function wj(e){return e.filter(t=>t.includes("would load it twice")).length}function bj(e,t,r){let n=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=r===void 0?`${i.commit}|${i.mode}`:i.mode,l=n.get(a);if(l){l.names.push(o);continue}n.set(a,{...r===void 0?{commit:i.commit}:{},ref:r??s,mode:i.mode,names:[o]})}return[...n.values()]}async function kj(e){let{discovered:t,names:r,allSkills:n,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let p of o){let f=t.find(m=>m.name===p);if(f===void 0){s(`${b(p)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(f)}return c}let a=t.filter(c=>!c.internal);if(n)return a;if(r.length>0)return r.map(c=>Dj(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new d(`No skills were named. Pass skill names, or --all-skills to install every skill in the catalog (${a.length} available).`,{isUserError:!0,missingFlag:"all-skills"});return vj(a,l)}function Dj(e,t){let r=yn(e,[...t]);if(r.kind==="match")return r.skill;throw r.kind==="ambiguous"?new d(`"${b(e)}" matches more than one skill: ${r.matches.map(n=>b(n.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new d(`No skill matches "${b(e)}".`+(r.candidates.length>0?`
276
- Available: ${r.candidates.map(n=>b(n)).join(", ")}`:""),{isUserError:!0})}var Ej=20,_A=60;async function vj(e,t){let r=new Set(t.map(s=>s.name)),n=[...e].sort((s,a)=>AA(s.category??"",a.category??"")||AA(s.name,a.name)),o=await Cr({message:"Select skills to install",pageSize:Math.min(Ej,Math.max(4,n.length)),choices:n.map(s=>({value:s.name,name:`${b(s.name)} ${Sj(b(s.description))}`,checked:r.has(s.name)})),validate:s=>s.length>0?!0:"Select at least one skill, or press Ctrl-C to cancel."}),i=new Set(o??[]);return n.filter(s=>i.has(s.name))}function AA(e,t){return e<t?-1:e>t?1:0}function Sj(e){return e.length<=_A?e:`${e.slice(0,_A-1)}\u2026`}function xj(e){let{plan:t,skill:r,existing:n,restore:o,kind:i,now:s}=e;if(!(r.storeAction==="written"||r.storeAction==="adopted"||r.storeAction==="unchanged")||r.hashes===null)return null;let l=new Map(t.skills.find(f=>f.name===r.name)?.targets.map(f=>[f.path,f.agents])??[]),c=[];for(let f of r.targets)f.skipped===!0||!f.success||c.push(...l.get(f.path)??[f.agent]);o&&c.push(...e.previousAgents);let p={agents:Ms(c),commit:t.source.commit,contentHash:r.hashes.contentHash,modeHash:r.hashes.modeHash,dir:r.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?Ml(p,{...n?{existing:n}:{},now:s}):p}function RA(e){let{plans:t,materialized:r,dryRun:n,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(p=>p.skills),warnings:[...new Set(t.flatMap(p=>p.warnings))],blocked:t.flatMap(p=>p.blocked)},c=_y({plan:l,materialized:r,dryRun:n});return{plan:l,dryRun:n,restored:o,cacheHit:i,materialized:[...r],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(p=>p.source)}:{}}}function Cj(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:ye,ref:e.options.ref??Ve,commit:"",pluginVersion:""},skills:[],warnings:[],blocked:[]};return{plan:e.plan??t,dryRun:e.dryRun,restored:e.restore,cacheHit:e.cacheHit,materialized:[],lockfilePath:e.lockPath,blocked:[],failures:[],summary:{requested:0,installed:0,skipped:0,blocked:0,failed:0,storeWrites:0,symlinks:0,copies:0,symlinkFallbacks:0}}}function ip(e){let t=e.plans[0],r=e.plans.flatMap(i=>i.skills),n={};for(let i of r)n[i.storeOverwrite]=(n[i.storeOverwrite]??0)+1;let o=t?_y({plan:{...t,skills:r,blocked:[]},materialized:e.materialized,dryRun:e.dryRun}):null;return{count:o?.summary.installed??0,scope:e.scope,scopeAutoDetected:e.scopeAutoDetected,mode:t?.mode??(e.options.copy===!0?"copy":"symlink"),agentCount:e.agents.length,agentIds:e.agents.map(i=>i.id),detectedAgentCount:e.detectedCount,sharedDirTargetCount:r.reduce((i,s)=>i+s.targets.filter(a=>a.link==="canonical").length,0),symlinkFallbackCount:o?.summary.symlinkFallbacks??0,symlinkFallbackErrno:[...new Set(e.materialized.flatMap(i=>i.targets.filter(s=>s.symlinkFailed===!0).map(s=>s.errno??"unknown")))].sort(),skillNames:r.map(i=>i.name),refKind:Fj(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:n,blockedCount:o?.summary.blocked??0,skippedCount:o?.summary.skipped??0,warningCount:[...new Set(e.plans.flatMap(i=>i.warnings))].length,restored:e.restore,duplicateNameWarnings:e.duplicateNameWarnings,...e.cancelled===!0?{cancelled:!0}:{}}}function Fj(e){return e===void 0||e===Ve?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}Y();C();we();R();j();Z();var ap=w(require("fs")),Ws=w(require("path"));var _j=256;async function IA(e){let{scope:t,lock:r}=e,n=Ws.default.resolve(e.root),o=st(t,n),i=e.display??(p=>p),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let p of Object.keys(r.skills).sort()){let f=r.skills[p];c.add(f.dir),l.push(await Aj({name:p,entry:f,scope:t,root:n,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await Pj({scope:t,root:n,store:o,recordedDirs:c})),{scope:t,root:n,store:o,lockfile:e.lockfile,source:r.source,skills:l,warnings:a}}async function Aj(e){let{name:t,entry:r,scope:n,root:o,store:i,platform:s,display:a,warn:l}=e,c=Ws.default.join(i,r.dir),p=Ij(r),f=await or(c),m={name:t,dir:r.dir,description:await $j(c),scope:n,status:"up-to-date",mode:r.mode,storePath:c,recordedHash:r.contentHash??null,onDiskHash:f?.contentHash??null,...r.skillPath!==void 0?{skillPath:r.skillPath}:{},...r.commit!==void 0?{commit:r.commit}:{},...r.ref!==void 0?{ref:r.ref}:{},...r.category!==void 0?{category:r.category}:{},agents:[]},g=[],h;for(let y of r.agents){let k=Br(y);if(k===void 0){g.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${b(t)} records the agent "${b(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let v=jt(k,n,o);if(v===null){g.push({id:y,label:k.displayName,path:null,link:"missing",present:!1});continue}let F=Ws.default.join(v,r.dir);if(Ye(F,c)){g.push({id:y,label:k.displayName,path:F,link:"canonical",present:f!==null});continue}let E=await Tj(F);if(E==="missing"){g.push({id:y,label:k.displayName,path:F,link:"missing",present:!1}),l(`${b(t)} is recorded for ${b(k.displayName)} but ${b(a(F))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let S=!1;if(r.mode==="copy"&&E==="copy"&&p!==null){let L=await or(F);S=L===null||!Mt(L,p,s),S&&h===void 0&&(h=k.displayName)}g.push({id:y,label:k.displayName,path:F,link:E,present:!0,...S?{diverged:!0}:{}})}return{...m,agents:g,...Rj({onDisk:f,recorded:p,platform:s,divergedLabel:h})}}function Rj(e){let{onDisk:t,recorded:r,platform:n,divergedLabel:o}=e;return t===null?{status:"missing"}:r!==null&&!Mt(t,r,n)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${b(o)} copy diverges`}:{status:"up-to-date"}}function Ij(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function Tj(e){try{let t=await ap.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function Pj(e){let{scope:t,store:r,recordedDirs:n}=e,o;try{o=await ap.default.promises.readdir(r,{withFileTypes:!0})}catch{return[]}let i=[],s=_j;for(let a of[...o].sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0)){if(s<=0)break;if(!a.isDirectory()&&!a.isSymbolicLink()||n.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=Ws.default.join(r,a.name),c=await or(l);if(c===null)continue;let p=await TA(l);p!==null&&DF(p.name)&&i.push({name:p.name,dir:a.name,description:p.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function $j(e){return(await TA(e))?.description??""}async function TA(e){try{let t=await ap.default.promises.readFile(Ws.default.join(e,Lt),"utf8"),r=ti(t);return{name:r.frontmatter.name,description:r.frontmatter.description}}catch{return null}}var PA="skills_list",Oj="name",Lj=dt(ii);async function lp(e){let t=Date.now(),r=Vt(),n=r?_.forSkills({authToken:r}):null;try{let o=await Nj(e);await n?.sendUsage(PA,{duration:Date.now()-t,...o})}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),PA,{duration:Date.now()-t}),new d(o,{prefix:`${D} Failed to list skills:`,...o instanceof d&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function Nj(e){let t=e.json===!0||Xe(),r=process.cwd(),n=Bd({cwd:r,home:de.home()}),o=[],i=Mj(e.fields,o),s=Bj(e.sortBy),a=Uj(e.order),l=Wj(e.agent),c=jj(e),p=[],f=0;for(let h of c){let y=h==="global"?de.home():r,k=Ll(h==="global"?"global":"project",y),v=await Hr(k),F;if(v.kind==="ok")F=v.lock;else if(v.kind==="too-new")F=v.lock??Bs(),o.push(`${n(k)} was written by a newer Webflow CLI (lockfile version ${v.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(v.kind==="corrupt"){o.push(`Skipped ${n(k)} \u2014 ${v.detail}. Fix the file and re-run.`);continue}else F=Bs();let E=await IA({scope:h,root:y,lockfile:k,lock:F,display:n});o.push(...E.warnings),f+=E.skills.length,l!==null&&(E.skills=E.skills.filter(S=>S.agents.some(L=>l.has(L.id)))),E.skills.sort(M_(s,a)),p.push(E)}let m=Ry(p);if(t)return u.info(JSON.stringify(j_({inventories:p,warnings:o}),null,2)),Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&f>0?`No skills are linked into ${[...l].sort().join(", ")}. ${f} ${f===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${f===1?"it":"them"}.`:Iy);for(let h of Ud(o))u.info(h);return Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}let g=[];for(let h of p){if(h.skills.length===0)continue;let y=L_(h.skills,{store:h.store,display:n});g.push([N_(h,{display:n}),"",$_(h.skills,i),...y===""?[]:["",y]].join(`
277
- `))}u.info(g.join(`
278
-
279
- `));for(let h of Ud(o))u.info(h);return Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}function jj(e){if(e.global===!0&&e.project===!0)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function Mj(e,t){let r=(e??Tl).split(",").map(i=>i.trim()).filter(Boolean),{valid:n,invalid:o}=Lj(r);if(n.length===0)throw new d(`No valid fields specified. Available: ${ii.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${ii.join(", ")}`),n}function Bj(e){if(e===void 0||e==="")return Oj;let t=Ns.find(r=>r===e.trim().toLowerCase());if(t===void 0)throw new d(`Cannot sort by "${e}". Available: ${Ns.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function Uj(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new d(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function Wj(e){let t=Os(e);return t.length===0?null:new Set(Ls(t).map(r=>r.id))}function Qy(e){let t=new Set;for(let r of e.inventories)for(let n of r.skills)for(let o of n.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(r=>r.scope),statusCounts:{upToDate:e.summary.upToDate,modified:e.summary.modified,missing:e.summary.missing,unmanaged:e.summary.unmanaged},agentIds:[...t].sort(),json:e.json,fieldCount:e.fields.length,agentFiltered:e.agentFilter!==null}}var Ft=w(require("fs")),Bl=w(require("os")),at=w(require("path"));Y();C();we();Oe();R();j();Z();async function pp(e,t){let r=Date.now(),n=s1();try{let o=t.json===!0||Xe(),i=await Hj(e,t,o);await n?.sendUsage("skills_remove",{duration:Date.now()-r,count:i.summary.requested,removed:i.summary.removed,storeDeleted:i.summary.storeDeleted,storeKept:i.summary.storeKept,failed:i.summary.failed,dryRun:i.dryRun,agentFiltered:i.agents!==null}),t1(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-r,dryRun:t.dryRun===!0}),o instanceof d?o:new d(o,{prefix:`${D} Failed to remove skills:`})}}async function Hj(e,t,r){let n=process.cwd(),o=[],i=t.dryRun===!0,s=await Hd(t,n,r),a=s==="global"?Bl.default.homedir():n,l=st(s,a),c=s==="global"?ci():li(a),p=await Hr(c);if(p.kind==="corrupt")throw ui(p);if(p.kind==="too-new")throw di(p);let f=p.kind==="ok"?p.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=Os(t.agent),h=m.length===0||m.includes(Al)?null:Ls(m).map(A=>A.id),y=Ur(s),k=await Vj({agents:y,scope:s,root:a,storeBase:l,warnings:o}),v=jA(k.dirNames,f),F=await Kj({names:e,options:t,identities:v,scope:s,cwd:n,json:r,warnings:o});if(F.length===0)return NA({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let E=new Set(h??[...ni,nr]);if(h?.includes(nr))for(let A of F){let q=(A.entry?.agents??[]).filter(W=>W!==nr&&!E.has(W));if(q.length>0)throw new d(`Cannot remove the shared store for "${b(A.name)}" while ${q.map(W=>b(W)).join(", ")} still link to it.
280
- Remove those first, or run \`webflow skills remove ${b(A.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${D} Cannot remove skills:`})}let S=[];for(let A of F)S.push(await zj({identity:A,agents:h===null?y:y.filter(q=>h.includes(q.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:E}));if(i)return{...ew({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:S.map(A=>o1(A,s)),summary:{requested:S.length,removed:0,storeDeleted:S.filter(A=>A.storeWillBeDeleted).length,storeKept:S.filter(A=>A.onDisk&&!A.storeWillBeDeleted).length,staleLockEntriesRemoved:S.filter(A=>!A.onDisk).length,failed:0},lockfileEmpty:n1(f,S),lockfileDeleted:!1};if(!await e1(S,s,t,r))return r||u.info("Removal cancelled \u2014 no changes made."),NA({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let L=new Set(k.skillDirs),U=pi({path:c,kind:s,lock:f}),N=[],te=[],G=[];for(let A of S){let q=F.find(W=>W.dir===A.dir);te.push(await Yj({plan:A,identity:q,scope:s,root:a,storeBase:l,knownDirs:L,writer:U,failures:N,removedDirectories:G}))}await U.flush({force:!0});let ce=rp(U.lock),Be=!1;return ce&&s==="global"&&(Be=await Zy(c)),{...ew({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:te,removedDirectories:G,failures:N,summary:{requested:S.length,removed:te.filter(A=>A.success).length,storeDeleted:te.filter(A=>A.storeAction==="deleted").length,storeKept:te.filter(A=>A.storeAction==="kept").length,staleLockEntriesRemoved:te.filter(A=>A.storeAction==="absent"&&A.lockEntry==="removed").length,failed:N.length},lockfileEmpty:ce,lockfileDeleted:Be}}async function Vj(e){let{agents:t,scope:r,root:n,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...rw(t,r,n,l)]){if(await i1(c)){i.push(`${Ul(c)} is a symbolic link, not a directory. Skills are not removed through one \u2014 repoint or replace it, then re-run.`);continue}a.add(c);let p;try{p=await Ft.default.promises.readdir(c,{withFileTypes:!0})}catch(f){let m=f.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${Ul(c)}: ${tw(f)}`);continue}for(let f of p)(f.isDirectory()||f.isSymbolicLink())&&s.add(f.name)}return{dirNames:s,skillDirs:a}}function rw(e,t,r,n){let o=new Set;for(let i of e){try{let a=jt(i,t,r);if(a!==null){if(ot(r,a))o.add(a);else if(n){let l=Zd(a);n(`${Ul(a)} resolves outside ${Ul(r)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=at.default.resolve(r,...i.skillsDir.split("/"));s.startsWith(at.default.resolve(r)+at.default.sep)&&o.add(s)}return[...o]}function jA(e,t){let r=new Map;for(let n of e)r.set(n,{name:n,dir:n,folderName:n,entry:null});for(let n of Er(t)){let o=t.skills[n];r.set(o.dir,{name:n,dir:o.dir,folderName:o.skillPath?Zn(o.skillPath):o.dir,entry:o})}return[...r.values()]}function cp(e){return e.entry===null}function Gj(e){return new d(`"${b(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
281
- It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${D} Refusing to remove an unmanaged skill directory:`})}async function Kj(e){let{names:t,options:r,identities:n,scope:o,cwd:i,json:s,warnings:a}=e,l=r.force===!0,c=n.filter(g=>!cp(g)),p=n.filter(cp);if(t.length>0){let g=[];for(let h of t){let y=yn(h,n);if(y.kind==="match"){if(!l&&cp(y.skill))throw Gj(y.skill);g.includes(y.skill)||g.push(y.skill);continue}throw y.kind==="ambiguous"?new d(`"${b(h)}" matches ${y.matches.length} installed skills: ${y.matches.map(k=>b(k.dir)).join(", ")}.
282
- Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot remove skills:`}):await Jj(h,y.candidates,o,i)}return g}if(r.all)return l?n:($A(p,a),c);if(V()||s)throw new d("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${D} Nothing to remove:`});let f=l?n:c;return l||$A(p,a),f.length===0?[]:await Cr({message:`Which skills should be removed (${o} scope)?`,choices:f.map(g=>({value:g,name:`${b(g.dir)}${cp(g)?" (not in the lockfile)":""}`})),validate:g=>g.length>0?!0:"Select at least one skill."})??[]}function $A(e,t){e.length!==0&&t.push(`${e.length} skill ${e.length===1?"directory":"directories"} have no lockfile entry and were left untouched: ${e.map(r=>b(r.dir)).join(", ")}. Pass --force to remove them too.`)}async function Jj(e,t,r,n){let o=r==="project"?"global":"project",i=o==="global"?Bl.default.homedir():n,s=o==="global"?ci():li(i),a=await Hr(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await Ft.default.promises.readdir(st(o,i)).catch(()=>[]);if(yn(e,jA(c,l)).kind!=="none")return new d(`"${b(e)}" is not installed at ${r} scope (${Ul(r==="global"?Bl.default.homedir():n)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${D} Cannot remove skills:`})}}return new d(`"${b(e)}" is not installed at ${r} scope.
283
- `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>b(l)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot remove skills:`})}async function zj(e){let{identity:t,agents:r,scope:n,root:o,storeBase:i,removalTargets:s}=e,a=at.default.join(i,t.dir),l=new Map;for(let m of r)for(let g of rw([m],n,o)){let h=at.default.join(g,t.dir);if(Ye(h,a))continue;let y=l.get(h);if(y){y.agents.push(m.id);continue}await dp(h)&&l.set(h,{agent:m.id,agents:[m.id],label:m.displayName,path:h})}let c=[...l.values()].sort((m,g)=>m.path<g.path?-1:m.path>g.path?1:0),{deleted:p,keptBecause:f}=await qj({identity:t,allAgents:e.allAgents,scope:n,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await dp(a),targets:c,storeWillBeDeleted:p,keptBecause:f}}async function qj(e){let{identity:t,removalTargets:r}=e,n=t.entry?.agents??[];if(n.length>0){let i=n.filter(s=>!r.has(s)).sort((s,a)=>s<a?-1:s>a?1:0);return{deleted:i.length===0,keptBecause:i}}let o=[];for(let i of e.allAgents)if(!r.has(i.id))for(let s of rw([i],e.scope,e.root)){let a=at.default.join(s,t.dir);if(!Ye(a,at.default.join(e.storeBase,t.dir))&&await dp(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function Yj(e){let{plan:t,identity:r,scope:n,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let f of t.targets){let m=await dp(f.path);try{await OA({target:f.path,slug:t.dir,knownDirs:o,root:e.root}),await LA(f.path),a.push({...f,action:m?"unlinked":"absent",error:null})}catch(g){l=!0;let h=tw(g);s.push({name:r.name,agent:f.agent,...up(g)!==void 0?{errno:up(g)}:{},message:h}),a.push({...f,action:"failed",error:h})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await OA({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await LA(t.storePath),c="deleted"}catch(f){l=!0,c="failed",s.push({name:r.name,...up(f)!==void 0?{errno:up(f)}:{},message:tw(f)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let p="absent";return!l&&r.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(r.name,{...r.entry,agents:t.keptBecause}),p="updated"):p=await i.forget(r.name)?"removed":"absent"),l||e.removedDirectories.push(...await Zj({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:n})),{name:r.name,dir:t.dir,scope:n,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:p,targets:a,success:!l,error:null}}async function OA(e){let{target:t,slug:r,knownDirs:n,root:o}=e;if(at.default.basename(t)!==r)throw new d(`Refusing to delete ${b(t)}: its final component is not "${b(r)}".`);let i=at.default.dirname(t),s;try{s=await Ft.default.promises.realpath(i)}catch{throw new d(`Refusing to delete ${b(t)}: its parent directory ${b(i)} could not be resolved.`)}if(!await Xj(n,s))throw new d(`Refusing to delete ${b(t)}: ${b(i)} is not a known skills directory.`);let l=await Ft.default.promises.realpath(o).catch(()=>o);if(Ye(s,l))throw new d(`Refusing to delete ${b(t)}: ${b(i)} resolves to the scope root itself, not to a skills directory.`);Me(l,at.default.join(s,at.default.basename(t)),"a skill directory being removed")}async function Xj(e,t){for(let r of e){if(Ye(r,t))return!0;let n=await Ft.default.promises.realpath(r).catch(()=>null);if(n!==null&&Ye(n,t))return!0}return!1}async function LA(e){let t=null;try{t=await Ft.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await Ft.default.promises.rm(e,{force:!0});return}await Ft.default.promises.rm(e,{recursive:!0,force:!0})}async function Zj(e){let t=[],r=new Set([e.root,Bl.default.homedir(),at.default.dirname(e.root)].map(o=>at.default.resolve(o))),n=[];for(let o of e.targets)n.push(at.default.dirname(o.path));e.storeDeleted&&n.push(e.storeBase,at.default.dirname(e.storeBase));for(let o of n){let i=at.default.resolve(o);if(!r.has(i)&&ot(e.root,i))try{let s=await Ft.default.promises.realpath(i);if(r.has(s)||!await Qj(e.root,s))continue;await Ft.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function Qj(e,t){let r=await Ft.default.promises.realpath(e).catch(()=>e);return ot(r,t)&&!Ye(r,t)}async function e1(e,t,r,n){if(r.yes)return!0;if(V()||n)throw new d(`Removal requires confirmation in non-interactive mode.
284
- Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot remove skills:`});return u.info(Ty(e,t)),$e({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function t1(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${X} ${b(r)}`);if(e.dryRun){u.info(Ty(e.skills.map(r=>({name:r.name,dir:r.dir,storePath:r.storePath,onDisk:r.storeAction!=="absent",targets:r.targets,storeWillBeDeleted:r.storeAction==="deleted",keptBecause:r.keptBecause})),e.scope,{dryRun:!0}));return}u.info(U_(e))}function r1(e,t){let r=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&r.add(i)}if(r.size!==1)return null;let[n]=[...r];return n==="copy"?"copy":"symlink"}function ew(e){return{kind:"skills.remove",schemaVersion:eo,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:r1(e.plans,e.lock),source:{...e.lock.source},agents:e.filterIds,skills:[],removedDirectories:[],failures:[],summary:{requested:0,removed:0,storeDeleted:0,storeKept:0,staleLockEntriesRemoved:0,failed:0},lockfileEmpty:!1,lockfileDeleted:!1,warnings:[...new Set(e.warnings)]}}function NA(e){return{...ew(e),lockfileEmpty:rp(e.lock)}}function n1(e,t){let r=new Set(t.filter(n=>n.keptBecause.length===0).map(n=>n.name));return Er(e).every(n=>r.has(n))}function o1(e,t){return{name:e.name,dir:e.dir,scope:t,storePath:e.storePath,storeAction:e.onDisk?e.storeWillBeDeleted?"deleted":"kept":"absent",keptBecause:e.keptBecause,lockEntry:e.keptBecause.length>0?"updated":"removed",targets:e.targets.map(r=>({...r,action:"unlinked",error:null})),success:!0,error:null}}async function i1(e){try{return(await Ft.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function dp(e){try{return await Ft.default.promises.lstat(e),!0}catch{return!1}}function up(e){let t=e?.code;return typeof t=="string"?t:void 0}function tw(e){return b(e instanceof Error?e.message:String(e))}function s1(){let e=Vt();return e?_.forSkills({authToken:e}):null}function Ul(e){return oi(e)}var Hs=w(require("fs")),UA=w(require("os")),vr=w(require("path"));Y();C();we();Oe();R();j();Z();function WA(e){let{presence:t,upstream:r,local:n,force:o}=e;if(!e.hasSkillPath){if(!e.foundByName)return{guard:"G2",state:"untracked",action:"skipped",willWrite:!1,blocked:!1,reason:"tracking-unrepairable"};let c=n==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:n==="absent"||r==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(n==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(n==="absent")return{guard:"G4",state:"missing",action:"reinstalled",willWrite:!0,blocked:!1,reason:"store-directory-missing"};if(t==="missing")return{guard:"G5",state:"removed-upstream",action:"orphaned",willWrite:!1,blocked:!1,reason:n==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":n==="differs"?r==="differs"?"conflict":"locally-modified":r==="differs"?"upstream-changed":"unchanged";if(n==="same")return i?{guard:"grid",state:s,action:r==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:r==="differs"?{guard:"grid",state:s,action:"updated",willWrite:!0,blocked:!1,reason:null}:{guard:"grid",state:s,action:"unchanged",willWrite:!1,blocked:!1,reason:null};let a=i?r==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":r==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?r==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&r==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function fp(e,t){let r=Date.now(),n=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});let i=R1(),s=t.json===!0||Xe();try{let a=await a1({names:e,options:t,checkOnly:n,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-r,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:n,force:o,scopeCount:a.scopes.length}),_1(a,s),(a.failures.length>0||!n&&a.summary.conflicts>0&&a.summary.updated===0)&&(process.exitCode=1)}catch(a){throw await i?.sendError(a instanceof Error?a:new Error(String(a)),"skills_update",{duration:Date.now()-r,checkOnly:n,force:o}),a instanceof d?a:new d(a,{prefix:`${D} Failed to update skills:`})}}async function a1(e){let{names:t,options:r,checkOnly:n,force:o,json:i}=e,s=[],a=process.cwd(),l=await l1(r,a,n,s);if(l.length===0)return ow({checkOnly:n,force:o,warnings:s});let c=c1(l,t,r);if(c.length===0)return ow({checkOnly:n,force:o,warnings:s,scopes:l.map(S=>S.scope)});let p=new Map;for(let{state:S,key:L}of c){let U=nw(r,S.lock,L);p.has(U)||p.set(U,(await kl(U)).commit)}let f=new Map;for(let{state:S,key:L}of c){let U=S.lock.skills[L];f.set(`${S.scope}\0${L}`,await f1(S,U))}let m=c.every(({state:S,key:L})=>{let U=S.lock.skills[L];return p.get(nw(r,S.lock,L))===U.commit}),g=c.every(({state:S,key:L})=>f.get(`${S.scope}\0${L}`)!==null);if(m&&g&&r.ref===void 0&&!o)return F1({selected:c,states:l,localDigests:f,refs:p,options:r,checkOnly:n,force:o,warnings:s});let h=new Map;for(let S of new Set(p.values()))h.set(S,await p1(S,s));let y=[],k=[];for(let{state:S,key:L}of c){let U=S.lock.skills[L],N=nw(r,S.lock,L),te=p.get(N),G=h.get(te);try{y.push(await m1({state:S,key:L,entry:U,ref:N,commit:te,catalog:G,force:o,checkOnly:n,localDigest:f.get(`${S.scope}\0${L}`)??null,warnings:s}))}catch(ce){k.push({name:L,errno:BA(ce),message:iw(ce)})}}let v=y.filter(S=>S.localDrift==="differs"&&S.outcome.willWrite);if(!n&&v.length>0&&!await v1(v,r,i))return ow({checkOnly:n,force:o,warnings:s,scopes:l.map(L=>L.scope),cancelled:!0});let F=new Map,E=[];if(!n)for(let S of l)S.readOnly||await Pl(S.storeBase,{dryRun:!1});for(let S of y)try{E.push(await y1({candidate:S,checkOnly:n,force:o,options:r,writers:F,failures:k,warnings:s}))}catch(L){k.push({name:S.key,errno:BA(L),message:iw(L)}),E.push(S1(S,iw(L)))}if(r.ref!==void 0&&!n)for(let S of l)S.readOnly||HA(S,F);for(let[S,L]of F){let U=l.find(ce=>ce.scope===S),N=r.ref??U.lock.source.ref??Ve,te=p.get(N)??y.find(ce=>ce.scopeState.scope===S)?.commit,G=JA(h);L.updateSource({ref:N,...te!==void 0?{commit:te}:{},...G!==void 0?{pluginVersion:G}:{}}),await L.flush({force:!0})}return C1({reports:E,candidates:y,failures:k,states:l,refs:p,catalogs:h,options:r,checkOnly:n,force:o,warnings:s})}async function l1(e,t,r,n){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?UA.default.homedir():t,l=s==="global"?ci():li(a),c=await Hr(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ui(c);if(c.kind==="too-new"){if(!r||c.lock===null)throw di(c);n.push(`${Hl(l)} was written by a newer Webflow CLI (lockfile version ${c.version}); reporting read-only.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:st(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&n.push(`${Hl(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:st(s,a),readOnly:r})}}return i}function c1(e,t,r){if(t.length===0)return e.flatMap(s=>Er(s.lock).map(a=>({state:s,key:a})));let n=r.global===!0||r.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=yn(s,d1(l.lock));if(c.kind==="ambiguous")throw new d(`"${b(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(p=>b(p.name)).join(", ")}.
285
- Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw u1(s,e);if(a.length>1&&!n)throw new d(`"${b(s)}" is installed at more than one scope:
286
- `+a.map(l=>` ${l.state.scope}: ${Hl(l.state.lockPath)}`).join(`
287
- `)+`
288
- Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function u1(e,t){let r=t.flatMap(n=>Er(n.lock).map(o=>n.lock.skills[o]?.dir??o));return new d(`"${b(e)}" is not installed.
289
- `+(r.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(r)].sort().map(n=>b(n)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot update skills:`})}function d1(e){return Er(e).map(t=>{let r=e.skills[t];return{name:t,dir:r.dir,folderName:r.skillPath?Zn(r.skillPath):r.dir}})}function nw(e,t,r){return e.ref??t.skills[r]?.ref??t.source.ref??Ve}async function p1(e,t){let r=await As({commit:e}),n=await Is(r.root),o=await $s(n.skillsDir,r.root);return t.push(...n.warnings,...o.warnings),{commit:e,root:r.root,pluginVersion:n.version,skills:o.skills}}async function f1(e,t){let r=vr.default.join(e.storeBase,t.dir),n=await or(r);if(n===null)return null;if(t.mode!=="copy")return n;let o=aw(t);if(o===null)return n;for(let i of A1(t)){let s=jt(i,e.scope,e.root);if(s===null)continue;let a=await or(vr.default.join(s,t.dir));if(a!==null&&!Mt(a,o))return a}return n}async function m1(e){let{state:t,key:r,entry:n,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=aw(n),p=vr.default.join(t.storeBase,n.dir),f=g1(n,s,l,r),m=s.skills.find(te=>te.name===r)??null,g=f!==null?"exists":m!==null?"moved":"missing",h=g==="exists"?f:g==="moved"?m.path:null,y=h===null?null:await or(h),k=e.localDigest===null?"absent":c===null||Mt(e.localDigest,c)?"same":"differs",v=Mt(y,c)?"same":"differs",F=WA({hasSkillPath:typeof n.skillPath=="string"&&n.skillPath!=="",foundByName:m!==null,presence:g,upstream:v,local:k,force:a}),E=g==="moved"&&m!==null?m.dir:n.dir,S=g==="exists"?n.skillPath:g==="moved"?m.skillPath:n.skillPath??null,{agents:L,dropped:U}=h1(t,n,l),N=h===null||S===null?null:{name:r,dir:E,folderName:Zn(S),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:h,skillPath:S,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:r,entry:n,dir:n.dir,newDir:E,storeDir:p,mode:n.mode,agents:L,droppedAgents:U,presence:g,upstreamDrift:v,localDrift:k,outcome:F,recorded:c,onDisk:e.localDigest,upstream:y,discovered:N,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:x1(F,{key:r,storeDir:p,recordedSkillPath:n.skillPath??null,newSkillPath:S,checkOnly:e.checkOnly})}}function g1(e,t,r,n){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Qd(o);if(i!==null)return r.push(`The recorded path for "${b(n)}" ${i}; locating it by name instead.`),null;let s=vr.default.resolve(t.root,...o.split("/"));return Me(t.root,s,"the recorded skill path"),Hs.default.existsSync(s)?vr.default.dirname(s):null}function h1(e,t,r){let n=[],o=[];for(let i of t.agents??[]){if(i===nr){n.push(i);continue}let s=Br(i);if(s===void 0){n.push(i);continue}if(jt(s,e.scope,e.root)===null){o.push(i),r.push(`${b(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}n.push(i)}return{agents:n,dropped:o}}async function y1(e){let{candidate:t,checkOnly:r,force:n,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Wl(t,r,[]);let l=await w1(t,n),c=new Set(t.droppedAgents);for(let h of l.targets)if(h.skipReason==="agent-dir-absent")for(let y of h.agents)c.add(y);e.warnings.push(...l.warnings);let p=t.agents.filter(h=>!c.has(h));if(p.length===0&&p.push(nr),r)return Wl(t,!0,l.targets.map(h=>sw(h)),[...c]);let f,m=t.onDisk;if(a.willWrite){let h=await $l(l.plan,l.skill);if(f=h.targets.map((y,k)=>VA(y,l.targets[k])),m=h.hashes,!h.success||h.storeAction==="failed"){let y=h.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let k of h.targets)!k.success&&k.error&&s.push({name:t.key,agent:k.agent,...k.errno!==void 0?{errno:k.errno}:{},message:k.error});return{...Wl(t,!1,f,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await k1(t,l.targets)}else{f=[];for(let h of l.targets)f.push(await b1(t,h))}let g=p.length!==(t.entry.agents??[]).length||p.some((h,y)=>(t.entry.agents??[])[y]!==h);return D1(t,a,g,o)&&!t.scopeState.readOnly&&await HA(t.scopeState,i).record(t.key,E1(t,m,a,o,p)),Wl(t,!1,f,[...c])}async function w1(e,t){let r={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},n=[];for(let s of e.agents){if(s===nr)continue;let a=Br(s);a!==void 0&&n.push({agent:a,explicit:!1})}let o=await Ol({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:r,skills:[e.discovered],targets:n,recorded:e.scopeState.lock.skills,platform:process.platform,display:Hl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function b1(e,t){if(t.skipped||t.link==="canonical")return sw(t);if(t.overwrite!=="fresh")return{...sw(t),action:"unchanged"};let r=await Xd({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...VA(r,t),action:r.success?"relinked":"failed"}}async function k1(e,t){let r=e.dir,n=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>vr.default.dirname(i.path))];for(let i of new Set(o)){let s=vr.default.join(i,r);if(vr.default.basename(s)===r&&s!==vr.default.join(i,e.newDir))try{let a=await Hs.default.promises.realpath(i);if(!ot(n,a))continue;await vs(n,vr.default.join(a,r),"a renamed skill directory"),(await Hs.default.promises.lstat(s)).isSymbolicLink()?await Hs.default.promises.rm(s,{force:!0}):await Hs.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function D1(e,t,r,n){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||n.ref!==void 0&&n.ref!==e.entry.ref?!0:r}function E1(e,t,r,n,o){let i=r.willWrite,s={...e.entry,commit:i?e.commit:e.entry.commit,dir:i?e.newDir:e.entry.dir,agents:[...o],mode:e.mode,...e.discovered!==null?{skillPath:e.discovered.skillPath}:{},...n.ref!==void 0?{ref:n.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?Ml(s,{existing:e.entry,now:new Date().toISOString()}):s}function HA(e,t){let r=t.get(e.scope);if(r)return r;let n=pi({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,n),n}async function v1(e,t,r){if(t.yes)return!0;if(V()||r)throw new d(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
290
- `+e.map(n=>` ${b(n.key)}`).join(`
291
- `)+`
292
- Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let n of e)u.warn(` ${b(n.key)}`);return $e({message:"Discard local changes and replace with upstream?",default:!1})}function Wl(e,t,r,n=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:GA(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!n.includes(o)),droppedAgents:n,reason:e.outcome.reason,detail:e.detail,fromCommit:e.entry.commit,toCommit:e.outcome.willWrite?e.commit:null,skillPath:e.discovered?.skillPath??e.entry.skillPath??null,targets:r}}function S1(e,t){return{...Wl(e,!1,[]),state:"failed",action:"failed",detail:t}}function sw(e){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.overwrite==="fresh"?"relinked":"unchanged",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:!1,errno:null,error:e.detail??null}}function VA(e,t){return{agent:e.agent,agents:t?.agents??[e.agent],label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.success?"linked":"failed",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:e.symlinkFailed===!0,errno:e.errno??null,error:e.error??null}}function GA(e,t){if(!t)return e;switch(e){case"updated":return"would-update";case"moved":return"would-move";case"moved+updated":return"would-move-and-update";case"reinstalled":return"would-reinstall";case"repaired":return"would-repair";default:return e}}function x1(e,t){let r=b(t.key),{checkOnly:n}=t;switch(e.reason){case"tracking-unrepairable":return"update tracking is missing and no upstream skill declares this name; nothing was changed.";case"not-on-disk-and-removed-upstream":return`not on disk and no longer published upstream. Clear the entry with \`webflow skills remove ${r}\`.`;case"store-directory-missing":return n?"the store directory is missing and would be restored.":"the store directory was missing and has been restored.";case"removed-upstream":return`no longer published upstream. Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"locally-modified":return e.willWrite?MA(n):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?MA(n):`updating would discard your edits. Review ${Hl(t.storeDir)}, then run \`webflow skills update ${r} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${b(t.recordedSkillPath)} \u2192 ${b(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?n?"moved upstream; local changes would be discarded.":"moved upstream; local changes were discarded.":"moved upstream AND locally modified. Re-run with --force.";case"moved-upstream-changed-upstream-and-locally-modified":return e.willWrite?n?"moved and changed upstream; local changes would be discarded.":"moved and changed upstream; local changes were discarded.":"moved upstream, changed upstream, AND locally modified. Re-run with --force.";default:return null}}function MA(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function C1(e){let{reports:t,candidates:r,failures:n,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ve;return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,scopes:o.map(c=>c.scope),source:{repo:a?.lock.source.repo??"",ref:l,recordedCommit:a?.lock.source.commit??null,resolvedCommit:i.get(l)??null,recordedPluginVersion:a?.lock.source.pluginVersion??null,resolvedPluginVersion:JA(e.catalogs)??null,upToDate:!1},skills:t,blocked:r.filter(c=>c.outcome.blocked).map(c=>({name:c.key,dir:c.dir,scope:c.scopeState.scope,state:c.outcome.state,reason:c.outcome.reason,requiredFlag:"--force"})),failures:n,summary:KA(t,n,e.checkOnly),warnings:[...new Set(e.warnings)]}}function KA(e,t,r){let n=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:n("upstream-changed","renamed-upstream","missing","untracked"),unchanged:n("unchanged"),locallyModified:n("locally-modified"),conflicts:n("conflict"),removedUpstream:n("removed-upstream","stale-entry"),updated:r?0:e.filter(i=>o.has(i.action)).length,relinked:e.reduce((i,s)=>i+s.targets.filter(a=>a.action==="relinked").length,0),unlinked:e.reduce((i,s)=>i+s.droppedAgents.length,0),blocked:e.filter(i=>i.action==="blocked").length,failed:t.length}}function F1(e){let{selected:t,states:r,localDigests:n,refs:o,options:i}=e,s=r[0],a=i.ref??s?.lock.source.ref??Ve,l=t.map(({state:c,key:p})=>{let f=c.lock.skills[p],m=aw(f),g=n.get(`${c.scope}\0${p}`)??null,h=m!==null&&!Mt(g,m);return{name:p,dir:f.dir,scope:c.scope,guard:"grid",state:h?"locally-modified":"unchanged",action:h?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:g?.contentHash??null,agents:f.agents??[],droppedAgents:[],reason:h?"locally-modified":null,detail:h?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:f.commit,toCommit:null,skillPath:f.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,scopes:r.map(c=>c.scope),source:{repo:s?.lock.source.repo??"",ref:a,recordedCommit:s?.lock.source.commit??null,resolvedCommit:o.get(a)??null,recordedPluginVersion:s?.lock.source.pluginVersion??null,resolvedPluginVersion:s?.lock.source.pluginVersion??null,upToDate:!0},skills:l,blocked:[],failures:[],summary:KA(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function ow(e){return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:Ve,recordedCommit:null,resolvedCommit:null,recordedPluginVersion:null,resolvedPluginVersion:null,upToDate:!0},skills:[],blocked:[],failures:[],summary:{checked:0,outdated:0,unchanged:0,locallyModified:0,conflicts:0,removedUpstream:0,updated:0,relinked:0,unlinked:0,blocked:0,failed:0},warnings:[...new Set(e.warnings)]}}function _1(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${X} ${b(r)}`);u.info(B_(e))}function aw(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function A1(e){let t=[];for(let r of e.agents??[]){let n=Br(r);n!==void 0&&t.push(n)}return t}function JA(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function BA(e){let t=e?.code;return typeof t=="string"?t:void 0}function iw(e){return b(e instanceof Error?e.message:String(e))}function R1(){let e=Vt();return e?_.forSkills({authToken:e}):null}function Hl(e){return oi(e)}var zA=e=>{let t=e.command("skills").description("Install and manage Webflow's first-party agent skills");t.command("install").description(`Install Webflow skills into your coding agents. Writes into your home directory for --global installs; use --dry-run to preview every path first.
293
- With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Cc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(Ea()).addOption(va()).option("--copy","Copy files instead of symlinking from the shared store").option("--ref <branch|sha>","Pin to a branch or 40-character commit SHA (default: main)").option("--force","Replace destinations that were modified locally or installed elsewhere").addOption(Ii()).addOption(_e()).addOption(re()).action(sp),t.command("update").description("Update installed skills to the latest upstream commit. Overwrites files in your agent directories; use --check to report what would change, or --dry-run to preview.").argument("[names...]","Skill names to update (default: all installed)").option("--check","Report what would change without writing anything").addOption(Ea()).addOption(va()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ii()).addOption(_e()).addOption(re()).action(fp),t.command("list").description("List installed skills and the agents they are linked into").addOption(Ea()).addOption(va()).addOption(Cc()).addOption(We([...ii]).default(Tl)).addOption(Pi([...Ns]).default("name")).addOption(Ti()).addOption(re()).action(lp),t.command("remove").description("Remove installed skills. Deletes skill directories and unlinks them from every agent; use --dry-run to preview exactly what is deleted.").argument("[names...]","Skill names to remove (default: choose interactively)").addOption(Cc()).option("--all","Remove every installed skill for the scope").addOption(Ea()).addOption(va()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ii()).addOption(_e()).addOption(re()).action(pp)};var YA=w(ac());function lw(e,t){t.forEach(r=>{e.addOption(r())}),e.commands.forEach(r=>lw(r,t))}function XA(e){let t=YA.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(r,n){return qA.Help.prototype.formatHelp.call(this,r,n).split(`
294
- `).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[dw(o)]:o.trim()===""?[o]:[P(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
294
+ `)}async function _w(e){Q(e.site,"siteId");let t=await R(),r=A.forForms({authToken:t}),n=Date.now();try{let o=await kI(t,e.site);if(await r.sendUsage("forms_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No forms found.");return}let i=Re(e.fields,EI,vI());u.info(SI(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list forms:`}))}}var _I=w(require("fs"));z();C();F();N();X();async function Aw(e){Q(e.site,"siteId"),Q(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await R(),r=A.forForms({authToken:t}),n=Date.now();try{let o=await DI(t,e.site,e.form);if(await r.sendUsage("forms_submissions",{duration:Date.now()-n,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=CI(o);_I.default.writeFileSync(e.output,i,"utf8"),u.info(`${$} ${o.length} submission${o.length===1?"":"s"} written to ${e.output}`);return}if(e.json){u.info(JSON.stringify(o,null,2));return}u.info(xI(o))}catch(o){throw await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to fetch submissions:`})}}var AI=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Nt()).addOption(ee()).addOption(Ke(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(_w),t.command("submissions").description("List or export form submissions").requiredOption("--site <siteId>","Site ID").requiredOption("--form <formId>","Form ID").option("--json","Output as JSON").option("--output <file>","Save submissions as CSV to a file").action(Aw)};var FI=e=>{let t=e.command("skills").description("Install and manage Webflow's first-party agent skills");t.command("install").description(`Install Webflow skills into your coding agents. Writes into your home directory for --global installs; use --dry-run to preview every path first.
295
+ With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Wu()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(dl()).addOption(pl()).option("--copy","Copy files instead of symlinking from the shared store").option("--ref <branch|sha>","Pin to a branch or 40-character commit SHA (default: main)").option("--force","Replace destinations that were modified locally or installed elsewhere").addOption(li()).addOption(_e()).addOption(ee()).action(ms),t.command("update").description("Update installed skills to the latest upstream commit. Overwrites files in your agent directories; use --check to report what would change, or --dry-run to preview.").argument("[names...]","Skill names to update (default: all installed)").option("--check","Report what would change without writing anything").addOption(dl()).addOption(pl()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(li()).addOption(_e()).addOption(ee()).action(Fu),t.command("list").description("List installed skills and the agents they are linked into").addOption(dl()).addOption(pl()).addOption(Wu()).addOption(Ke([...Xo]).default(qa)).addOption(Es([...cs]).default("name")).addOption(Ds()).addOption(ee()).action(Su),t.command("remove").description("Remove installed skills. Deletes skill directories and unlinks them from every agent; use --dry-run to preview exactly what is deleted.").argument("[names...]","Skill names to remove (default: choose interactively)").addOption(Wu()).option("--all","Remove every installed skill for the scope").addOption(dl()).addOption(pl()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(li()).addOption(_e()).addOption(ee()).action(Au)};var RI=w(fc());function Fw(e,t){t.forEach(r=>{e.addOption(r())}),e.commands.forEach(r=>Fw(r,t))}function TI(e){let t=RI.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(r,n){return II.Help.prototype.formatHelp.call(this,r,n).split(`
296
+ `).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[Tw(o)]:o.trim()===""?[o]:[P(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
295
297
  `)+`
296
- `}}).addOption(Uf()).addOption(Ak()).addOption(Hf()).addOption(Vf()).addOption(Gf()).showHelpAfterError(),Ke()&&e.addOption(Wf()),e.hook("preAction",async(r,n)=>{let o=r.opts();if(o.input?r.getOptionValueSource("input")==="cli"&&yb(!0):hb(!0),n.opts().json&&bb(!0),Jr.start(),o.manifest&&kb(o.manifest),Ke()){let i=Ob(o.region);$b(i),u.debug(`Region resolved to "${i}" (--region=${o.region??"unset"}, WEBFLOW_REGION=${process.env.WEBFLOW_REGION??"unset"})`)}else u.debug("Region targeting is beta-gated; not resolved on this build.");try{await _.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!Xe()&&await new pa().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Jr.displayGrouped(),Jr.stop()}),Ok(e),aC(e),dD(e),nv(e),zx(e),Ke()&&Yx(e),rv(e),hC(e),YC(e),iF(e),zA(e),XE(e),e.commands.forEach(r=>{lw(r,[Uf,Hf,...Ke()?[Wf]:[],Vf,Gf])})}R();C();we();var eR=new QA.Command;XA(eR);function I1(e){let t=e instanceof Error?e.message:String(e),r=e instanceof d?e.missingFlag:void 0,n=e instanceof d?e.prefix:void 0,o=n?bt(n).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Gb(e,{prefix:n});let i=JSON.stringify({error:{message:t,context:o,missingFlag:r}});ZA.default.writeSync(1,`${i}
297
- `)}eR.parseAsync().catch(e=>{if(!(e instanceof d&&e.skipLogging))if(Xe())I1(e);else if(e instanceof d)if(e.isUserError){let t=e.prefix?`${e.prefix} `:"";console.error(`${t}${e.message}`)}else u.error(e,{prefix:e.prefix});else u.error(e);process.exit(1)});
298
+ `}}).addOption(xg()).addOption(aS()).addOption(_g()).addOption(Ag()).addOption(Fg()).showHelpAfterError(),Ve()&&e.addOption(Cg()),e.hook("preAction",async(r,n)=>{let o=r.opts();if(o.input?r.getOptionValueSource("input")==="cli"&&jb(!0):Nb(!0),n.opts().json&&Bb(!0),Zr.start(),o.manifest&&Ub(o.manifest),Ve()){let i=rk(o.region);tk(i),u.debug(`Region resolved to "${i}" (--region=${o.region??"unset"}, WEBFLOW_REGION=${process.env.WEBFLOW_REGION??"unset"})`)}else u.debug("Region targeting is beta-gated; not resolved on this build.");try{await A.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!He()&&await new va().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Zr.displayGrouped(),Zr.stop()}),fS(e),IF(e),HS(e),OC(e),wF(e),Ve()&&bF(e),$C(e),MF(e),bI(e),AI(e),FI(e),FC(e),e.commands.forEach(r=>{Fw(r,[xg,_g,...Ve()?[Cg]:[],Ag,Fg])})}F();C();he();var OI=new $I.Command;TI(OI);function TM(e){let t=e instanceof Error?e.message:String(e),r=e instanceof d?e.missingFlag:void 0,n=e instanceof d?e.prefix:void 0,o=n?bt(n).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;pk(e,{prefix:n});let i=JSON.stringify({error:{message:t,context:o,missingFlag:r}});PI.default.writeSync(1,`${i}
299
+ `)}OI.parseAsync().catch(e=>{if(!(e instanceof d&&e.skipLogging))if(He())TM(e);else if(e instanceof d)if(e.isUserError){let t=e.prefix?`${e.prefix} `:"";console.error(`${t}${e.message}`)}else u.error(e,{prefix:e.prefix});else u.error(e);process.exit(1)});
298
300
  //# sourceMappingURL=index.js.map