@webflow/webflow-cli 2.4.0-next.1 → 2.4.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,69 +1,72 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var C_=Object.create;var Wd=Object.defineProperty;var F_=Object.getOwnPropertyDescriptor;var __=Object.getOwnPropertyNames;var A_=Object.getPrototypeOf,I_=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Hd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),by=(e,t)=>{for(var n in t)Wd(e,n,{get:t[n],enumerable:!0})},R_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of __(t))!I_.call(e,o)&&o!==n&&Wd(e,o,{get:()=>t[o],enumerable:!(r=F_(t,o))||r.enumerable});return e};var w=(e,t,n)=>(n=e!=null?C_(A_(e)):{},R_(t||!e||!e.__esModule?Wd(n,"default",{value:e,enumerable:!0}):n,e));var Ey,Ne,Vd,Mt,le,Ft,K,se,R,pe=L(()=>{"use strict";Ey=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,Ne=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,Vd=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Mt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,le=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,Ft=e=>`\x1B[97m${e}\x1B[0m`,K=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,R=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function L_(){let e=new Map;for(let[t,n]of Object.entries(Ae)){for(let[r,o]of Object.entries(n))Ae[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=Ae[r],e.set(o[0],o[1]);Object.defineProperty(Ae,t,{value:n,enumerable:!1})}return Object.defineProperty(Ae,"codes",{value:e,enumerable:!1}),Ae.color.close="\x1B[39m",Ae.bgColor.close="\x1B[49m",Ae.color.ansi=vy(),Ae.color.ansi256=Sy(),Ae.color.ansi16m=xy(),Ae.bgColor.ansi=vy(10),Ae.bgColor.ansi256=Sy(10),Ae.bgColor.ansi16m=xy(10),Object.defineProperties(Ae,{rgbToAnsi256:{value(t,n,r){return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(i=>i+i).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Ae.rgbToAnsi256(...Ae.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,o;if(t>=232)n=((t-232)*10+8)/255,r=n,o=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,r=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(n,r,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>Ae.ansi256ToAnsi(Ae.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>Ae.ansi256ToAnsi(Ae.hexToAnsi256(t)),enumerable:!1}}),Ae}var vy,Sy,xy,Ae,NN,$_,O_,jN,N_,tn,Cy=L(()=>{"use strict";vy=(e=0)=>t=>`\x1B[${t+e}m`,Sy=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,xy=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,Ae={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]}},NN=Object.keys(Ae.modifier),$_=Object.keys(Ae.color),O_=Object.keys(Ae.bgColor),jN=[...$_,...O_];N_=L_(),tn=N_});function Bt(e,t=globalThis.Deno?globalThis.Deno.args:_l.default.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}function j_(){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 M_(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function B_(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=j_();r!==void 0&&(Fl=r);let o=n?Fl:r;if(o===0)return 0;if(n){if(Bt("color=16m")||Bt("color=full")||Bt("color=truecolor"))return 3;if(Bt("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(_l.default.platform==="win32"){let s=_y.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 Fy(e,t={}){let n=B_(e,{streamIsTTY:e&&e.isTTY,...t});return M_(n)}var _l,_y,Gd,Ue,Fl,U_,Ay,Iy=L(()=>{"use strict";_l=w(require("process"),1),_y=w(require("os"),1),Gd=w(require("tty"),1);({env:Ue}=_l.default);Bt("no-color")||Bt("no-colors")||Bt("color=false")||Bt("color=never")?Fl=0:(Bt("color")||Bt("colors")||Bt("color=true")||Bt("color=always"))&&(Fl=1);U_={stdout:Fy({isTTY:Gd.default.isatty(1)}),stderr:Fy({isTTY:Gd.default.isatty(2)})},Ay=U_});function Ry(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,r)+t+n,i=r+o,r=e.indexOf(t,i);while(r!==-1);return s+=e.slice(i),s}function Ty(e,t,n,r){let o=0,i="";do{let s=e[r-1]==="\r";i+=e.slice(o,s?r-1:r)+t+(s?`\r
2
+ "use strict";var z_=Object.create;var Xd=Object.defineProperty;var q_=Object.getOwnPropertyDescriptor;var X_=Object.getOwnPropertyNames;var Y_=Object.getPrototypeOf,Z_=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Py=(e,t)=>{for(var n in t)Xd(e,n,{get:t[n],enumerable:!0})},Q_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of X_(t))!Z_.call(e,o)&&o!==n&&Xd(e,o,{get:()=>t[o],enumerable:!(r=q_(t,o))||r.enumerable});return e};var w=(e,t,n)=>(n=e!=null?z_(Y_(e)):{},Q_(t||!e||!e.__esModule?Xd(n,"default",{value:e,enumerable:!0}):n,e));var Oy,je,Zd,Bt,le,_t,J,se,I,pe=L(()=>{"use strict";Oy=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,je=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,Zd=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Bt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,le=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,_t=e=>`\x1B[97m${e}\x1B[0m`,J=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,I=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function oA(){let e=new Map;for(let[t,n]of Object.entries(Te)){for(let[r,o]of Object.entries(n))Te[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=Te[r],e.set(o[0],o[1]);Object.defineProperty(Te,t,{value:n,enumerable:!1})}return Object.defineProperty(Te,"codes",{value:e,enumerable:!1}),Te.color.close="\x1B[39m",Te.bgColor.close="\x1B[49m",Te.color.ansi=Ly(),Te.color.ansi256=Ny(),Te.color.ansi16m=jy(),Te.bgColor.ansi=Ly(10),Te.bgColor.ansi256=Ny(10),Te.bgColor.ansi16m=jy(10),Object.defineProperties(Te,{rgbToAnsi256:{value(t,n,r){return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(i=>i+i).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Te.rgbToAnsi256(...Te.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,o;if(t>=232)n=((t-232)*10+8)/255,r=n,o=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,r=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(n,r,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>Te.ansi256ToAnsi(Te.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>Te.ansi256ToAnsi(Te.hexToAnsi256(t)),enumerable:!1}}),Te}var Ly,Ny,jy,Te,cj,nA,rA,uj,iA,nn,My=L(()=>{"use strict";Ly=(e=0)=>t=>`\x1B[${t+e}m`,Ny=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,jy=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,Te={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]}},cj=Object.keys(Te.modifier),nA=Object.keys(Te.color),rA=Object.keys(Te.bgColor),uj=[...nA,...rA];iA=oA(),nn=iA});function Ut(e,t=globalThis.Deno?globalThis.Deno.args:$l.default.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}function sA(){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 aA(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function lA(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=sA();r!==void 0&&(Pl=r);let o=n?Pl:r;if(o===0)return 0;if(n){if(Ut("color=16m")||Ut("color=full")||Ut("color=truecolor"))return 3;if(Ut("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($l.default.platform==="win32"){let s=Uy.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 By(e,t={}){let n=lA(e,{streamIsTTY:e&&e.isTTY,...t});return aA(n)}var $l,Uy,Qd,We,Pl,cA,Wy,Hy=L(()=>{"use strict";$l=w(require("process"),1),Uy=w(require("os"),1),Qd=w(require("tty"),1);({env:We}=$l.default);Ut("no-color")||Ut("no-colors")||Ut("color=false")||Ut("color=never")?Pl=0:(Ut("color")||Ut("colors")||Ut("color=true")||Ut("color=always"))&&(Pl=1);cA={stdout:By({isTTY:Qd.default.isatty(1)}),stderr:By({isTTY:Qd.default.isatty(2)})},Wy=cA});function Vy(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,r)+t+n,i=r+o,r=e.indexOf(t,i);while(r!==-1);return s+=e.slice(i),s}function Gy(e,t,n,r){let o=0,i="";do{let s=e[r-1]==="\r";i+=e.slice(o,s?r-1:r)+t+(s?`\r
3
3
  `:`
4
4
  `)+n,o=r+1,r=e.indexOf(`
5
- `,o)}while(r!==-1);return i+=e.slice(o),i}var Py=L(()=>{"use strict"});function Is(e){return H_(e)}var $y,Oy,Jd,si,As,Ly,ai,W_,H_,Kd,V_,G_,zd,Al,J_,K_,GN,nn,qd=L(()=>{"use strict";Cy();Iy();Py();({stdout:$y,stderr:Oy}=Ay),Jd=Symbol("GENERATOR"),si=Symbol("STYLER"),As=Symbol("IS_EMPTY"),Ly=["ansi","ansi","ansi256","ansi16m"],ai=Object.create(null),W_=(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 n=$y?$y.level:0;e.level=t.level===void 0?n:t.level},H_=e=>{let t=(...n)=>n.join(" ");return W_(t,e),Object.setPrototypeOf(t,Is.prototype),t};Object.setPrototypeOf(Is.prototype,Function.prototype);for(let[e,t]of Object.entries(tn))ai[e]={get(){let n=Al(this,zd(t.open,t.close,this[si]),this[As]);return Object.defineProperty(this,e,{value:n}),n}};ai.visible={get(){let e=Al(this,this[si],!0);return Object.defineProperty(this,"visible",{value:e}),e}};Kd=(e,t,n,...r)=>e==="rgb"?t==="ansi16m"?tn[n].ansi16m(...r):t==="ansi256"?tn[n].ansi256(tn.rgbToAnsi256(...r)):tn[n].ansi(tn.rgbToAnsi(...r)):e==="hex"?Kd("rgb",t,n,...tn.hexToRgb(...r)):tn[n][e](...r),V_=["rgb","hex","ansi256"];for(let e of V_){ai[e]={get(){let{level:n}=this;return function(...r){let o=zd(Kd(e,Ly[n],"color",...r),tn.color.close,this[si]);return Al(this,o,this[As])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);ai[t]={get(){let{level:n}=this;return function(...r){let o=zd(Kd(e,Ly[n],"bgColor",...r),tn.bgColor.close,this[si]);return Al(this,o,this[As])}}}}G_=Object.defineProperties(()=>{},{...ai,level:{enumerable:!0,get(){return this[Jd].level},set(e){this[Jd].level=e}}}),zd=(e,t,n)=>{let r,o;return n===void 0?(r=e,o=t):(r=n.openAll+e,o=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:o,parent:n}},Al=(e,t,n)=>{let r=(...o)=>J_(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,G_),r[Jd]=e,r[si]=t,r[As]=n,r},J_=(e,t)=>{if(e.level<=0||!t)return e[As]?"":t;let n=e[si];if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=Ry(t,n.close,n.open),n=n.parent;let i=t.indexOf(`
6
- `);return i!==-1&&(t=Ty(t,o,r,i)),r+t+o};Object.defineProperties(Is.prototype,ai);K_=Is(),GN=Is({level:Oy?Oy.level:0}),nn=K_});function Xd(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let o of Reflect.ownKeys(t))z_(e,t,o,n);return X_(e,t),eA(e,t,r),e}var z_,q_,X_,Y_,Z_,Q_,eA,Ny=L(()=>{"use strict";z_=(e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(e,n),i=Object.getOwnPropertyDescriptor(t,n);!q_(o,i)&&r||Object.defineProperty(e,n,i)},q_=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)},X_=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Y_=(e,t)=>`/* Wrapped ${e}*/
7
- ${t}`,Z_=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Q_=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),eA=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=Y_.bind(null,r,t.toString());Object.defineProperty(o,"name",Q_);let{writable:i,enumerable:s,configurable:a}=Z_;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Il,jy,My,By=L(()=>{"use strict";Ny();Il=new WeakMap,jy=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(Il.set(i,++r),r===1)n=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return n};return Xd(i,e),Il.set(i,r),i};jy.callCount=e=>{if(!Il.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Il.get(e)};My=jy});var qr,Uy=L(()=>{"use strict";qr=[];qr.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&qr.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&qr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Rl,Yd,Zd,tA,Qd,Tl,nA,ep,tp,np,Wy,ZN,QN,Hy=L(()=>{"use strict";Uy();Rl=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",Yd=Symbol.for("signal-exit emitter"),Zd=globalThis,tA=Object.defineProperty.bind(Object),Qd=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Zd[Yd])return Zd[Yd];tA(Zd,Yd,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){let r=this.listeners[t],o=r.indexOf(n);o!==-1&&(o===0&&r.length===1?r.length=0:r.splice(o,1))}emit(t,n,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(n,r)===!0||o;return t==="exit"&&(o=this.emit("afterExit",n,r)||o),o}},Tl=class{},nA=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),ep=class extends Tl{onExit(){return()=>{}}load(){}unload(){}},tp=class extends Tl{#s=np.platform==="win32"?"SIGINT":"SIGHUP";#n=new Qd;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let n of qr)this.#t[n]=()=>{let r=this.#e.listeners(n),{count:o}=this.#n,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),r.length===o){this.unload();let s=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#s:n;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,n){if(!Rl(this.#e))return()=>{};this.#i===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,t),()=>{this.#n.removeListener(r,t),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#n.count+=1;for(let t of qr)try{let n=this.#t[t];n&&this.#e.on(t,n)}catch{}this.#e.emit=(t,...n)=>this.#f(t,...n),this.#e.reallyExit=t=>this.#r(t)}}unload(){this.#i&&(this.#i=!1,qr.forEach(t=>{let n=this.#t[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,n)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#n.count-=1)}#r(t){return Rl(this.#e)?(this.#e.exitCode=t||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...n){let r=this.#o;if(t==="exit"&&Rl(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let o=r.call(this.#e,t,...n);return this.#n.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,t,...n)}},np=globalThis.process,{onExit:Wy,load:ZN,unload:QN}=nA(Rl(np)?new tp(np):new ep)});var Rs,Vy,rA,Gy,Jy=L(()=>{"use strict";Rs=w(require("process"),1);By();Hy();Vy=Rs.default.stderr.isTTY?Rs.default.stderr:Rs.default.stdout.isTTY?Rs.default.stdout:void 0,rA=Vy?My(()=>{Wy(()=>{Vy.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Gy=rA});var rp,Pl,li,op,Ky=L(()=>{"use strict";rp=w(require("process"),1);Jy();Pl=!1,li={};li.show=(e=rp.default.stderr)=>{e.isTTY&&(Pl=!1,e.write("\x1B[?25h"))};li.hide=(e=rp.default.stderr)=>{e.isTTY&&(Gy(),Pl=!0,e.write("\x1B[?25l"))};li.toggle=(e,t)=>{e!==void 0&&(Pl=e),Pl?li.show(t):li.hide(t)};op=li});var zy=Hd((sj,oA)=>{oA.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 ip=Hd((aj,Xy)=>{"use strict";var $l=Object.assign({},zy()),qy=Object.keys($l);Object.defineProperty($l,"random",{get(){let e=Math.floor(Math.random()*qy.length),t=qy[e];return $l[t]}});Xy.exports=$l});function sp(){return Ut.default.platform!=="win32"?Ut.default.env.TERM!=="linux":!!Ut.default.env.CI||!!Ut.default.env.WT_SESSION||!!Ut.default.env.TERMINUS_SUBLIME||Ut.default.env.ConEmuTask==="{cmd::Cmder}"||Ut.default.env.TERM_PROGRAM==="Terminus-Sublime"||Ut.default.env.TERM_PROGRAM==="vscode"||Ut.default.env.TERM==="xterm-256color"||Ut.default.env.TERM==="alacritty"||Ut.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ut,Yy=L(()=>{"use strict";Ut=w(require("process"),1)});var iA,sA,aA,Ts,Zy=L(()=>{"use strict";qd();Yy();iA={info:nn.blue("\u2139"),success:nn.green("\u2714"),warning:nn.yellow("\u26A0"),error:nn.red("\u2716")},sA={info:nn.blue("i"),success:nn.green("\u221A"),warning:nn.yellow("\u203C"),error:nn.red("\xD7")},aA=sp()?iA:sA,Ts=aA});function ap({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 Qy=L(()=>{"use strict"});function lp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(lA,"")}var lA,ew=L(()=>{"use strict";Qy();lA=ap()});function cp({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 tw=L(()=>{"use strict"});function up(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(cA,"")}var cA,nw=L(()=>{"use strict";tw();cA=cp()});var Ol,Ll,dp,pp,Ps,rw=L(()=>{"use strict";Ol=[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],Ll=[12288,12288,65281,65376,65504,65510],dp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],pp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ps=[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 Nl,ow=L(()=>{"use strict";Nl=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=o*2;if(t<e[i])r=o-1;else if(t>e[i+1])n=o+1;else return!0}return!1}});function wA(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let o=e[r],i=e[r+1];if(iw>=o&&iw<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}var uA,dA,pA,fA,Ej,vj,Sj,xj,mA,gA,iw,hA,yA,sw,aw,lw,cw=L(()=>{"use strict";rw();ow();uA=Ol[0],dA=Ol.at(-1),pA=Ll[0],fA=Ll.at(-1),Ej=dp[0],vj=dp.at(-1),Sj=pp[0],xj=pp.at(-1),mA=Ps[0],gA=Ps.at(-1),iw=19968,[hA,yA]=wA(Ps);sw=e=>e<uA||e>dA?!1:Nl(Ol,e),aw=e=>e<pA||e>fA?!1:Nl(Ll,e),lw=e=>e>=hA&&e<=yA?!0:e<mA||e>gA?!1:Nl(Ps,e)});function DA(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function uw(e,{ambiguousAsWide:t=!1}={}){return DA(e),aw(e)||lw(e)||t&&sw(e)?2:1}var dw=L(()=>{"use strict";cw()});var pw,fw=L(()=>{"use strict";pw=()=>/[#*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 fp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=up(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!n};for(let{segment:s}of bA.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)&&!kA.test(s)){if(pw().test(s)){o+=2;continue}o+=uw(a,i)}}return o}var bA,kA,mw=L(()=>{"use strict";nw();dw();fw();bA=new Intl.Segmenter,kA=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function mp({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var gw=L(()=>{"use strict"});function hp(){let{env:e}=gp.default,{TERM:t,TERM_PROGRAM:n}=e;return gp.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var gp,hw=L(()=>{"use strict";gp=w(require("process"),1)});var rn,EA,yp,vA,wp,yw=L(()=>{"use strict";rn=w(require("process"),1),EA=3,yp=class{#s=0;start(){this.#s++,this.#s===1&&this.#n()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#n(){rn.default.platform==="win32"||!rn.default.stdin.isTTY||(rn.default.stdin.setRawMode(!0),rn.default.stdin.on("data",this.#o),rn.default.stdin.resume())}#e(){rn.default.stdin.isTTY&&(rn.default.stdin.off("data",this.#o),rn.default.stdin.pause(),rn.default.stdin.setRawMode(!1))}#o(t){t[0]===EA&&rn.default.emit("SIGINT")}},vA=new yp,wp=vA});function bp(e){return new Dp(e)}var $s,Os,SA,Dp,ww=L(()=>{"use strict";$s=w(require("process"),1);qd();Ky();Os=w(ip(),1);Zy();ew();mw();gw();hw();yw();SA=w(ip(),1),Dp=class{#s=0;#n=!1;#e=0;#o=-1;#p=0;#t;#i;#r;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:$s.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#r=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:mp({stream:this.#r}),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,$s.default.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(n){this.#s=n}}),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=Os.default.line;else if(t===void 0)this.#i=Os.default.dots;else if(t!=="default"&&Os.default[t])this.#i=Os.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,n=" "){return typeof t=="string"&&t!==""?t+n:typeof t=="function"?t()+n:""}#w(t=this.#l,n=" "){return typeof t=="string"&&t!==""?n+t:typeof t=="function"?n+t():""}#m(){let t=this.#r.columns??80,n=this.#y(this.#a,"-"),r=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+n+"--"+this.#h+"--"+r;this.#e=0;for(let i of lp(o).split(`
8
- `))this.#e+=Math.max(1,Math.ceil(fp(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:n}=this.#i,r=n[this.#o];this.color&&(r=nn[this.color](r));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+r+i+s}clear(){if(!this.#c||!this.#r.isTTY)return this;this.#r.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#r.moveCursor(0,-1),this.#r.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#r.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#r.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&&op.hide(this.#r),this.#t.discardStdin&&$s.default.stdin.isTTY&&(this.#n=!0,wp.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#r.write(`- ${this.text}
9
- `),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&op.show(this.#r),this.#t.discardStdin&&$s.default.stdin.isTTY&&this.#n&&(wp.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Ts.success,text:t})}fail(t){return this.stopAndPersist({symbol:Ts.error,text:t})}warn(t){return this.stopAndPersist({symbol:Ts.warning,text:t})}info(t){return this.stopAndPersist({symbol:Ts.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let n=t.prefixText??this.#a,r=this.#y(n," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),d=r+o+a+c+`
10
- `;return this.stop(),this.#r.write(d),this}}});function Ls(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),jl.default.platform==="darwin"?xA(e):jl.default.platform==="win32"?CA(e):FA(e)}var Ie,kp,jl,ur,Ep,ci,xA,CA,FA,vp=L(()=>{"use strict";Ie=w(require("path"),1),kp=w(require("os"),1),jl=w(require("process"),1),ur=kp.default.homedir(),Ep=kp.default.tmpdir(),{env:ci}=jl.default,xA=e=>{let t=Ie.default.join(ur,"Library");return{data:Ie.default.join(t,"Application Support",e),config:Ie.default.join(t,"Preferences",e),cache:Ie.default.join(t,"Caches",e),log:Ie.default.join(t,"Logs",e),temp:Ie.default.join(Ep,e)}},CA=e=>{let t=ci.APPDATA||Ie.default.join(ur,"AppData","Roaming"),n=ci.LOCALAPPDATA||Ie.default.join(ur,"AppData","Local");return{data:Ie.default.join(n,e,"Data"),config:Ie.default.join(t,e,"Config"),cache:Ie.default.join(n,e,"Cache"),log:Ie.default.join(n,e,"Log"),temp:Ie.default.join(Ep,e)}},FA=e=>{let t=Ie.default.basename(ur);return{data:Ie.default.join(ci.XDG_DATA_HOME||Ie.default.join(ur,".local","share"),e),config:Ie.default.join(ci.XDG_CONFIG_HOME||Ie.default.join(ur,".config"),e),cache:Ie.default.join(ci.XDG_CACHE_HOME||Ie.default.join(ur,".cache"),e),log:Ie.default.join(ci.XDG_STATE_HOME||Ie.default.join(ur,".local","state"),e),temp:Ie.default.join(Ep,t,e)}}});function Ml(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Dw(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var bw=L(()=>{"use strict"});function Ns(e,t={}){let n=/[\u0000-\u001F\u0080-\u009F]/g,r=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(Ml().test(o)&&n.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(r,"$1")),e=e.normalize("NFD"),e=e.replace(AA,o),e=e.replace(Ml(),o),e=e.replace(n,o),e=e.replace(IA,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Dw().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:_A;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 _A,AA,IA,Sp=L(()=>{"use strict";bw();_A=100,AA=/^\.+(\\|\/)|^\.+$/,IA=/\.+$/});var RA,kw=L(()=>{"use strict";RA=w(require("path"),1);Sp()});var Ew=L(()=>{"use strict";Sp();kw()});var Bl,xp=L(()=>{"use strict";Bl="webflow.json"});var Xr,Cp=L(()=>{"use strict";Xr=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Fw(e){vw=e}function _w(e){Sw=e}function TA(){for(let e of Aw){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function PA(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||TA()!==null}function V(){return vw?!0:Sw?!1:PA()}function on(){return!V()}function Iw(e){xw=e}function Ye(){return xw}function Rw(e){Cw=e}function Tw(){return Cw}var vw,Sw,xw,Cw,Aw,i1,we=L(()=>{"use strict";vw=!1,Sw=!1,xw=!1;Aw=[{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"}],i1=Aw.map(e=>e.variable)});function Yr(){let e=Tw();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Pw.statSync)(e)?.isDirectory())return{path:(0,$w.join)(e,Bl),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:`./${Bl}`,isUserDefined:!1}}var Pw,$w,Fp=L(()=>{"use strict";Pw=require("fs"),$w=require("path");xp();we()});var Ow,$A,OA,_p,Lw=L(()=>{"use strict";Ow=w(require("ajv")),$A=new Ow.default,OA={type:"object",properties:{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:[]}}},_p=$A.compile(OA)});function Nw(e){return e instanceof Error?e:new Error("Unknown error")}function ne(){let{path:e}=Yr();if(!(0,Ul.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,Ul.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${Nw(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let r;try{r=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${Nw(o).message}`)}if(!_p(r)){let o=_p.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:r,manifestPath:e}}var Ul,js=L(()=>{"use strict";Ul=require("fs");Fp();Lw()});function Ms(e,t){let n=e[t];if(!n)throw new Xr(t);return n}var jw=L(()=>{"use strict";Cp()});function Se(e){let t=ne(),n=t.manifest,r=t.manifestPath,o={...n};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,Mw.writeFileSync)(r,JSON.stringify(o,null,2),"utf-8"),o}var Mw,Ap=L(()=>{"use strict";Mw=require("fs");js()});var We=L(()=>{"use strict";xp();Cp();js();Fp();jw();Ap()});var Wl=Hd((x1,LA)=>{LA.exports={name:"@webflow/webflow-cli",version:"2.4.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/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.6","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 jn(){try{return Wl().version}catch{return"unknown"}}function bn(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 n=Bs.default.homedir();if(n){let o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let r=Bs.default.userInfo().username;if(r){let o=new RegExp(`/Users/${r}`,"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 Ip(e){if(e.stack)return bn(e.stack)}function dr(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],n={};for(let[r,o]of Object.entries(e)){let i=r.toLowerCase();t.some(s=>i.includes(s))?n[r]="[REDACTED]":typeof o=="string"?n[r]=bn(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=dr(o):Array.isArray(o)?n[r]=o.map(s=>typeof s=="object"&&s!==null?dr(s):typeof s=="string"?bn(s):s):n[r]=o}return n}function Bw(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${Bs.default.type()} ${Bs.default.release()}`}}function Rp(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var Bs,Us=L(()=>{"use strict";Bs=w(require("os"))});var $,k,je,ui,Tp,at,re,Hl,Pp,Mn,M=L(()=>{"use strict";pe();$=K("\u2713"),k=Mt("\u2716"),je=Ne("\u2139"),ui=K("\u279C"),Tp=Mt("\u279C"),at="\u279C",re=le("\u26A0"),Hl=R("\u2732"),Pp=K("\u2732"),Mn=le("[Deprecated]")});var pr,$p=L(()=>{"use strict";We();Us();_();pe();M();we();pr=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}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;try{let{manifest:t}=await ne(),n=t?.telemetry?.global?.allowTelemetry;return this.cache=n,n}catch{return}}async setPreference(t){this.cache=t,await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(Ye()||u.info(`${je} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(Ye()||(u.info(`${Pp} ${R("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${Pp} ${R("To opt out, run")} ${K("webflow auth telemetry --disable")}`)),await this.setPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return this.getPreference()}async setGlobalPreference(t){let n={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:jn()}}};await Se(n),Ye()||u.info(`${$} Telemetry configuration updated in webflow.json`),this.cache=t}async hasGlobalPreference(){return await this.getPreference()!==void 0}async getTelemetryStatus(){let t=await this.getPreference();return t!==void 0?{enabled:t,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,n){this.cache=n}}});async function J(e,t){let r={"User-Agent":`webflow-cli@${jn()}`};return(0,Uw.default)(e,{...t,headers:{...t?.headers,...r}})}var Uw,lt=L(()=>{"use strict";Uw=w(require("node-fetch"));X()});var Ww,Hw=L(()=>{"use strict";Ww=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});var Op,P,di,kn,Ws,Lp,Hs,Vs,pi,be=L(()=>{"use strict";Hw();Op=(e,t)=>(Ww(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),P=process.env.WEBFLOW_API_HOST?Op("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):"https://api.webflow.com",di=process.env.WEBFLOW_CDN_API_HOST?Op("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):"https://api-cdn.webflow.com",kn=process.env.WEBFLOW_HOST?Op("WEBFLOW_HOST",process.env.WEBFLOW_HOST):"https://webflow.com",Ws="wf-manifest.json",Lp="mf-manifest.json",Hs="@webflow_renderer",Vs="ssr-bundle.tar",pi="index.js"});function NA(){let e=process.argv.slice(2),t=[];for(let n=0;n<e.length;n+=1){let r=e[n],o=r.indexOf("=");if(o>0&&Vw.has(r.slice(0,o))){t.push(`${r.slice(0,o)}=<redacted>`);continue}t.push(r),Vw.has(r)&&n+1<e.length&&(t.push("<redacted>"),n+=1)}return t.join(" ")||void 0}var Vw,F,Np=L(()=>{"use strict";$p();Us();_();lt();be();Vw=new Set(["--ref","--name","--q","--branch","--key"]);F=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=pr.getInstance(),this.sessionId=Rp(),this.platformInfo=Bw()}async sendEvent(t){try{if(!await this.isEnabled())return;let n=this.enrichEvent(t),r=this.sanitizeEvent(n);await this.transmitEvent(r)}catch(n){u.debug(`Failed to send telemetry event: ${n}`)}}async sendError(t,n,r){await this.sendEvent({eventType:"error",success:!1,name:t.name,message:t.message,cause:t.cause,stack:Ip(t),context:n,metadata:r?dr(r):void 0})}async sendUsage(t,n){let{duration:r,...o}=n??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof r=="number"?r:void 0,data:Object.keys(o).length>0?dr(o):void 0})}async sendPerformance(t,n,r){await this.sendEvent({eventType:"performance",operation:t,duration:n,metrics:r})}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 n=pr.getInstance(),r=await n.getPreference();return r!==void 0?r:await n.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:jn(),command:this.config.suppressCommand?void 0:NA(),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 n=JSON.parse(JSON.stringify(t));return n.message&&(n.message=bn(n.message)),n.stack&&(n.stack=bn(n.stack)),n.context&&(n.context=bn(n.context)),n.metadata&&(n.metadata=dr(n.metadata)),n.data&&(n.data=dr(n.data)),n}async transmitEvent(t){let n=this.getEndpoint(),r=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(r){console.log(`\u{1F4CA} [Telemetry] Sending to: ${n}`);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 J(n,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)r&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw r&&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:n}=this.config;return`${t}/webflow-cli/${n}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"skills"})}}});var Gw=L(()=>{"use strict"});function Jw(e){return async(t,n,r)=>{let o=Date.now(),i=process.memoryUsage().heapUsed;try{let s=await n(),a=Date.now()-o,l=process.memoryUsage().heapUsed;return await e.sendPerformance(t,a,{memoryDelta:l-i,...r}),s}catch(s){let a=Date.now()-o;throw await e.sendPerformance(t,a,{failed:1,...r}),s}}}var X=L(()=>{"use strict";Np();$p();Gw();Us();Us()});var Mp,jp,jA,Bn,Bp=L(()=>{"use strict";Mp=Symbol("webflow-cli-warn"),jp=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let n=t.split(`
11
- `);for(let r=2;r<n.length;r++){let o=n[r],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]===Mp){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let n=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),r=new Error().stack||"",o=this.parseSource(r);this.warnings.push({message:n,timestamp:Date.now(),source:o,stackTrace:r})})}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(r!==-1);return i+=e.slice(o),i}var Ky=L(()=>{"use strict"});function $s(e){return dA(e)}var Jy,zy,ep,ci,Ps,qy,ui,uA,dA,tp,pA,fA,np,Ol,mA,gA,yj,rn,rp=L(()=>{"use strict";My();Hy();Ky();({stdout:Jy,stderr:zy}=Wy),ep=Symbol("GENERATOR"),ci=Symbol("STYLER"),Ps=Symbol("IS_EMPTY"),qy=["ansi","ansi","ansi256","ansi16m"],ui=Object.create(null),uA=(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 n=Jy?Jy.level:0;e.level=t.level===void 0?n:t.level},dA=e=>{let t=(...n)=>n.join(" ");return uA(t,e),Object.setPrototypeOf(t,$s.prototype),t};Object.setPrototypeOf($s.prototype,Function.prototype);for(let[e,t]of Object.entries(nn))ui[e]={get(){let n=Ol(this,np(t.open,t.close,this[ci]),this[Ps]);return Object.defineProperty(this,e,{value:n}),n}};ui.visible={get(){let e=Ol(this,this[ci],!0);return Object.defineProperty(this,"visible",{value:e}),e}};tp=(e,t,n,...r)=>e==="rgb"?t==="ansi16m"?nn[n].ansi16m(...r):t==="ansi256"?nn[n].ansi256(nn.rgbToAnsi256(...r)):nn[n].ansi(nn.rgbToAnsi(...r)):e==="hex"?tp("rgb",t,n,...nn.hexToRgb(...r)):nn[n][e](...r),pA=["rgb","hex","ansi256"];for(let e of pA){ui[e]={get(){let{level:n}=this;return function(...r){let o=np(tp(e,qy[n],"color",...r),nn.color.close,this[ci]);return Ol(this,o,this[Ps])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);ui[t]={get(){let{level:n}=this;return function(...r){let o=np(tp(e,qy[n],"bgColor",...r),nn.bgColor.close,this[ci]);return Ol(this,o,this[Ps])}}}}fA=Object.defineProperties(()=>{},{...ui,level:{enumerable:!0,get(){return this[ep].level},set(e){this[ep].level=e}}}),np=(e,t,n)=>{let r,o;return n===void 0?(r=e,o=t):(r=n.openAll+e,o=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:o,parent:n}},Ol=(e,t,n)=>{let r=(...o)=>mA(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,fA),r[ep]=e,r[ci]=t,r[Ps]=n,r},mA=(e,t)=>{if(e.level<=0||!t)return e[Ps]?"":t;let n=e[ci];if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=Vy(t,n.close,n.open),n=n.parent;let i=t.indexOf(`
6
+ `);return i!==-1&&(t=Gy(t,o,r,i)),r+t+o};Object.defineProperties($s.prototype,ui);gA=$s(),yj=$s({level:zy?zy.level:0}),rn=gA});function op(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let o of Reflect.ownKeys(t))hA(e,t,o,n);return wA(e,t),EA(e,t,r),e}var hA,yA,wA,bA,DA,kA,EA,Xy=L(()=>{"use strict";hA=(e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(e,n),i=Object.getOwnPropertyDescriptor(t,n);!yA(o,i)&&r||Object.defineProperty(e,n,i)},yA=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)},wA=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},bA=(e,t)=>`/* Wrapped ${e}*/
7
+ ${t}`,DA=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),kA=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),EA=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=bA.bind(null,r,t.toString());Object.defineProperty(o,"name",kA);let{writable:i,enumerable:s,configurable:a}=DA;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Ll,Yy,Zy,Qy=L(()=>{"use strict";Xy();Ll=new WeakMap,Yy=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(Ll.set(i,++r),r===1)n=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return n};return op(i,e),Ll.set(i,r),i};Yy.callCount=e=>{if(!Ll.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ll.get(e)};Zy=Yy});var Yr,ew=L(()=>{"use strict";Yr=[];Yr.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Yr.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Yr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Nl,ip,sp,vA,ap,jl,SA,lp,cp,up,tw,Sj,xj,nw=L(()=>{"use strict";ew();Nl=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",ip=Symbol.for("signal-exit emitter"),sp=globalThis,vA=Object.defineProperty.bind(Object),ap=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(sp[ip])return sp[ip];vA(sp,ip,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){let r=this.listeners[t],o=r.indexOf(n);o!==-1&&(o===0&&r.length===1?r.length=0:r.splice(o,1))}emit(t,n,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(n,r)===!0||o;return t==="exit"&&(o=this.emit("afterExit",n,r)||o),o}},jl=class{},SA=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),lp=class extends jl{onExit(){return()=>{}}load(){}unload(){}},cp=class extends jl{#s=up.platform==="win32"?"SIGINT":"SIGHUP";#n=new ap;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let n of Yr)this.#t[n]=()=>{let r=this.#e.listeners(n),{count:o}=this.#n,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),r.length===o){this.unload();let s=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#s:n;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,n){if(!Nl(this.#e))return()=>{};this.#i===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,t),()=>{this.#n.removeListener(r,t),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#n.count+=1;for(let t of Yr)try{let n=this.#t[t];n&&this.#e.on(t,n)}catch{}this.#e.emit=(t,...n)=>this.#f(t,...n),this.#e.reallyExit=t=>this.#r(t)}}unload(){this.#i&&(this.#i=!1,Yr.forEach(t=>{let n=this.#t[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,n)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#n.count-=1)}#r(t){return Nl(this.#e)?(this.#e.exitCode=t||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...n){let r=this.#o;if(t==="exit"&&Nl(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let o=r.call(this.#e,t,...n);return this.#n.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,t,...n)}},up=globalThis.process,{onExit:tw,load:Sj,unload:xj}=SA(Nl(up)?new cp(up):new lp)});var Os,rw,xA,ow,iw=L(()=>{"use strict";Os=w(require("process"),1);Qy();nw();rw=Os.default.stderr.isTTY?Os.default.stderr:Os.default.stdout.isTTY?Os.default.stdout:void 0,xA=rw?Zy(()=>{tw(()=>{rw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},ow=xA});var dp,Ml,di,pp,sw=L(()=>{"use strict";dp=w(require("process"),1);iw();Ml=!1,di={};di.show=(e=dp.default.stderr)=>{e.isTTY&&(Ml=!1,e.write("\x1B[?25h"))};di.hide=(e=dp.default.stderr)=>{e.isTTY&&(ow(),Ml=!0,e.write("\x1B[?25l"))};di.toggle=(e,t)=>{e!==void 0&&(Ml=e),Ml?di.show(t):di.hide(t)};pp=di});var aw=Yd((Tj,CA)=>{CA.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 fp=Yd((Pj,cw)=>{"use strict";var Bl=Object.assign({},aw()),lw=Object.keys(Bl);Object.defineProperty(Bl,"random",{get(){let e=Math.floor(Math.random()*lw.length),t=lw[e];return Bl[t]}});cw.exports=Bl});function mp(){return Wt.default.platform!=="win32"?Wt.default.env.TERM!=="linux":!!Wt.default.env.CI||!!Wt.default.env.WT_SESSION||!!Wt.default.env.TERMINUS_SUBLIME||Wt.default.env.ConEmuTask==="{cmd::Cmder}"||Wt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Wt.default.env.TERM_PROGRAM==="vscode"||Wt.default.env.TERM==="xterm-256color"||Wt.default.env.TERM==="alacritty"||Wt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Wt,uw=L(()=>{"use strict";Wt=w(require("process"),1)});var FA,_A,AA,Ls,dw=L(()=>{"use strict";rp();uw();FA={info:rn.blue("\u2139"),success:rn.green("\u2714"),warning:rn.yellow("\u26A0"),error:rn.red("\u2716")},_A={info:rn.blue("i"),success:rn.green("\u221A"),warning:rn.yellow("\u203C"),error:rn.red("\xD7")},AA=mp()?FA:_A,Ls=AA});function gp({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 pw=L(()=>{"use strict"});function hp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(RA,"")}var RA,fw=L(()=>{"use strict";pw();RA=gp()});function yp({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 mw=L(()=>{"use strict"});function wp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(IA,"")}var IA,gw=L(()=>{"use strict";mw();IA=yp()});var Ul,Wl,bp,Dp,Ns,hw=L(()=>{"use strict";Ul=[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],Wl=[12288,12288,65281,65376,65504,65510],bp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Dp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ns=[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 Hl,yw=L(()=>{"use strict";Hl=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=o*2;if(t<e[i])r=o-1;else if(t>e[i+1])n=o+1;else return!0}return!1}});function BA(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let o=e[r],i=e[r+1];if(ww>=o&&ww<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}var TA,PA,$A,OA,zj,qj,Xj,Yj,LA,NA,ww,jA,MA,bw,Dw,kw,Ew=L(()=>{"use strict";hw();yw();TA=Ul[0],PA=Ul.at(-1),$A=Wl[0],OA=Wl.at(-1),zj=bp[0],qj=bp.at(-1),Xj=Dp[0],Yj=Dp.at(-1),LA=Ns[0],NA=Ns.at(-1),ww=19968,[jA,MA]=BA(Ns);bw=e=>e<TA||e>PA?!1:Hl(Ul,e),Dw=e=>e<$A||e>OA?!1:Hl(Wl,e),kw=e=>e>=jA&&e<=MA?!0:e<LA||e>NA?!1:Hl(Ns,e)});function UA(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function vw(e,{ambiguousAsWide:t=!1}={}){return UA(e),Dw(e)||kw(e)||t&&bw(e)?2:1}var Sw=L(()=>{"use strict";Ew()});var xw,Cw=L(()=>{"use strict";xw=()=>/[#*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 kp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=wp(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!n};for(let{segment:s}of WA.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)&&!HA.test(s)){if(xw().test(s)){o+=2;continue}o+=vw(a,i)}}return o}var WA,HA,Fw=L(()=>{"use strict";gw();Sw();Cw();WA=new Intl.Segmenter,HA=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Ep({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var _w=L(()=>{"use strict"});function Sp(){let{env:e}=vp.default,{TERM:t,TERM_PROGRAM:n}=e;return vp.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vp,Aw=L(()=>{"use strict";vp=w(require("process"),1)});var on,VA,xp,GA,Cp,Rw=L(()=>{"use strict";on=w(require("process"),1),VA=3,xp=class{#s=0;start(){this.#s++,this.#s===1&&this.#n()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#n(){on.default.platform==="win32"||!on.default.stdin.isTTY||(on.default.stdin.setRawMode(!0),on.default.stdin.on("data",this.#o),on.default.stdin.resume())}#e(){on.default.stdin.isTTY&&(on.default.stdin.off("data",this.#o),on.default.stdin.pause(),on.default.stdin.setRawMode(!1))}#o(t){t[0]===VA&&on.default.emit("SIGINT")}},GA=new xp,Cp=GA});function _p(e){return new Fp(e)}var js,Ms,KA,Fp,Iw=L(()=>{"use strict";js=w(require("process"),1);rp();sw();Ms=w(fp(),1);dw();fw();Fw();_w();Aw();Rw();KA=w(fp(),1),Fp=class{#s=0;#n=!1;#e=0;#o=-1;#p=0;#t;#i;#r;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:js.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#r=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ep({stream:this.#r}),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,js.default.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(n){this.#s=n}}),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(!Sp())this.#i=Ms.default.line;else if(t===void 0)this.#i=Ms.default.dots;else if(t!=="default"&&Ms.default[t])this.#i=Ms.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,n=" "){return typeof t=="string"&&t!==""?t+n:typeof t=="function"?t()+n:""}#w(t=this.#l,n=" "){return typeof t=="string"&&t!==""?n+t:typeof t=="function"?n+t():""}#m(){let t=this.#r.columns??80,n=this.#y(this.#a,"-"),r=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+n+"--"+this.#h+"--"+r;this.#e=0;for(let i of hp(o).split(`
8
+ `))this.#e+=Math.max(1,Math.ceil(kp(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:n}=this.#i,r=n[this.#o];this.color&&(r=rn[this.color](r));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+r+i+s}clear(){if(!this.#c||!this.#r.isTTY)return this;this.#r.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#r.moveCursor(0,-1),this.#r.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#r.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#r.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&&pp.hide(this.#r),this.#t.discardStdin&&js.default.stdin.isTTY&&(this.#n=!0,Cp.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#r.write(`- ${this.text}
9
+ `),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&pp.show(this.#r),this.#t.discardStdin&&js.default.stdin.isTTY&&this.#n&&(Cp.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Ls.success,text:t})}fail(t){return this.stopAndPersist({symbol:Ls.error,text:t})}warn(t){return this.stopAndPersist({symbol:Ls.warning,text:t})}info(t){return this.stopAndPersist({symbol:Ls.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let n=t.prefixText??this.#a,r=this.#y(n," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),p=r+o+a+c+`
10
+ `;return this.stop(),this.#r.write(p),this}}});function Bs(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),Vl.default.platform==="darwin"?JA(e):Vl.default.platform==="win32"?zA(e):qA(e)}var Pe,Ap,Vl,pr,Rp,pi,JA,zA,qA,Ip=L(()=>{"use strict";Pe=w(require("path"),1),Ap=w(require("os"),1),Vl=w(require("process"),1),pr=Ap.default.homedir(),Rp=Ap.default.tmpdir(),{env:pi}=Vl.default,JA=e=>{let t=Pe.default.join(pr,"Library");return{data:Pe.default.join(t,"Application Support",e),config:Pe.default.join(t,"Preferences",e),cache:Pe.default.join(t,"Caches",e),log:Pe.default.join(t,"Logs",e),temp:Pe.default.join(Rp,e)}},zA=e=>{let t=pi.APPDATA||Pe.default.join(pr,"AppData","Roaming"),n=pi.LOCALAPPDATA||Pe.default.join(pr,"AppData","Local");return{data:Pe.default.join(n,e,"Data"),config:Pe.default.join(t,e,"Config"),cache:Pe.default.join(n,e,"Cache"),log:Pe.default.join(n,e,"Log"),temp:Pe.default.join(Rp,e)}},qA=e=>{let t=Pe.default.basename(pr);return{data:Pe.default.join(pi.XDG_DATA_HOME||Pe.default.join(pr,".local","share"),e),config:Pe.default.join(pi.XDG_CONFIG_HOME||Pe.default.join(pr,".config"),e),cache:Pe.default.join(pi.XDG_CACHE_HOME||Pe.default.join(pr,".cache"),e),log:Pe.default.join(pi.XDG_STATE_HOME||Pe.default.join(pr,".local","state"),e),temp:Pe.default.join(Rp,t,e)}}});function Gl(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Tw(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var Pw=L(()=>{"use strict"});function Us(e,t={}){let n=/[\u0000-\u001F\u0080-\u009F]/g,r=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(Gl().test(o)&&n.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(r,"$1")),e=e.normalize("NFD"),e=e.replace(YA,o),e=e.replace(Gl(),o),e=e.replace(n,o),e=e.replace(ZA,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Tw().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:XA;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 XA,YA,ZA,Tp=L(()=>{"use strict";Pw();XA=100,YA=/^\.+(\\|\/)|^\.+$/,ZA=/\.+$/});var QA,$w=L(()=>{"use strict";QA=w(require("path"),1);Tp()});var Ow=L(()=>{"use strict";Tp();$w()});var Kl,Pp=L(()=>{"use strict";Kl="webflow.json"});var Zr,$p=L(()=>{"use strict";Zr=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Bw(e){Lw=e}function Uw(e){Nw=e}function e0(){for(let e of Ww){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function t0(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||e0()!==null}function V(){return Lw?!0:Nw?!1:t0()}function sn(){return!V()}function Hw(e){jw=e}function et(){return jw}function Vw(e){Mw=e}function Gw(){return Mw}var Lw,Nw,jw,Mw,Ww,I1,be=L(()=>{"use strict";Lw=!1,Nw=!1,jw=!1;Ww=[{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"}],I1=Ww.map(e=>e.variable)});function Qr(){let e=Gw();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Kw.statSync)(e)?.isDirectory())return{path:(0,Jw.join)(e,Kl),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:`./${Kl}`,isUserDefined:!1}}var Kw,Jw,Op=L(()=>{"use strict";Kw=require("fs"),Jw=require("path");Pp();be()});var zw,n0,r0,Lp,qw=L(()=>{"use strict";zw=w(require("ajv")),n0=new zw.default,r0={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:[]}}},Lp=n0.compile(r0)});function Xw(e){return e instanceof Error?e:new Error("Unknown error")}function ee(){let{path:e}=Qr();if(!(0,Jl.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,Jl.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${Xw(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let r;try{r=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${Xw(o).message}`)}if(!Lp(r)){let o=Lp.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:r,manifestPath:e}}var Jl,Ws=L(()=>{"use strict";Jl=require("fs");Op();qw()});function Hs(e,t){let n=e[t];if(!n)throw new Zr(t);return n}var Yw=L(()=>{"use strict";$p()});function xe(e){let t=ee(),n=t.manifest,r=t.manifestPath,o={...n};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,Zw.writeFileSync)(r,JSON.stringify(o,null,2),"utf-8"),o}var Zw,Np=L(()=>{"use strict";Zw=require("fs");Ws()});var Me=L(()=>{"use strict";Pp();$p();Ws();Op();Yw();Np()});var zl=Yd((Y1,o0)=>{o0.exports={name:"@webflow/webflow-cli",version:"2.4.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/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.6","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 Bn(){try{return zl().version}catch{return"unknown"}}function kn(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 n=Vs.default.homedir();if(n){let o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let r=Vs.default.userInfo().username;if(r){let o=new RegExp(`/Users/${r}`,"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 jp(e){if(e.stack)return kn(e.stack)}function fr(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],n={};for(let[r,o]of Object.entries(e)){let i=r.toLowerCase();t.some(s=>i.includes(s))?n[r]="[REDACTED]":typeof o=="string"?n[r]=kn(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=fr(o):Array.isArray(o)?n[r]=o.map(s=>typeof s=="object"&&s!==null?fr(s):typeof s=="string"?kn(s):s):n[r]=o}return n}function Qw(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${Vs.default.type()} ${Vs.default.release()}`}}function Mp(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var Vs,Gs=L(()=>{"use strict";Vs=w(require("os"))});var $,k,Ce,fi,Bp,at,re,ql,Up,Un,M=L(()=>{"use strict";pe();$=J("\u2713"),k=Bt("\u2716"),Ce=je("\u2139"),fi=J("\u279C"),Bp=Bt("\u279C"),at="\u279C",re=le("\u26A0"),ql=I("\u2732"),Up=J("\u2732"),Un=le("[Deprecated]")});var mr,Wp=L(()=>{"use strict";Me();Gs();A();pe();M();be();mr=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}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;try{let{manifest:t}=await ee(),n=t?.telemetry?.global?.allowTelemetry;return this.cache=n,n}catch{return}}async setPreference(t){this.cache=t,await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(et()||u.info(`${Ce} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(et()||(u.info(`${Up} ${I("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${Up} ${I("To opt out, run")} ${J("webflow auth telemetry --disable")}`)),await this.setPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return this.getPreference()}async setGlobalPreference(t){let n={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Bn()}}};await xe(n),et()||u.info(`${$} Telemetry configuration updated in webflow.json`),this.cache=t}async hasGlobalPreference(){return await this.getPreference()!==void 0}async getTelemetryStatus(){let t=await this.getPreference();return t!==void 0?{enabled:t,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,n){this.cache=n}}});async function G(e,t){let r={"User-Agent":`webflow-cli@${Bn()}`};return(0,eb.default)(e,{...t,headers:{...t?.headers,...r}})}var eb,lt=L(()=>{"use strict";eb=w(require("node-fetch"));X()});var f,C=L(()=>{"use strict";f=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,n){let r=t instanceof Error?t.message:String(t);super(r),this.name="CLIError",this.prefix=n?.prefix,this.skipLogging=n?.skipLogging??!1,this.isUserError=n?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=n?.missingFlag,this.code=n?.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 nb(e){tb=e}function rb(){return tb}function Hp(e,t){if(Ks.includes(e))return e;throw new f(`Invalid region "${e}" from ${t}. Valid regions: ${Ks.join(", ")}.`,{isUserError:!0})}function ob(e){if(e)return Hp(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return Hp(t,"WEBFLOW_REGION");let n;try{n=ee().manifest.region}catch(r){if(r instanceof Error&&r.message.startsWith("Invalid manifest:"))throw new f(r.message,{isUserError:!0});return"us"}return n?Hp(n,"webflow.json"):"us"}var Ks,tb,Xl=L(()=>{"use strict";C();Me();Ks=["us","eu"],tb="us"});var ib,sb=L(()=>{"use strict";ib=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 s0(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function Gp(){return i0[s0()][rb()]}function P(){return process.env.WEBFLOW_API_HOST?Vp("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):Gp().api}function mi(){return process.env.WEBFLOW_CDN_API_HOST?Vp("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):Gp().cdnApi}function En(){return process.env.WEBFLOW_HOST?Vp("WEBFLOW_HOST",process.env.WEBFLOW_HOST):Gp().webflow}var Vp,i0,Js,Kp,zs,qs,gi,De=L(()=>{"use strict";Xl();sb();Vp=(e,t)=>(ib(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),i0={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"}}};Js="wf-manifest.json",Kp="mf-manifest.json",zs="@webflow_renderer",qs="ssr-bundle.tar",gi="index.js"});function a0(){let e=process.argv.slice(2),t=[];for(let n=0;n<e.length;n+=1){let r=e[n],o=r.indexOf("=");if(o>0&&ab.has(r.slice(0,o))){t.push(`${r.slice(0,o)}=<redacted>`);continue}t.push(r),ab.has(r)&&n+1<e.length&&(t.push("<redacted>"),n+=1)}return t.join(" ")||void 0}var ab,F,Jp=L(()=>{"use strict";Wp();Gs();A();lt();De();ab=new Set(["--ref","--name","--q","--branch","--key"]);F=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=mr.getInstance(),this.sessionId=Mp(),this.platformInfo=Qw()}async sendEvent(t){try{if(!await this.isEnabled())return;let n=this.enrichEvent(t),r=this.sanitizeEvent(n);await this.transmitEvent(r)}catch(n){u.debug(`Failed to send telemetry event: ${n}`)}}async sendError(t,n,r){await this.sendEvent({eventType:"error",success:!1,name:t.name,message:t.message,cause:t.cause,stack:jp(t),context:n,metadata:r?fr(r):void 0})}async sendUsage(t,n){let{duration:r,...o}=n??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof r=="number"?r:void 0,data:Object.keys(o).length>0?fr(o):void 0})}async sendPerformance(t,n,r){await this.sendEvent({eventType:"performance",operation:t,duration:n,metrics:r})}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 n=mr.getInstance(),r=await n.getPreference();return r!==void 0?r:await n.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:Bn(),command:this.config.suppressCommand?void 0:a0(),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 n=JSON.parse(JSON.stringify(t));return n.message&&(n.message=kn(n.message)),n.stack&&(n.stack=kn(n.stack)),n.context&&(n.context=kn(n.context)),n.metadata&&(n.metadata=fr(n.metadata)),n.data&&(n.data=fr(n.data)),n}async transmitEvent(t){let n=this.getEndpoint(),r=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(r){console.log(`\u{1F4CA} [Telemetry] Sending to: ${n}`);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 G(n,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)r&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw r&&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:n}=this.config;return`${t}/webflow-cli/${n}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"skills"})}}});var lb=L(()=>{"use strict"});function cb(e){return async(t,n,r)=>{let o=Date.now(),i=process.memoryUsage().heapUsed;try{let s=await n(),a=Date.now()-o,l=process.memoryUsage().heapUsed;return await e.sendPerformance(t,a,{memoryDelta:l-i,...r}),s}catch(s){let a=Date.now()-o;throw await e.sendPerformance(t,a,{failed:1,...r}),s}}}var X=L(()=>{"use strict";Jp();Wp();lb();Gs();Gs()});var qp,zp,l0,Wn,Xp=L(()=>{"use strict";qp=Symbol("webflow-cli-warn"),zp=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let n=t.split(`
11
+ `);for(let r=2;r<n.length;r++){let o=n[r],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]===qp){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let n=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),r=new Error().stack||"",o=this.parseSource(r);this.warnings.push({message:n,timestamp:Date.now(),source:o,stackTrace:r})})}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((n,r)=>{let o=r.source||"General";return n[o]||(n[o]=[]),n[o].push(r),n},{});Object.entries(t).forEach(([n,r])=>{n!=="General"&&console.log(` ${n}:`),r.forEach((o,i)=>{let s=n!=="General"?" ":" ",a=o.message||"[Empty warning message]";console.log(`${s}${i+1}. ${a}`)}),n!=="General"&&console.log("")}),t.General&&console.log("")}debug(){console.log(`
14
14
  \u{1F41B} Debug: Captured Warnings
15
15
  `),this.warnings.forEach((t,n)=>{console.log(`Warning ${n+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(r=>{console.log(` ${r}`)})),console.log("")})}},jA=new jp,Bn=jA});function wt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function qw(e,t){if(!e)return t;let n=parseInt(e,10);return isNaN(n)||n<=0?t:n}function Un(e){Js.push(bn(e)),Js.length>UA&&Js.shift()}function Xw(e){Wp=e}function Kw(e){return Un(`DEBUG: ${e}`),e}function HA(e){return Un(`INFO: ${e}`),e}function VA(e){return Un(`WARN: ${e}`),e}function GA(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Un(`ERROR: ${r}${n}`),Hp=!0;let o=e instanceof Error?e.message:String(e);return Mt(`${r}${o}`)}function JA(e){return Un(`SUCCESS: ${e}`),K(e)}function qA(e){let t=bp({text:`${e}...`,indent:1}).start(),n=!1,r=o=>i=>{if(Un(`${KA[o]||"INFO"}: ${i||e}`),o==="fail"&&(Hp=!0),o==="update"){t.text=i||e;return}n||(n=!0,t.stopAndPersist({symbol:zA[o],text:R(i||e)}))};return{succeed:r("succeed"),fail:r("fail"),warn:r("warn"),info:r("info"),neutral:r("neutral"),update:r("update"),stop:()=>{n||(n=!0,t.stop())}}}function XA(){let e=fi.default.readdirSync(_t).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:fi.default.statSync(Vl.default.join(_t,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);for(;e.length>=BA;)try{let t=e.pop();if(!t)break;fi.default.removeSync(Vl.default.join(_t,t.name))}catch{}}function Vp(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;fi.default.ensureDirSync(_t),XA(),Js.unshift(`CLI Version: ${jn()}`,`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()}`,...Wp?[`Sync ID: ${Wp}`]:[],"");let n=Js.map(wt);fi.default.writeFileSync(Up,n.join(`
17
- `)),Hp&&(console.info(`
18
- ${k} ${R("An error occurred. See logs for more information:")}`),console.info(` ${Tp} Latest log: ${Up}`),console.info(` ${Tp} All logs: ${_t}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
- ${$} Command completed successfully. Logs written to:`),console.info(` ${ui} Latest log: ${Up}`),console.info(` ${ui} All logs: ${_t}`))}catch(t){console.error("Failed to write logs:",t)}}function Yw(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Un(`ERROR: ${r}${n}`)}var fi,Vl,n2,MA,_t,BA,UA,WA,Up,Js,Hp,Wp,KA,zA,mi,zw,Gs,YA,u,_=L(()=>{"use strict";fi=w(require("fs-extra")),Vl=w(require("path")),n2=require("source-map-support/register");ww();vp();Ew();X();pe();Bp();M();MA=Ls("webflow-cli"),_t=MA.log;BA=qw(process.env.MAX_PERSISTED_LOGS,50),UA=qw(process.env.MAX_IN_MEMORY_LOGS,1e3),WA=`${Ns(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Up=Vl.default.join(_t,WA);Js=[],Hp=!1;KA={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},zA={succeed:$,fail:k,warn:re,info:je,neutral:" ",update:void 0};mi=!1;process.on("uncaughtException",e=>{mi||(mi=!0,Un(`UNCAUGHT EXCEPTION: ${e?.stack}`),Vp(1)),Bn.displayGrouped(),Bn.stop(),process.exit(1)});process.on("unhandledRejection",e=>{mi||(mi=!0,Un(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),Vp(1)),Bn.displayGrouped(),Bn.stop(),process.exit(1)});process.on("exit",e=>{mi||(mi=!0,Vp(e))});zw=!0,Gs=e=>{let t=e.split(`
16
+ `).slice(0,3).forEach(r=>{console.log(` ${r}`)})),console.log("")})}},l0=new zp,Wn=l0});function wt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function pb(e,t){if(!e)return t;let n=parseInt(e,10);return isNaN(n)||n<=0?t:n}function Hn(e){Ys.push(kn(e)),Ys.length>d0&&Ys.shift()}function fb(e){Zp=e}function ub(e){return Hn(`DEBUG: ${e}`),e}function f0(e){return Hn(`INFO: ${e}`),e}function m0(e){return Hn(`WARN: ${e}`),e}function g0(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Hn(`ERROR: ${r}${n}`),Qp=!0;let o=e instanceof Error?e.message:String(e);return Bt(`${r}${o}`)}function h0(e){return Hn(`SUCCESS: ${e}`),J(e)}function b0(e){let t=_p({text:`${e}...`,indent:1}).start(),n=!1,r=o=>i=>{if(Hn(`${y0[o]||"INFO"}: ${i||e}`),o==="fail"&&(Qp=!0),o==="update"){t.text=i||e;return}n||(n=!0,t.stopAndPersist({symbol:w0[o],text:I(i||e)}))};return{succeed:r("succeed"),fail:r("fail"),warn:r("warn"),info:r("info"),neutral:r("neutral"),update:r("update"),stop:()=>{n||(n=!0,t.stop())}}}function D0(){let e=hi.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:hi.default.statSync(Yl.default.join(At,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);for(;e.length>=u0;)try{let t=e.pop();if(!t)break;hi.default.removeSync(Yl.default.join(At,t.name))}catch{}}function ef(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;hi.default.ensureDirSync(At),D0(),Ys.unshift(`CLI Version: ${Bn()}`,`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()}`,...Zp?[`Sync ID: ${Zp}`]:[],"");let n=Ys.map(wt);hi.default.writeFileSync(Yp,n.join(`
17
+ `)),Qp&&(console.info(`
18
+ ${k} ${I("An error occurred. See logs for more information:")}`),console.info(` ${Bp} Latest log: ${Yp}`),console.info(` ${Bp} All logs: ${At}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
+ ${$} Command completed successfully. Logs written to:`),console.info(` ${fi} Latest log: ${Yp}`),console.info(` ${fi} All logs: ${At}`))}catch(t){console.error("Failed to write logs:",t)}}function mb(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Hn(`ERROR: ${r}${n}`)}var hi,Yl,P2,c0,At,u0,d0,p0,Yp,Ys,Qp,Zp,y0,w0,yi,db,Xs,k0,u,A=L(()=>{"use strict";hi=w(require("fs-extra")),Yl=w(require("path")),P2=require("source-map-support/register");Iw();Ip();Ow();X();pe();Xp();M();c0=Bs("webflow-cli"),At=c0.log;u0=pb(process.env.MAX_PERSISTED_LOGS,50),d0=pb(process.env.MAX_IN_MEMORY_LOGS,1e3),p0=`${Us(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Yp=Yl.default.join(At,p0);Ys=[],Qp=!1;y0={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},w0={succeed:$,fail:k,warn:re,info:Ce,neutral:" ",update:void 0};yi=!1;process.on("uncaughtException",e=>{yi||(yi=!0,Hn(`UNCAUGHT EXCEPTION: ${e?.stack}`),ef(1)),Wn.displayGrouped(),Wn.stop(),process.exit(1)});process.on("unhandledRejection",e=>{yi||(yi=!0,Hn(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),ef(1)),Wn.displayGrouped(),Wn.stop(),process.exit(1)});process.on("exit",e=>{yi||(yi=!0,ef(e))});db=!0,Xs=e=>{let t=e.split(`
20
20
  `).map(n=>n.length?` ${n}`:n).join(`
21
- `);return zw?(zw=!1,`
22
- `+t):t};YA={debug:e=>{let t=Kw(e);process.env.DEBUG&&console.debug(Gs(t))},trace:e=>{let t=Kw(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(Gs(HA(e))),warn:e=>console.warn(Gs(VA(e)),Mp),error:(e,t)=>{console.error(Gs(GA(e,t)))},success:e=>console.log(Gs(JA(e))),spinner:qA},u=YA});async function gi(e){process.stdout.write(`
23
- `);try{return await e()}catch(t){throw t instanceof Error&&o0.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 Re(e){return V()?e.default??!1:gi(()=>ct.confirm({...e,theme:QA}))}async function Me(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(n=>{if(!n||typeof n!="object"||ct.Separator.isSeparator(n)||n.type==="separator")return n;let r=n.name??String(n.value??"");return{...n,name:` ${R(r)}`}});return gi(()=>ct.select({...e,choices:t,theme:t0}))}async function Je(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:gi(()=>ct.input({...e,theme:eD}))}async function rD(e){return V()?null:gi(()=>ct.password({...e,theme:eD}))}async function En(e){if(V()){let n=[];return await e.validate?.(n)!==!0?null:n}let t=e.choices.map(n=>{if(!n||typeof n!="object"||n.type==="separator"||ct.Separator.isSeparator(n))return n;let r=n.name??String(n.value??"");return{...n,name:` ${R(r)}`}});return gi(()=>ct.checkbox({...e,choices:t,theme:n0}))}async function Jl(e){if(V())return"default"in e?e.default:null;let t=(async(n,r)=>(await e.source(n,r)).map(i=>!i||typeof i!="object"||ct.Separator.isSeparator(i)?i:{...i,name:` ${R(i.name??"")}`}));return gi(()=>ct.search({...e,source:t,theme:r0}))}var ct,QA,eD,Ks,tD,Kp,zp,nD,e0,t0,n0,r0,o0,Te=L(()=>{"use strict";ct=w(require("@inquirer/prompts"));we();_();pe();QA={prefix:` ${Ne("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
21
+ `);return db?(db=!1,`
22
+ `+t):t};k0={debug:e=>{let t=ub(e);process.env.DEBUG&&console.debug(Xs(t))},trace:e=>{let t=ub(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(Xs(f0(e))),warn:e=>console.warn(Xs(m0(e)),qp),error:(e,t)=>{console.error(Xs(g0(e,t)))},success:e=>console.log(Xs(h0(e))),spinner:b0},u=k0});async function wi(e){process.stdout.write(`
23
+ `);try{return await e()}catch(t){throw t instanceof Error&&_0.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:wi(()=>ct.confirm({...e,theme:v0}))}async function Be(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(n=>{if(!n||typeof n!="object"||ct.Separator.isSeparator(n)||n.type==="separator")return n;let r=n.name??String(n.value??"");return{...n,name:` ${I(r)}`}});return wi(()=>ct.select({...e,choices:t,theme:x0}))}async function Ke(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:wi(()=>ct.input({...e,theme:yb}))}async function Db(e){return V()?null:wi(()=>ct.password({...e,theme:yb}))}async function vn(e){if(V()){let n=[];return await e.validate?.(n)!==!0?null:n}let t=e.choices.map(n=>{if(!n||typeof n!="object"||n.type==="separator"||ct.Separator.isSeparator(n))return n;let r=n.name??String(n.value??"");return{...n,name:` ${I(r)}`}});return wi(()=>ct.checkbox({...e,choices:t,theme:C0}))}async function Ql(e){if(V())return"default"in e?e.default:null;let t=(async(n,r)=>(await e.source(n,r)).map(i=>!i||typeof i!="object"||ct.Separator.isSeparator(i)?i:{...i,name:` ${I(i.name??"")}`}));return wi(()=>ct.search({...e,source:t,theme:F0}))}var ct,v0,yb,Zs,wb,rf,of,bb,S0,x0,C0,F0,_0,Oe=L(()=>{"use strict";ct=w(require("@inquirer/prompts"));be();A();pe();v0={prefix:` ${je("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
24
24
  `:`${se(e)}
25
- `,answer:e=>` ${R(e)}`}},eD={prefix:` ${Ne("?")}`,style:{message:e=>`${se(e)}
26
- `,answer:e=>R(e)}},Ks=2,tD=1,Kp=(e,t)=>t==="done"?`${se(e)}
27
- `:se(e),zp=e=>` ${R(wt(e).trim())}`,nD=e=>{let t=wt(e),n=t.slice(0,Ks),r=t.slice(Ks+1+tD);return Ne(`${n} ${r}`)},e0=e=>{let t=wt(e),n=t.slice(0,Ks),r=t[Ks+2],o=t.slice(Ks+3+tD);return Ne(`${n} ${r} ${o}`)},t0={prefix:` ${Ne("?")}`,style:{message:Kp,answer:zp,highlight:nD,keysHelpTip:e=>` ${e.map(([t,n])=>`${R(t)} ${R(n)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`}},n0={prefix:` ${Ne("?")}`,style:{message:Kp,answer:zp,highlight:e0,keysHelpTip:e=>` ${e.map(([t,n])=>`${R(t)} ${R(n)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`,checked:` ${K("\u25C9")}`,unchecked:` ${R("\u25EF")}`}},r0={prefix:` ${Ne("?")}`,style:{message:Kp,answer:zp,highlight:nD,searchTerm:e=>Ne(e)},icon:{cursor:` ${Ne("\u23F5")}`}},o0=/SIGINT/i});function tt(){return!0}var Wn=L(()=>{"use strict"});function Hn({apiToken:e,siteId:t,directory:n}){let r=qs.resolve(n?qs.join(n,".env"):qs.join(process.cwd(),".env"));n&&!to.existsSync(n)&&to.mkdirSync(n,{recursive:!0}),to.existsSync(r)||to.writeFileSync(r,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),Kl.default.config({path:r,quiet:!0}),e&&Kl.default.set("WEBFLOW_API_TOKEN",e,{path:r,encrypt:!1}),t&&Kl.default.set("WEBFLOW_SITE_ID",t,{path:r,encrypt:!1})}var to,qs,Kl,cD=L(()=>{"use strict";to=w(require("fs")),qs=w(require("path")),Kl=w(require("@dotenvx/dotenvx"))});var f,C=L(()=>{"use strict";f=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,n){let r=t instanceof Error?t.message:String(t);super(r),this.name="CLIError",this.prefix=n?.prefix,this.skipLogging=n?.skipLogging??!1,this.isUserError=n?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=n?.missingFlag,this.code=n?.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 zl(){if(process.platform==="win32"){let n=process.env.APPDATA??Xs.default.join(Xp.default.homedir(),"AppData","Roaming");return Xs.default.join(n,uD)}let t=process.env.XDG_CONFIG_HOME??Xs.default.join(Xp.default.homedir(),".config");return Xs.default.join(t,uD)}function dD(){return Ls("webflow-cli").cache}var Xp,Xs,uD,ql=L(()=>{"use strict";Xp=w(require("os")),Xs=w(require("path"));vp();uD="webflow"});function gr(){let e=zl();return Yp.default.join(e,a0)}function Ys(){let e=gr();try{if(!mr.default.existsSync(e))return null;let t=mr.default.readFileSync(e,"utf8");return JSON.parse(t)}catch{return null}}function Zp(e){let t=gr(),n=Yp.default.dirname(t);mr.default.existsSync(n)||mr.default.mkdirSync(n,{recursive:!0,mode:448}),mr.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}function Qp(){let e=gr();try{mr.default.existsSync(e)&&mr.default.unlinkSync(e)}catch{}}var mr,Yp,a0,ef=L(()=>{"use strict";mr=w(require("fs")),Yp=w(require("path"));ql();a0="auth.json"});var Zs,tf=L(()=>{"use strict";be();Zs={serverUrl:kn,timeoutMs:300*1e3}});var pD,fD,mD,gD,l0,hD,c0,yD,wD=L(()=>{"use strict";pD=require("crypto"),fD=w(require("open"));tf();_();lt();mD=e=>{let t=new Uint8Array(e);return pD.webcrypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")},gD=({pollId:e,clientId:t,scope:n})=>`${Zs.serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(n.join(" "))}`,l0=e=>`${Zs.serverUrl}/oauth/webflow/poll?pollId=${e}`,hD=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(n=>setTimeout(n,3e3)),await(0,fD.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},c0=async e=>{let t=l0(e),n=await J(t);if(!n.ok){let r=`Failed to poll for authentication status (${n.status})`;try{let o=await n.json();o&&o.error&&(r+=`: ${o.error}`)}catch{}throw new Error(r)}return n.json()},yD=(e,t)=>{let n=u.spinner("Waiting");return new Promise((r,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 c0(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),n.succeed("Authentication successful! You can close the browser window."),r(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function bD(){return[...u0,...tt()?d0:[]].sort()}function At(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=Ys();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!DD&&(DD=!0,u.warn(`${re} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${K("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 o=At();if(o)return o}if(V())throw new f(`No API token found. To authenticate in CI/CD environments:
25
+ `,answer:e=>` ${I(e)}`}},yb={prefix:` ${je("?")}`,style:{message:e=>`${se(e)}
26
+ `,answer:e=>I(e)}},Zs=2,wb=1,rf=(e,t)=>t==="done"?`${se(e)}
27
+ `:se(e),of=e=>` ${I(wt(e).trim())}`,bb=e=>{let t=wt(e),n=t.slice(0,Zs),r=t.slice(Zs+1+wb);return je(`${n} ${r}`)},S0=e=>{let t=wt(e),n=t.slice(0,Zs),r=t[Zs+2],o=t.slice(Zs+3+wb);return je(`${n} ${r} ${o}`)},x0={prefix:` ${je("?")}`,style:{message:rf,answer:of,highlight:bb,keysHelpTip:e=>` ${e.map(([t,n])=>`${I(t)} ${I(n)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`}},C0={prefix:` ${je("?")}`,style:{message:rf,answer:of,highlight:S0,keysHelpTip:e=>` ${e.map(([t,n])=>`${I(t)} ${I(n)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`,checked:` ${J("\u25C9")}`,unchecked:` ${I("\u25EF")}`}},F0={prefix:` ${je("?")}`,style:{message:rf,answer:of,highlight:bb,searchTerm:e=>je(e)},icon:{cursor:` ${je("\u23F5")}`}},_0=/SIGINT/i});function Je(){return!1}var Vn=L(()=>{"use strict"});function Gn({apiToken:e,siteId:t,directory:n}){let r=ea.resolve(n?ea.join(n,".env"):ea.join(process.cwd(),".env"));n&&!ro.existsSync(n)&&ro.mkdirSync(n,{recursive:!0}),ro.existsSync(r)||ro.writeFileSync(r,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),ec.default.config({path:r,quiet:!0}),e&&ec.default.set("WEBFLOW_API_TOKEN",e,{path:r,encrypt:!1}),t&&ec.default.set("WEBFLOW_SITE_ID",t,{path:r,encrypt:!1})}var ro,ea,ec,Cb=L(()=>{"use strict";ro=w(require("fs")),ea=w(require("path")),ec=w(require("@dotenvx/dotenvx"))});function tc(){if(process.platform==="win32"){let n=process.env.APPDATA??ta.default.join(af.default.homedir(),"AppData","Roaming");return ta.default.join(n,Fb)}let t=process.env.XDG_CONFIG_HOME??ta.default.join(af.default.homedir(),".config");return ta.default.join(t,Fb)}function _b(){return Bs("webflow-cli").cache}var af,ta,Fb,nc=L(()=>{"use strict";af=w(require("os")),ta=w(require("path"));Ip();Fb="webflow"});function yr(){let e=tc();return lf.default.join(e,I0)}function na(){let e=yr();try{if(!hr.default.existsSync(e))return null;let t=hr.default.readFileSync(e,"utf8");return JSON.parse(t)}catch{return null}}function cf(e){let t=yr(),n=lf.default.dirname(t);hr.default.existsSync(n)||hr.default.mkdirSync(n,{recursive:!0,mode:448}),hr.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}function uf(){let e=yr();try{hr.default.existsSync(e)&&hr.default.unlinkSync(e)}catch{}}var hr,lf,I0,df=L(()=>{"use strict";hr=w(require("fs")),lf=w(require("path"));nc();I0="auth.json"});function ra(){return{serverUrl:En(),timeoutMs:300*1e3}}var pf=L(()=>{"use strict";De()});var Ab,Rb,Ib,Tb,T0,Pb,P0,$b,Ob=L(()=>{"use strict";Ab=require("crypto"),Rb=w(require("open"));pf();A();lt();Ib=e=>{let t=new Uint8Array(e);return Ab.webcrypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")},Tb=({pollId:e,clientId:t,scope:n})=>`${ra().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(n.join(" "))}`,T0=e=>`${ra().serverUrl}/oauth/webflow/poll?pollId=${e}`,Pb=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(n=>setTimeout(n,3e3)),await(0,Rb.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},P0=async e=>{let t=T0(e),n=await G(t);if(!n.ok){let r=`Failed to poll for authentication status (${n.status})`;try{let o=await n.json();o&&o.error&&(r+=`: ${o.error}`)}catch{}throw new Error(r)}return n.json()},$b=(e,t)=>{let n=u.spinner("Waiting");return new Promise((r,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 P0(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),n.succeed("Authentication successful! You can close the browser window."),r(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function Nb(){return[...$0,...Je()?O0:[]].sort()}function Rt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=na();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!Lb&&(Lb=!0,u.warn(`${re} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${J("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 o=Rt();if(o)return o}if(V())throw new f(`No API token found. To authenticate in CI/CD environments:
28
28
  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=mD(16),n=p0(),r=bD();try{let o=gD({pollId:t,clientId:n,scope:r});await hD(o);let i=await yD(t,Zs.timeoutMs);return Zp({accessToken:i,scopes:r,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${gr()}`),i}catch(o){throw new f(o)}}function p0(){return"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}var u0,d0,DD,nf=L(()=>{"use strict";we();_();M();C();ef();tf();wD();pe();Wn();u0=["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"],d0=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];DD=!1});function no(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function hr(e){try{let n=await new kD.WebflowClient({accessToken:e,environment:{base:`${P}/v2`,dataApi:`${P}/v2`,contentDeliveryApi:`${di}/v2`}}).sites.list();if(!n||typeof n!="object"||!n.sites||!Array.isArray(n.sites))throw new f("Invalid response from Webflow API");let r=n.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 r.sort((o,i)=>o.displayName.localeCompare(i.displayName)),r}catch(t){throw new f(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
30
- `})}}async function hi(e){let t=e.map(r=>({name:`${r.displayName} (${r.shortName})`,value:r})),n=await Jl({message:"Search for a Webflow site:",source:r=>{if(!r)return t;let o=r.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!n){if(e.length===0)throw new f("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return n}var kD,Xl=L(()=>{"use strict";kD=require("webflow-api");Te();_();be();be();C()});var ro,yr,rf=L(()=>{"use strict";C();ro=class extends f{constructor(t){super(t),this.name="NoWebflowSitesError"}},yr=class extends f{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Ke(e,t){let n=t?.site??no(e);if(V()&&!n)throw new f(`No site ID configured for this project.
31
- Run ${K("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 r=await T({apiToken:t?.apiToken,force:t?.force});if(!n||t?.force){let o=await hr(r);if(o.length===0)throw new ro("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 hi(o):o[0];n=i.id;let s=Se({siteId:n});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:n,siteName:i.displayName,accessToken:r}}return{siteId:n,accessToken:r}}var ED=L(()=>{"use strict";We();we();nf();Xl();C();rf();M();pe();_()});async function of(e){let t=new vD.WebflowClient({accessToken:e,environment:{base:`${P}/v2`,dataApi:`${P}/v2`,contentDeliveryApi:`${di}/v2`}});try{return await t.token.authorizedBy()}catch{return null}}var vD,SD=L(()=>{"use strict";vD=require("webflow-api");be()});var q=L(()=>{"use strict";cD();nf();ED();Xl();Xl();ef();SD();rf()});function x0(e,t){if(e.includes("..")||sn.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let n=sn.resolve(t,e),r=sn.resolve(t);if(!n.startsWith(r+sn.sep)&&n!==r)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function lc(e,t,n){let r=sn.join(process.cwd(),t);n&&(0,Dr.existsSync)(r)&&await(0,ac.rm)(r,{recursive:!0,force:!0}),(0,Dr.existsSync)(r)||await(0,ac.mkdir)(r);for(let o of e){x0(o.path,r);let i=C0(r,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));F0(r,s)}(0,Dr.writeFileSync)(i,o.content,{flag:"w+"})}}function C0(e,t){return sn.join(e,...t.split("/"))}function F0(e,t){let n=t.split("/"),r=e;for(let o of n)r=sn.join(r,o),(0,Dr.existsSync)(r)||(0,Dr.mkdirSync)(r)}var Dr,ac,sn,hf=L(()=>{"use strict";Dr=require("fs"),ac=require("fs/promises"),sn=w(require("path"))});function uc(e){for(let t of e??[]){let n=u[t.status]??u.info,r=R0[t.status]??je;n(`
33
- ${r} ${t.content}`)}}var R0,Df=L(()=>{"use strict";_();M();R0={info:je,warn:re,success:$}});function kf(e){let{manifestPath:t}=ne();return(0,ab.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var ab,lb=L(()=>{"use strict";ab=require("fs");js()});function dc(e,t){try{let n=Ef(),r=vf(Object.values(e)),o=t?.force;return r&&n&&!o}catch{return!1}}var cb,ub,Ef,vf,pc=L(()=>{"use strict";cb=require("path"),ub=require("fs-extra");Ef=()=>{try{return(0,ub.existsSync)((0,cb.join)(process.cwd(),"tsconfig.json"))}catch{return!1}},vf=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function T0(e){let{export:t,...n}=e;return t?n["devlink-export"]!=null?(kf(n),n):(u.warn(`${re} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),n["devlink-export"]={...t},kf(n),n):n}function fb(e,t){try{new RegExp(e)}catch{throw new f(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function gb(e){e=T0(e);let t=e["devlink-export"]||{},n=!1,r=t.rootDir;r||(V()?r=db:(n=!0,r=await Je({message:"Enter the root directory for exported components:",default:db,validate:d=>!d||d.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(O0()?o=!0:V()?o=!1:(n=!0,o=await Re({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=pb:(n=!0,i=await Re({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:pb}))),t.components&&fb(t.components,"components"),t.componentGroups&&fb(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=fc,a=mc):(n=!0,await Re({message:"Do you want to export all components?",default:!0})?(s=fc,a=mc):(s=await Je({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:fc,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Je({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:mc,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||fc,a=a||mc;let l=t.relativeHrefRoot;l===void 0&&(l=P0);let c={...t,rootDir:r,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)&&$0(c),{config:c,wasPrompted:n}}function $0(e){Se({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function O0(){try{let e=process.cwd();if(Ef())return!0;let t=["src","app","pages","components"];for(let n of t){let r=mb.join(e,n);if(gc.existsSync(r)&&vf(gc.readdirSync(r)))return!0}}catch{}return!1}var gc,mb,db,fc,mc,pb,P0,hb=L(()=>{"use strict";gc=w(require("fs")),mb=w(require("path"));Te();we();_();M();C();Ap();lb();pc();db="./webflow",fc=".*",mc=".*",pb=!0,P0="/"});function io(e){let t=e;for(let n=0;n<8&&t instanceof Error;n+=1){if(t.code===xf)return!0;t=t.cause}return!1}async function Db(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let n,r;try{let o=JSON.parse(t);n=o.message,r=o.code}catch{}throw new ta(n||`Request failed (HTTP ${e.status}).`,{code:r})}async function Cf(e,t,n,r){let o=await L0(n,r,t,e);if(!o.files||!Array.isArray(o.files))throw new f("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function L0(e,t,n,r){let{taskId:o,polling:i}=await N0(e,t,n,r);return j0(e,t,n,o,i)}async function N0(e,t,n,r){let o=await(0,Sf.default)(`${P}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",[wb]:t},body:JSON.stringify(r),timeout:6e4});return o.ok||await Db(o),await o.json()}async function j0(e,t,n,r,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,d=i;do{let p=await(0,Sf.default)(`${P}/v2/devlink/${e}/export/${r}`,{headers:{Authorization:`Bearer ${n}`,[wb]:t},timeout:6e4});p.ok||await Db(p);let m=await p.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new ta("The export task failed. Please try again or report a bug.");await(0,yb.setTimeout)(d),d=Math.min(d*a,s)}while(Date.now()<c);throw new ta(`Export task timed out after ${l}ms. Please try again.`)}var Sf,yb,wb,xf,ta,Ff=L(()=>{"use strict";Sf=w(require("node-fetch")),yb=require("timers/promises");_();be();C();wb="X-WF-Sync-Id",xf="devlink_export_not_entitled",ta=class extends Error{code;constructor(t,n){super(t),this.code=n?.code}}});var bb,kb=L(()=>{"use strict";Te();_();bb=async(e,t)=>{if(!t)return;await Re({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function Eb(e,t,n){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:n||`${t}s`;return`${e} ${i}`}var vb=L(()=>{"use strict"});async function hc(e){let t=Date.now(),n;try{let{manifest:r}=ne(),{siteId:o,accessToken:i}=await Ke(r,e),s=(0,Sb.randomUUID)();Xw(s);let{config:a,wasPrompted:l}=await gb(r);u.info(`${$} Export configuration loaded!`),await bb(a,l);let c=F.forExport({authToken:i,siteId:o});n=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:d,messages:p,metadata:m}=await Cf(a,i,o,s),h=m.exportCoverage==="full";await lc(d,a.rootDir,h),n.succeed(`${Eb(m.componentCount,"component")} exported to ${a.rootDir}`),uc(p);let g=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:g,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);throw e?.silentNotEntitled&&io(d)?n.stop():n.fail(`Components export failed: ${p}`),await c.sendError(d instanceof Error?d:new Error(String(d)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),d}}catch(r){if(!(e?.silentNotEntitled&&io(r))){let i="Export failed: "+(r instanceof Error?r.message:r);n?n.fail(i):u.error(i,{prefix:`
34
- `+k})}throw new f(r,{skipLogging:!0})}}var Sb,xb=L(()=>{"use strict";Sb=require("crypto");hb();Ff();kb();X();q();We();vb();_();C();hf();M();Df()});var Cb={};by(Cb,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>xf,exportComponents:()=>hc,isDevlinkNotEntitledError:()=>io});var yc=L(()=>{"use strict";xb();Ff()});var ky=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function T_(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 P_(e=process){if(e[ky])return;e[ky]=!0;let t=e.emit;e.emit=function(r,...o){return r==="warning"&&T_(o[0])?!1:t.call(this,r,...o)}}P_();var E_=w(require("fs")),v_=require("commander");var D_=require("commander");pe();_();var Zw=require("child_process"),Qw=require("fs"),Gp=w(require("semver"));_();var Jp="@webflow/webflow-cli",Zr="@webflow/data-types",Gl="@webflow/react",ZA=[Jp,Zr,Gl],Qr=class{getInstalledDependencies(){try{let t=(0,Zw.execSync)(`npm ls ${ZA.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),n=JSON.parse(t);return n.dependencies?Object.entries(n.dependencies).reduce((r,[o,{version:i}])=>(r[o]=i,r),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let n=JSON.parse((0,Qw.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...n.dependencies,...n.devDependencies}}checkCLIAndDataTypes(t){let n=t[Zr];if(!n)return;let o=this.getRequiredDependencies(Jp)[Zr];if(!Gp.default.satisfies(n,o))throw new Error(`Version mismatch: ${Jp} requires ${Zr} v${o} but found v${n}`)}checkReactAndDataTypes(t){let n=t[Zr],r=t[Gl];if(!(!n||!r)&&!Gp.default.eq(n,r))throw new Error(`Version mismatch: ${Gl} and ${Zr} must be on the same version. Found ${Gl}@${r} and ${Zr}@${n}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var aD=require("fs-extra");Te();var lD=require("@dotenvx/dotenvx"),eo=w(require("semver"));_();var oD=require("child_process"),iD=require("util"),i0=(0,iD.promisify)(oD.exec);async function fr(e,t){try{let{stdout:n,stderr:r}=await i0(e,t);return{stdout:n.toString().trim(),stderr:r.toString().trim(),code:0}}catch(n){let r=n;return{stdout:r.stdout??"",stderr:r.stderr??String(r.message??""),code:r.code??1}}}we();var qp=w(Wl());M();pe();(0,lD.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var sD={npm:{updateCommand:"npm install",update:async e=>await fr(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await fr(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await fr(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await fr(`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}},s0=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],zs=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(sD))if((0,aD.existsSync)(t.lockFile))return t;return sD.npm}async listOutdatedPackages(t="local",n=s0){let{getOutdated:r,globalFlag:o}=this.packageManager,i=await r(`${t==="global"?o:""} ${n?.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 n=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...n}}async showUpdatePrompt(t){let n={name:"Update all packages",value:"update-all"},r=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${at} ${a})`,value:i})),o=await En({message:`New versions of the following ${Ne("@webflow")} packages are available. Would you like to update them?`,choices:[n,...r]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:n,globalFlag:r}=this.packageManager;u.info(`${je} New versions of the following ${Ne("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(R(` ${Hl} ${s} (${a} ${at} ${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(`
35
- ${at} To update, run:`),o.length>0&&u.info(K(` ${n} ${o.join(" ")}`)),i.length>0&&u.info(K(` ${n} ${r} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=eo.prerelease(qp.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:r,code:o}=await fr(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!r.trim()){n.succeed("Up to date");return}let i=r.trim(),s=qp.default.version;if(!eo.valid(i)||!eo.valid(s)){n.succeed("Up to date");return}if(!eo.gt(i,s)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){u.info(`${je} A new version of @webflow/webflow-cli@${t} is available.`);let{code:p}=await fr("npm ls @webflow/webflow-cli --json"),h=(p===0?"local":"global")==="global"?" --global":"";u.info(`${at} To update, run: `+K(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`)+`
36
- `);return}let{code:l}=await fr("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await Re({message:`A new version of @webflow/webflow-cli@${t} is available.
37
- Would you like to update it?`,default:!1})){n=u.spinner("Updating");let p=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${p} @webflow/webflow-cli@${t}`),n.succeed("Updated successfully")}catch{let h=c==="global"?` ${this.packageManager.globalFlag}`:"";n.fail("Update failed. Manually run: "+K(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let r=await this.getOutdatedPackages();if(!(Object.keys(r).length>0)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){this.showUpdateSuggestions(r);return}let s=await this.showUpdatePrompt(r);if(s.length>0){n=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,h)=>(m[r[h].installationType==="global"?"global":"local"].push(h),m),{local:[],global:[]}),{update:c,globalFlag:d,updateCommand:p}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${d} ${l.map(m=>`${m}@latest`).join(" ")}`),n.succeed("Updated successfully")}catch{n.fail("Update failed. Manually run: "+K(`${p} ${s.map(h=>`${h}@latest`).join(" ")}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}};we();Wn();Bp();Np();Te();X();q();we();We();_();C();M();pe();var CD=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 n=>{if(V()){u.info(`${k} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:r}=ne();if(!n.force&&At()){let i=no(r);u.info(`${$} Webflow credentials already exist:`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
38
- Use --force flag to reauthenticate anyway`);return}try{let o=await T({force:n.force});Hn({apiToken:o}),u.info(`
39
- You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new f(o,{prefix:`${k} Authentication failed:`})}}),t.command("status").description("Show current authentication status").action(async()=>{let n=Ys(),r=n?.accessToken??At();if(!r){u.info(`${k} Not logged in. Run ${K("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let o=await of(r);if(!o){u.info(`${k} Token is invalid or expired. Run ${K("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}u.info(`${$} Logged in as ${o.firstName} ${o.lastName} (${o.email})`),n?.scopes?.length&&u.info(` Scopes: ${n.scopes.join(", ")}`),u.info(` Session: ${gr()}`)}catch(o){throw new f(o,{prefix:`${k} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove stored credentials").action(async()=>{Qp(),u.info(`${$} Logged out. Session file removed.`),u.info(`${at} Run ${K("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").action(async n=>{let r=pr.getInstance();if(n.status){let s=await r.getTelemetryStatus();u.info(xD(s.enabled));return}if(n.enable){await r.setGlobalPreference(!0),u.info(sf(!0));return}if(n.disable){await r.setGlobalPreference(!1),u.info(sf(!1));return}let o=await r.getTelemetryStatus();if(u.info(xD(o.enabled)),V()){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 r.setGlobalPreference(s),u.info(sf(s))}})},sf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,xD=e=>`${je} Telemetry status: ${e?`enabled ${$}`:`disabled ${k}`}`;var JD=w(require("http")),KD=w(require("node-fetch")),zD=w(require("serve-handler")),qD=require("fs"),XD=w(require("path")),YD=require("commander");var _D=w(require("archiver")),lf=require("commander"),Ql=require("fs");var FD=require("cosmiconfig"),af=require("commander"),Yl=async(e,t)=>{let n=await f0(t),r=n.config.apiVersion;return r&&typeof r!="string"&&af.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:n.filepath,config:{publicDir:e,...n.config}}},f0=async e=>{let n=await(0,FD.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return n||af.program.error(`No ${e} file was found. Run this command within your extension folder.`),n};var AD=w(require("mime-types")),Zl=w(require("path")),m0=5*1024*1024,g0=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"]),ID=async(e,t,n)=>{let{config:r,filepath:o}=await Yl(e,t),i=Zl.join(o,".."),s=!0,a=!1,l=d=>{let p=d.name,m=AD.default.lookup(p);return p==="index.html"&&(a=!0),p&&p.endsWith(".DS_Store")||!m?!1:g0.has(m)?d:(console.log(`Invalid file type: ${m} for file: ${p}`),s=!1,!1)},c=d=>{(0,Ql.unlink)(n,p=>{p&&console.error(`Failed to delete file: ${p}`),lf.program.error(d)})};return console.log(`Packaging the contents of the ${r.publicDir} folder into ${n}...`),new Promise(d=>{let p=(0,_D.default)("zip",{zlib:{level:9}}),m=(0,Ql.createWriteStream)(Zl.join(i,n));m.on("close",()=>{d(void 0)}),p.directory(Zl.join(i,r.publicDir),!1,l),p.file(o,{name:t}),p.pipe(m),p.finalize(),p.on("warning",h=>{console.log(h)}),p.on("error",h=>{lf.program.error(h.message)}),p.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(!p.pointer()||p.pointer()===0){c("Bundling failed with no output");return}if(p.pointer()>=m0){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${p.pointer()} total bytes written`),console.log(`Done! ${n} is ready for you to upload to your Webflow app.`)})})};var Qs=w(require("path")),vn=w(require("fs/promises")),nc=w(require("fs")),TD=require("url"),UM=require("dotenv/config"),PD=["js","cjs","json"],df=process.cwd(),$D=".webflowrc",Gn=Qs.extname(nc.readdirSync(df).find(e=>e.includes($D))??"").replace(/\./g,""),Vn=Qs.join(df,`${$D}${Gn&&`.${Gn}`}`),OD=nc.existsSync(Vn),cf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${PD.join(", ")}`)}},ec=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Gn}. The supported extensions are: ${PD.join(", ")}`)}},tc=class extends Error{constructor(t){let n=t.includes(".webflowrc"),r=t.includes("webflow.json"),o;n?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.`:r?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)}},uf=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 h0(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,TD.pathToFileURL)(e).href:e)).default}function RD(e,t){let n=t.filter(r=>!e[r]);if(n.length)throw new uf(n.join(", "))}async function yi(e=[],t=!1){if(!OD){if(t)return{};throw new tc(Vn)}if(!Gn)throw new cf;switch(Gn){case"js":case"cjs":{await vn.access(Vn);let n=await h0(Vn);return RD(n,e),n}case"json":{let n=JSON.parse(await vn.readFile(Vn,"utf8"));return RD(n,e),n}default:throw new ec}}function y0(e,t){if(Gn==="js"||Gn==="cjs"){let r=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(r)return r[1]}}function w0(e,t,n){let r=y0(t,n);if(r){let o=new RegExp(`${n}: ".*?",`,"g");return e.replace(o,`${n}: process.env.${r},`)}return e}async function D0(e){let t=["authToken","host","siteId"],n=await vn.readFile(Vn,"utf-8");for(let r of t)e=w0(e,n,r);return e}async function b0(){try{let e=Qs.join(df,"package.json");return await vn.access(e),JSON.parse(await vn.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function LD(e){if(!OD)throw new tc(Vn);let t=JSON.stringify(e,null,2);switch(Gn){case"js":case"cjs":{let n=await D0(t.replace(/"([^"]+)":/g,"$1:")),r=await b0()&&Gn==="js"?"export default ":"module.exports = ";return vn.writeFile(Vn,r+n)}case"json":return vn.writeFile(Vn,t);default:throw new ec}}var wr=w(require("fs")),Wt=w(require("path"));var ea="webflow.json",ND="index.html",jD="bundle.zip",pf="public",ff="extension-scaffolds",rc="default";var MD="package.json",BD="wf-placeholder-name",mf=e=>JSON.stringify(e,null,2),UD=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
29
+ 2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=Ib(16),n=L0(),r=Nb();try{let o=Tb({pollId:t,clientId:n,scope:r});await Pb(o);let i=await $b(t,ra().timeoutMs);return cf({accessToken:i,scopes:r,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${yr()}`),i}catch(o){throw new f(o)}}function L0(){return"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}var $0,O0,Lb,ff=L(()=>{"use strict";be();A();M();C();df();pf();Ob();pe();Vn();$0=["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"],O0=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];Lb=!1});function oo(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function wr(e){try{let n=await new jb.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/v2`}}).sites.list();if(!n||typeof n!="object"||!n.sites||!Array.isArray(n.sites))throw new f("Invalid response from Webflow API");let r=n.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 r.sort((o,i)=>o.displayName.localeCompare(i.displayName)),r}catch(t){throw new f(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
30
+ `})}}async function bi(e){let t=e.map(r=>({name:`${r.displayName} (${r.shortName})`,value:r})),n=await Ql({message:"Search for a Webflow site:",source:r=>{if(!r)return t;let o=r.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!n){if(e.length===0)throw new f("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return n}var jb,rc=L(()=>{"use strict";jb=require("webflow-api");Oe();A();De();De();C()});var io,br,mf=L(()=>{"use strict";C();io=class extends f{constructor(t){super(t),this.name="NoWebflowSitesError"}},br=class extends f{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function ze(e,t){let n=t?.site??oo(e);if(V()&&!n)throw new f(`No site ID configured for this project.
31
+ Run ${J("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 r=await T({apiToken:t?.apiToken,force:t?.force});if(!n||t?.force){let o=await wr(r);if(o.length===0)throw new io("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];n=i.id;let s=xe({siteId:n});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:n,siteName:i.displayName,accessToken:r}}return{siteId:n,accessToken:r}}var Mb=L(()=>{"use strict";Me();be();ff();rc();C();mf();M();pe();A()});async function gf(e){let t=new Bb.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/v2`}});try{return await t.token.authorizedBy()}catch{return null}}var Bb,Ub=L(()=>{"use strict";Bb=require("webflow-api");De()});var q=L(()=>{"use strict";Cb();ff();Mb();rc();rc();df();Ub();mf()});function q0(e,t){if(e.includes("..")||an.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let n=an.resolve(t,e),r=an.resolve(t);if(!n.startsWith(r+an.sep)&&n!==r)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function gc(e,t,n){let r=an.join(process.cwd(),t);n&&(0,kr.existsSync)(r)&&await(0,mc.rm)(r,{recursive:!0,force:!0}),(0,kr.existsSync)(r)||await(0,mc.mkdir)(r);for(let o of e){q0(o.path,r);let i=X0(r,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));Y0(r,s)}(0,kr.writeFileSync)(i,o.content,{flag:"w+"})}}function X0(e,t){return an.join(e,...t.split("/"))}function Y0(e,t){let n=t.split("/"),r=e;for(let o of n)r=an.join(r,o),(0,kr.existsSync)(r)||(0,kr.mkdirSync)(r)}var kr,mc,an,Cf=L(()=>{"use strict";kr=require("fs"),mc=require("fs/promises"),an=w(require("path"))});function yc(e){for(let t of e??[]){let n=u[t.status]??u.info,r=tR[t.status]??Ce;n(`
33
+ ${r} ${t.content}`)}}var tR,Af=L(()=>{"use strict";A();M();tR={info:Ce,warn:re,success:$}});function If(e){let{manifestPath:t}=ee();return(0,SD.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var SD,xD=L(()=>{"use strict";SD=require("fs");Ws()});function wc(e,t,n){try{let r=Tf(n),o=Pf(Object.values(e)),i=t?.force;return o&&r&&!i}catch{return!1}}var CD,FD,Tf,Pf,bc=L(()=>{"use strict";CD=require("path"),FD=require("fs-extra");Tf=e=>{try{return(0,FD.existsSync)((0,CD.join)(e,"tsconfig.json"))}catch{return!1}},Pf=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function nR(e){let{export:t,...n}=e;return t?n["devlink-export"]!=null?(If(n),n):(u.warn(`${re} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),n["devlink-export"]={...t},If(n),n):n}function RD(e,t){try{new RegExp(e)}catch{throw new f(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function TD(e){e=nR(e);let t=e["devlink-export"]||{},n=!1,r=t.rootDir;r||(V()?r=_D:(n=!0,r=await Ke({message:"Enter the root directory for exported components:",default:_D,validate:p=>!p||p.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(iR()?o=!0:V()?o=!1:(n=!0,o=await $e({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=AD:(n=!0,i=await $e({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:AD}))),t.components&&RD(t.components,"components"),t.componentGroups&&RD(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=Dc,a=kc):(n=!0,await $e({message:"Do you want to export all components?",default:!0})?(s=Dc,a=kc):(s=await Ke({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Dc,validate:d=>{try{return new RegExp(d),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Ke({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:kc,validate:d=>{try{return new RegExp(d),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Dc,a=a||kc;let l=t.relativeHrefRoot;l===void 0&&(l=rR);let c={...t,rootDir:r,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)&&oR(c),{config:c,wasPrompted:n}}function oR(e){xe({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function iR(){try{let e=process.cwd();if(Tf(e))return!0;let t=["src","app","pages","components"];for(let n of t){let r=ID.join(e,n);if(Ec.existsSync(r)&&Pf(Ec.readdirSync(r)))return!0}}catch{}return!1}var Ec,ID,_D,Dc,kc,AD,rR,PD=L(()=>{"use strict";Ec=w(require("fs")),ID=w(require("path"));Oe();be();A();M();C();Np();xD();bc();_D="./webflow",Dc=".*",kc=".*",AD=!0,rR="/"});function ao(e){let t=e;for(let n=0;n<8&&t instanceof Error;n+=1){if(t.code===Of)return!0;t=t.cause}return!1}async function LD(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let n,r;try{let o=JSON.parse(t);n=o.message,r=o.code}catch{}throw new sa(n||`Request failed (HTTP ${e.status}).`,{code:r})}async function Lf(e,t,n,r){let o=await sR(n,r,t,e);if(!o.files||!Array.isArray(o.files))throw new f("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function sR(e,t,n,r){let{taskId:o,polling:i}=await aR(e,t,n,r);return lR(e,t,n,o,i)}async function aR(e,t,n,r){let o=await(0,$f.default)(`${P()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",[OD]:t},body:JSON.stringify(r),timeout:6e4});return o.ok||await LD(o),await o.json()}async function lR(e,t,n,r,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,p=i;do{let d=await(0,$f.default)(`${P()}/v2/devlink/${e}/export/${r}`,{headers:{Authorization:`Bearer ${n}`,[OD]:t},timeout:6e4});d.ok||await LD(d);let m=await d.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new sa("The export task failed. Please try again or report a bug.");await(0,$D.setTimeout)(p),p=Math.min(p*a,s)}while(Date.now()<c);throw new sa(`Export task timed out after ${l}ms. Please try again.`)}var $f,$D,OD,Of,sa,Nf=L(()=>{"use strict";$f=w(require("node-fetch")),$D=require("timers/promises");A();De();C();OD="X-WF-Sync-Id",Of="devlink_export_not_entitled",sa=class extends Error{code;constructor(t,n){super(t),this.code=n?.code}}});var ND,jD=L(()=>{"use strict";Oe();A();ND=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 MD(e,t,n){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:n||`${t}s`;return`${e} ${i}`}var BD=L(()=>{"use strict"});async function vc(e){let t=Date.now(),n;try{let{manifest:r}=ee(),{siteId:o,accessToken:i}=await ze(r,e),s=(0,UD.randomUUID)();fb(s);let{config:a,wasPrompted:l}=await TD(r);u.info(`${$} Export configuration loaded!`),await ND(a,l);let c=F.forExport({authToken:i,siteId:o});n=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:p,messages:d,metadata:m}=await Lf(a,i,o,s),h=m.exportCoverage==="full";await gc(p,a.rootDir,h),n.succeed(`${MD(m.componentCount,"component")} exported to ${a.rootDir}`),yc(d);let g=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:g,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let d=p instanceof Error?p.message:String(p);throw e?.silentNotEntitled&&ao(p)?n.stop():n.fail(`Components export failed: ${d}`),await c.sendError(p instanceof Error?p:new Error(String(p)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),p}}catch(r){if(!(e?.silentNotEntitled&&ao(r))){let i="Export failed: "+(r instanceof Error?r.message:r);n?n.fail(i):u.error(i,{prefix:`
34
+ `+k})}throw new f(r,{skipLogging:!0})}}var UD,WD=L(()=>{"use strict";UD=require("crypto");PD();Nf();jD();X();q();Me();BD();A();C();Cf();M();Af()});var HD={};Py(HD,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>Of,exportComponents:()=>vc,isDevlinkNotEntitledError:()=>ao});var Sc=L(()=>{"use strict";WD();Nf()});var $y=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function eA(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 tA(e=process){if(e[$y])return;e[$y]=!0;let t=e.emit;e.emit=function(r,...o){return r==="warning"&&eA(o[0])?!1:t.call(this,r,...o)}}tA();var V_=w(require("fs")),G_=require("commander");var U_=require("commander");pe();A();var gb=require("child_process"),hb=require("fs"),tf=w(require("semver"));A();var nf="@webflow/webflow-cli",eo="@webflow/data-types",Zl="@webflow/react",E0=[nf,eo,Zl],to=class{getInstalledDependencies(){try{let t=(0,gb.execSync)(`npm ls ${E0.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),n=JSON.parse(t);return n.dependencies?Object.entries(n.dependencies).reduce((r,[o,{version:i}])=>(r[o]=i,r),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let n=JSON.parse((0,hb.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...n.dependencies,...n.devDependencies}}checkCLIAndDataTypes(t){let n=t[eo];if(!n)return;let o=this.getRequiredDependencies(nf)[eo];if(!tf.default.satisfies(n,o))throw new Error(`Version mismatch: ${nf} requires ${eo} v${o} but found v${n}`)}checkReactAndDataTypes(t){let n=t[eo],r=t[Zl];if(!(!n||!r)&&!tf.default.eq(n,r))throw new Error(`Version mismatch: ${Zl} and ${eo} must be on the same version. Found ${Zl}@${r} and ${eo}@${n}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var Sb=require("fs-extra");Oe();var xb=require("@dotenvx/dotenvx"),no=w(require("semver"));A();var kb=require("child_process"),Eb=require("util"),A0=(0,Eb.promisify)(kb.exec);async function gr(e,t){try{let{stdout:n,stderr:r}=await A0(e,t);return{stdout:n.toString().trim(),stderr:r.toString().trim(),code:0}}catch(n){let r=n;return{stdout:r.stdout??"",stderr:r.stderr??String(r.message??""),code:r.code??1}}}be();var sf=w(zl());M();pe();(0,xb.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var vb={npm:{updateCommand:"npm install",update:async e=>await gr(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await gr(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await gr(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await gr(`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}},R0=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],Qs=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(vb))if((0,Sb.existsSync)(t.lockFile))return t;return vb.npm}async listOutdatedPackages(t="local",n=R0){let{getOutdated:r,globalFlag:o}=this.packageManager,i=await r(`${t==="global"?o:""} ${n?.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 n=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...n}}async showUpdatePrompt(t){let n={name:"Update all packages",value:"update-all"},r=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${at} ${a})`,value:i})),o=await vn({message:`New versions of the following ${je("@webflow")} packages are available. Would you like to update them?`,choices:[n,...r]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:n,globalFlag:r}=this.packageManager;u.info(`${Ce} New versions of the following ${je("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(I(` ${ql} ${s} (${a} ${at} ${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(`
35
+ ${at} To update, run:`),o.length>0&&u.info(J(` ${n} ${o.join(" ")}`)),i.length>0&&u.info(J(` ${n} ${r} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=no.prerelease(sf.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:r,code:o}=await gr(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!r.trim()){n.succeed("Up to date");return}let i=r.trim(),s=sf.default.version;if(!no.valid(i)||!no.valid(s)){n.succeed("Up to date");return}if(!no.gt(i,s)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){u.info(`${Ce} A new version of @webflow/webflow-cli@${t} is available.`);let{code:d}=await gr("npm ls @webflow/webflow-cli --json"),h=(d===0?"local":"global")==="global"?" --global":"";u.info(`${at} To update, run: `+J(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`)+`
36
+ `);return}let{code:l}=await gr("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.
37
+ Would you like to update it?`,default:!1})){n=u.spinner("Updating");let d=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${d} @webflow/webflow-cli@${t}`),n.succeed("Updated successfully")}catch{let h=c==="global"?` ${this.packageManager.globalFlag}`:"";n.fail("Update failed. Manually run: "+J(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let r=await this.getOutdatedPackages();if(!(Object.keys(r).length>0)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){this.showUpdateSuggestions(r);return}let s=await this.showUpdatePrompt(r);if(s.length>0){n=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,h)=>(m[r[h].installationType==="global"?"global":"local"].push(h),m),{local:[],global:[]}),{update:c,globalFlag:p,updateCommand:d}=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(" ")}`),n.succeed("Updated successfully")}catch{n.fail("Update failed. Manually run: "+J(`${d} ${s.map(h=>`${h}@latest`).join(" ")}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}};be();Xl();Vn();Xp();Jp();Oe();X();q();be();Me();A();C();M();pe();var Hb=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 n=>{if(V()){u.info(`${k} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:r}=ee();if(!n.force&&Rt()){let i=oo(r);u.info(`${$} Webflow credentials already exist:`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
38
+ Use --force flag to reauthenticate anyway`);return}try{let o=await T({force:n.force});Gn({apiToken:o}),u.info(`
39
+ You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new f(o,{prefix:`${k} Authentication failed:`})}}),t.command("status").description("Show current authentication status").action(async()=>{let n=na(),r=n?.accessToken??Rt();if(!r){u.info(`${k} Not logged in. Run ${J("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let o=await gf(r);if(!o){u.info(`${k} Token is invalid or expired. Run ${J("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}u.info(`${$} Logged in as ${o.firstName} ${o.lastName} (${o.email})`),n?.scopes?.length&&u.info(` Scopes: ${n.scopes.join(", ")}`),u.info(` Session: ${yr()}`)}catch(o){throw new f(o,{prefix:`${k} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove stored credentials").action(async()=>{uf(),u.info(`${$} Logged out. Session file removed.`),u.info(`${at} Run ${J("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").action(async n=>{let r=mr.getInstance();if(n.status){let s=await r.getTelemetryStatus();u.info(Wb(s.enabled));return}if(n.enable){await r.setGlobalPreference(!0),u.info(hf(!0));return}if(n.disable){await r.setGlobalPreference(!1),u.info(hf(!1));return}let o=await r.getTelemetryStatus();if(u.info(Wb(o.enabled)),V()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await Be({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 r.setGlobalPreference(s),u.info(hf(s))}})},hf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,Wb=e=>`${Ce} Telemetry status: ${e?`enabled ${$}`:`disabled ${k}`}`;var cD=w(require("http")),uD=w(require("node-fetch")),dD=w(require("serve-handler")),pD=require("fs"),fD=w(require("path")),mD=require("commander");var Gb=w(require("archiver")),wf=require("commander"),sc=require("fs");var Vb=require("cosmiconfig"),yf=require("commander"),oc=async(e,t)=>{let n=await N0(t),r=n.config.apiVersion;return r&&typeof r!="string"&&yf.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:n.filepath,config:{publicDir:e,...n.config}}},N0=async e=>{let n=await(0,Vb.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return n||yf.program.error(`No ${e} file was found. Run this command within your extension folder.`),n};var Kb=w(require("mime-types")),ic=w(require("path")),j0=5*1024*1024,M0=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"]),Jb=async(e,t,n)=>{let{config:r,filepath:o}=await oc(e,t),i=ic.join(o,".."),s=!0,a=!1,l=p=>{let d=p.name,m=Kb.default.lookup(d);return d==="index.html"&&(a=!0),d&&d.endsWith(".DS_Store")||!m?!1:M0.has(m)?p:(console.log(`Invalid file type: ${m} for file: ${d}`),s=!1,!1)},c=p=>{(0,sc.unlink)(n,d=>{d&&console.error(`Failed to delete file: ${d}`),wf.program.error(p)})};return console.log(`Packaging the contents of the ${r.publicDir} folder into ${n}...`),new Promise(p=>{let d=(0,Gb.default)("zip",{zlib:{level:9}}),m=(0,sc.createWriteStream)(ic.join(i,n));m.on("close",()=>{p(void 0)}),d.directory(ic.join(i,r.publicDir),!1,l),d.file(o,{name:t}),d.pipe(m),d.finalize(),d.on("warning",h=>{console.log(h)}),d.on("error",h=>{wf.program.error(h.message)}),d.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(!d.pointer()||d.pointer()===0){c("Bundling failed with no output");return}if(d.pointer()>=j0){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${d.pointer()} total bytes written`),console.log(`Done! ${n} is ready for you to upload to your Webflow app.`)})})};var oa=w(require("path")),Sn=w(require("fs/promises")),cc=w(require("fs")),qb=require("url"),yB=require("dotenv/config"),Xb=["js","cjs","json"],kf=process.cwd(),Yb=".webflowrc",Jn=oa.extname(cc.readdirSync(kf).find(e=>e.includes(Yb))??"").replace(/\./g,""),Kn=oa.join(kf,`${Yb}${Jn&&`.${Jn}`}`),Zb=cc.existsSync(Kn),bf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${Xb.join(", ")}`)}},ac=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Jn}. The supported extensions are: ${Xb.join(", ")}`)}},lc=class extends Error{constructor(t){let n=t.includes(".webflowrc"),r=t.includes("webflow.json"),o;n?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.`:r?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)}},Df=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 B0(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,qb.pathToFileURL)(e).href:e)).default}function zb(e,t){let n=t.filter(r=>!e[r]);if(n.length)throw new Df(n.join(", "))}async function Di(e=[],t=!1){if(!Zb){if(t)return{};throw new lc(Kn)}if(!Jn)throw new bf;switch(Jn){case"js":case"cjs":{await Sn.access(Kn);let n=await B0(Kn);return zb(n,e),n}case"json":{let n=JSON.parse(await Sn.readFile(Kn,"utf8"));return zb(n,e),n}default:throw new ac}}function U0(e,t){if(Jn==="js"||Jn==="cjs"){let r=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(r)return r[1]}}function W0(e,t,n){let r=U0(t,n);if(r){let o=new RegExp(`${n}: ".*?",`,"g");return e.replace(o,`${n}: process.env.${r},`)}return e}async function H0(e){let t=["authToken","host","siteId"],n=await Sn.readFile(Kn,"utf-8");for(let r of t)e=W0(e,n,r);return e}async function V0(){try{let e=oa.join(kf,"package.json");return await Sn.access(e),JSON.parse(await Sn.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function Qb(e){if(!Zb)throw new lc(Kn);let t=JSON.stringify(e,null,2);switch(Jn){case"js":case"cjs":{let n=await H0(t.replace(/"([^"]+)":/g,"$1:")),r=await V0()&&Jn==="js"?"export default ":"module.exports = ";return Sn.writeFile(Kn,r+n)}case"json":return Sn.writeFile(Kn,t);default:throw new ac}}var Dr=w(require("fs")),Ht=w(require("path"));var ia="webflow.json",eD="index.html",tD="bundle.zip",Ef="public",vf="extension-scaffolds",uc="default";var nD="package.json",rD="wf-placeholder-name",Sf=e=>JSON.stringify(e,null,2),oD=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
40
40
  \u2502 `+e+` \u2502
41
- \u2570`+t+"\u256F"};var WD=async(e,t="./",n=rc,r)=>{let o=r[n];try{for(let i of o){let s=Wt.join(t,i),a=v0(s,n,e);if(i.includes(MD)||i.includes(ea))await E0(i,a,e);else{let l=await wr.promises.readFile(i);await GD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},HD=async()=>{let e={},t=Wt.resolve(__dirname),n=Wt.join(t,ff),r=await wr.promises.readdir(n);for(let o of r){let i=Wt.join(n,o),s=await VD(i);e[o]=s}return e},VD=async e=>{let t=[];try{let n=await wr.promises.readdir(e);for(let r of n){let o=Wt.join(e,r);if((await wr.promises.stat(o)).isDirectory()){let s=await VD(o);t.push(...s)}else t.push(o)}}catch(n){console.error(`Error reading ${Wt}, `,n)}return t},GD=async(e,t)=>{try{await wr.promises.mkdir(Wt.dirname(e),{recursive:!0}),await wr.promises.writeFile(e,t)}catch(n){console.error("Error writing file ",n)}},E0=async(e,t,n)=>wr.promises.readFile(e,"utf8").then(async r=>{let o=r.replace(BD,n);await GD(t,o)}),v0=(e,t,n)=>{let r=Wt.join(ff,t),o=e.indexOf(r);if(o!==-1){let i=e.substring(o+r.length+1);return Wt.join(n,i)}return""};var oc=async()=>await HD(),ZD=async()=>{let e=await oc(),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"')},QD=async(e,t=rc)=>{let n=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let r=await oc();await WD(e,n,t,r),console.log(`Done! Check out ${n}/README.md for steps on how to develop your extension.`)},eb=()=>ID(pf,ea,jD),tb=async e=>{let{config:t,filepath:n}=await Yl(pf,ea),r=XD.join(n,"..",t.publicDir,ND),i=(await yi([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(h=>t.featureFlags?.[h]===!0?`ff_on=${h}`:`ff_off=${h}`).join("&"),l=a?`&${a}`:"",d=await(await(0,KD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),p=new JD.Server((h,g)=>{if(h.url==="/"){qD.promises.readFile(r,{encoding:"utf-8"}).catch(y=>{YD.program.error(y.message)}).then(y=>{let b=d.replace("{{ui}}",y);return g.writeHead(200,{"Content-Length":Buffer.byteLength(b),"Content-Type":"text/html"}),g.end(b)});return}if(h.url==="/__webflow")return g.writeHead(200,{"Content-Length":Buffer.byteLength(mf(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),g.end(mf(t));(0,zD.default)(h,g,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=S0(e);p.listen(m),console.log(UD(`Serving your extension at http://localhost:${m}`)+`
42
- `)},S0=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};Te();C();var nb=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(ZD),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(n,r)=>{let o=await oc(),i=Object.keys(o),s=await Je({message:"What would you like to name your Designer Extension?",default:n,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new f("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:r||"default"});await QD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(eb),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(tb)};var bf=w(require("process"));_();be();We();var ob=w(require("fs"));C();async function sc(e){let{authToken:t,siteId:n}=e||{},{path:r,isUserDefined:o}=Yr(),i=ob.existsSync(r),s=!1;try{let{manifest:a}=ne();s=!0,o&&u.info(`Using manifest file: ${r}`);try{let l=Ms(a,"devlink");if(!t||!n)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.
41
+ \u2570`+t+"\u256F"};var iD=async(e,t="./",n=uc,r)=>{let o=r[n];try{for(let i of o){let s=Ht.join(t,i),a=J0(s,n,e);if(i.includes(nD)||i.includes(ia))await K0(i,a,e);else{let l=await Dr.promises.readFile(i);await lD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},sD=async()=>{let e={},t=Ht.resolve(__dirname),n=Ht.join(t,vf),r=await Dr.promises.readdir(n);for(let o of r){let i=Ht.join(n,o),s=await aD(i);e[o]=s}return e},aD=async e=>{let t=[];try{let n=await Dr.promises.readdir(e);for(let r of n){let o=Ht.join(e,r);if((await Dr.promises.stat(o)).isDirectory()){let s=await aD(o);t.push(...s)}else t.push(o)}}catch(n){console.error(`Error reading ${Ht}, `,n)}return t},lD=async(e,t)=>{try{await Dr.promises.mkdir(Ht.dirname(e),{recursive:!0}),await Dr.promises.writeFile(e,t)}catch(n){console.error("Error writing file ",n)}},K0=async(e,t,n)=>Dr.promises.readFile(e,"utf8").then(async r=>{let o=r.replace(rD,n);await lD(t,o)}),J0=(e,t,n)=>{let r=Ht.join(vf,t),o=e.indexOf(r);if(o!==-1){let i=e.substring(o+r.length+1);return Ht.join(n,i)}return""};var dc=async()=>await sD(),gD=async()=>{let e=await dc(),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"')},hD=async(e,t=uc)=>{let n=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let r=await dc();await iD(e,n,t,r),console.log(`Done! Check out ${n}/README.md for steps on how to develop your extension.`)},yD=()=>Jb(Ef,ia,tD),wD=async e=>{let{config:t,filepath:n}=await oc(Ef,ia),r=fD.join(n,"..",t.publicDir,eD),i=(await Di([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(h=>t.featureFlags?.[h]===!0?`ff_on=${h}`:`ff_off=${h}`).join("&"),l=a?`&${a}`:"",p=await(await(0,uD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),d=new cD.Server((h,g)=>{if(h.url==="/"){pD.promises.readFile(r,{encoding:"utf-8"}).catch(y=>{mD.program.error(y.message)}).then(y=>{let b=p.replace("{{ui}}",y);return g.writeHead(200,{"Content-Length":Buffer.byteLength(b),"Content-Type":"text/html"}),g.end(b)});return}if(h.url==="/__webflow")return g.writeHead(200,{"Content-Length":Buffer.byteLength(Sf(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),g.end(Sf(t));(0,dD.default)(h,g,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=z0(e);d.listen(m),console.log(oD(`Serving your extension at http://localhost:${m}`)+`
42
+ `)},z0=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 bD=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(gD),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(n,r)=>{let o=await dc(),i=Object.keys(o),s=await Ke({message:"What would you like to name your Designer Extension?",default:n,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new f("When --no-input mode is enabled please provide the [projectName] argument.");let a=await Be({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:r||"default"});await hD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(yD),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(wD)};var Rf=w(require("process"));A();De();Me();var kD=w(require("fs"));C();async function fc(e){let{authToken:t,siteId:n}=e||{},{path:r,isUserDefined:o}=Qr(),i=kD.existsSync(r),s=!1;try{let{manifest:a}=ee();s=!0,o&&u.info(`Using manifest file: ${r}`);try{let l=Hs(a,"devlink");if(!t||!n)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.
43
43
 
44
44
  To set up your credentials, run:
45
- webflow auth login`);return rb(l?.relativeHrefRoot),{...l,host:P,authToken:t,siteId:n,cssModules:!!l?.cssModules,components:ic(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new f(l,{prefix:`Failed to read devlink config from manifest file: ${r}
45
+ webflow auth login`);return DD(l?.relativeHrefRoot),{...l,host:P(),authToken:t,siteId:n,cssModules:!!l?.cssModules,components:pc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new f(l,{prefix:`Failed to read devlink config from manifest file: ${r}
46
46
  `})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${r}
47
47
  `:`Your manifest file exists but is invalid or missing required properties: ${r}
48
- `;throw new f(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),n||a.push("siteId");let l=await yi(a);return rb(l?.relativeHrefRoot),{...l,host:l.host||P,cssModules:!!l?.cssModules,components:ic(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:
48
+ `;throw new f(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),n||a.push("siteId");let l=await Di(a);return DD(l?.relativeHrefRoot),{...l,host:l.host||P(),cssModules:!!l?.cssModules,components:pc(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:
49
49
  - webflow.json with a "devlink" section, or
50
50
  - .webflowrc file
51
- in your project root.`),new f(a)}}function rb(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 ic(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}hf();lt();C();var wi=class extends Error{};function _0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function A0(e){switch(e.status){case 400:{let t=await e.text(),n=_0(t);throw new wi(n||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new wi("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new wi("`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 wi(`Something went wrong (HTTP ${e.status}).`)}}async function I0(e){try{let{siteId:t,host:n,authToken:r,...o}=e,i=await J(`${n}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():A0(i)}catch(t){throw new f(t,{skipLogging:!0})}}async function yf(e){try{let t=await I0(e);if(!t.files||!Array.isArray(t.files))throw new f("Invalid response format from V1 API: expected 'files' array");let n=t.metadata?.exportCoverage==="full";return await lc(t.files,e.rootDir,n),{messages:t.messages}}catch(t){throw t instanceof f?t:new f(t,{skipLogging:!0})}}var oo=w(require("process"));_();We();lt();var wf=class{config;error;constructor(t,n){this.config=t,this.error=n}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,n=this.error;J(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:n.cause,message:n.message,name:n.name,stack:this.stripPII(n.stack),platform:oo.default.platform,node:oo.default.version})})}async storeChoice(t){try{return Se({devlink:{allowTelemetry:t}})}catch{let r=await yi();await LD({...r,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 cc(e){return async function(n){oo.default.removeListener("uncaughtException",cc),oo.default.removeListener("unhandledRejection",cc);let r=await sc(e);if(!r)return;await new wf(r,n).prompt()}}function ib(e){oo.default.on("uncaughtException",cc(e)),oo.default.on("unhandledRejection",cc(e))}X();_();q();We();Df();async function sb(e,t){let n=Date.now(),{manifest:r}=ne(),{accessToken:o,siteId:i}=await Ke(r,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:ic(e),overwriteModule:!1}:{overwriteModule:!0}};ib(s);let a=await sc(s);if(!a)return bf.default.exit();let l;try{l=F.forDevlinkSync(a)}catch(d){u.debug(`Failed to initialize telemetry: ${d}`)}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:d}=await yf(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),uc(d);let p=Date.now()-n;await l?.sendUsage("devlink_sync_success",{duration:p,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);c.fail(`Failed to export components: ${p}`);let m=Date.now()-n;throw await l?.sendError(d instanceof Error?d:new Error(String(d)),"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:bf.default.argv.slice(2)}),d}}yc();var xr=require("commander");var Oc=require("path"),Ci=require("@webflow/data-types");be();var wc=require("fs"),_f=w(require("md5"));function na(e,t){try{let n=(0,wc.statSync)(e),r=(0,wc.readFileSync)(e);return{value:r,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,_f.default)(r),size:n.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function ra(e,t,n){try{let r=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,_f.default)(o),size:r,...n}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var Fb=w(require("node-fetch")),_b=w(require("form-data"));async function oa(e,t){let n={...t.fields,file:e.value},r=new _b.default;Object.entries(n).forEach(([i,s])=>{r.append(i,s)});let o=await(0,Fb.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:r});M0(o)}function M0(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}`)}}_();We();X();be();lt();pe();function B0({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:n=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(n==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${P}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${P}/v2/workspaces`,authToken:e}}function U0(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function W0(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 ${K("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 br({endpoint:e,method:t="GET",body:n,options:r}){let{baseUrl:o,authToken:i}=B0(r),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await J(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:U0(n)});return await W0(a),a.json()}async function Af({options:e}){return(await br({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function If({name:e,description:t,slug:n,options:r}){return(await br({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:n},options:r})).payload}async function Rf({resourceId:e,files:t,options:n}){return(await br({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:n})).payload}async function Tf({resourceId:e,codeModule:t,components:n,options:r}){return(await br({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:n},options:r})).payload}var Dk=require("path"),bk=w(require("webpack-merge")),so=require("@webflow/data-types");be();_();var Rb=require("memfs/lib/volume"),ia=require("@webflow/data-types");var Sn="./tmp_entry",Ab="components";function Dc(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,n)=>n.toUpperCase()).replace(/\s+/g,"")}function H0(e){let t=Dc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function Ib(e,t){let n=e.map(({name:l,path:c,isDefaultExport:d})=>d?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
51
+ in your project root.`),new f(a)}}function DD(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 pc(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}Cf();lt();C();var ki=class extends Error{};function Z0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function Q0(e){switch(e.status){case 400:{let t=await e.text(),n=Z0(t);throw new ki(n||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new ki("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new ki("`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 ki(`Something went wrong (HTTP ${e.status}).`)}}async function eR(e){try{let{siteId:t,host:n,authToken:r,...o}=e,i=await G(`${n}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():Q0(i)}catch(t){throw new f(t,{skipLogging:!0})}}async function Ff(e){try{let t=await eR(e);if(!t.files||!Array.isArray(t.files))throw new f("Invalid response format from V1 API: expected 'files' array");let n=t.metadata?.exportCoverage==="full";return await gc(t.files,e.rootDir,n),{messages:t.messages}}catch(t){throw t instanceof f?t:new f(t,{skipLogging:!0})}}var so=w(require("process"));A();Me();lt();var _f=class{config;error;constructor(t,n){this.config=t,this.error=n}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,n=this.error;G(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:n.cause,message:n.message,name:n.name,stack:this.stripPII(n.stack),platform:so.default.platform,node:so.default.version})})}async storeChoice(t){try{return xe({devlink:{allowTelemetry:t}})}catch{let r=await Di();await Qb({...r,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 hc(e){return async function(n){so.default.removeListener("uncaughtException",hc),so.default.removeListener("unhandledRejection",hc);let r=await fc(e);if(!r)return;await new _f(r,n).prompt()}}function ED(e){so.default.on("uncaughtException",hc(e)),so.default.on("unhandledRejection",hc(e))}X();A();q();Me();Af();async function vD(e,t){let n=Date.now(),{manifest:r}=ee(),{accessToken:o,siteId:i}=await ze(r,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:pc(e),overwriteModule:!1}:{overwriteModule:!0}};ED(s);let a=await fc(s);if(!a)return Rf.default.exit();let l;try{l=F.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 Ff(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),yc(p);let d=Date.now()-n;await l?.sendUsage("devlink_sync_success",{duration:d,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let d=p instanceof Error?p.message:String(p);c.fail(`Failed to export components: ${d}`);let m=Date.now()-n;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:Rf.default.argv.slice(2)}),p}}Sc();var Fr=require("commander");var co=require("path"),Ai=require("@webflow/data-types");De();var xc=require("fs"),jf=w(require("md5"));function aa(e,t){try{let n=(0,xc.statSync)(e),r=(0,xc.readFileSync)(e);return{value:r,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,jf.default)(r),size:n.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function la(e,t,n){try{let r=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,jf.default)(o),size:r,...n}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var VD=w(require("node-fetch")),GD=w(require("form-data"));async function ca(e,t){let n={...t.fields,file:e.value},r=new GD.default;Object.entries(n).forEach(([i,s])=>{r.append(i,s)});let o=await(0,VD.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:r});cR(o)}function cR(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}`)}}A();Me();X();De();lt();pe();function uR({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:n=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(n==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${P()}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${P()}/v2/workspaces`,authToken:e}}function dR(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function pR(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 ${J("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 Er({endpoint:e,method:t="GET",body:n,options:r}){let{baseUrl:o,authToken:i}=uR(r),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await G(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:dR(n)});return await pR(a),a.json()}async function Mf({options:e}){return(await Er({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function Bf({name:e,description:t,slug:n,options:r}){return(await Er({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:n},options:r})).payload}async function Uf({resourceId:e,files:t,options:n}){return(await Er({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:n})).payload}async function Wf({resourceId:e,codeModule:t,components:n,options:r}){return(await Er({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:n},options:r})).payload}var xi=require("path"),Lk=w(require("webpack-merge")),lo=require("@webflow/data-types");De();A();var zD=require("memfs/lib/volume"),ua=require("@webflow/data-types");var xn="./tmp_entry",KD="components";function Cc(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,n)=>n.toUpperCase()).replace(/\s+/g,"")}function fR(e){let t=Cc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function JD(e,t){let n=e.map(({name:l,path:c,isDefaultExport:p})=>p?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
52
52
  `),r=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=r,a=o?`components: { ${o} }`:void 0;return`${n}
53
53
 
54
- export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function Tb(e,t,n){let r={},o=`${Sn}/Client.js`,i=`${Sn}/Server.js`;r[o]=Ib([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],ia.Environment.Client);let s={},a=c=>{let d=H0(c);return s[d]?(s[d]+=1,`${d}${s[d]}`):(s[d]=1,d)};r[i]=Ib([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([c])=>n[c]?.ssr??!0).map(([c,d])=>{let p=a(c),m=d.startsWith(Sn)?d.replace(`${Sn}/`,"./"):d;return{name:p,path:m,exportKey:c,isDefaultExport:!0,type:"component"}})],ia.Environment.Server);let l={[ia.Environment.Client]:o,[ia.Environment.Server]:i};return{entryPointsVolume:Rb.Volume.fromJSON(r),paths:l}}var kk=require("memfs/lib/volume");var Nb=w(require("archiver")),Di=require("path");be();var sa=require("@webflow/data-types");be();_();var kr=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var Pb=2;function $b(e){let t={type:sa.ModuleLoader.FEDERATION,version:Pb,entry:Lp,renderer:Hs,components:e};return{title:Ws,content:JSON.stringify(t)}}function Ob(e){let t={type:sa.ModuleLoader.SSR,version:Pb,entry:pi,components:e};return{title:Ws,content:JSON.stringify(t)}}function Lb(e){let t=`/${sa.Environment.Client}/${Lp}`;try{if(e.existsSync(t)){let n=e.readFileSync(t,"utf8"),r=JSON.parse(n.toString()),o="publicPath"in r.metaData?r.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return r.exposes.reduce((i,s)=>{let a=s.name;return a===Hs||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${kr(o)}${l}`)})),i},{})}}catch(n){u.error(n,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var bc=require("@webflow/data-types"),V0=/\.css$/i;async function jb(e,t,n){let r=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${bc.Environment.Server}/${Vs}`,a=(0,Nb.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",p=>(r=!0,i(p))),l.on("close",()=>{if(!r)try{let p={type:"asset",name:Vs,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let h=(0,Di.resolve)((0,Di.join)(`/${bc.Environment.Server}`,m.name));t.existsSync(h)&&t.rmSync(h)}),o([p])}catch(p){return i(p)}finally{r=!0}}),a.pipe(l);let{title:c,content:d}=Ob(n);a.append(d,{name:c}),e.forEach(p=>{if(!V0.test(p.name))try{let m=(0,Di.resolve)((0,Di.join)(`/${bc.Environment.Server}`,p.name)),h=t.readFileSync(m,"utf8");a.append(h,{name:p.name})}catch(m){return r=!0,i(m)}}),await a.finalize()})}var Mb=require("@webflow/data-types");async function Bb(e,t,n){let{title:r,content:o}=$b(n);await t.promises.writeFile(`/${Mb.Environment.Client}/${r}`,o);let i={type:"asset",name:r,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var pk=require("@rspack/core"),fk=w(require("fork-ts-checker-webpack-plugin")),mk=require("ts-checker-rspack-plugin"),gk=w(require("mini-css-extract-plugin")),hk=require("@webflow/data-types");var Wb=require("webpack"),$f=w(require("mini-css-extract-plugin")),Hb=w(require("tsconfig-paths-webpack-plugin")),Vb=require("tsconfig-paths"),Of=require("@webflow/data-types"),Gb=require("path");be();var Ub=w(require("postcss-selector-parser")),Pf=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,Ub.default)(n=>{n.walkPseudos(r=>{r.value===":root"&&(r.value=":host")})}).processSync(t.selector)})}});Pf.postcss=!0;Pf.postcssPlugin="CSSinShadowDOM";var kc=Pf;function G0(){return(0,Vb.loadConfig)(process.cwd()).resultType==="success"}function Jb({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i}){let s={mode:n,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:$f.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[kc]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new $f.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[G0()?new Hb.default:null].filter(Boolean)},performance:{hints:!1}};if(t===Of.Environment.Client)return{...s,entry:()=>({}),output:{path:i?(0,Gb.join)(process.cwd(),i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Of.Environment.Server)return{...s,plugins:[...s.plugins||[],new Wb.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:pi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var Kb=require("@module-federation/enhanced"),Lf=require("@webflow/data-types");function zb({libraryName:e,env:t,exposes:n}){if(t===Lf.Environment.Client)return{plugins:[new Kb.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Lf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function qb(){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 Ec(){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 vc=require("@rspack/core"),Xb=require("tsconfig-paths"),Nf=require("@webflow/data-types"),Yb=require("path");be();function J0(){let e=(0,Xb.loadConfig)(process.cwd());if(e.resultType==="success")return e.configFileAbsolutePath}function Zb({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i}){let s={mode:n,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:vc.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:[kc]}}}],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 vc.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let a=J0();return a?{tsConfig:{configFile:a}}:{}})(),performance:{hints:!1}};if(t===Nf.Environment.Client)return{...s,entry:()=>({}),output:{path:i?(0,Yb.join)(process.cwd(),i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Nf.Environment.Server)return{...s,plugins:[...Array.isArray(s.plugins)?s.plugins:[],new vc.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:pi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var Qb=require("@module-federation/enhanced/rspack"),jf=require("@webflow/data-types");function ek({libraryName:e,env:t,exposes:n}){if(t===jf.Environment.Client)return{plugins:[new Qb.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===jf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var z0=w(require("fs")),tk=require("unionfs"),nk=require("webpack");function K0(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Sc(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:n=>e.toString(n),toJson:()=>({...t,assets:(t.assets??[]).map(K0)})}}async function rk({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new tk.Union().use(z0));return new Promise((s,a)=>{let l=(0,nk.webpack)(e);l.inputFileSystem=i,n&&(l.outputFileSystem=n),r&&(l.outputPath=r),l.run((c,d)=>{l.close(p=>{c||p?a(c||p):d?d.hasErrors()||o&&d.hasWarnings()?a(new Error(d.toString("errors-warnings"))):s(Sc(d)):a(new Error("Webpack stats are undefined"))})})})}var q0=w(require("fs")),Mf=w(require("webpack-merge")),ok=require("memfs"),ik=require("unionfs"),sk=require("@rspack/core");async function xc({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new ik.Union().use(q0)),s=e;return t.length>0&&(s=(0,Mf.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),n&&(s=(0,Mf.default)(s,{output:{clean:!1,...r&&{path:r}}})),new Promise((a,l)=>{let c=(0,sk.rspack)(s);c.inputFileSystem=i,n&&(c.outputFileSystem=(0,ok.createFsFromVolume)(n)),r&&(c.outputPath=r),c.run((d,p)=>{c.close(m=>{d||m?l(d||m):p?p.hasErrors()||o&&p.hasWarnings()?l(new Error(p.toString("errors-warnings"))):a(Sc(p)):l(new Error("Rspack stats are undefined"))})})})}var lk=require("@module-federation/enhanced");var bi=w(require("webpack-merge"));_();function Er(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function ak(e,t){let n=Object.entries(e).filter(([r])=>!t.includes(r));return Object.fromEntries(n)}function X0(e,t){return e instanceof t||Er(e)==="ModuleFederationPlugin"}function Fc(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:n,getPluginOptions:r,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],d=Y0(s),p=Array.isArray(l)?Cc(...l.map(d)):Cc(d(l));Object.keys(p).some(H=>c.includes(H))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let h={...ak(p,[...c,"ModuleFederationPlugin","module","plugins"]),module:ak(p.module??{},["rules"])},g=(0,bi.default)(a,h),y=p.plugins??[];o&&(y=y.filter(o));let b=a.plugins??[],A=(0,bi.mergeWithCustomize)({customizeArray:(0,bi.unique)("plugins",t,H=>Er(H))})({plugins:y},{plugins:b}).plugins,v=p?.ModuleFederationPlugin?.shared,x=A?.map(H=>{if(X0(H,n)){let B=r(H);return new n({...B,...v?{shared:v}:{}})}return H});g.plugins=x;let O=p.module?.rules;if(O&&typeof O=="function"){let H=a.module?.rules??[];g.module={...g.module??{},rules:O(H)}}return g}}function Cc(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let n of e){let{module:r,ModuleFederationPlugin:o,plugins:i,...s}=n;if(t={...t,...s},r){let{rules:a,...l}=r;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=d=>{let p=c(d);return a(p)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function Y0(e){return t=>typeof t=="function"?t(e):t}var Z0=Fc({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:lk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function ck(e,t,n){return Z0(e,t,n)}var uk=require("@module-federation/enhanced/rspack");var Q0=Fc({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:uk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Er(e)!=="MiniCssExtractPlugin"});function dk(e,t,n){return Q0(e,t,n)}var Bf={[hk.Framework.React]:{generateWebpackBundlerConfig:qb,generateRspackBundlerConfig:Ec}},eI={webpack:{generateBaseConfig:Jb,getFrameworkConfig:(e,t)=>Bf[e].generateWebpackBundlerConfig(t),generateFederationConfig:zb,mergeConfigs:(e,t,n)=>ck(e,t,n),bundle:e=>rk({...e,config:e.config}),typeCheckerPlugin:fk.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Er(t)==="MiniCssExtractPlugin"?new gk.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:Zb,getFrameworkConfig:(e,t)=>Bf[e].generateRspackBundlerConfig(t),generateFederationConfig:ek,mergeConfigs:(e,t,n)=>dk(e,t,n),bundle:e=>xc({...e,config:e.config}),typeCheckerPlugin:mk.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Er(t)==="CssExtractRspackPlugin"?new pk.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},ki=e=>eI[e],yk=e=>!!Bf[e];var wk={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 _c(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:n,paths:r}=Tb(e.renderer,e.componentsFiles,e.componentsOptions),o=kk.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=ki(t),a=b=>{let S=tI({env:b,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:r,libraryName:e.libraryIdentifier,bundler:t}),A=s.mergeConfigs(b,S,i);return e?.debugBundler&&(u.info(`${t} config for env ${b}:`),u.dir(A)),A},l={sourceVolumes:[...e.sourceVolumes,n],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,d]=await Promise.all([s.bundle({...l,config:a(so.Environment.Server),outputPath:`/${so.Environment.Server}`}),s.bundle({...l,config:a(so.Environment.Client),outputPath:`/${so.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(wk)}`),u.debug(`Client Bundler Stats: ${d.toString(wk)}`));let p=Lb(o);u.debug("Packaging server bundle...");let m=await jb(c.toJson().assets||[],o,p);u.debug("Packaging client bundle...");let h=await Bb(d.toJson().assets||[],o,p),g=b=>S=>[S,b];return{outputFiles:[...m.map(g(so.Environment.Server)),...h.map(g(so.Environment.Client))],outputVolume:o}}function tI({env:e,mode:t="production",framework:n,publicPath:r,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack"}){if(!yk(n))throw new Error(`Unknown framework: ${n}`);let c=Object.entries({[Hs]:i[e],...o}).reduce((g,[y,b])=>({...g,[`./${y}`]:`./${(0,Dk.relative)(process.cwd(),b)}`}),{}),d=ki(l),p=d.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:r,outputPath:a}),m=d.getFrameworkConfig(n,e),h=d.generateFederationConfig({exposes:c,env:e,libraryName:s});return(0,bk.default)(p,m,h)}var Sk=w(require("path")),Wf=require("memfs/lib/volume"),Hf=w(require("webpack-merge")),xk=w(require("webpack-node-externals")),Ht=require("@webflow/data-types");var nI=w(require("fs")),Ei=require("path"),vi=require("webpack");function rI(e,t=nI){let n=(0,Ei.join)(process.cwd(),"node_modules",e);for(;n!==(0,Ei.dirname)(n)&&n!=="node_modules";){let r=(0,Ei.join)(n,"package.json");if(t.existsSync(r))try{let{name:o,version:i}=JSON.parse(t.readFileSync(r,"utf8"));return`${o}@${i}`}catch{return null}n=(0,Ei.dirname)(n)}return null}var Ac=class{apply(t){t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(n){n.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:vi.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let r=n.getAssets(),o={};Object.values(r).forEach(({name:i,source:s})=>{if(!i.endsWith(".map"))return;let[a,l,c]=i.split("."),d=o[a]?.sources??{},p=o[a]?.dependencies??new Set;JSON.parse(s.source().toString()).sources.forEach(h=>{if(h.startsWith("external")){let g=h.match(/^external \S+ "(.+)"$/)?.[1];if(!g)throw new Error(`Could not extract package name from ${h}`);let y=rI(g,n.inputFileSystem);if(!y)throw new Error(`Could not find package information for ${g}`);y&&p.add(y)}}),o[a]={sources:{...d,[`./${a}.${c}`]:l},dependencies:p},n.deleteAsset(i)}),Object.entries(o).forEach(([i,{sources:s,dependencies:a}])=>{n.emitAsset(`${i}.js.map`,new vi.sources.RawSource(JSON.stringify({sources:s,dependencies:[...a]})))})}catch(r){n.errors.push(new vi.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${r instanceof Error?r.stack:String(r)}`))}})})}};var Ek=w(require("module")),vk=require("jsdom"),Uf="__webflowCliImportModuleWindow__";function oI(e){let n=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),r=!!n,o=`module[${JSON.stringify(Uf)}]`,i=[];r||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(`
54
+ export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function qD(e,t,n,r){let o={},i=`${xn}/Client.js`,s=`${xn}/Server.js`;o[i]=JD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],ua.Environment.Client);let a={},l=p=>{let d=fR(p);return a[d]?(a[d]+=1,`${d}${a[d]}`):(a[d]=1,d)};o[s]=JD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>n[p]?.ssr??!0).map(([p,d])=>{let m=l(p),h=d.startsWith(xn)?d.replace(`${xn}/`,"./"):d;return{name:m,path:h,exportKey:p,isDefaultExport:!0,type:"component"}})],ua.Environment.Server);let c={[ua.Environment.Client]:i,[ua.Environment.Server]:s};return{entryPointsVolume:zD.Volume.fromJSON(o,r),paths:c}}var Nk=require("memfs/lib/volume");var ek=w(require("archiver")),Ei=require("path");De();var da=require("@webflow/data-types");De();A();var vr=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var XD=2;function YD(e){let t={type:da.ModuleLoader.FEDERATION,version:XD,entry:Kp,renderer:zs,components:e};return{title:Js,content:JSON.stringify(t)}}function ZD(e){let t={type:da.ModuleLoader.SSR,version:XD,entry:gi,components:e};return{title:Js,content:JSON.stringify(t)}}function QD(e){let t=`/${da.Environment.Client}/${Kp}`;try{if(e.existsSync(t)){let n=e.readFileSync(t,"utf8"),r=JSON.parse(n.toString()),o="publicPath"in r.metaData?r.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return r.exposes.reduce((i,s)=>{let a=s.name;return a===zs||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${vr(o)}${l}`)})),i},{})}}catch(n){u.error(n,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Fc=require("@webflow/data-types"),mR=/\.css$/i;async function tk(e,t,n){let r=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Fc.Environment.Server}/${qs}`,a=(0,ek.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",d=>(r=!0,i(d))),l.on("close",()=>{if(!r)try{let d={type:"asset",name:qs,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let h=(0,Ei.resolve)((0,Ei.join)(`/${Fc.Environment.Server}`,m.name));t.existsSync(h)&&t.rmSync(h)}),o([d])}catch(d){return i(d)}finally{r=!0}}),a.pipe(l);let{title:c,content:p}=ZD(n);a.append(p,{name:c}),e.forEach(d=>{if(!mR.test(d.name))try{let m=(0,Ei.resolve)((0,Ei.join)(`/${Fc.Environment.Server}`,d.name)),h=t.readFileSync(m,"utf8");a.append(h,{name:d.name})}catch(m){return r=!0,i(m)}}),await a.finalize()})}var nk=require("@webflow/data-types");async function rk(e,t,n){let{title:r,content:o}=YD(n);await t.promises.writeFile(`/${nk.Environment.Client}/${r}`,o);let i={type:"asset",name:r,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var Ak=require("@rspack/core"),Rk=w(require("fork-ts-checker-webpack-plugin")),Ik=require("ts-checker-rspack-plugin"),Tk=w(require("mini-css-extract-plugin")),Pk=require("@webflow/data-types");var ik=require("webpack"),Vf=w(require("mini-css-extract-plugin")),sk=w(require("tsconfig-paths-webpack-plugin")),ak=require("tsconfig-paths"),Gf=require("@webflow/data-types"),lk=require("path");De();var ok=w(require("postcss-selector-parser")),Hf=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,ok.default)(n=>{n.walkPseudos(r=>{r.value===":root"&&(r.value=":host")})}).processSync(t.selector)})}});Hf.postcss=!0;Hf.postcssPlugin="CSSinShadowDOM";var _c=Hf;function gR(e){let t=(0,ak.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function ck({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i,projectDir:s}){let a={mode:n,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Vf.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[_c]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Vf.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=gR(s);return l?new sk.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===Gf.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,lk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Gf.Environment.Server)return{...a,plugins:[...a.plugins||[],new ik.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:gi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var uk=require("@module-federation/enhanced"),Kf=require("@webflow/data-types");function dk({libraryName:e,env:t,exposes:n}){if(t===Kf.Environment.Client)return{plugins:[new uk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Kf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function pk(){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 Ac(){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 Rc=require("@rspack/core"),fk=require("tsconfig-paths"),Jf=require("@webflow/data-types"),mk=require("path");De();function hR(e){let t=(0,fk.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function gk({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i,projectDir:s}){let a={mode:n,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Rc.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:[_c]}}}],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 Rc.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=hR(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===Jf.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,mk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Jf.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new Rc.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:gi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var hk=require("@module-federation/enhanced/rspack"),zf=require("@webflow/data-types");function yk({libraryName:e,env:t,exposes:n}){if(t===zf.Environment.Client)return{plugins:[new hk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===zf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var wR=w(require("fs")),wk=require("unionfs"),bk=require("webpack");function yR(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Ic(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:n=>e.toString(n),toJson:()=>({...t,assets:(t.assets??[]).map(yR)})}}async function Dk({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new wk.Union().use(wR));return new Promise((s,a)=>{let l=(0,bk.webpack)(e);l.inputFileSystem=i,n&&(l.outputFileSystem=n),r&&(l.outputPath=r),l.run((c,p)=>{l.close(d=>{c||d?a(c||d):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(Ic(p)):a(new Error("Webpack stats are undefined"))})})})}var bR=w(require("fs")),qf=w(require("webpack-merge")),kk=require("memfs"),Ek=require("unionfs"),vk=require("@rspack/core");async function Tc({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new Ek.Union().use(bR)),s=e;return t.length>0&&(s=(0,qf.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),n&&(s=(0,qf.default)(s,{output:{clean:!1,...r&&{path:r}}})),new Promise((a,l)=>{let c=(0,vk.rspack)(s);c.inputFileSystem=i,n&&(c.outputFileSystem=(0,kk.createFsFromVolume)(n)),r&&(c.outputPath=r),c.run((p,d)=>{c.close(m=>{p||m?l(p||m):d?d.hasErrors()||o&&d.hasWarnings()?l(new Error(d.toString("errors-warnings"))):a(Ic(d)):l(new Error("Rspack stats are undefined"))})})})}var xk=require("@module-federation/enhanced");var vi=w(require("webpack-merge"));A();function Sr(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function Sk(e,t){let n=Object.entries(e).filter(([r])=>!t.includes(r));return Object.fromEntries(n)}function DR(e,t){return e instanceof t||Sr(e)==="ModuleFederationPlugin"}function $c(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:n,getPluginOptions:r,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=kR(s),d=Array.isArray(l)?Pc(...l.map(p)):Pc(p(l));Object.keys(d).some(H=>c.includes(H))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let h={...Sk(d,[...c,"ModuleFederationPlugin","module","plugins"]),module:Sk(d.module??{},["rules"])},g=(0,vi.default)(a,h),y=d.plugins??[];o&&(y=y.filter(o));let b=a.plugins??[],_=(0,vi.mergeWithCustomize)({customizeArray:(0,vi.unique)("plugins",t,H=>Sr(H))})({plugins:y},{plugins:b}).plugins,v=d?.ModuleFederationPlugin?.shared,x=_?.map(H=>{if(DR(H,n)){let B=r(H);return new n({...B,...v?{shared:v}:{}})}return H});g.plugins=x;let O=d.module?.rules;if(O&&typeof O=="function"){let H=a.module?.rules??[];g.module={...g.module??{},rules:O(H)}}return g}}function Pc(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let n of e){let{module:r,ModuleFederationPlugin:o,plugins:i,...s}=n;if(t={...t,...s},r){let{rules:a,...l}=r;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=p=>{let d=c(p);return a(d)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function kR(e){return t=>typeof t=="function"?t(e):t}var ER=$c({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:xk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function Ck(e,t,n){return ER(e,t,n)}var Fk=require("@module-federation/enhanced/rspack");var vR=$c({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:Fk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Sr(e)!=="MiniCssExtractPlugin"});function _k(e,t,n){return vR(e,t,n)}var Xf={[Pk.Framework.React]:{generateWebpackBundlerConfig:pk,generateRspackBundlerConfig:Ac}},SR={webpack:{generateBaseConfig:ck,getFrameworkConfig:(e,t)=>Xf[e].generateWebpackBundlerConfig(t),generateFederationConfig:dk,mergeConfigs:(e,t,n)=>Ck(e,t,n),bundle:e=>Dk({...e,config:e.config}),typeCheckerPlugin:Rk.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Sr(t)==="MiniCssExtractPlugin"?new Tk.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:gk,getFrameworkConfig:(e,t)=>Xf[e].generateRspackBundlerConfig(t),generateFederationConfig:yk,mergeConfigs:(e,t,n)=>_k(e,t,n),bundle:e=>Tc({...e,config:e.config}),typeCheckerPlugin:Ik.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Sr(t)==="CssExtractRspackPlugin"?new Ak.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},Si=e=>SR[e],$k=e=>!!Xf[e];var Ok={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 Oc(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:n,paths:r}=qD(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=Nk.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=Si(t),a=b=>{let S=xR({env:b,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:r,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),_=s.mergeConfigs(b,S,i);return e?.debugBundler&&(u.info(`${t} config for env ${b}:`),u.dir(_)),_},l={sourceVolumes:[...e.sourceVolumes,n],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(lo.Environment.Server),outputPath:`/${lo.Environment.Server}`}),s.bundle({...l,config:a(lo.Environment.Client),outputPath:`/${lo.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(Ok)}`),u.debug(`Client Bundler Stats: ${p.toString(Ok)}`));let d=QD(o);u.debug("Packaging server bundle...");let m=await tk(c.toJson().assets||[],o,d);u.debug("Packaging client bundle...");let h=await rk(p.toJson().assets||[],o,d),g=b=>S=>[S,b];return{outputFiles:[...m.map(g(lo.Environment.Server)),...h.map(g(lo.Environment.Client))],outputVolume:o}}function xR({env:e,mode:t="production",framework:n,publicPath:r,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!$k(n))throw new Error(`Unknown framework: ${n}`);let p=Object.entries({[zs]:i[e],...o}).reduce((y,[b,S])=>{let _=(0,xi.isAbsolute)(S)?S:(0,xi.join)(c,S);return{...y,[`./${b}`]:`./${(0,xi.relative)(c,_)}`}},{}),d=Si(l),m=d.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:r,outputPath:a,projectDir:c}),h=d.getFrameworkConfig(n,e),g=d.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,Lk.default)(m,h,g)}var Bk=w(require("path")),Zf=require("memfs/lib/volume"),Qf=w(require("webpack-merge")),Uk=w(require("webpack-node-externals")),Vt=require("@webflow/data-types");var CR=w(require("fs")),Ci=require("path"),Fi=require("webpack");function FR(e,t,n=CR){let r=(0,Ci.join)(t,"node_modules",e);for(;r!==(0,Ci.dirname)(r)&&r!=="node_modules";){let o=(0,Ci.join)(r,"package.json");if(n.existsSync(o))try{let{name:i,version:s}=JSON.parse(n.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}r=(0,Ci.dirname)(r)}return null}var Lc=class{apply(t){let n=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(r){r.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Fi.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=r.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),d=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(g=>{if(g.startsWith("external")){let y=g.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${g}`);let b=FR(y,n,r.inputFileSystem);if(!b)throw new Error(`Could not find package information for ${y}`);b&&m.add(b)}}),i[l]={sources:{...d,[`./${l}.${p}`]:c},dependencies:m},r.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{r.emitAsset(`${s}.js.map`,new Fi.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){r.errors.push(new Fi.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var jk=w(require("module")),Mk=require("jsdom"),Yf="__webflowCliImportModuleWindow__";function _R(e){let n=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),r=!!n,o=`module[${JSON.stringify(Yf)}]`,i=[];r||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(`
55
55
  `)+`
56
- `;return n?e.slice(0,n[0].length)+s+e.slice(n[0].length):s+e}function aa(e,t){let n=e.readFileSync(t,"utf-8"),o=new vk.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=oI(n),s=new Ek.default(t,module);Object.defineProperty(s,Uf,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Uf),o.close()}}function iI(e,t){let n=`/${t}.js`,r=aa(e,n),o=r.exports.default||r.exports;if(o&&typeof o=="object")try{return(0,Ht.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 sI({declarations:e,sources:t,overrideConfig:n={},performTypeCheck:r,bundler:o="webpack"}){let i=new Wf.Volume,s=ki(o),a=(0,Hf.default)(s.generateBaseConfig({entry:e,env:Ht.Environment.Client,publicPath:"/",libraryName:"metadata"}),s.getFrameworkConfig(Ht.Framework.React,Ht.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:r?[new s.typeCheckerPlugin]:[]}),l=s.mergeConfigs(Ht.Environment.Client,a,n);return await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}async function aI({declarations:e,sources:t,overrideConfig:n={},bundler:r}){let o=new Wf.Volume,i=ki(r),s=(0,Hf.default)(i.generateBaseConfig({entry:e,env:Ht.Environment.Client,publicPath:"/",libraryName:"source-maps"}),i.getFrameworkConfig(Ht.Framework.React,Ht.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:i.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new Ac],externals:[(0,xk.default)()]}),a=i.mergeConfigs(Ht.Environment.Client,s,n);return a=i.replaceCssPlugin(a),await i.bundle({outputPath:"/",config:a,sourceVolumes:t?[t]:[],outputVolume:o,failOnWarnings:!1}),o}function lI(e){return Object.entries(e.toJSON()).reduce((t,[n,r])=>{if(n.endsWith(".map")&&r?.length){let o=Sk.default.basename(n).split(".")[0];t[o]=r}return t},{})}async function Ic({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r=!1,skipSourceMaps:o=!1,bundler:i="webpack"}){let[s,a]=await Promise.all([sI({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r,bundler:i}),o||i==="rspack"?Promise.resolve(null):aI({declarations:e,sources:t,overrideConfig:n,bundler:i})]),{metadata:l,options:c}=Object.keys(e).reduce((p,m)=>{let h=iI(s,m);return p.metadata[m]=h,p.options[m]=h.options||{},p},{metadata:{},options:{}});return{sourceMaps:a?lI(a):{},metadata:l,options:c}}function Ck(e,{framework:t,sourceMaps:n}){return Object.fromEntries(Object.keys(e).map(r=>[r,{...e[r],id:r,framework:t,exportPath:"default",hash:n[r]}]))}Te();var _k=w(require("md5"));we();pe();M();var Vf=" ",Ak=`${Vf}${Hl} `;function cI(e){return e==="added"?` ${K("(Added)")}`:e==="removed"?` ${le("(Removed)")}`:e==="changed"?` ${Ne("(Changed)")}`:""}function Fk(e){if(!e)return"";let t=JSON.parse(e);return(0,_k.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(n=>!n.includes("@webflow/data-types")&&!n.includes("@webflow/react"))].sort()))}function uI({componentsMetadata:e,latestVersion:t,sourceMaps:n}){let r=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(r).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=Fk(n[s]),d=a.displayName&&l.displayName!==a.displayName,p=c&&a.hash&&c!==Fk(a.hash),m=d||p;o[s]={component:l,status:m?"changed":"unchanged",previousName:d?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{r[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",d=l?`${l} ${at} ${c}`:c;return`${R(`${Ak}${d}`)}${cI(a)}`}).sort().join(`
57
- `)}function dI({componentsMetadata:e}){return Object.values(e).map(n=>`${R(Ak+(n.displayName??"Unknown Component"))}`).sort().join(`
58
- `)}async function Ik({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:n,sourceMaps:r,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?n.find(({profile:d})=>d.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?uI({componentsMetadata:t,latestVersion:i,sourceMaps:r}):dI({componentsMetadata:t}),l=s?`Ready to update ${Ne(e.name)} on ${Vd(o.name)}?`:`Ready to share ${Ne(e.name)} with ${Vd(o.name)}?`;return await Re({message:`${l}
56
+ `;return n?e.slice(0,n[0].length)+s+e.slice(n[0].length):s+e}function pa(e,t){let n=e.readFileSync(t,"utf-8"),o=new Mk.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=_R(n),s=new jk.default(t,module);Object.defineProperty(s,Yf,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Yf),o.close()}}function AR(e,t){let n=`/${t}.js`,r=pa(e,n),o=r.exports.default||r.exports;if(o&&typeof o=="object")try{return(0,Vt.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 RR({declarations:e,sources:t,overrideConfig:n={},performTypeCheck:r,bundler:o="webpack",projectDir:i}){let s=new Zf.Volume,a=Si(o),l=(0,Qf.default)(a.generateBaseConfig({entry:e,env:Vt.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(Vt.Framework.React,Vt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:r?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(Vt.Environment.Client,l,n);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function IR({declarations:e,sources:t,overrideConfig:n={},bundler:r,projectDir:o}){let i=new Zf.Volume,s=Si(r),a=(0,Qf.default)(s.generateBaseConfig({entry:e,env:Vt.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(Vt.Framework.React,Vt.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 Lc],externals:[(0,Uk.default)()]}),l=s.mergeConfigs(Vt.Environment.Client,a,n);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function TR(e){return Object.entries(e.toJSON()).reduce((t,[n,r])=>{if(n.endsWith(".map")&&r?.length){let o=Bk.default.basename(n).split(".")[0];t[o]=r}return t},{})}async function Nc({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([RR({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):IR({declarations:e,sources:t,overrideConfig:n,bundler:i,projectDir:s})]),{metadata:c,options:p}=Object.keys(e).reduce((m,h)=>{let g=AR(a,h);return m.metadata[h]=g,m.options[h]=g.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?TR(l):{},metadata:c,options:p}}function Wk(e,{framework:t,sourceMaps:n}){return Object.fromEntries(Object.keys(e).map(r=>[r,{...e[r],id:r,framework:t,exportPath:"default",hash:n[r]}]))}Oe();var Vk=w(require("md5"));be();pe();M();var em=" ",Gk=`${em}${ql} `;function PR(e){return e==="added"?` ${J("(Added)")}`:e==="removed"?` ${le("(Removed)")}`:e==="changed"?` ${je("(Changed)")}`:""}function Hk(e){if(!e)return"";let t=JSON.parse(e);return(0,Vk.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(n=>!n.includes("@webflow/data-types")&&!n.includes("@webflow/react"))].sort()))}function $R({componentsMetadata:e,latestVersion:t,sourceMaps:n}){let r=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(r).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=Hk(n[s]),p=a.displayName&&l.displayName!==a.displayName,d=c&&a.hash&&c!==Hk(a.hash),m=p||d;o[s]={component:l,status:m?"changed":"unchanged",previousName:p?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{r[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} ${at} ${c}`:c;return`${I(`${Gk}${p}`)}${PR(a)}`}).sort().join(`
57
+ `)}function OR({componentsMetadata:e}){return Object.values(e).map(n=>`${I(Gk+(n.displayName??"Unknown Component"))}`).sort().join(`
58
+ `)}async function Kk({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:n,sourceMaps:r,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?n.find(({profile:p})=>p.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?$R({componentsMetadata:t,latestVersion:i,sourceMaps:r}):OR({componentsMetadata:t}),l=s?`Ready to update ${je(e.name)} on ${Zd(o.name)}?`:`Ready to share ${je(e.name)} with ${Zd(o.name)}?`;return await $e({message:`${l}
59
59
 
60
- ${Vf}${R("Code components:")}
60
+ ${em}${I("Code components:")}
61
61
  ${a}
62
62
 
63
- ${Vf}Confirm to proceed`})}var Rc=require("path"),Pk=require("memfs/lib/volume");var Rk=w(require("fast-glob")),pI=e=>{let t=e.split("/");return t[t.length-1]},fI=e=>pI(e).split(".")[0];async function Tk(e,t){return(await Rk.default.glob(e,{absolute:!0,...t||{}})).reduce((r,o)=>{let i=fI(o);if(r[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${r[i]}, but also found at ${o}.`);return{...r,[i]:o}},{})}async function Tc(e){let t=await Tk(e.components,{cwd:(0,Rc.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(o=>o!=null)});if(!Object.keys(t).length)throw new Error("No declaration files found");let{componentsFiles:n,componentsVolume:r}=mI(t,e.renderer.client,e.globals);return{componentsFiles:n,componentsVolume:r}}function mI(e,t,n){let r={},o={};return Object.entries(e).forEach(([i,s])=>{let a=(0,Rc.extname)(s),l=`${Sn}/${Ab}/${i}${a}`;r[i]=l,o[l]=gI(t,s,n)}),{componentsFiles:r,componentsVolume:Pk.Volume.fromJSON(o)}}function gI(e,t,n){return n?`
64
- import { applyDecorators } from "${e}";
65
- import componentDefinition from "${t}";
66
- const globals = require("${n}") || {};
63
+ ${em}Confirm to proceed`})}var jc=require("path"),qk=require("memfs/lib/volume");var Jk=w(require("fast-glob")),LR=e=>{let t=e.split("/");return t[t.length-1]},NR=e=>LR(e).split(".")[0];async function zk(e,t){return(await Jk.default.glob(e,{absolute:!0,...t||{}})).reduce((r,o)=>{let i=NR(o);if(r[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${r[i]}, but also found at ${o}.`);return{...r,[i]:o}},{})}function It(e){return e.replace(/\\/g,"/")}async function Mc(e,t){let n=await zk(e.components,{cwd:(0,jc.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(n).length)throw new Error("No declaration files found");let{componentsFiles:r,componentsVolume:o}=jR(n,e.renderer.client,e.globals,t);return{componentsFiles:r,componentsVolume:o}}function jR(e,t,n,r){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,jc.extname)(a),c=`${xn}/${KD}/${s}${l}`;o[s]=c,i[c]=MR(t,a,n)}),{componentsFiles:o,componentsVolume:qk.Volume.fromJSON(i,r)}}function MR(e,t,n){let r=JSON.stringify(It(t)),o=JSON.stringify(It(e));if(!n)return`
64
+ import componentDefinition from ${r};
65
+ export default {...componentDefinition};
66
+ `.trim();let i=JSON.stringify(It(n));return`
67
+ import { applyDecorators } from ${o};
68
+ import componentDefinition from ${r};
69
+ const globals = require(${i}) || {};
67
70
 
68
71
  const globalDecorators = globals?.decorators || [];
69
72
  const decoratedDefinition = {
@@ -79,59 +82,56 @@ if (componentDefinition?.component) {
79
82
  }
80
83
 
81
84
  export default decoratedDefinition;
82
- `.trim():`
83
- import componentDefinition from "${t}";
84
- export default {...componentDefinition};
85
- `.trim()}q();pc();var $k=require("@webflow/data-types"),Pc={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:$k.Framework.React};var Si=require("path"),xi=require("fs");Te();_();We();function Jn(e){return e.replace(/\\/g,"/")}we();C();pe();M();function Ok(e){let t={...e};if(e.globals){let n=(0,Si.resolve)(process.cwd(),e.globals);if(!(0,xi.existsSync)(n))throw new Error(`Globals file not found: ${e.globals}
86
- Resolved path: ${n}
87
- Please ensure the file exists or remove the 'globals' field from your manifest.`);t.globals=Jn(n)}if(e.bundleConfig){let n=(0,Si.resolve)(process.cwd(),e.bundleConfig);if(!(0,xi.existsSync)(n))throw new Error(`Bundle config file not found: ${e.bundleConfig}
88
- Resolved path: ${n}
89
- Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);t.bundleConfig=Jn(n)}if(typeof e.renderer=="string"){let n=(0,Si.resolve)(process.cwd(),e.renderer);(0,xi.existsSync)(n)&&(t.renderer=Jn(n))}else if(typeof e.renderer=="object"&&typeof t.renderer=="object"){if(typeof e.renderer.client=="string"){let n=(0,Si.resolve)(process.cwd(),e.renderer.client);(0,xi.existsSync)(n)&&(t.renderer={...t.renderer,client:Jn(n)})}if(typeof e.renderer.server=="string"){let n=(0,Si.resolve)(process.cwd(),e.renderer.server);(0,xi.existsSync)(n)&&(t.renderer={...t.renderer,server:Jn(n)})}}return t}async function hI({initialData:e}){let t=await Je({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 f("When --no-input mode is enabled please provide a name in your library manifest");let n=await Je({message:"Enter a description for your code library",default:e?.description??""});if(!await Re({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:n}}async function yI({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},r=[...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+=` ${le("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await Jl({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...r];let s=i.toLowerCase(),a=r.filter(l=>{let c=l.value?.id??"",d=l.value?.name??"",p=l.value?.description??"";return c.toLowerCase().includes(s)||d.toLowerCase().includes(s)||p.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Gf({initialData:e,existingCodeLibraries:t}){let n,r={components:Pc.components},o=t.length>0?await yI({existingCodeLibraries:t}):null;if(o)n={...r,...o,...e,id:o.id};else{let a=await hI({initialData:e});n={...r,...e,...a}}let i=Ok(n);Se({library:i}),u.info(`${$} Library configuration updated in webflow.json`);let{path:s}=Yr();return{libraryManifest:i,manifestPath:s}}async function Lk({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:n,manifestPath:r}=ne(),o=Ms(n,"library");if(!o.id){if(on())return t.succeed(),Gf({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&&on())return t.succeed(),Gf({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=Ok({...o,name:i});return Promise.resolve({libraryManifest:s,manifestPath:r})}catch(n){if(n instanceof Xr&&on())return t.info(n.message),Gf({existingCodeLibraries:e});throw t.fail(),n}}var Jf=require("memfs/lib/volume"),Mk=w(require("webpack-merge"));var Bk="/client-renderer.js",Uk="/server-renderer.js",Nk=`${Sn}/test-renderers${Bk}`,jk=`${Sn}/test-renderers${Uk}`,wI=new Set(["@webflow/react"]),DI=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function Wk(e){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(wI.has(e.client)&&DI.has(e.server))return;let t=await EI(e);bI(e.client,t),kI(e.server,t)}function bI(e,t){let n=aa(t,Bk);if(typeof n.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof n.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let r=()=>null,o=n.exports.ClientRenderer(r),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 kI(e,t){let n=aa(t,Uk);if(typeof n.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let r=()=>null,o=n.exports.ServerRenderer(r),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 EI(e){let t=new Jf.Volume,n=Jn(e.client),r=Jn(e.server),o={[Nk]:`
90
- export * from "${n}";
91
- `,[jk]:`
85
+ `.trim()}q();bc();var Uc=require("path");var Xk=require("@webflow/data-types"),Bc={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:Xk.Framework.React};var zn=require("path"),_i=require("fs");Oe();A();Me();be();C();pe();M();function Yk(e,t){let n={...e};if(e.globals){let r=(0,zn.resolve)(t,e.globals);if(!(0,_i.existsSync)(r))throw new Error(`Globals file not found: ${e.globals}
86
+ Resolved path: ${r}
87
+ Please ensure the file exists or remove the 'globals' field from your manifest.`);n.globals=It(r)}if(e.bundleConfig){let r=(0,zn.resolve)(t,e.bundleConfig);if(!(0,_i.existsSync)(r))throw new Error(`Bundle config file not found: ${e.bundleConfig}
88
+ Resolved path: ${r}
89
+ Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);n.bundleConfig=It(r)}if(typeof e.renderer=="string"){let r=(0,zn.resolve)(t,e.renderer);(0,_i.existsSync)(r)&&(n.renderer=It(r))}else if(typeof e.renderer=="object"&&typeof n.renderer=="object"){if(typeof e.renderer.client=="string"){let r=(0,zn.resolve)(t,e.renderer.client);(0,_i.existsSync)(r)&&(n.renderer={...n.renderer,client:It(r)})}if(typeof e.renderer.server=="string"){let r=(0,zn.resolve)(t,e.renderer.server);(0,_i.existsSync)(r)&&(n.renderer={...n.renderer,server:It(r)})}}return n}async function BR({initialData:e}){let t=await Ke({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 f("When --no-input mode is enabled please provide a name in your library manifest");let n=await Ke({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:n}}async function UR({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},r=[...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+=` ${le("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await Ql({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...r];let s=i.toLowerCase(),a=r.filter(l=>{let c=l.value?.id??"",p=l.value?.name??"",d=l.value?.description??"";return c.toLowerCase().includes(s)||p.toLowerCase().includes(s)||d.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function tm({initialData:e,existingCodeLibraries:t}){let n,r={components:Bc.components},o=t.length>0?await UR({existingCodeLibraries:t}):null;if(o)n={...r,...o,...e,id:o.id};else{let a=await BR({initialData:e});n={...r,...e,...a}}let{path:i}=Qr(),s=Yk(n,(0,zn.dirname)(i));return xe({library:s}),u.info(`${$} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function Zk({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:n,manifestPath:r}=ee(),o=Hs(n,"library");if(!o.id){if(sn())return t.succeed(),tm({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&&sn())return t.succeed(),tm({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=Yk({...o,name:i},(0,zn.dirname)(r));return Promise.resolve({libraryManifest:s,manifestPath:r})}catch(n){if(n instanceof Zr&&sn())return t.info(n.message),tm({existingCodeLibraries:e});throw t.fail(),n}}var nm=require("memfs/lib/volume"),tE=w(require("webpack-merge"));var nE="/client-renderer.js",rE="/server-renderer.js",Qk=`${xn}/test-renderers${nE}`,eE=`${xn}/test-renderers${rE}`,WR=new Set(["@webflow/react"]),HR=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function oE(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(WR.has(e.client)&&HR.has(e.server))return;let n=await KR(e,t);VR(e.client,n),GR(e.server,n)}function VR(e,t){let n=pa(t,nE);if(typeof n.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof n.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let r=()=>null,o=n.exports.ClientRenderer(r),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 GR(e,t){let n=pa(t,rE);if(typeof n.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let r=()=>null,o=n.exports.ServerRenderer(r),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 KR(e,t){let n=new nm.Volume,r=It(e.client),o=It(e.server),i={[Qk]:`
92
90
  export * from "${r}";
93
- `},i=(0,Mk.default)(Ec(),{entry:{"client-renderer":Nk,"server-renderer":jk},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await xc({config:i,sourceVolumes:[Jf.Volume.fromJSON(o)],outputVolume:t,failOnWarnings:!1}),t}async function $c({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:n}=await Lk({existingCodeLibraries:e}),{renderer:r,...o}=Pc,i=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??r.client,server:t.renderer?.server??r.server};return i.server==="@webflow/react"&&(i.server="@webflow/react/server"),await Wk(i),{...o,...t,renderer:i,manifestPath:n}}C();M();async function vI(e,t){let{trackPerformance:n,libraryConfig:r}=e;return await n("collect_metadata",async()=>{let{componentsFiles:o,componentsVolume:i}=await Tc(r);u.debug(`Components: ${JSON.stringify(o,null,2)}`);let{sourceMaps:s,metadata:a,options:l}=await Ic({declarations:o,sources:i,overrideConfig:e.overrideConfig,performTypeCheck:dc(o,t),bundler:t?.bundler});return u.debug(`Metadata: ${JSON.stringify(a,null,2)}`),u.debug(`Source Maps:
91
+ `,[eE]:`
92
+ export * from "${o}";
93
+ `},s=(0,tE.default)(Ac(),{context:t,entry:{"client-renderer":Qk,"server-renderer":eE},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await Tc({config:s,sourceVolumes:[nm.Volume.fromJSON(i,t)],outputVolume:n,failOnWarnings:!1}),n}async function Wc({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:n}=await Zk({existingCodeLibraries:e}),r=(0,Uc.resolve)((0,Uc.dirname)(n)),{renderer:o,...i}=Bc,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 oE(s,r),{...i,...t,renderer:s,manifestPath:n}}C();M();async function JR(e,t){let{trackPerformance:n,libraryConfig:r,projectDir:o}=e;return await n("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await Mc(r,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await Nc({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:wc(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
94
94
 
95
- ${Object.entries(s).reduce((c,[d,p])=>(c+=`${d}: ${JSON.stringify(JSON.parse(p),null,2)}
95
+ ${Object.entries(a).reduce((p,[d,m])=>(p+=`${d}: ${JSON.stringify(JSON.parse(m),null,2)}
96
96
 
97
- `,c),"")}`),{componentsFiles:o,componentsVolume:i,componentsMetadata:a,componentsOptions:l,sourceMaps:s}})}async function SI(e,t,n,r,o,i,s){let{trackPerformance:a,libraryConfig:l}=e;return await a("generate_library_bundle",async()=>await _c({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:kr(i[Ci.Environment.Client]),sourceVolumes:[n],componentsFiles:t,componentsOptions:r,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler}))}async function xI(e,t,n,r){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let d=(0,Oc.resolve)((0,Oc.join)(`/${c}`,`${l.name}`));return ra(n.readFileSync(d,"utf8").toString(),d,{bundleEnvironment:c})}),{signatures:a}=await Rf({resourceId:r,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(d=>d.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await oa(c,l.value)}))})}async function CI(e,t,n,r,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:kr(o[Ci.Environment.Client])+Ws,loaderType:Ci.ModuleLoader.FEDERATION},serverModule:{bundleUrl:kr(o[Ci.Environment.Server])+Vs}},c=Ck(t,{framework:s.framework,sourceMaps:n}),{taskId:d}=await Tf({resourceId:r,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:d},null,2))})}async function Kf(e){e?.verbose&&(process.env.DEBUG="true");let t,n=Date.now(),r=await T({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=F.forCodeLibraries({authToken:r}),i=Jw(o);try{u.debug("Checking dependencies versions..."),new Qr().run();let s={apiToken:r};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await Af({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let d=await $c({existingCodeLibraries:c}),p=d.bundleConfig?require(d.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:d,overrideConfig:p};t=u.spinner("Collecting metadata");let{componentsFiles:h,componentsVolume:g,componentsMetadata:y,componentsOptions:b,sourceMaps:S}=await vI(m,e);if(t.succeed(),!await Ik({libraryConfig:d,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:S,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:v,profileSlug:x,workspace:O,s3Urls:H,cdnUrls:B}=await i("init_code_library",async()=>await If({name:d.name,slug:d.id,description:d.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:v,profileSlug:x,s3Urls:H,cdnUrls:B},null,2)),await o.sendUsage("library_initialized",{libraryName:d.name,framework:d.framework,resourceId:v,profileSlug:x}),d.id||(Se({library:{id:x}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:ye,outputVolume:ve}=await SI(m,h,g,b,v,B,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:d.name,componentCount:Object.keys(h).length,resourceId:v,profileSlug:x}),t=u.spinner("Uploading files"),await xI(m,ye,ve,v),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:d.name,fileCount:ye.length,resourceId:v,profileSlug:x}),t=u.spinner("Sharing library"),await CI(m,y,S,v,B),t.succeed(),u.success(`Code library shared successfully${O?.slug?`: ${kn}/dashboard/workspace/${O?.slug}/shared-libraries-and-templates`:"!"}`);let me=Date.now()-n;await o.sendUsage("share_library",{duration:me,componentCount:Object.keys(h).length,libraryName:d.name,framework:d.framework,resourceId:v,profileSlug:x})}catch(s){t?.fail();let a=Date.now()-n;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new f(s)}}var Lc=w(require("fs")),Fi=require("path");_();pc();C();var FI="CodeLibrary",_I="dist",AI="http://localhost/";async function zf(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new Qr().run(),u.debug("Looking for manifest...");let n=await $c({existingCodeLibraries:[]}),r=Dc(n.name)||FI,o=`_${e.libraryId||r}`;e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(n,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:i,componentsVolume:s}=await Tc(n);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(i,null,2)}`);let a=n.bundleConfig?require(n.bundleConfig):{},{sourceMaps:l,metadata:c,options:d}=await Ic({declarations:i,sources:s,overrideConfig:a,performTypeCheck:dc(i,e),skipSourceMaps:!e?.debugBundler,bundler:e.bundler});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(c,null,2)}`),u.debug(`Source Maps:
97
+ `,p),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function zR(e,t,n,r,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await Oc({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:vr(i[Ai.Environment.Client]),sourceVolumes:[n],componentsFiles:t,componentsOptions:r,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler,projectDir:c}))}async function qR(e,t,n,r){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let p=(0,co.resolve)((0,co.join)(`/${c}`,`${l.name}`));return la(n.readFileSync(p,"utf8").toString(),p,{bundleEnvironment:c})}),{signatures:a}=await Uf({resourceId:r,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 ca(c,l.value)}))})}async function XR(e,t,n,r,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:vr(o[Ai.Environment.Client])+Js,loaderType:Ai.ModuleLoader.FEDERATION},serverModule:{bundleUrl:vr(o[Ai.Environment.Server])+qs}},c=Wk(t,{framework:s.framework,sourceMaps:n}),{taskId:p}=await Wf({resourceId:r,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:p},null,2))})}async function rm(e){e?.verbose&&(process.env.DEBUG="true");let t,n=Date.now(),r=await T({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=F.forCodeLibraries({authToken:r}),i=cb(o);try{u.debug("Checking dependencies versions..."),new to().run();let s={apiToken:r};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await Mf({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let p=await Wc({existingCodeLibraries:c}),d=p.bundleConfig?require(p.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:p,overrideConfig:d,projectDir:(0,co.resolve)((0,co.dirname)(p.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:h,componentsVolume:g,componentsMetadata:y,componentsOptions:b,sourceMaps:S}=await JR(m,e);if(t.succeed(),!await Kk({libraryConfig:p,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:S,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:v,profileSlug:x,workspace:O,s3Urls:H,cdnUrls:B}=await i("init_code_library",async()=>await Bf({name:p.name,slug:p.id,description:p.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:v,profileSlug:x,s3Urls:H,cdnUrls:B},null,2)),await o.sendUsage("library_initialized",{libraryName:p.name,framework:p.framework,resourceId:v,profileSlug:x}),p.id||(xe({library:{id:x}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:we,outputVolume:Se}=await zR(m,h,g,b,v,B,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:p.name,componentCount:Object.keys(h).length,resourceId:v,profileSlug:x}),t=u.spinner("Uploading files"),await qR(m,we,Se,v),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:p.name,fileCount:we.length,resourceId:v,profileSlug:x}),t=u.spinner("Sharing library"),await XR(m,y,S,v,B),t.succeed(),u.success(`Code library shared successfully${O?.slug?`: ${En()}/dashboard/workspace/${O?.slug}/shared-libraries-and-templates`:"!"}`);let me=Date.now()-n;await o.sendUsage("share_library",{duration:me,componentCount:Object.keys(h).length,libraryName:p.name,framework:p.framework,resourceId:v,profileSlug:x})}catch(s){t?.fail();let a=Date.now()-n;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new f(s)}}var Hc=w(require("fs")),Cn=require("path");A();bc();C();var YR="CodeLibrary",ZR="dist",QR="http://localhost/";async function om(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new to().run(),u.debug("Looking for manifest...");let n=await Wc({existingCodeLibraries:[]}),r=Cc(n.name)||YR,o=`_${e.libraryId||r}`,i=(0,Cn.resolve)((0,Cn.dirname)(n.manifestPath));e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(n,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:s,componentsVolume:a}=await Mc(n,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=n.bundleConfig?require(n.bundleConfig):{},{sourceMaps:c,metadata:p,options:d}=await Nc({declarations:s,sources:a,overrideConfig:l,performTypeCheck:wc(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:
98
98
 
99
- ${Object.entries(l).reduce((h,[g,y])=>(h+=`${g}: ${JSON.stringify(JSON.parse(y),null,2)}
99
+ ${Object.entries(c).reduce((g,[y,b])=>(g+=`${y}: ${JSON.stringify(JSON.parse(b),null,2)}
100
100
 
101
- `,h),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:p,outputVolume:m}=await _c({libraryIdentifier:o,renderer:n.renderer,framework:n.framework,publicPath:kr(e.publicPath||AI),sourceVolumes:[s],componentsFiles:i,componentsOptions:d,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:a,failOnWarnings:!e.force,bundler:e.bundler});t.succeed(),t=u.spinner("Writing to disk"),p.forEach(([h,g])=>{let y=(0,Fi.join)(`/${g}`,`${h.name}`),b=ra(m.readFileSync(y,"utf8").toString(),y,{bundleEnvironment:g}),S=(0,Fi.join)(process.cwd(),e.outputPath||_I);Lc.default.existsSync((0,Fi.join)(S,`${g}`))||Lc.default.mkdirSync((0,Fi.join)(S,`${g}`),{recursive:!0}),Lc.default.writeFileSync((0,Fi.join)(S,g,h.name),b.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(n){throw t?.fail(),new f(n)}}_();M();var la=w(require("fs-extra")),qf=w(require("path"));_();M();function II(){try{if(!la.default.existsSync(_t))return null;let e=la.default.readdirSync(_t).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:qf.default.join(_t,t),time:la.default.statSync(qf.default.join(_t,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);if(e.length===0)return null;for(let t of e)try{let r=la.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(r){let o=r[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function Xf(){let e=II();e&&u.info(`${ui} Latest log: ${e}`),u.info(`${ui} All logs: ${_t}`)}async function Hk(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(Xf)}var De=require("commander");C();_();function ut(e){let t=Object.fromEntries(e.map(n=>[n.toLowerCase(),n]));return n=>{let r=[],o=[];for(let i of n){let s=t[i.toLowerCase()];s?r.push(s):o.push(i)}return{valid:r,invalid:o}}}function Ce(e,t,n){let r=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(r);if(o.length===0)throw new f(`No valid fields specified. Available: ${n.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${n.join(", ")}`),o}pe();_();var Vk=(e,t)=>e+" ".repeat(Math.max(0,t-wt(e).length));function ze(e,t){let n=e.map((s,a)=>Math.max(wt(s).length,...t.map(l=>wt(String(l[a])).length))),r=n.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>Vk(s,n[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>Vk(String(a),n[l]+2)).join("")).join(`
101
+ `,g),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:h}=await Oc({libraryIdentifier:o,renderer:n.renderer,framework:n.framework,publicPath:vr(e.publicPath||QR),sourceVolumes:[a],componentsFiles:s,componentsOptions:d,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(([g,y])=>{let b=(0,Cn.join)(`/${y}`,`${g.name}`),S=la(h.readFileSync(b,"utf8").toString(),b,{bundleEnvironment:y}),_=(0,Cn.join)(i,e.outputPath||ZR);Hc.default.existsSync((0,Cn.join)(_,`${y}`))||Hc.default.mkdirSync((0,Cn.join)(_,`${y}`),{recursive:!0}),Hc.default.writeFileSync((0,Cn.join)(_,y,g.name),S.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(n){throw t?.fail(),new f(n)}}A();M();var fa=w(require("fs-extra")),im=w(require("path"));A();M();function eI(){try{if(!fa.default.existsSync(At))return null;let e=fa.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:im.default.join(At,t),time:fa.default.statSync(im.default.join(At,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);if(e.length===0)return null;for(let t of e)try{let r=fa.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(r){let o=r[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function sm(){let e=eI();e&&u.info(`${fi} Latest log: ${e}`),u.info(`${fi} All logs: ${At}`)}async function iE(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(sm)}var ye=require("commander");C();A();function ut(e){let t=Object.fromEntries(e.map(n=>[n.toLowerCase(),n]));return n=>{let r=[],o=[];for(let i of n){let s=t[i.toLowerCase()];s?r.push(s):o.push(i)}return{valid:r,invalid:o}}}function _e(e,t,n){let r=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(r);if(o.length===0)throw new f(`No valid fields specified. Available: ${n.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${n.join(", ")}`),o}pe();A();var sE=(e,t)=>e+" ".repeat(Math.max(0,t-wt(e).length));function qe(e,t){let n=e.map((s,a)=>Math.max(wt(s).length,...t.map(l=>wt(String(l[a])).length))),r=n.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>sE(s,n[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>sE(String(a),n[l]+2)).join("")).join(`
102
102
  `);return`${o}
103
103
  ${r}
104
- ${i}`}function _i(e){return e?`
104
+ ${i}`}function Ri(e){return e?`
105
105
 
106
- More: pass --cursor ${e}`:""}var Gk=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],Jk=["id","url","lastPublished","fullSiteCompiledAt"],Kk=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],Nc="id,name,siteId,createdAt",Yf="id,name,description,siteId,appPath,createdAt",jc="id,url,lastPublished",Mc="id,branch,deployUrl,latestDeploymentStatus,createdAt",RI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function TI(e,t){return e==null||e===""?R("\u2014"):RI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ca(e,t,n){if(e.length===0)return R(n);let r=t.map(i=>se(i)),o=e.map(i=>t.map(s=>TI(i[s],s)));return ze(r,o)}var Bc=ut(Gk),zk=ut(Jk),qk=ut(Kk);function vr(){return Gk}function ua(){return Jk}function da(){return Kk}function Uc(e,t=Nc.split(",")){return ca(e,t,"No apps found.")}function Xk(e,t=jc.split(",")){return ca(e,t,"No domains found.")}function Yk(e,t=Mc.split(",")){return ca(e,t,"No environments found.")}function Zk(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 PI=["success","failed","canceled","unstaged"],Wc=5,Hc=600;function Qk(e){return PI.includes(e)}var eE=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],pa="id,status,sourceType,commitHash,buildStartedAt",Vc=ut(eE);function Sr(){return eE}function fa(e,t=pa.split(",")){return ca(e,t,"No deployments found.")}var Zf=()=>new De.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."),tE=()=>new De.Option("--input","Force interactive mode, overriding the automatic no-input detection."),Qf=()=>new De.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),em=()=>new De.Option("--skip-update-check","Skip checking for @webflow packages updates"),tm=()=>new De.Option("--verbose","Display more information for debugging purposes."),Kn=()=>new De.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),It=()=>new De.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ai=e=>{if(e.trim()==="")throw new De.InvalidArgumentError("must be a non-empty value.");return e},Gc=(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.`,Jc=e=>new De.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(Ai),oe=()=>new De.Option("--json","Output as JSON"),ma=()=>new De.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),ga=()=>new De.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),nm=()=>new De.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Pe=()=>new De.Option("--dry-run","Preview without executing"),Ii=()=>new De.Option("-y, --yes","Skip confirmation prompt"),Ri=()=>new De.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Kc=()=>new De.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]),ha=()=>new De.Option("-g, --global","Operate on the per-user (home directory) install"),ya=()=>new De.Option("-p, --project","Operate on the current project's install"),He=e=>new De.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Ti=e=>new De.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),zc=()=>new De.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),qc=()=>new De.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),$I=100,Xc=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new De.InvalidArgumentError("must be a positive integer.");return t},rm=()=>new De.Option("--limit <n>","Max log lines to return (default: 100)").default($I).argParser(Xc),OI=20,nE=()=>new De.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(OI).argParser(Xc),rE=e=>{let t=Number(e);if(!Number.isInteger(t))throw new De.InvalidArgumentError("must be an integer number of seconds.");return t},oE=()=>new De.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(Wc).argParser(rE),iE=()=>new De.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Hc).argParser(rE),wa=e=>async(t,n)=>{let o={...n.parent?.opts()||{},...t};await e(o)};pe();var LI=`${le("[Deprecated]")} The 'library' commands will be removed in the next major release.`,NI=()=>{u.warn(`${re} ${le("webflow library share")} is deprecated and will be removed in the next major release.
107
- Use ${K("webflow devlink import")} instead.
108
- `)},jI=()=>{u.warn(`${re} ${le("webflow library bundle")} is deprecated and will be removed in the next major release.
109
- Use ${K("webflow devlink bundle")} instead.
110
- `)},MI=()=>{u.warn(`${re} ${le("webflow library log")} is deprecated and will be removed in the next major release.
111
- Use ${K("webflow log")} instead.
112
- `)},BI="Import a library of Code Components into your Webflow Workspace.",UI="Bundle a library of Code Components for local development.",sE=()=>new xr.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),aE=()=>new xr.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),lE=()=>new xr.Option("--dev","Bundle in development mode for debugging purposes."),cE=()=>new xr.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),WI=()=>new xr.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),HI=()=>new xr.Option("--public-path <path>","Set the public path for the bundle."),VI=()=>new xr.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function om(e,t){return e.command(t).description(BI).addOption(Kn()).addOption(sE()).addOption(aE()).addOption(lE()).addOption(cE()).action(wa(Kf))}function im(e,t){return e.command(t).description(UI).addOption(WI()).addOption(HI()).addOption(VI()).addOption(sE()).addOption(aE()).addOption(lE()).addOption(cE()).action(wa(zf))}var uE=e=>{let t=e.command("library").description(LI);om(t,"share").description(`${le("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",NI),im(t,"bundle").description(`${le("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",jI),t.command("log").description(`${le("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",MI).action(Xf)};pe();var dE=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${le("[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(Kn()).addOption(It()).action(sb),om(t,"import"),im(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(Kn()).addOption(It()).action(wa(hc))};var Xn=w(require("fs")),Vt=w(require("path"));_();q();var xe={New:"new",Existing:"existing"},pE="cli",zn=3,qn=39,Yc="astro",fE="cloud-scaffolds";var mE="package.json",ao="webflow.json",Zc="wf-placeholder-name",gE="CLOUD_MOUNT_PATH",hE="gitignore";function sm(e){return!e.siteId}var Da=async(e,t,n=Yc,r,o,i)=>{try{let s,a;if("content"in r){let l=r.content;s=l.files,a=c=>Vt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=r[n];if(!c)throw new Error(`Scaffold "${n}" not found`);s=c;let d=Vt.join(fE,n);a=p=>p.split(d)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Vt.join(e,a(l)),d=l.includes("next.config.ts"),p=l.includes("astro.config.mjs"),m=d||p;if(l.includes(ao)&&Xn.existsSync(c))continue;if(l.includes(mE)||l.includes(ao)){let g=(await Xn.promises.readFile(l,"utf8")).replace(Zc,e);await Qc(c,g)}else if(m){let h=await Xn.promises.readFile(l,"utf8");await Qc(c,h.replace(gE,t))}else if(Vt.basename(c).toLowerCase()===hE){let h=await Xn.promises.readFile(l,"utf8"),g=Vt.join(Vt.dirname(c),".gitignore");await Qc(g,h)}else{let h=await Xn.promises.readFile(l);await Qc(c,h)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Hn({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 Qc=async(e,t)=>{try{await Xn.promises.mkdir(Vt.dirname(e),{recursive:!0}),await Xn.promises.writeFile(e,t)}catch(n){throw u.error(`Error writing file ${e}: ${n}`),n}};var Cr=w(require("fs")),yE=w(require("fs-extra")),Fr=w(require("path")),dm=w(require("os")),wE=w(require("tar"));var Ze=class extends Error{constructor(n,r,o){super(n);this.scaffoldId=r;this.supportedIds=o;this.name="ScaffoldError"}};var ba={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v2",betaRef:"astro7"}},"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:"v2",betaRef:"astro7"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function ka(e){let t=ba[e];if(!t){let n=Object.keys(ba);throw new Ze(`Unsupported framework: "${e}". Supported: ${n.join(", ")}`,e,n)}return t}function am(){return Object.keys(ba)}function lm(){return[...new Set(am().map(e=>e.replace(/-minimal$/,"")))]}function cm(){return["astro","nextjs"]}function um(e){let n=`${e.replace(/-minimal$/,"")}-minimal`;if(!ba[n]){let r=am();throw new Ze(`No minimal scaffold for "${e}". Supported: ${r.join(", ")}`,n,r)}return n}_();Wn();var GI="https://github.com";async function pm(e){let t=e.endsWith("-minimal")?e:um(e);return eu(t)}async function eu(e){return ka(e).source.type==="github"?JI(e):DE(e)}async function DE(e){let t=ka(e);if(t.source.type!=="local")throw new Ze(`Scaffold "${e}" does not have a local source`,e);let n=Fr.isAbsolute(t.source.path)?t.source.path:Fr.join(__dirname,t.source.path);if(!Cr.existsSync(n))throw new Ze(`Scaffold directory not found: ${n}`,e);let r=await fm(n);return{scaffoldId:e,files:r,extractionRoot:n}}async function JI(e){let t=ka(e);if(t.source.type!=="github")throw new Ze(`Scaffold "${e}" does not have a GitHub source`,e);let n=(tt()?t.source.betaRef:void 0)??t.source.ref??"main",r=`${GI}/${t.source.repo}/archive/${n}.tar.gz`,o=await Cr.promises.mkdtemp(Fr.join(dm.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${n})`);try{let s;try{s=await fetch(r,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(h){throw i.fail("Download failed"),new Ze(`Failed to fetch scaffold from GitHub: ${h instanceof Error?h.message:String(h)}. Repo: ${t.source.repo}, ref: ${n}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new Ze(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${n}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await KI(a,o),l.succeed("Scaffold ready")}catch(h){throw l.fail("Unpack failed"),h}let c=await Cr.promises.readdir(o),d=c[0];if(!d||c.length!==1)throw new Ze(`Unexpected tarball structure for ${t.source.repo}`,e);let p=Fr.join(o,d),m=await fm(p);return{scaffoldId:e,files:m,extractionRoot:p}}catch(s){try{yE.default.removeSync(o)}catch{}throw s instanceof Ze?s:new Ze(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function KI(e,t){let n=Fr.join(dm.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await Cr.promises.writeFile(n,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await wE.extract({file:n,cwd:t})}finally{await Cr.promises.unlink(n).catch(()=>{})}}async function fm(e){let t=[],n=await Cr.promises.readdir(e,{withFileTypes:!0});for(let r of n){let o=Fr.join(e,r.name);r.isDirectory()?t.push(...await fm(o)):t.push(o)}return t}var Mm=w(require("fs-extra"));q();X();var ee=w(require("fs")),ce=w(require("path")),La=require("child_process"),av=w(require("tar"));var ft=w(require("fs")),un=w(require("path"));var j={};by(j,{BRAND:()=>DR,DIRTY:()=>lo,EMPTY_PATH:()=>YI,INVALID:()=>Y,NEVER:()=>rT,OK:()=>dt,ParseStatus:()=>nt,Schema:()=>ae,ZodAny:()=>Ir,ZodArray:()=>er,ZodBigInt:()=>uo,ZodBoolean:()=>po,ZodBranded:()=>va,ZodCatch:()=>vo,ZodDate:()=>fo,ZodDefault:()=>Eo,ZodDiscriminatedUnion:()=>ru,ZodEffects:()=>Kt,ZodEnum:()=>bo,ZodError:()=>Dt,ZodFirstPartyTypeKind:()=>Q,ZodFunction:()=>iu,ZodIntersection:()=>yo,ZodIssueCode:()=>I,ZodLazy:()=>wo,ZodLiteral:()=>Do,ZodMap:()=>ji,ZodNaN:()=>Bi,ZodNativeEnum:()=>ko,ZodNever:()=>an,ZodNull:()=>go,ZodNullable:()=>Fn,ZodNumber:()=>co,ZodObject:()=>bt,ZodOptional:()=>Gt,ZodParsedType:()=>W,ZodPipeline:()=>Sa,ZodPromise:()=>Rr,ZodReadonly:()=>So,ZodRecord:()=>ou,ZodSchema:()=>ae,ZodSet:()=>Mi,ZodString:()=>Ar,ZodSymbol:()=>Li,ZodTransformer:()=>Kt,ZodTuple:()=>Cn,ZodType:()=>ae,ZodUndefined:()=>mo,ZodUnion:()=>ho,ZodUnknown:()=>Qn,ZodVoid:()=>Ni,addIssueToContext:()=>N,any:()=>_R,array:()=>TR,bigint:()=>vR,boolean:()=>IE,coerce:()=>nT,custom:()=>FE,date:()=>SR,datetimeRegex:()=>xE,defaultErrorMap:()=>Yn,discriminatedUnion:()=>LR,effect:()=>zR,enum:()=>GR,function:()=>WR,getErrorMap:()=>Pi,getParsedType:()=>xn,instanceof:()=>kR,intersection:()=>NR,isAborted:()=>tu,isAsync:()=>$i,isDirty:()=>nu,isValid:()=>_r,late:()=>bR,lazy:()=>HR,literal:()=>VR,makeIssue:()=>Ea,map:()=>BR,nan:()=>ER,nativeEnum:()=>JR,never:()=>IR,null:()=>FR,nullable:()=>XR,number:()=>AE,object:()=>PR,objectUtil:()=>mm,oboolean:()=>tT,onumber:()=>eT,optional:()=>qR,ostring:()=>QR,pipeline:()=>ZR,preprocess:()=>YR,promise:()=>KR,quotelessJson:()=>zI,record:()=>MR,set:()=>UR,setErrorMap:()=>XI,strictObject:()=>$R,string:()=>_E,symbol:()=>xR,transformer:()=>zR,tuple:()=>jR,undefined:()=>CR,union:()=>OR,unknown:()=>AR,util:()=>de,void:()=>RR});var de;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,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 r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(de||(de={}));var mm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mm||(mm={}));var W=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xn=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}};var I=de.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"]),zI=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=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_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)r._errors.push(n(s));else{let a=r,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(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}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,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Dt.create=e=>new Dt(e);var qI=(e,t)=>{let n;switch(e.code){case I.invalid_type:e.received===W.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,de.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(e.keys,", ")}`;break;case I.invalid_union:n="Invalid input";break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(e.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:n="Invalid function arguments";break;case I.invalid_return_type:n="Invalid function return type";break;case I.invalid_date:n="Invalid date";break;case I.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:de.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case I.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case I.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case I.custom:n="Invalid input";break;case I.invalid_intersection_types:n="Intersection results could not be merged";break;case I.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:n="Number must be finite";break;default:n=t.defaultError,de.assertNever(e)}return{message:n}},Yn=qI;var bE=Yn;function XI(e){bE=e}function Pi(){return bE}var Ea=e=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},YI=[];function N(e,t){let n=Pi(),r=Ea({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Yn?void 0:Yn].filter(o=>!!o)});e.common.issues.push(r)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let o of n){if(o.status==="aborted")return Y;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let o of n){let i=await o.key,s=await o.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Y;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},Y=Object.freeze({status:"aborted"}),lo=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),tu=e=>e.status==="aborted",nu=e=>e.status==="dirty",_r=e=>e.status==="valid",$i=e=>typeof Promise<"u"&&e instanceof Promise;var G;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(G||(G={}));var Jt=class{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,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}},kE=(e,t)=>{if(_r(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 n=new Dt(e.common.issues);return this._error=n,this._error}}};function ie(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))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??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}var ae=class{get description(){return this._def.description}_getType(t){return xn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:xn(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:xn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if($i(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return kE(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return _r(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>_r(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xn(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await($i(o)?o:Promise.resolve(o));return kE(r,i)}refine(t,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:I.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Kt({schema:this,typeName:Q.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:n=>this["~validate"](n)}}optional(){return Gt.create(this,this._def)}nullable(){return Fn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return Rr.create(this,this._def)}or(t){return ho.create([this,t],this._def)}and(t){return yo.create(this,t,this._def)}transform(t){return new Kt({...ie(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Eo({...ie(this._def),innerType:this,defaultValue:n,typeName:Q.ZodDefault})}brand(){return new va({typeName:Q.ZodBranded,type:this,...ie(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new vo({...ie(this._def),innerType:this,catchValue:n,typeName:Q.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Sa.create(this,t)}readonly(){return So.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ZI=/^c[^\s-]{8,}$/i,QI=/^[0-9a-z]+$/,eR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tR=/^[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,nR=/^[a-z0-9_-]{21}$/i,rR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oR=/^[-+]?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)?)??$/,iR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gm,aR=/^(?:(?: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])$/,lR=/^(?:(?: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])$/,cR=/^(([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]))$/,uR=/^(([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])$/,dR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vE="((\\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])))",fR=new RegExp(`^${vE}$`);function SE(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function mR(e){return new RegExp(`^${SE(e)}$`)}function xE(e){let t=`${vE}T${SE(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function gR(e,t){return!!((t==="v4"||!t)&&aR.test(e)||(t==="v6"||!t)&&cR.test(e))}function hR(e,t){if(!rR.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function yR(e,t){return!!((t==="v4"||!t)&&lR.test(e)||(t==="v6"||!t)&&uR.test(e))}var Ar=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_type,expected:W.string,received:i.parsedType}),Y}let r=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.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?N(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")iR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"email",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")gm||(gm=new RegExp(sR,"u")),gm.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"emoji",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")tR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"uuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")nR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"nanoid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ZI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")QI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid2",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")eR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ulid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),N(o,{validation:"url",code:I.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"regex",code:I.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.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),N(o,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?xE(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?fR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?mR(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?oR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"duration",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?gR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ip",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?hR(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"jwt",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?yR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cidr",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?dR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?pR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64url",code:I.invalid_string,message:i.message}),r.dirty()):de.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:I.invalid_string,...G.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...G.errToObj(t)})}url(t){return this._addCheck({kind:"url",...G.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...G.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...G.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...G.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...G.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...G.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...G.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...G.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...G.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...G.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...G.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...G.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,...G.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,...G.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...G.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...G.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...G.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...G.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...G.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...G.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...G.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...G.errToObj(n)})}nonempty(t){return this.min(1,G.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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ar.create=e=>new Ar({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...ie(e)});function wR(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var co=class e extends ae{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)!==W.number){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_type,expected:W.number,received:i.parsedType}),Y}let r,o=new nt;for(let i of this._def.checks)i.kind==="int"?de.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{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)&&(r=this._getOrReturnCtx(t,r),N(r,{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)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?wR(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:I.not_finite,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,G.toString(n))}gt(t,n){return this.setLimit("min",t,!1,G.toString(n))}lte(t,n){return this.setLimit("max",t,!0,G.toString(n))}lt(t,n){return this.setLimit("max",t,!1,G.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:G.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:G.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:G.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:G.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&de.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};co.create=e=>new co({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...ie(e)});var uo=class e extends ae{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)!==W.bigint)return this._getInvalidInput(t);let r,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{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)&&(r=this._getOrReturnCtx(t,r),N(r,{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)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return N(n,{code:I.invalid_type,expected:W.bigint,received:n.parsedType}),Y}gte(t,n){return this.setLimit("min",t,!0,G.toString(n))}gt(t,n){return this.setLimit("min",t,!1,G.toString(n))}lte(t,n){return this.setLimit("max",t,!0,G.toString(n))}lt(t,n){return this.setLimit("max",t,!1,G.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:G.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:G.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:G.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};uo.create=e=>new uo({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...ie(e)});var po=class extends ae{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.boolean,received:r.parsedType}),Y}return dt(t.data)}};po.create=e=>new po({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...ie(e)});var fo=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_type,expected:W.date,received:i.parsedType}),Y}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_date}),Y}let r=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):de.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:G.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:G.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};fo.create=e=>new fo({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...ie(e)});var Li=class extends ae{_parse(t){if(this._getType(t)!==W.symbol){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.symbol,received:r.parsedType}),Y}return dt(t.data)}};Li.create=e=>new Li({typeName:Q.ZodSymbol,...ie(e)});var mo=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.undefined,received:r.parsedType}),Y}return dt(t.data)}};mo.create=e=>new mo({typeName:Q.ZodUndefined,...ie(e)});var go=class extends ae{_parse(t){if(this._getType(t)!==W.null){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.null,received:r.parsedType}),Y}return dt(t.data)}};go.create=e=>new go({typeName:Q.ZodNull,...ie(e)});var Ir=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Ir.create=e=>new Ir({typeName:Q.ZodAny,...ie(e)});var Qn=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};Qn.create=e=>new Qn({typeName:Q.ZodUnknown,...ie(e)});var an=class extends ae{_parse(t){let n=this._getOrReturnCtx(t);return N(n,{code:I.invalid_type,expected:W.never,received:n.parsedType}),Y}};an.create=e=>new an({typeName:Q.ZodNever,...ie(e)});var Ni=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.void,received:r.parsedType}),Y}return dt(t.data)}};Ni.create=e=>new Ni({typeName:Q.ZodVoid,...ie(e)});var er=class e extends ae{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==W.array)return N(n,{code:I.invalid_type,expected:W.array,received:n.parsedType}),Y;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(N(n,{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}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(N(n,{code:I.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(N(n,{code:I.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Jt(n,s,n.path,a)))).then(s=>nt.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new Jt(n,s,n.path,a)));return nt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:G.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:G.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:G.toString(n)}})}nonempty(t){return this.min(1,t)}};er.create=(e,t)=>new er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...ie(t)});function Oi(e){if(e instanceof bt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Gt.create(Oi(r))}return new bt({...e._def,shape:()=>t})}else return e instanceof er?new er({...e._def,type:Oi(e.element)}):e instanceof Gt?Gt.create(Oi(e.unwrap())):e instanceof Fn?Fn.create(Oi(e.unwrap())):e instanceof Cn?Cn.create(e.items.map(t=>Oi(t))):e}var bt=class e extends ae{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(),n=de.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==W.object){let c=this._getOrReturnCtx(t);return N(c,{code:I.invalid_type,expected:W.object,received:c.parsedType}),Y}let{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof an&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let d=i[c],p=o.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new Jt(o,p,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof an){let c=this._def.unknownKeys;if(c==="passthrough")for(let d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(c==="strict")a.length>0&&(N(o,{code:I.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let d of a){let p=o.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new Jt(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let d of l){let p=await d.key,m=await d.value;c.push({key:p,value:m,alwaysSet:d.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(r,c)):nt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return G.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:G.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:Q.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of de.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of de.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return Oi(this)}partial(t){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of de.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Gt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return CE(de.objectKeys(this.shape))}};bt.create=(e,t)=>new bt({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Q.ZodObject,...ie(t)});bt.strictCreate=(e,t)=>new bt({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Q.ZodObject,...ie(t)});bt.lazycreate=(e,t)=>new bt({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Q.ZodObject,...ie(t)});var ho=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=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 n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Dt(a.ctx.common.issues));return N(n,{code:I.invalid_union,unionErrors:s}),Y}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new Dt(l));return N(n,{code:I.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}};ho.create=(e,t)=>new ho({options:e,typeName:Q.ZodUnion,...ie(t)});var Zn=e=>e instanceof wo?Zn(e.schema):e instanceof Kt?Zn(e.innerType()):e instanceof Do?[e.value]:e instanceof bo?e.options:e instanceof ko?de.objectValues(e.enum):e instanceof Eo?Zn(e._def.innerType):e instanceof mo?[void 0]:e instanceof go?[null]:e instanceof Gt?[void 0,...Zn(e.unwrap())]:e instanceof Fn?[null,...Zn(e.unwrap())]:e instanceof va||e instanceof So?Zn(e.unwrap()):e instanceof vo?Zn(e._def.innerType):[],ru=class e extends ae{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return N(n,{code:I.invalid_type,expected:W.object,received:n.parsedType}),Y;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(N(n,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let o=new Map;for(let i of n){let s=Zn(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:Q.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ie(r)})}};function hm(e,t){let n=xn(e),r=xn(t);if(e===t)return{valid:!0,data:e};if(n===W.object&&r===W.object){let o=de.objectKeys(t),i=de.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=hm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===W.array&&r===W.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=hm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===W.date&&r===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var yo=class extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(tu(i)||tu(s))return Y;let a=hm(i.value,s.value);return a.valid?((nu(i)||nu(s))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:I.invalid_intersection_types}),Y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};yo.create=(e,t,n)=>new yo({left:e,right:t,typeName:Q.ZodIntersection,...ie(n)});var Cn=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.array)return N(r,{code:I.invalid_type,expected:W.array,received:r.parsedType}),Y;if(r.data.length<this._def.items.length)return N(r,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Jt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>nt.mergeArray(n,s)):nt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Cn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cn({items:e,typeName:Q.ZodTuple,rest:null,...ie(t)})};var ou=class e extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return N(r,{code:I.invalid_type,expected:W.object,received:r.parsedType}),Y;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new Jt(r,a,r.path,a)),value:s._parse(new Jt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?nt.mergeObjectAsync(n,o):nt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ae?new e({keyType:t,valueType:n,typeName:Q.ZodRecord,...ie(r)}):new e({keyType:Ar.create(),valueType:t,typeName:Q.ZodRecord,...ie(n)})}},ji=class extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.map)return N(r,{code:I.invalid_type,expected:W.map,received:r.parsedType}),Y;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Jt(r,a,r.path,[c,"key"])),value:i._parse(new Jt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return Y;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return Y;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}}}};ji.create=(e,t,n)=>new ji({valueType:t,keyType:e,typeName:Q.ZodMap,...ie(n)});var Mi=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.set)return N(r,{code:I.invalid_type,expected:W.set,received:r.parsedType}),Y;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(N(r,{code:I.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(N(r,{code:I.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let d of l){if(d.status==="aborted")return Y;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>i._parse(new Jt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:G.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:G.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Mi.create=(e,t)=>new Mi({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...ie(t)});var iu=class e extends ae{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.function)return N(n,{code:I.invalid_type,expected:W.function,received:n.parsedType}),Y;function r(a,l){return Ea({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Pi(),Yn].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function o(a,l){return Ea({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Pi(),Yn].filter(c=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Rr){let a=this;return dt(async function(...l){let c=new Dt([]),d=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),p=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(p,i).catch(h=>{throw c.addIssue(o(p,h)),c})})}else{let a=this;return dt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new Dt([r(l,c.error)]);let d=Reflect.apply(s,this,c.data),p=a._def.returns.safeParse(d,i);if(!p.success)throw new Dt([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Cn.create(t).rest(Qn.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,n,r){return new e({args:t||Cn.create([]).rest(Qn.create()),returns:n||Qn.create(),typeName:Q.ZodFunction,...ie(r)})}},wo=class extends ae{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};wo.create=(e,t)=>new wo({getter:e,typeName:Q.ZodLazy,...ie(t)});var Do=class extends ae{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return N(n,{received:n.data,code:I.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:t.data}}get value(){return this._def.value}};Do.create=(e,t)=>new Do({value:e,typeName:Q.ZodLiteral,...ie(t)});function CE(e,t){return new bo({values:e,typeName:Q.ZodEnum,...ie(t)})}var bo=class e extends ae{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{expected:de.joinValues(r),received:n.parsedType,code:I.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{received:n.data,code:I.invalid_enum_value,options:r}),Y}return dt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};bo.create=CE;var ko=class extends ae{_parse(t){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==W.string&&r.parsedType!==W.number){let o=de.objectValues(n);return N(r,{expected:de.joinValues(o),received:r.parsedType,code:I.invalid_type}),Y}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=de.objectValues(n);return N(r,{received:r.data,code:I.invalid_enum_value,options:o}),Y}return dt(t.data)}get enum(){return this._def.values}};ko.create=(e,t)=>new ko({values:e,typeName:Q.ZodNativeEnum,...ie(t)});var Rr=class extends ae{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.promise&&n.common.async===!1)return N(n,{code:I.invalid_type,expected:W.promise,received:n.parsedType}),Y;let r=n.parsedType===W.promise?n.data:Promise.resolve(n.data);return dt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Rr.create=(e,t)=>new Rr({type:e,typeName:Q.ZodPromise,...ie(t)});var Kt=class extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{N(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Y;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Y:l.status==="dirty"?lo(l.value):n.value==="dirty"?lo(l.value):l});{if(n.value==="aborted")return Y;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Y:a.status==="dirty"?lo(a.value):n.value==="dirty"?lo(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(r.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(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_r(s))return Y;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:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>_r(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):Y);de.assertNever(o)}};Kt.create=(e,t,n)=>new Kt({schema:e,typeName:Q.ZodEffects,effect:t,...ie(n)});Kt.createWithPreprocess=(e,t,n)=>new Kt({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...ie(n)});var Gt=class extends ae{_parse(t){return this._getType(t)===W.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:Q.ZodOptional,...ie(t)});var Fn=class extends ae{_parse(t){return this._getType(t)===W.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Fn.create=(e,t)=>new Fn({innerType:e,typeName:Q.ZodNullable,...ie(t)});var Eo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===W.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Eo.create=(e,t)=>new Eo({innerType:e,typeName:Q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ie(t)});var vo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return $i(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Dt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Dt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};vo.create=(e,t)=>new vo({innerType:e,typeName:Q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ie(t)});var Bi=class extends ae{_parse(t){if(this._getType(t)!==W.nan){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.nan,received:r.parsedType}),Y}return{status:"valid",value:t.data}}};Bi.create=e=>new Bi({typeName:Q.ZodNaN,...ie(e)});var DR=Symbol("zod_brand"),va=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Sa=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Y:i.status==="dirty"?(n.dirty(),lo(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Y:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Q.ZodPipeline})}},So=class extends ae{_parse(t){let n=this._def.innerType._parse(t),r=o=>(_r(o)&&(o.value=Object.freeze(o.value)),o);return $i(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};So.create=(e,t)=>new So({innerType:e,typeName:Q.ZodReadonly,...ie(t)});function EE(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function FE(e,t={},n){return e?Ir.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=EE(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=EE(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Ir.create()}var bR={object:bt.lazycreate},Q;(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"})(Q||(Q={}));var kR=(e,t={message:`Input not instance of ${e.name}`})=>FE(n=>n instanceof e,t),_E=Ar.create,AE=co.create,ER=Bi.create,vR=uo.create,IE=po.create,SR=fo.create,xR=Li.create,CR=mo.create,FR=go.create,_R=Ir.create,AR=Qn.create,IR=an.create,RR=Ni.create,TR=er.create,PR=bt.create,$R=bt.strictCreate,OR=ho.create,LR=ru.create,NR=yo.create,jR=Cn.create,MR=ou.create,BR=ji.create,UR=Mi.create,WR=iu.create,HR=wo.create,VR=Do.create,GR=bo.create,JR=ko.create,KR=Rr.create,zR=Kt.create,qR=Gt.create,XR=Fn.create,YR=Kt.createWithPreprocess,ZR=Sa.create,QR=()=>_E().optional(),eT=()=>AE().optional(),tT=()=>IE().optional(),nT={string:(e=>Ar.create({...e,coerce:!0})),number:(e=>co.create({...e,coerce:!0})),boolean:(e=>po.create({...e,coerce:!0})),bigint:(e=>uo.create({...e,coerce:!0})),date:(e=>fo.create({...e,coerce:!0}))};var rT=Y;function su(e,t=!1){let n=e.length,r=0,o="",i=0,s=16,a=0,l=0,c=0,d=0,p=0;function m(v,x){let O=0,H=0;for(;O<v||!x;){let B=e.charCodeAt(r);if(B>=48&&B<=57)H=H*16+B-48;else if(B>=65&&B<=70)H=H*16+B-65+10;else if(B>=97&&B<=102)H=H*16+B-97+10;else break;r++,O++}return O<v&&(H=-1),H}function h(v){r=v,o="",i=0,s=16,p=0}function g(){let v=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Ui(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Ui(e.charCodeAt(r)))for(r++;r<e.length&&Ui(e.charCodeAt(r));)r++;else return p=3,e.substring(v,r);let x=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Ui(e.charCodeAt(r))){for(r++;r<e.length&&Ui(e.charCodeAt(r));)r++;x=r}else p=3;return e.substring(v,x)}function y(){let v="",x=r;for(;;){if(r>=n){v+=e.substring(x,r),p=2;break}let O=e.charCodeAt(r);if(O===34){v+=e.substring(x,r),r++;break}if(O===92){if(v+=e.substring(x,r),r++,r>=n){p=2;break}switch(e.charCodeAt(r++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
113
- `;break;case 114:v+="\r";break;case 116:v+=" ";break;case 117:let B=m(4,!0);B>=0?v+=String.fromCharCode(B):p=4;break;default:p=5}x=r;continue}if(O>=0&&O<=31)if(xa(O)){v+=e.substring(x,r),p=2;break}else p=6;r++}return v}function b(){if(o="",p=0,i=r,l=a,d=c,r>=n)return i=n,s=17;let v=e.charCodeAt(r);if(ym(v)){do r++,o+=String.fromCharCode(v),v=e.charCodeAt(r);while(ym(v));return s=15}if(xa(v))return r++,o+=String.fromCharCode(v),v===13&&e.charCodeAt(r)===10&&(r++,o+=`
114
- `),a++,c=r,s=14;switch(v){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=y(),s=10;case 47:let x=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!xa(e.charCodeAt(r));)r++;return o=e.substring(x,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;let O=n-1,H=!1;for(;r<O;){let B=e.charCodeAt(r);if(B===42&&e.charCodeAt(r+1)===47){r+=2,H=!0;break}r++,xa(B)&&(B===13&&e.charCodeAt(r)===10&&r++,a++,c=r)}return H||(r++,p=1),o=e.substring(x,r),s=13}return o+=String.fromCharCode(v),r++,s=16;case 45:if(o+=String.fromCharCode(v),r++,r===n||!Ui(e.charCodeAt(r)))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+=g(),s=11;default:for(;r<n&&S(v);)r++,v=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(v),r++,s=16}}function S(v){if(ym(v)||xa(v))return!1;switch(v){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function A(){let v;do v=b();while(v>=12&&v<=15);return v}return{setPosition:h,getPosition:()=>r,scan:t?A:b,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-d,getTokenError:()=>p}}function ym(e){return e===32||e===9}function xa(e){return e===10||e===13}function Ui(e){return e>=48&&e<=57}var RE;(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"})(RE||(RE={}));var iT=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Wi=200,sT={" ":{"\n":new Array(Wi).fill(0).map((e,t)=>`
115
- `+" ".repeat(t)),"\r":new Array(Wi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Wi).fill(0).map((e,t)=>`\r
116
- `+" ".repeat(t))}," ":{"\n":new Array(Wi).fill(0).map((e,t)=>`
117
- `+" ".repeat(t)),"\r":new Array(Wi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Wi).fill(0).map((e,t)=>`\r
118
- `+" ".repeat(t))}};var au;(function(e){e.DEFAULT={allowTrailingComma:!1}})(au||(au={}));function TE(e,t=[],n=au.DEFAULT){let r=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):r!==null&&(o[r]=l)}return PE(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,r=null},onObjectProperty:l=>{r=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,r=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,d)=>{t.push({error:l,offset:c,length:d})}},n),o[0]}function PE(e,t,n=au.DEFAULT){let r=su(e,!1),o=[],i=0;function s(U){return U?()=>i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(U){return U?ge=>i===0&&U(ge,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(U){return U?ge=>i===0&&U(ge,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(U){return U?()=>{i>0?i++:U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function d(U){return U?()=>{i>0&&i--,i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let p=c(t.onObjectBegin),m=l(t.onObjectProperty),h=d(t.onObjectEnd),g=c(t.onArrayBegin),y=d(t.onArrayEnd),b=l(t.onLiteralValue),S=a(t.onSeparator),A=s(t.onComment),v=a(t.onError),x=n&&n.disallowComments,O=n&&n.allowTrailingComma;function H(){for(;;){let U=r.scan();switch(r.getTokenError()){case 4:B(14);break;case 5:B(15);break;case 3:B(13);break;case 1:x||B(11);break;case 2:B(12);break;case 6:B(16);break}switch(U){case 12:case 13:x?B(10):A();break;case 16:B(1);break;case 15:case 14:break;default:return U}}}function B(U,ge=[],lr=[]){if(v(U),ge.length+lr.length>0){let cr=r.getToken();for(;cr!==17;){if(ge.indexOf(cr)!==-1){H();break}else if(lr.indexOf(cr)!==-1)break;cr=H()}}}function ye(U){let ge=r.getTokenValue();return U?b(ge):(m(ge),o.push(ge)),H(),!0}function ve(){switch(r.getToken()){case 11:let U=r.getTokenValue(),ge=Number(U);isNaN(ge)&&(B(2),ge=0),b(ge);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return H(),!0}function me(){return r.getToken()!==10?(B(3,[],[2,5]),!1):(ye(!1),r.getToken()===6?(S(":"),H(),z()||B(4,[],[2,5])):B(5,[],[2,5]),o.pop(),!0)}function Le(){p(),H();let U=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(U||B(4,[],[]),S(","),H(),r.getToken()===2&&O)break}else U&&B(6,[],[]);me()||B(4,[],[2,5]),U=!0}return h(),r.getToken()!==2?B(7,[2],[]):H(),!0}function E(){g(),H();let U=!0,ge=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(ge||B(4,[],[]),S(","),H(),r.getToken()===4&&O)break}else ge&&B(6,[],[]);U?(o.push(0),U=!1):o[o.length-1]++,z()||B(4,[],[4,5]),ge=!0}return y(),U||o.pop(),r.getToken()!==4?B(8,[4],[]):H(),!0}function z(){switch(r.getToken()){case 3:return E();case 1:return Le();case 10:return ye(!0);default:return ve()}}return H(),r.getToken()===17?n.allowEmptyContent?!0:(B(4,[],[]),!1):z()?(r.getToken()!==17&&B(9,[],[]),!0):(B(4,[],[]),!1)}var $E;(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"})($E||($E={}));var OE;(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"})(OE||(OE={}));var xo=TE;var LE;(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"})(LE||(LE={}));var qi=w(require("fs")),ZE=w(require("path")),QE=require("@webflow/cosmic-deploy-contract");var zE=w(require("fs")),qE=w(require("path"));var Hi=class extends Error{remediation;documentationUrl;cause;constructor(t,n){super(t),this.name="FrameworkError",this.cause=n?.cause,this.remediation=n?.remediation,this.documentationUrl=n?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
106
+ More: pass --cursor ${e}`:""}var aE=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],lE=["id","url","lastPublished","fullSiteCompiledAt"],cE=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],Vc="id,name,siteId,createdAt",am="id,name,description,siteId,appPath,createdAt",Gc="id,url,lastPublished",Kc="id,branch,deployUrl,latestDeploymentStatus,createdAt",tI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function nI(e,t){return e==null||e===""?I("\u2014"):tI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ma(e,t,n){if(e.length===0)return I(n);let r=t.map(i=>se(i)),o=e.map(i=>t.map(s=>nI(i[s],s)));return qe(r,o)}var Jc=ut(aE),uE=ut(lE),dE=ut(cE);function xr(){return aE}function ga(){return lE}function ha(){return cE}function zc(e,t=Vc.split(",")){return ma(e,t,"No apps found.")}function pE(e,t=Gc.split(",")){return ma(e,t,"No domains found.")}function fE(e,t=Kc.split(",")){return ma(e,t,"No environments found.")}function mE(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 rI=["success","failed","canceled","unstaged"],qc=5,Xc=600;function gE(e){return rI.includes(e)}var hE=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],ya="id,status,sourceType,commitHash,buildStartedAt",Yc=ut(hE);function Cr(){return hE}function wa(e,t=ya.split(",")){return ma(e,t,"No deployments found.")}Xl();var lm=()=>new ye.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."),cm=()=>new ye.Option("--region <region>",`Webflow region to target: ${Ks.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(Ks),yE=()=>new ye.Option("--input","Force interactive mode, overriding the automatic no-input detection."),um=()=>new ye.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),dm=()=>new ye.Option("--skip-update-check","Skip checking for @webflow packages updates"),pm=()=>new ye.Option("--verbose","Display more information for debugging purposes."),qn=()=>new ye.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Tt=()=>new ye.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ii=e=>{if(e.trim()==="")throw new ye.InvalidArgumentError("must be a non-empty value.");return e},Zc=(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.`,Qc=e=>new ye.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(Ii),ne=()=>new ye.Option("--json","Output as JSON"),ba=()=>new ye.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Da=()=>new ye.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),fm=()=>new ye.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Ae=()=>new ye.Option("--dry-run","Preview without executing"),Ti=()=>new ye.Option("-y, --yes","Skip confirmation prompt"),Pi=()=>new ye.Option("--order <dir>","Sort direction: asc or desc").default("asc"),eu=()=>new ye.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]),ka=()=>new ye.Option("-g, --global","Operate on the per-user (home directory) install"),Ea=()=>new ye.Option("-p, --project","Operate on the current project's install"),He=e=>new ye.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),$i=e=>new ye.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),tu=()=>new ye.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),nu=()=>new ye.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),oI=100,ru=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new ye.InvalidArgumentError("must be a positive integer.");return t},mm=()=>new ye.Option("--limit <n>","Max log lines to return (default: 100)").default(oI).argParser(ru),iI=20,wE=()=>new ye.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(iI).argParser(ru),bE=e=>{let t=Number(e);if(!Number.isInteger(t))throw new ye.InvalidArgumentError("must be an integer number of seconds.");return t},DE=()=>new ye.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(qc).argParser(bE),kE=()=>new ye.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Xc).argParser(bE),va=e=>async(t,n)=>{let o={...n.parent?.opts()||{},...t};await e(o)};pe();var sI=`${le("[Deprecated]")} The 'library' commands will be removed in the next major release.`,aI=()=>{u.warn(`${re} ${le("webflow library share")} is deprecated and will be removed in the next major release.
107
+ Use ${J("webflow devlink import")} instead.
108
+ `)},lI=()=>{u.warn(`${re} ${le("webflow library bundle")} is deprecated and will be removed in the next major release.
109
+ Use ${J("webflow devlink bundle")} instead.
110
+ `)},cI=()=>{u.warn(`${re} ${le("webflow library log")} is deprecated and will be removed in the next major release.
111
+ Use ${J("webflow log")} instead.
112
+ `)},uI="Import a library of Code Components into your Webflow Workspace.",dI="Bundle a library of Code Components for local development.",EE=()=>new Fr.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),vE=()=>new Fr.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),SE=()=>new Fr.Option("--dev","Bundle in development mode for debugging purposes."),xE=()=>new Fr.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),pI=()=>new Fr.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),fI=()=>new Fr.Option("--public-path <path>","Set the public path for the bundle."),mI=()=>new Fr.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function gm(e,t){return e.command(t).description(uI).addOption(qn()).addOption(EE()).addOption(vE()).addOption(SE()).addOption(xE()).action(va(rm))}function hm(e,t){return e.command(t).description(dI).addOption(pI()).addOption(fI()).addOption(mI()).addOption(EE()).addOption(vE()).addOption(SE()).addOption(xE()).action(va(om))}var CE=e=>{let t=e.command("library").description(sI);gm(t,"share").description(`${le("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",aI),hm(t,"bundle").description(`${le("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",lI),t.command("log").description(`${le("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",cI).action(sm)};pe();var FE=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${le("[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(qn()).addOption(Tt()).action(vD),gm(t,"import"),hm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(qn()).addOption(Tt()).action(va(vc))};var Zn=w(require("fs")),Gt=w(require("path"));A();q();var Fe={New:"new",Existing:"existing"},_E="cli",Xn=3,Yn=39,ou="astro",AE="cloud-scaffolds";var RE="package.json",uo="webflow.json",iu="wf-placeholder-name",IE="CLOUD_MOUNT_PATH",TE="gitignore";function ym(e){return!e.siteId}var Sa=async(e,t,n=ou,r,o,i)=>{try{let s,a;if("content"in r){let l=r.content;s=l.files,a=c=>Gt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=r[n];if(!c)throw new Error(`Scaffold "${n}" not found`);s=c;let p=Gt.join(AE,n);a=d=>d.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Gt.join(e,a(l)),p=l.includes("next.config.ts"),d=l.includes("astro.config.mjs"),m=p||d;if(l.includes(uo)&&Zn.existsSync(c))continue;if(l.includes(RE)||l.includes(uo)){let g=(await Zn.promises.readFile(l,"utf8")).replace(iu,e);await su(c,g)}else if(m){let h=await Zn.promises.readFile(l,"utf8");await su(c,h.replace(IE,t))}else if(Gt.basename(c).toLowerCase()===TE){let h=await Zn.promises.readFile(l,"utf8"),g=Gt.join(Gt.dirname(c),".gitignore");await su(g,h)}else{let h=await Zn.promises.readFile(l);await su(c,h)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Gn({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 su=async(e,t)=>{try{await Zn.promises.mkdir(Gt.dirname(e),{recursive:!0}),await Zn.promises.writeFile(e,t)}catch(n){throw u.error(`Error writing file ${e}: ${n}`),n}};var _r=w(require("fs")),PE=w(require("fs-extra")),Ar=w(require("path")),Em=w(require("os")),$E=w(require("tar"));var tt=class extends Error{constructor(n,r,o){super(n);this.scaffoldId=r;this.supportedIds=o;this.name="ScaffoldError"}};var xa={"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 Ca(e){let t=xa[e];if(!t){let n=Object.keys(xa);throw new tt(`Unsupported framework: "${e}". Supported: ${n.join(", ")}`,e,n)}return t}function wm(){return Object.keys(xa)}function bm(){return[...new Set(wm().map(e=>e.replace(/-minimal$/,"")))]}function Dm(){return["astro","nextjs"]}function km(e){let n=`${e.replace(/-minimal$/,"")}-minimal`;if(!xa[n]){let r=wm();throw new tt(`No minimal scaffold for "${e}". Supported: ${r.join(", ")}`,n,r)}return n}A();Vn();var gI="https://github.com";async function vm(e){let t=e.endsWith("-minimal")?e:km(e);return au(t)}async function au(e){return Ca(e).source.type==="github"?hI(e):OE(e)}async function OE(e){let t=Ca(e);if(t.source.type!=="local")throw new tt(`Scaffold "${e}" does not have a local source`,e);let n=Ar.isAbsolute(t.source.path)?t.source.path:Ar.join(__dirname,t.source.path);if(!_r.existsSync(n))throw new tt(`Scaffold directory not found: ${n}`,e);let r=await Sm(n);return{scaffoldId:e,files:r,extractionRoot:n}}async function hI(e){let t=Ca(e);if(t.source.type!=="github")throw new tt(`Scaffold "${e}" does not have a GitHub source`,e);let n=(Je()?t.source.betaRef:void 0)??t.source.ref??"main",r=`${gI}/${t.source.repo}/archive/${n}.tar.gz`,o=await _r.promises.mkdtemp(Ar.join(Em.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${n})`);try{let s;try{s=await fetch(r,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(h){throw i.fail("Download failed"),new tt(`Failed to fetch scaffold from GitHub: ${h instanceof Error?h.message:String(h)}. Repo: ${t.source.repo}, ref: ${n}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new tt(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${n}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await yI(a,o),l.succeed("Scaffold ready")}catch(h){throw l.fail("Unpack failed"),h}let c=await _r.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new tt(`Unexpected tarball structure for ${t.source.repo}`,e);let d=Ar.join(o,p),m=await Sm(d);return{scaffoldId:e,files:m,extractionRoot:d}}catch(s){try{PE.default.removeSync(o)}catch{}throw s instanceof tt?s:new tt(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function yI(e,t){let n=Ar.join(Em.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await _r.promises.writeFile(n,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await $E.extract({file:n,cwd:t})}finally{await _r.promises.unlink(n).catch(()=>{})}}async function Sm(e){let t=[],n=await _r.promises.readdir(e,{withFileTypes:!0});for(let r of n){let o=Ar.join(e,r.name);r.isDirectory()?t.push(...await Sm(o)):t.push(o)}return t}var Ym=w(require("fs-extra"));q();X();var oe=w(require("fs")),ue=w(require("path")),Wa=require("child_process"),Cv=w(require("tar"));var ft=w(require("fs")),dn=w(require("path"));var j={};Py(j,{BRAND:()=>HI,DIRTY:()=>po,EMPTY_PATH:()=>kI,INVALID:()=>Y,NEVER:()=>FT,OK:()=>dt,ParseStatus:()=>nt,Schema:()=>ae,ZodAny:()=>Tr,ZodArray:()=>nr,ZodBigInt:()=>mo,ZodBoolean:()=>go,ZodBranded:()=>_a,ZodCatch:()=>Co,ZodDate:()=>ho,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>uu,ZodEffects:()=>zt,ZodEnum:()=>vo,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>Q,ZodFunction:()=>pu,ZodIntersection:()=>Do,ZodIssueCode:()=>R,ZodLazy:()=>ko,ZodLiteral:()=>Eo,ZodMap:()=>Bi,ZodNaN:()=>Wi,ZodNativeEnum:()=>So,ZodNever:()=>ln,ZodNull:()=>wo,ZodNullable:()=>An,ZodNumber:()=>fo,ZodObject:()=>Dt,ZodOptional:()=>Kt,ZodParsedType:()=>W,ZodPipeline:()=>Aa,ZodPromise:()=>Pr,ZodReadonly:()=>Fo,ZodRecord:()=>du,ZodSchema:()=>ae,ZodSet:()=>Ui,ZodString:()=>Ir,ZodSymbol:()=>ji,ZodTransformer:()=>zt,ZodTuple:()=>_n,ZodType:()=>ae,ZodUndefined:()=>yo,ZodUnion:()=>bo,ZodUnknown:()=>tr,ZodVoid:()=>Mi,addIssueToContext:()=>N,any:()=>ZI,array:()=>nT,bigint:()=>JI,boolean:()=>KE,coerce:()=>CT,custom:()=>HE,date:()=>zI,datetimeRegex:()=>UE,defaultErrorMap:()=>Qn,discriminatedUnion:()=>sT,effect:()=>wT,enum:()=>gT,function:()=>pT,getErrorMap:()=>Oi,getParsedType:()=>Fn,instanceof:()=>GI,intersection:()=>aT,isAborted:()=>lu,isAsync:()=>Li,isDirty:()=>cu,isValid:()=>Rr,late:()=>VI,lazy:()=>fT,literal:()=>mT,makeIssue:()=>Fa,map:()=>uT,nan:()=>KI,nativeEnum:()=>hT,never:()=>eT,null:()=>YI,nullable:()=>DT,number:()=>GE,object:()=>rT,objectUtil:()=>xm,oboolean:()=>xT,onumber:()=>ST,optional:()=>bT,ostring:()=>vT,pipeline:()=>ET,preprocess:()=>kT,promise:()=>yT,quotelessJson:()=>wI,record:()=>cT,set:()=>dT,setErrorMap:()=>DI,strictObject:()=>oT,string:()=>VE,symbol:()=>qI,transformer:()=>wT,tuple:()=>lT,undefined:()=>XI,union:()=>iT,unknown:()=>QI,util:()=>de,void:()=>tT});var de;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,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 r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(de||(de={}));var xm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(xm||(xm={}));var W=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fn=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}};var R=de.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"]),wI=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_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)r._errors.push(n(s));else{let a=r,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(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}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,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};bt.create=e=>new bt(e);var bI=(e,t)=>{let n;switch(e.code){case R.invalid_type:e.received===W.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,de.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(e.keys,", ")}`;break;case R.invalid_union:n="Invalid input";break;case R.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(e.options)}`;break;case R.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:n="Invalid function arguments";break;case R.invalid_return_type:n="Invalid function return type";break;case R.invalid_date:n="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:de.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case R.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case R.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case R.custom:n="Invalid input";break;case R.invalid_intersection_types:n="Intersection results could not be merged";break;case R.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:n="Number must be finite";break;default:n=t.defaultError,de.assertNever(e)}return{message:n}},Qn=bI;var LE=Qn;function DI(e){LE=e}function Oi(){return LE}var Fa=e=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},kI=[];function N(e,t){let n=Oi(),r=Fa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Qn?void 0:Qn].filter(o=>!!o)});e.common.issues.push(r)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let o of n){if(o.status==="aborted")return Y;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let o of n){let i=await o.key,s=await o.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Y;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},Y=Object.freeze({status:"aborted"}),po=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),lu=e=>e.status==="aborted",cu=e=>e.status==="dirty",Rr=e=>e.status==="valid",Li=e=>typeof Promise<"u"&&e instanceof Promise;var K;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(K||(K={}));var Jt=class{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,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}},NE=(e,t)=>{if(Rr(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 n=new bt(e.common.issues);return this._error=n,this._error}}};function ie(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))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??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}var ae=class{get description(){return this._def.description}_getType(t){return Fn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Fn(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:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Li(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return NE(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Rr(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Rr(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Li(o)?o:Promise.resolve(o));return NE(r,i)}refine(t,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:R.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new zt({schema:this,typeName:Q.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:n=>this["~validate"](n)}}optional(){return Kt.create(this,this._def)}nullable(){return An.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nr.create(this)}promise(){return Pr.create(this,this._def)}or(t){return bo.create([this,t],this._def)}and(t){return Do.create(this,t,this._def)}transform(t){return new zt({...ie(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new xo({...ie(this._def),innerType:this,defaultValue:n,typeName:Q.ZodDefault})}brand(){return new _a({typeName:Q.ZodBranded,type:this,...ie(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Co({...ie(this._def),innerType:this,catchValue:n,typeName:Q.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Aa.create(this,t)}readonly(){return Fo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},EI=/^c[^\s-]{8,}$/i,vI=/^[0-9a-z]+$/,SI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xI=/^[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,CI=/^[a-z0-9_-]{21}$/i,FI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_I=/^[-+]?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)?)??$/,AI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cm,II=/^(?:(?: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])$/,TI=/^(?:(?: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])$/,PI=/^(([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]))$/,$I=/^(([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])$/,OI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ME="((\\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])))",NI=new RegExp(`^${ME}$`);function BE(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function jI(e){return new RegExp(`^${BE(e)}$`)}function UE(e){let t=`${ME}T${BE(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function MI(e,t){return!!((t==="v4"||!t)&&II.test(e)||(t==="v6"||!t)&&PI.test(e))}function BI(e,t){if(!FI.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function UI(e,t){return!!((t==="v4"||!t)&&TI.test(e)||(t==="v6"||!t)&&$I.test(e))}var Ir=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_type,expected:W.string,received:i.parsedType}),Y}let r=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.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?N(o,{code:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")AI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"email",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Cm||(Cm=new RegExp(RI,"u")),Cm.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"emoji",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")xI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"uuid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")CI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"nanoid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")EI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")vI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid2",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")SI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ulid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),N(o,{validation:"url",code:R.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"regex",code:R.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.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),N(o,{code:R.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?UE(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?NI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?jI(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?_I.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"duration",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?MI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ip",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?BI(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"jwt",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?UI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cidr",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?OI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?LI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64url",code:R.invalid_string,message:i.message}),r.dirty()):de.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:R.invalid_string,...K.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...K.errToObj(t)})}url(t){return this._addCheck({kind:"url",...K.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...K.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...K.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...K.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...K.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...K.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...K.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...K.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...K.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...K.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...K.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...K.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,...K.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,...K.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...K.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...K.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...K.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...K.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...K.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...K.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...K.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...K.errToObj(n)})}nonempty(t){return this.min(1,K.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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ir.create=e=>new Ir({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...ie(e)});function WI(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var fo=class e extends ae{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)!==W.number){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_type,expected:W.number,received:i.parsedType}),Y}let r,o=new nt;for(let i of this._def.checks)i.kind==="int"?de.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:R.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.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)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?WI(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:R.not_finite,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,K.toString(n))}gt(t,n){return this.setLimit("min",t,!1,K.toString(n))}lte(t,n){return this.setLimit("max",t,!0,K.toString(n))}lt(t,n){return this.setLimit("max",t,!1,K.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:K.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:K.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:K.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&de.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};fo.create=e=>new fo({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...ie(e)});var mo=class e extends ae{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)!==W.bigint)return this._getInvalidInput(t);let r,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.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)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return N(n,{code:R.invalid_type,expected:W.bigint,received:n.parsedType}),Y}gte(t,n){return this.setLimit("min",t,!0,K.toString(n))}gt(t,n){return this.setLimit("min",t,!1,K.toString(n))}lte(t,n){return this.setLimit("max",t,!0,K.toString(n))}lt(t,n){return this.setLimit("max",t,!1,K.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.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:K.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:K.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};mo.create=e=>new mo({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...ie(e)});var go=class extends ae{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.boolean,received:r.parsedType}),Y}return dt(t.data)}};go.create=e=>new go({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...ie(e)});var ho=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_type,expected:W.date,received:i.parsedType}),Y}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_date}),Y}let r=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):de.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:K.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:K.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};ho.create=e=>new ho({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...ie(e)});var ji=class extends ae{_parse(t){if(this._getType(t)!==W.symbol){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.symbol,received:r.parsedType}),Y}return dt(t.data)}};ji.create=e=>new ji({typeName:Q.ZodSymbol,...ie(e)});var yo=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.undefined,received:r.parsedType}),Y}return dt(t.data)}};yo.create=e=>new yo({typeName:Q.ZodUndefined,...ie(e)});var wo=class extends ae{_parse(t){if(this._getType(t)!==W.null){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.null,received:r.parsedType}),Y}return dt(t.data)}};wo.create=e=>new wo({typeName:Q.ZodNull,...ie(e)});var Tr=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Tr.create=e=>new Tr({typeName:Q.ZodAny,...ie(e)});var tr=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};tr.create=e=>new tr({typeName:Q.ZodUnknown,...ie(e)});var ln=class extends ae{_parse(t){let n=this._getOrReturnCtx(t);return N(n,{code:R.invalid_type,expected:W.never,received:n.parsedType}),Y}};ln.create=e=>new ln({typeName:Q.ZodNever,...ie(e)});var Mi=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.void,received:r.parsedType}),Y}return dt(t.data)}};Mi.create=e=>new Mi({typeName:Q.ZodVoid,...ie(e)});var nr=class e extends ae{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==W.array)return N(n,{code:R.invalid_type,expected:W.array,received:n.parsedType}),Y;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(N(n,{code:s?R.too_big:R.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}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(N(n,{code:R.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(N(n,{code:R.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Jt(n,s,n.path,a)))).then(s=>nt.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new Jt(n,s,n.path,a)));return nt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:K.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:K.toString(n)}})}nonempty(t){return this.min(1,t)}};nr.create=(e,t)=>new nr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...ie(t)});function Ni(e){if(e instanceof Dt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Kt.create(Ni(r))}return new Dt({...e._def,shape:()=>t})}else return e instanceof nr?new nr({...e._def,type:Ni(e.element)}):e instanceof Kt?Kt.create(Ni(e.unwrap())):e instanceof An?An.create(Ni(e.unwrap())):e instanceof _n?_n.create(e.items.map(t=>Ni(t))):e}var Dt=class e extends ae{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(),n=de.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==W.object){let c=this._getOrReturnCtx(t);return N(c,{code:R.invalid_type,expected:W.object,received:c.parsedType}),Y}let{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ln&&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],d=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Jt(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof ln){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&&(N(o,{code:R.unrecognized_keys,keys:a}),r.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 d=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Jt(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let d=await p.key,m=await p.value;c.push({key:d,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(r,c)):nt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return K.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:K.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:Q.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of de.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of de.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return Ni(this)}partial(t){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of de.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Kt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return WE(de.objectKeys(this.shape))}};Dt.create=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strip",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});Dt.strictCreate=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strict",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});Dt.lazycreate=(e,t)=>new Dt({shape:e,unknownKeys:"strip",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});var bo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=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 n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new bt(a.ctx.common.issues));return N(n,{code:R.invalid_union,unionErrors:s}),Y}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},p=l._parseSync({data:n.data,path:n.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 n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new bt(l));return N(n,{code:R.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}};bo.create=(e,t)=>new bo({options:e,typeName:Q.ZodUnion,...ie(t)});var er=e=>e instanceof ko?er(e.schema):e instanceof zt?er(e.innerType()):e instanceof Eo?[e.value]:e instanceof vo?e.options:e instanceof So?de.objectValues(e.enum):e instanceof xo?er(e._def.innerType):e instanceof yo?[void 0]:e instanceof wo?[null]:e instanceof Kt?[void 0,...er(e.unwrap())]:e instanceof An?[null,...er(e.unwrap())]:e instanceof _a||e instanceof Fo?er(e.unwrap()):e instanceof Co?er(e._def.innerType):[],uu=class e extends ae{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return N(n,{code:R.invalid_type,expected:W.object,received:n.parsedType}),Y;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(N(n,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let o=new Map;for(let i of n){let s=er(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:Q.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ie(r)})}};function Fm(e,t){let n=Fn(e),r=Fn(t);if(e===t)return{valid:!0,data:e};if(n===W.object&&r===W.object){let o=de.objectKeys(t),i=de.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=Fm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===W.array&&r===W.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=Fm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===W.date&&r===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Do=class extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(lu(i)||lu(s))return Y;let a=Fm(i.value,s.value);return a.valid?((cu(i)||cu(s))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:R.invalid_intersection_types}),Y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Do.create=(e,t,n)=>new Do({left:e,right:t,typeName:Q.ZodIntersection,...ie(n)});var _n=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.array)return N(r,{code:R.invalid_type,expected:W.array,received:r.parsedType}),Y;if(r.data.length<this._def.items.length)return N(r,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Jt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>nt.mergeArray(n,s)):nt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};_n.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _n({items:e,typeName:Q.ZodTuple,rest:null,...ie(t)})};var du=class e extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return N(r,{code:R.invalid_type,expected:W.object,received:r.parsedType}),Y;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new Jt(r,a,r.path,a)),value:s._parse(new Jt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?nt.mergeObjectAsync(n,o):nt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ae?new e({keyType:t,valueType:n,typeName:Q.ZodRecord,...ie(r)}):new e({keyType:Ir.create(),valueType:t,typeName:Q.ZodRecord,...ie(n)})}},Bi=class extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.map)return N(r,{code:R.invalid_type,expected:W.map,received:r.parsedType}),Y;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Jt(r,a,r.path,[c,"key"])),value:i._parse(new Jt(r,l,r.path,[c,"value"]))}));if(r.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 Y;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.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 Y;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}}}};Bi.create=(e,t,n)=>new Bi({valueType:t,keyType:e,typeName:Q.ZodMap,...ie(n)});var Ui=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.set)return N(r,{code:R.invalid_type,expected:W.set,received:r.parsedType}),Y;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(N(r,{code:R.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(N(r,{code:R.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let p of l){if(p.status==="aborted")return Y;p.status==="dirty"&&n.dirty(),c.add(p.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>i._parse(new Jt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:K.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Ui.create=(e,t)=>new Ui({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...ie(t)});var pu=class e extends ae{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.function)return N(n,{code:R.invalid_type,expected:W.function,received:n.parsedType}),Y;function r(a,l){return Fa({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oi(),Qn].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:l}})}function o(a,l){return Fa({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oi(),Qn].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Pr){let a=this;return dt(async function(...l){let c=new bt([]),p=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(o(d,h)),c})})}else{let a=this;return dt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new bt([r(l,c.error)]);let p=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(p,i);if(!d.success)throw new bt([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:_n.create(t).rest(tr.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,n,r){return new e({args:t||_n.create([]).rest(tr.create()),returns:n||tr.create(),typeName:Q.ZodFunction,...ie(r)})}},ko=class extends ae{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ko.create=(e,t)=>new ko({getter:e,typeName:Q.ZodLazy,...ie(t)});var Eo=class extends ae{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return N(n,{received:n.data,code:R.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:t.data}}get value(){return this._def.value}};Eo.create=(e,t)=>new Eo({value:e,typeName:Q.ZodLiteral,...ie(t)});function WE(e,t){return new vo({values:e,typeName:Q.ZodEnum,...ie(t)})}var vo=class e extends ae{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{expected:de.joinValues(r),received:n.parsedType,code:R.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{received:n.data,code:R.invalid_enum_value,options:r}),Y}return dt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};vo.create=WE;var So=class extends ae{_parse(t){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==W.string&&r.parsedType!==W.number){let o=de.objectValues(n);return N(r,{expected:de.joinValues(o),received:r.parsedType,code:R.invalid_type}),Y}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=de.objectValues(n);return N(r,{received:r.data,code:R.invalid_enum_value,options:o}),Y}return dt(t.data)}get enum(){return this._def.values}};So.create=(e,t)=>new So({values:e,typeName:Q.ZodNativeEnum,...ie(t)});var Pr=class extends ae{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.promise&&n.common.async===!1)return N(n,{code:R.invalid_type,expected:W.promise,received:n.parsedType}),Y;let r=n.parsedType===W.promise?n.data:Promise.resolve(n.data);return dt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Pr.create=(e,t)=>new Pr({type:e,typeName:Q.ZodPromise,...ie(t)});var zt=class extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{N(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Y;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Y:l.status==="dirty"?po(l.value):n.value==="dirty"?po(l.value):l});{if(n.value==="aborted")return Y;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Y:a.status==="dirty"?po(a.value):n.value==="dirty"?po(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(r.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(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rr(s))return Y;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:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Rr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):Y);de.assertNever(o)}};zt.create=(e,t,n)=>new zt({schema:e,typeName:Q.ZodEffects,effect:t,...ie(n)});zt.createWithPreprocess=(e,t,n)=>new zt({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...ie(n)});var Kt=class extends ae{_parse(t){return this._getType(t)===W.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Kt.create=(e,t)=>new Kt({innerType:e,typeName:Q.ZodOptional,...ie(t)});var An=class extends ae{_parse(t){return this._getType(t)===W.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};An.create=(e,t)=>new An({innerType:e,typeName:Q.ZodNullable,...ie(t)});var xo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===W.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xo.create=(e,t)=>new xo({innerType:e,typeName:Q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ie(t)});var Co=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Li(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Co.create=(e,t)=>new Co({innerType:e,typeName:Q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ie(t)});var Wi=class extends ae{_parse(t){if(this._getType(t)!==W.nan){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.nan,received:r.parsedType}),Y}return{status:"valid",value:t.data}}};Wi.create=e=>new Wi({typeName:Q.ZodNaN,...ie(e)});var HI=Symbol("zod_brand"),_a=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Aa=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Y:i.status==="dirty"?(n.dirty(),po(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Y:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Q.ZodPipeline})}},Fo=class extends ae{_parse(t){let n=this._def.innerType._parse(t),r=o=>(Rr(o)&&(o.value=Object.freeze(o.value)),o);return Li(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Fo.create=(e,t)=>new Fo({innerType:e,typeName:Q.ZodReadonly,...ie(t)});function jE(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function HE(e,t={},n){return e?Tr.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=jE(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=jE(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Tr.create()}var VI={object:Dt.lazycreate},Q;(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"})(Q||(Q={}));var GI=(e,t={message:`Input not instance of ${e.name}`})=>HE(n=>n instanceof e,t),VE=Ir.create,GE=fo.create,KI=Wi.create,JI=mo.create,KE=go.create,zI=ho.create,qI=ji.create,XI=yo.create,YI=wo.create,ZI=Tr.create,QI=tr.create,eT=ln.create,tT=Mi.create,nT=nr.create,rT=Dt.create,oT=Dt.strictCreate,iT=bo.create,sT=uu.create,aT=Do.create,lT=_n.create,cT=du.create,uT=Bi.create,dT=Ui.create,pT=pu.create,fT=ko.create,mT=Eo.create,gT=vo.create,hT=So.create,yT=Pr.create,wT=zt.create,bT=Kt.create,DT=An.create,kT=zt.createWithPreprocess,ET=Aa.create,vT=()=>VE().optional(),ST=()=>GE().optional(),xT=()=>KE().optional(),CT={string:(e=>Ir.create({...e,coerce:!0})),number:(e=>fo.create({...e,coerce:!0})),boolean:(e=>go.create({...e,coerce:!0})),bigint:(e=>mo.create({...e,coerce:!0})),date:(e=>ho.create({...e,coerce:!0}))};var FT=Y;function fu(e,t=!1){let n=e.length,r=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,d=0;function m(v,x){let O=0,H=0;for(;O<v||!x;){let B=e.charCodeAt(r);if(B>=48&&B<=57)H=H*16+B-48;else if(B>=65&&B<=70)H=H*16+B-65+10;else if(B>=97&&B<=102)H=H*16+B-97+10;else break;r++,O++}return O<v&&(H=-1),H}function h(v){r=v,o="",i=0,s=16,d=0}function g(){let v=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Hi(e.charCodeAt(r)))for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;else return d=3,e.substring(v,r);let x=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Hi(e.charCodeAt(r))){for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;x=r}else d=3;return e.substring(v,x)}function y(){let v="",x=r;for(;;){if(r>=n){v+=e.substring(x,r),d=2;break}let O=e.charCodeAt(r);if(O===34){v+=e.substring(x,r),r++;break}if(O===92){if(v+=e.substring(x,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
113
+ `;break;case 114:v+="\r";break;case 116:v+=" ";break;case 117:let B=m(4,!0);B>=0?v+=String.fromCharCode(B):d=4;break;default:d=5}x=r;continue}if(O>=0&&O<=31)if(Ra(O)){v+=e.substring(x,r),d=2;break}else d=6;r++}return v}function b(){if(o="",d=0,i=r,l=a,p=c,r>=n)return i=n,s=17;let v=e.charCodeAt(r);if(_m(v)){do r++,o+=String.fromCharCode(v),v=e.charCodeAt(r);while(_m(v));return s=15}if(Ra(v))return r++,o+=String.fromCharCode(v),v===13&&e.charCodeAt(r)===10&&(r++,o+=`
114
+ `),a++,c=r,s=14;switch(v){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=y(),s=10;case 47:let x=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Ra(e.charCodeAt(r));)r++;return o=e.substring(x,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;let O=n-1,H=!1;for(;r<O;){let B=e.charCodeAt(r);if(B===42&&e.charCodeAt(r+1)===47){r+=2,H=!0;break}r++,Ra(B)&&(B===13&&e.charCodeAt(r)===10&&r++,a++,c=r)}return H||(r++,d=1),o=e.substring(x,r),s=13}return o+=String.fromCharCode(v),r++,s=16;case 45:if(o+=String.fromCharCode(v),r++,r===n||!Hi(e.charCodeAt(r)))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+=g(),s=11;default:for(;r<n&&S(v);)r++,v=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(v),r++,s=16}}function S(v){if(_m(v)||Ra(v))return!1;switch(v){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function _(){let v;do v=b();while(v>=12&&v<=15);return v}return{setPosition:h,getPosition:()=>r,scan:t?_:b,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-p,getTokenError:()=>d}}function _m(e){return e===32||e===9}function Ra(e){return e===10||e===13}function Hi(e){return e>=48&&e<=57}var JE;(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"})(JE||(JE={}));var AT=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Vi=200,RT={" ":{"\n":new Array(Vi).fill(0).map((e,t)=>`
115
+ `+" ".repeat(t)),"\r":new Array(Vi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Vi).fill(0).map((e,t)=>`\r
116
+ `+" ".repeat(t))}," ":{"\n":new Array(Vi).fill(0).map((e,t)=>`
117
+ `+" ".repeat(t)),"\r":new Array(Vi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Vi).fill(0).map((e,t)=>`\r
118
+ `+" ".repeat(t))}};var mu;(function(e){e.DEFAULT={allowTrailingComma:!1}})(mu||(mu={}));function zE(e,t=[],n=mu.DEFAULT){let r=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):r!==null&&(o[r]=l)}return qE(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,r=null},onObjectProperty:l=>{r=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,r=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,p)=>{t.push({error:l,offset:c,length:p})}},n),o[0]}function qE(e,t,n=mu.DEFAULT){let r=fu(e,!1),o=[],i=0;function s(U){return U?()=>i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(U){return U?ge=>i===0&&U(ge,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(U){return U?ge=>i===0&&U(ge,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(U){return U?()=>{i>0?i++:U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function p(U){return U?()=>{i>0&&i--,i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=c(t.onObjectBegin),m=l(t.onObjectProperty),h=p(t.onObjectEnd),g=c(t.onArrayBegin),y=p(t.onArrayEnd),b=l(t.onLiteralValue),S=a(t.onSeparator),_=s(t.onComment),v=a(t.onError),x=n&&n.disallowComments,O=n&&n.allowTrailingComma;function H(){for(;;){let U=r.scan();switch(r.getTokenError()){case 4:B(14);break;case 5:B(15);break;case 3:B(13);break;case 1:x||B(11);break;case 2:B(12);break;case 6:B(16);break}switch(U){case 12:case 13:x?B(10):_();break;case 16:B(1);break;case 15:case 14:break;default:return U}}}function B(U,ge=[],ur=[]){if(v(U),ge.length+ur.length>0){let dr=r.getToken();for(;dr!==17;){if(ge.indexOf(dr)!==-1){H();break}else if(ur.indexOf(dr)!==-1)break;dr=H()}}}function we(U){let ge=r.getTokenValue();return U?b(ge):(m(ge),o.push(ge)),H(),!0}function Se(){switch(r.getToken()){case 11:let U=r.getTokenValue(),ge=Number(U);isNaN(ge)&&(B(2),ge=0),b(ge);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return H(),!0}function me(){return r.getToken()!==10?(B(3,[],[2,5]),!1):(we(!1),r.getToken()===6?(S(":"),H(),z()||B(4,[],[2,5])):B(5,[],[2,5]),o.pop(),!0)}function Ne(){d(),H();let U=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(U||B(4,[],[]),S(","),H(),r.getToken()===2&&O)break}else U&&B(6,[],[]);me()||B(4,[],[2,5]),U=!0}return h(),r.getToken()!==2?B(7,[2],[]):H(),!0}function E(){g(),H();let U=!0,ge=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(ge||B(4,[],[]),S(","),H(),r.getToken()===4&&O)break}else ge&&B(6,[],[]);U?(o.push(0),U=!1):o[o.length-1]++,z()||B(4,[],[4,5]),ge=!0}return y(),U||o.pop(),r.getToken()!==4?B(8,[4],[]):H(),!0}function z(){switch(r.getToken()){case 3:return E();case 1:return Ne();case 10:return we(!0);default:return Se()}}return H(),r.getToken()===17?n.allowEmptyContent?!0:(B(4,[],[]),!1):z()?(r.getToken()!==17&&B(9,[],[]),!0):(B(4,[],[]),!1)}var XE;(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"})(XE||(XE={}));var YE;(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"})(YE||(YE={}));var _o=zE;var ZE;(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"})(ZE||(ZE={}));var Zi=w(require("fs")),gv=w(require("path")),hv=require("@webflow/cosmic-deploy-contract");var dv=w(require("fs")),pv=w(require("path"));var Gi=class extends Error{remediation;documentationUrl;cause;constructor(t,n){super(t),this.name="FrameworkError",this.cause=n?.cause,this.remediation=n?.remediation,this.documentationUrl=n?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
119
119
 
120
120
  How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
121
121
 
122
- Documentation: ${this.documentationUrl}`),t}},Fe=class extends Hi{constructor(t,n){super(t,n),this.name="FrameworkValidationError"}};var Co=class extends Hi{configFile;constructor(t,n){super(t,n),this.name="FrameworkConfigError",this.configFile=n?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
122
+ Documentation: ${this.documentationUrl}`),t}},Re=class extends Gi{constructor(t,n){super(t,n),this.name="FrameworkValidationError"}};var Ao=class extends Gi{configFile;constructor(t,n){super(t,n),this.name="FrameworkConfigError",this.configFile=n?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
123
123
 
124
- Config file: ${this.configFile}`),t}},tr=class extends Hi{constructor(t,n){super(t,n),this.name="FrameworkDetectionError"}};var Et=w(require("path")),Fa=w(require("fs"));var NE=w(require("semver")),pt=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,n){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:n}=this.ctx;return t in(n.dependencies||{})||t in(n.devDependencies||{})}getDependencyVersion(t){let{packageJson:n}=this.ctx;return n.dependencies?.[t]||n.devDependencies?.[t]}resolveFrameworkVersion(t){let n=this.getDependencyVersion(t);if(n)return NE.default.coerce(n)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}};var HE=w(require("semver")),$e=w(require("fs")),_n=w(require("path"));var Fo=w(require("semver"));function fT(){return process.version.slice(1)}function mT(e){let t=Fo.coerce(e);return t?t.major:null}function gT(e,t){let n=Fo.coerce(e),r=Fo.coerce(t);return!n||!r?!1:Fo.gte(n,r)}function Tr(e,t,n){let r=fT(),o=t.minimum;if(gT(r,o))e.debug(`Node.js version ${r} meets requirement ${o}`);else{let i=mT(o),s=`${n} requires Node.js ${o} or higher. Current version: ${r}`;if(t.severity==="error")throw new Fe(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
124
+ Config file: ${this.configFile}`),t}},rr=class extends Gi{constructor(t,n){super(t,n),this.name="FrameworkDetectionError"}};var Et=w(require("path")),Ta=w(require("fs"));var QE=w(require("semver")),pt=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,n){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:n}=this.ctx;return t in(n.dependencies||{})||t in(n.devDependencies||{})}getDependencyVersion(t){let{packageJson:n}=this.ctx;return n.dependencies?.[t]||n.devDependencies?.[t]}resolveFrameworkVersion(t){let n=this.getDependencyVersion(t);if(n)return QE.default.coerce(n)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}};var sv=w(require("semver")),Le=w(require("fs")),Rn=w(require("path"));var Ro=w(require("semver"));function NT(){return process.version.slice(1)}function jT(e){let t=Ro.coerce(e);return t?t.major:null}function MT(e,t){let n=Ro.coerce(e),r=Ro.coerce(t);return!n||!r?!1:Ro.gte(n,r)}function $r(e,t,n){let r=NT(),o=t.minimum;if(MT(r,o))e.debug(`Node.js version ${r} meets requirement ${o}`);else{let i=jT(o),s=`${n} requires Node.js ${o} or higher. Current version: ${r}`;if(t.severity==="error")throw new Re(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
125
125
 
126
126
  nvm install ${i}
127
- nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var lu=w(require("fs")),jE=w(require("path"));var ME=j.object({name:j.string().optional(),version:j.string().optional(),dependencies:j.record(j.string()).optional(),devDependencies:j.record(j.string()).optional()});function Ca(e){let t=jE.default.join(e,"package.json");if(!lu.statSync(t,{throwIfNoEntry:!1}))return;let n=lu.readFileSync(t).toString("utf8"),r;try{r=JSON.parse(n)}catch(o){throw new Fe("package.json was not valid JSON",{cause:o})}try{return ME.parse(r)}catch(o){throw new Fe("package.json schema validation failed",{cause:o})}}var cu=w(require("fs")),BE=w(require("path"));var uu=j.object({cloud:j.object({contract_version:j.string().optional(),framework:j.string().optional(),framework_version:j.string().optional(),entrypoint_path:j.string().optional(),deployment_type:j.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:j.boolean().optional(),assets_path_prefix:j.string().optional(),assets_source_skip_mount_path:j.boolean().optional()}).passthrough().optional()}).passthrough();function Vi(e,t,n="webflow.json"){let r=BE.default.join(t,n);if(!cu.statSync(r,{throwIfNoEntry:!1}))return n.endsWith(".json")?Vi(e,t,n+"c"):void 0;let o=cu.readFileSync(r).toString("utf8"),i;try{i=xo(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${r} ${JSON.stringify(o)}: ${s}`);return}try{let s=uu.parse(i);return e.debug(`loaded ${r}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${r} was valid JSON but schema validation failed: ${s}`);return}}var UE=require("child_process"),WE=["--no-update-notifier","--no-progress","--no-audit","--no-fund"];async function Qe(e){let{log:t,cwd:n,args:r}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...WE,...r];t.debug(`npm ${i.join(" ")} (in ${n})`),(0,UE.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:n,env:o,stdio:"inherit"})}function ln(e){if(!e)return null;let t=HE.coerce(e);return t?t.major:null}function Pr(e,t,n,r){let o=r?.exclude?Array.isArray(r.exclude)?r.exclude:[r.exclude]:[],i=_n.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(r?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=r?.followSymlinks!==!1,a=s?$e.statSync(t,{throwIfNoEntry:!1}):$e.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} -> ${n}`);let c=$e.readdirSync(t),d=0;for(let p of c)d+=Pr(e,_n.join(t,p),_n.join(n,p),r);return d}let l=_n.dirname(n);return $e.existsSync(l)||$e.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${n}`),$e.copyFileSync(t,n),1}function kt(e){return $e.existsSync(e)}function ht(...e){for(let t of e)if($e.existsSync(t))return t;return e[0]??""}async function An(e,t,n,r){if(!$e.existsSync(t))throw new Co(`Template not found: ${t}`,{configFile:t});let o=$e.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${n}`);let i=r||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=_n.dirname(n);$e.existsSync(a)||$e.mkdirSync(a,{recursive:!0}),$e.writeFileSync(n,s)}function In(e,t,n,r){for(let o of r){let i=_n.join(t,`${n}.${o}`);if($e.existsSync(i)){let s=_n.join(t,`clouduser.${n}.${o}`);return e.info(`Renaming user config: ${n}.${o} -> clouduser.${n}.${o}`),$e.renameSync(i,s),s}}return null}var Dm=ht(Et.join(__dirname,"templates","astro","v5"),Et.join(__dirname,"templates","v5")),VE=ht(Et.join(__dirname,"templates","astro"),Et.join(__dirname,"templates")),_o=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return r==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=ln(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&Tr(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Fe("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 Fe('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=ln(o);if(i!==null&&i>=6)throw new Fe(`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:n}=this.ctx,r=this.getCloudflareAdapter();this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Qe({log:t,cwd:n,args:["install","--save",`${r.name}@${r.version}`]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Qe({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:Et.join(Dm,"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 Et.join(Dm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Et.join(VE,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;In(t,n,"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"),Fa.writeFileSync(Et.join(n,"clouduser.astro.config.mjs"),`export default {};
128
- `));let i=Et.join(VE,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Fa.copyFileSync(i,Et.join(n,"astro.config.webflow.ts")));let s=Et.join(Dm,"astro.config.mjs.template"),a=Et.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Fa.copyFileSync(l.templatePath,Et.join(n,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"}}};var vt=w(require("path")),_a=w(require("fs"));var bm=ht(vt.join(__dirname,"templates","astro","v6"),vt.join(__dirname,"templates","v6")),GE=ht(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),Ao=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=ln(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:n}=this.ctx,r=this.getNodeVersionRequirement();r&&Tr(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Fe("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 Fe('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=ln(o);if(i!==null&&i<6)throw new Fe(`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 Fe(`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.0.0",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:n}=this.ctx,r=this.getCloudflareAdapter();if(this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Qe({log:t,cwd:n,args:["install","--save",`${r.name}@${r.version}`]})),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Qe({log:t,cwd:n,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Qe({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(bm,"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(bm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(GE,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;In(t,n,"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"),_a.writeFileSync(vt.join(n,"clouduser.astro.config.mjs"),`export default {};
129
- `));let i=vt.join(GE,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),_a.copyFileSync(i,vt.join(n,"astro.config.webflow.ts")));let s=vt.join(bm,"astro.config.mjs.template"),a=vt.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),_a.copyFileSync(l.templatePath,vt.join(n,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 St=w(require("path")),Aa=w(require("fs"));var km=ht(St.join(__dirname,"templates","astro","v7"),St.join(__dirname,"templates","v7")),JE=ht(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),Gi=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=ln(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&Tr(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Fe("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 Fe('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=ln(o);if(i!==null&&i<7)throw new Fe(`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.0",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:n}=this.ctx,r=this.getCloudflareAdapter();if(this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Qe({log:t,cwd:n,args:["install","--save",`${r.name}@${r.version}`]})),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Qe({log:t,cwd:n,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Qe({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(km,"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(km,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(JE,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;In(t,n,"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"),Aa.writeFileSync(St.join(n,"clouduser.astro.config.mjs"),`export default {};
130
- `));let i=St.join(JE,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Aa.copyFileSync(i,St.join(n,"astro.config.webflow.ts")));let s=St.join(km,"astro.config.mjs.template"),a=St.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Aa.copyFileSync(l.templatePath,St.join(n,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 Ve=w(require("path")),zt=w(require("fs"));var Ji=ht(Ve.join(__dirname,"templates","nextjs"),Ve.join(__dirname,"templates")),Ki=class extends pt{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,n){let r=n?.cloud?.framework;return r==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:r&&r!=="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:n}=this.ctx,r=n.dependencies?.next||n.devDependencies?.next;if(!r)throw new Fe("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@${r}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:n}=this.ctx,r=this.getCloudflareAdapter();this.hasDependency(r.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await Qe({log:t,cwd:n,args:["install","--save",r.name]}))}getWebflowLoader(){return{templatePath:Ve.join(Ji,"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 Ve.join(Ji,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ve.join(Ji,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(zt.existsSync(Ve.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:n,cwd:r}=this.ctx,o=this.findOpenNextConfig();if(o){n.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(n.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!zt.existsSync(t))throw new Co(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=Ve.join(r,"open-next.config.ts");zt.copyFileSync(t,i),n.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=In(t,n,"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"),zt.writeFileSync(Ve.join(n,"clouduser.next.config.ts"),`export default {};
131
- `)):Ve.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${Ve.basename(o)}`),zt.writeFileSync(Ve.join(n,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
127
+ nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var gu=w(require("fs")),ev=w(require("path"));var tv=j.object({name:j.string().optional(),version:j.string().optional(),dependencies:j.record(j.string()).optional(),devDependencies:j.record(j.string()).optional()});function Ia(e){let t=ev.default.join(e,"package.json");if(!gu.statSync(t,{throwIfNoEntry:!1}))return;let n=gu.readFileSync(t).toString("utf8"),r;try{r=JSON.parse(n)}catch(o){throw new Re("package.json was not valid JSON",{cause:o})}try{return tv.parse(r)}catch(o){throw new Re("package.json schema validation failed",{cause:o})}}var hu=w(require("fs")),nv=w(require("path"));var yu=j.object({cloud:j.object({contract_version:j.string().optional(),framework:j.string().optional(),framework_version:j.string().optional(),entrypoint_path:j.string().optional(),deployment_type:j.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:j.boolean().optional(),assets_path_prefix:j.string().optional(),assets_source_skip_mount_path:j.boolean().optional()}).passthrough().optional()}).passthrough();function Ki(e,t,n="webflow.json"){let r=nv.default.join(t,n);if(!hu.statSync(r,{throwIfNoEntry:!1}))return n.endsWith(".json")?Ki(e,t,n+"c"):void 0;let o=hu.readFileSync(r).toString("utf8"),i;try{i=_o(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${r} ${JSON.stringify(o)}: ${s}`);return}try{let s=yu.parse(i);return e.debug(`loaded ${r}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${r} was valid JSON but schema validation failed: ${s}`);return}}var Ji=w(require("fs")),rv=w(require("path"));function Rm(e,t,n,r,o){if(!n||r!=="astro"&&r!=="nextjs")return t;let i=rv.join(e,t);if(!Ji.existsSync(i)||!Ji.statSync(i).isDirectory())return t;let a=Ji.readdirSync(i,{withFileTypes:!0}).find(l=>!(!l.isDirectory()||o&&l.name===o||r==="astro"&&(l.name==="_routes.json"||l.name==="_worker.js")));return a?`${t}/${a.name}`:t}var ov=require("child_process"),iv=["--no-update-notifier","--no-progress","--no-audit","--no-fund"];async function Ze(e){let{log:t,cwd:n,args:r}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...iv,...r];t.debug(`npm ${i.join(" ")} (in ${n})`),(0,ov.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:n,env:o,stdio:"inherit"})}function cn(e){if(!e)return null;let t=sv.coerce(e);return t?t.major:null}function Or(e,t,n,r){let o=r?.exclude?Array.isArray(r.exclude)?r.exclude:[r.exclude]:[],i=Rn.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(r?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=r?.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} -> ${n}`);let c=Le.readdirSync(t),p=0;for(let d of c)p+=Or(e,Rn.join(t,d),Rn.join(n,d),r);return p}let l=Rn.dirname(n);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${n}`),Le.copyFileSync(t,n),1}function kt(e){return Le.existsSync(e)}function yt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function In(e,t,n,r){if(!Le.existsSync(t))throw new Ao(`Template not found: ${t}`,{configFile:t});let o=Le.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${n}`);let i=r||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=Rn.dirname(n);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(n,s)}function Tn(e,t,n,r){for(let o of r){let i=Rn.join(t,`${n}.${o}`);if(Le.existsSync(i)){let s=Rn.join(t,`clouduser.${n}.${o}`);return e.info(`Renaming user config: ${n}.${o} -> clouduser.${n}.${o}`),Le.renameSync(i,s),s}}return null}var Im=yt(Et.join(__dirname,"templates","astro","v5"),Et.join(__dirname,"templates","v5")),av=yt(Et.join(__dirname,"templates","astro"),Et.join(__dirname,"templates")),Io=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return r==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=cn(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&$r(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Re("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 Re('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=cn(o);if(i!==null&&i>=6)throw new Re(`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:n}=this.ctx,r=this.getCloudflareAdapter();this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:n,args:["install","--save",`${r.name}@${r.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:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:Et.join(Im,"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 Et.join(Im,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Et.join(av,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;Tn(t,n,"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"),Ta.writeFileSync(Et.join(n,"clouduser.astro.config.mjs"),`export default {};
128
+ `));let i=Et.join(av,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Ta.copyFileSync(i,Et.join(n,"astro.config.webflow.ts")));let s=Et.join(Im,"astro.config.mjs.template"),a=Et.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ta.copyFileSync(l.templatePath,Et.join(n,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"}}};var vt=w(require("path")),$a=w(require("fs"));var Pa=w(require("semver"));async function wu(e){let{log:t,cwd:n,adapterName:r,installVersion:o,fixedFloor:i,declaredVersion:s}=e;if(!s){t.warn(`Installing ${r}@${o} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:n,args:["install","--save",`${r}@${o}`]});return}let a=Pa.coerce(s);if(!a||!Pa.lt(a,i))return;let l=Pa.coerce(i)?.major;a.major===l?(t.warn(`Detected ${r}@${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:n,args:["install","--save",`${r}@${o}`]})):t.warn(`${r}@${s} predates the base-path fix in ${i} and upgrading crosses a major version. Please upgrade to ${r}@${o} manually to avoid broken asset serving on mounted apps.`)}var Tm=yt(vt.join(__dirname,"templates","astro","v6"),vt.join(__dirname,"templates","v6")),lv=yt(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),To=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=cn(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:n}=this.ctx,r=this.getNodeVersionRequirement();r&&$r(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Re("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 Re('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=cn(o);if(i!==null&&i<6)throw new Re(`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 Re(`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:n}=this.ctx,r=this.getCloudflareAdapter();if(await wu({log:t,cwd:n,adapterName:r.name,installVersion:r.version,fixedFloor:"13.3.1",declaredVersion:this.getDependencyVersion(r.name)}),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Ze({log:t,cwd:n,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:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(Tm,"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(Tm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(lv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;Tn(t,n,"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"),$a.writeFileSync(vt.join(n,"clouduser.astro.config.mjs"),`export default {};
129
+ `));let i=vt.join(lv,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),$a.copyFileSync(i,vt.join(n,"astro.config.webflow.ts")));let s=vt.join(Tm,"astro.config.mjs.template"),a=vt.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),$a.copyFileSync(l.templatePath,vt.join(n,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 St=w(require("path")),Oa=w(require("fs"));var Pm=yt(St.join(__dirname,"templates","astro","v7"),St.join(__dirname,"templates","v7")),cv=yt(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),zi=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=cn(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&$r(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Re("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 Re('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=cn(o);if(i!==null&&i<7)throw new Re(`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:n}=this.ctx,r=this.getCloudflareAdapter();if(await wu({log:t,cwd:n,adapterName:r.name,installVersion:r.version,fixedFloor:"14.0.0",declaredVersion:this.getDependencyVersion(r.name)}),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Ze({log:t,cwd:n,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:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(Pm,"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(Pm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(cv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;Tn(t,n,"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"),Oa.writeFileSync(St.join(n,"clouduser.astro.config.mjs"),`export default {};
130
+ `));let i=St.join(cv,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Oa.copyFileSync(i,St.join(n,"astro.config.webflow.ts")));let s=St.join(Pm,"astro.config.mjs.template"),a=St.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Oa.copyFileSync(l.templatePath,St.join(n,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 Ve=w(require("path")),qt=w(require("fs"));var qi=yt(Ve.join(__dirname,"templates","nextjs"),Ve.join(__dirname,"templates")),Xi=class extends pt{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,n){let r=n?.cloud?.framework;return r==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:r&&r!=="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:n}=this.ctx,r=n.dependencies?.next||n.devDependencies?.next;if(!r)throw new Re("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@${r}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:n}=this.ctx,r=this.getCloudflareAdapter();this.hasDependency(r.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await Ze({log:t,cwd:n,args:["install","--save",r.name]}))}getWebflowLoader(){return{templatePath:Ve.join(qi,"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 Ve.join(qi,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ve.join(qi,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(qt.existsSync(Ve.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:n,cwd:r}=this.ctx,o=this.findOpenNextConfig();if(o){n.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(n.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!qt.existsSync(t))throw new Ao(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=Ve.join(r,"open-next.config.ts");qt.copyFileSync(t,i),n.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=Tn(t,n,"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(Ve.join(n,"clouduser.next.config.ts"),`export default {};
131
+ `)):Ve.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${Ve.basename(o)}`),qt.writeFileSync(Ve.join(n,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
132
132
  declare const config: UserNextConfig;
133
133
  export default config;
134
- `));let i=Ve.join(Ji,"next.config.webflow.ts");kt(i)&&(t.info("Copying next.config.webflow.ts..."),zt.copyFileSync(i,Ve.join(n,"next.config.webflow.ts")));let s=Ve.join(Ji,"next.config.ts.template"),a=Ve.join(n,"next.config.ts");t.info("Generating next.config.ts from template..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),zt.copyFileSync(l.templatePath,Ve.join(n,l.destinationName)));let c=Ve.join(Ji,"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 zt.statSync(Ve.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}};var Rt=w(require("path")),qt=w(require("fs"));var du=ht(Rt.join(__dirname,"templates","vite"),Rt.join(__dirname,"templates")),zi=class extends pt{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,n){let r=n?.cloud?.framework;return r==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:r&&r!=="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:n}=this.ctx,r=n.dependencies?.vite||n.devDependencies?.vite;if(!r)throw new Fe("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@${r}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:n,packageJson:r}=this.ctx,o=r.devDependencies?.vite||r.dependencies?.vite||"",i=ln(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Qe({log:t,cwd:n,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 Qe({log:t,cwd:n,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 Qe({log:t,cwd:n,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Rt.join(du,"wrangler.json")}getAdditionalConfigFiles(){return[Rt.join(du,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:n}=this.ctx;for(let r of["wrangler.json","wrangler.jsonc"]){let o=Rt.join(n,r);if(qt.existsSync(o)){try{let i=qt.readFileSync(o,"utf8"),s=xo(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${r} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${r}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:n}=this.ctx,r=Rt.join(n,"src","worker.ts");if(qt.existsSync(r)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),qt.mkdirSync(Rt.join(n,"src"),{recursive:!0}),qt.writeFileSync(r,`/// <reference types="@cloudflare/workers-types" />
134
+ `));let i=Ve.join(qi,"next.config.webflow.ts");kt(i)&&(t.info("Copying next.config.webflow.ts..."),qt.copyFileSync(i,Ve.join(n,"next.config.webflow.ts")));let s=Ve.join(qi,"next.config.ts.template"),a=Ve.join(n,"next.config.ts");t.info("Generating next.config.ts from template..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),qt.copyFileSync(l.templatePath,Ve.join(n,l.destinationName)));let c=Ve.join(qi,"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(Ve.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}};var Pt=w(require("path")),Xt=w(require("fs"));var bu=yt(Pt.join(__dirname,"templates","vite"),Pt.join(__dirname,"templates")),Yi=class extends pt{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,n){let r=n?.cloud?.framework;return r==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:r&&r!=="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:n}=this.ctx,r=n.dependencies?.vite||n.devDependencies?.vite;if(!r)throw new Re("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@${r}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:n,packageJson:r}=this.ctx,o=r.devDependencies?.vite||r.dependencies?.vite||"",i=cn(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Ze({log:t,cwd:n,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:n,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:n,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Pt.join(bu,"wrangler.json")}getAdditionalConfigFiles(){return[Pt.join(bu,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:n}=this.ctx;for(let r of["wrangler.json","wrangler.jsonc"]){let o=Pt.join(n,r);if(Xt.existsSync(o)){try{let i=Xt.readFileSync(o,"utf8"),s=_o(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${r} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${r}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:n}=this.ctx,r=Pt.join(n,"src","worker.ts");if(Xt.existsSync(r)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),Xt.mkdirSync(Pt.join(n,"src"),{recursive:!0}),Xt.writeFileSync(r,`/// <reference types="@cloudflare/workers-types" />
135
135
 
136
136
  interface Env {
137
137
  ASSETS: Fetcher;
@@ -142,155 +142,155 @@ export default {
142
142
  return env.ASSETS.fetch(request);
143
143
  },
144
144
  } satisfies ExportedHandler<Env>;
145
- `)}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=this.hasCustomWorkerEntry();In(t,n,"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"),qt.writeFileSync(Rt.join(n,"clouduser.vite.config.ts"),`export default {};
146
- `));let s=Rt.join(du,"vite.config.webflow.ts");kt(s)&&(t.info("Copying vite.config.webflow.ts..."),qt.copyFileSync(s,Rt.join(n,"vite.config.webflow.ts")));let a=Rt.join(du,"vite.config.ts.template"),l=Rt.join(n,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await An(t,a,l,{...process.env,...r}),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}}};var KE=w(require("fs")),Ia=w(require("path"));var hT=ht(Ia.join(__dirname,"templates","static"),Ia.join(__dirname,"templates")),Ra=["_headers","_redirects"],Em=["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"];function yT(e,t){if(!t.includes("*"))return e===t;let n=t.split("*").map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${n}$`).test(e)}function Ta(e){return e===".well-known"?!1:e.startsWith(".")||Ra.includes(e)?!0:Em.some(t=>yT(e,t))}var wT=["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"],DT=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],bT=new Set([...wT,...DT]);function Pa(e){let t=[],n=(r,o)=>{let i;try{i=KE.readdirSync(r,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){Ta(s.name)||n(Ia.join(r,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||bT.has(s.name))&&t.push(a)}};return n(e,""),t}var cn=class extends pt{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,n){return n?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Pa(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 Ia.join(hT,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}};var XE=[Gi,Ao,_o,Ki,zi,cn],$a=["astro","nextjs","vite","static"];function pu(e,t){for(let n of XE){let r=n.detect(e,t);if(r.detected)return{Builder:n,result:r}}return null}function vm(e,t){let n=pu(e.packageJson,t);if(!n)throw new tr("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${$a.join(", ")})`});return e.log.info(`Detected framework: ${n.result.reason}`),new n.Builder(e)}function YE(e){let{hasPackageJson:t,specifiedFramework:n,hasRootIndexHtmlFile:r,hasRuntimeIndicators:o}=e;if(n==="static")return!0;let i=n!=null&&n!=="static";return!t&&!i&&r&&!o}function Oa(e,t,n){let r=n?.cloud?.framework,i=zE.lstatSync(qE.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Pa(e),a=YE({hasPackageJson:t!=null,specifiedFramework:r,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&r==null)throw new tr(`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}}function fu(e,t,n,r){let o=ZE.join(t,"webflow.json"),i={cloud:{}};if(qi.existsSync(o))try{let a=qi.readFileSync(o,"utf8"),l=JSON.parse(a),c=uu.safeParse(l);if(c.success)i=c.data;else{let d=c.error.issues.map(p=>`${p.path.join(".")}: ${p.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${d}`),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=n,r){let a=r.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=r.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,QE.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${n}`),qi.writeFileSync(o,JSON.stringify(i,null,2))}function ev(e,t){let n=Vi(e,t);if(n?.cloud?.framework)return n.cloud.framework;let r=Ca(t),{isStatic:o}=Oa(t,r,n);if(o)return e.info("Detected static app (no framework, no build)"),fu(e,t,cn.frameworkName),cn.frameworkName;if(!r)throw new tr("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=pu(r,n);if(!i)throw new tr("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}`),fu(e,t,s),s}_();var tv=j.object({name:j.string(),main:j.string().optional(),compatibility_date:j.string(),compatibility_flags:j.array(j.string()).optional(),placement:j.object({mode:j.string()}).passthrough().optional(),assets:j.object({directory:j.string(),binding:j.string().optional()}).passthrough().optional(),d1_databases:j.array(j.object({database_name:j.string(),database_id:j.string(),binding:j.string(),migrations_dir:j.string().optional()}).passthrough()).default([]),kv_namespaces:j.array(j.object({binding:j.string(),id:j.string()}).passthrough()).default([]),r2_buckets:j.array(j.object({binding:j.string(),bucket_name:j.string()}).passthrough()).default([])}).passthrough();function nv(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
147
- `)}function rv(e,t="wrangler.json"){let n=un.join(e,t);if(!ft.existsSync(n)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),rv(e,t+"c");u.warn(`/${t} not found`);return}let r=ft.readFileSync(n,"utf8");u.info(`reading /${t}...`);let o;try{o=xo(r)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=tv.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
148
- ${nv(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function ov(e,t){let n=null,r=null,o=un.join(t,"wrangler.json"),i=un.join(t,"wrangler.jsonc");ft.existsSync(o)?(n=o,r=".json"):ft.existsSync(i)&&(n=i,r=".jsonc"),n&&r&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${r}...`),ft.copyFileSync(n,un.join(t,`clouduser.wrangler${r}`)));let s=n?rv(t,un.basename(n)):null,a=e.getWranglerTemplatePath(),l=un.join(t,"wrangler.json");if(!ft.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`),ft.copyFileSync(a,l),!s)return;let c=JSON.parse(ft.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`)),ft.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let d in s.d1_databases){let p=s.d1_databases[d];if(!p.migrations_dir){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir is not defined`);continue}let m=p.migrations_dir,h=un.join(t,m);if(!ft.existsSync(h)){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let g=un.join(t,"clouduser","migrations",m),y=Pr(u,h,g);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${m}) is empty`)}}function kT(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 iv(e){let t=null;for(let s of[".json",".jsonc"]){let a=un.join(e,`clouduser.wrangler${s}`);if(ft.existsSync(a)){t=a;break}}if(!t)return;let n=ft.readFileSync(t,"utf8"),r;try{r=xo(n)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=tv.safeParse(r);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
149
- ${nv(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)kT(s.bucket_name)}}_();C();M();pe();var ET="4.82.1",mu=60;function nr(e,t){let n=Math.min(mu,process.stdout.columns??mu),r=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,n-r.length));u.info(`
150
- ${se(`${r}${o}`)}`)}function Sm(e,t){let n=Math.min(mu,process.stdout.columns??mu),r=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,n-r.length));u.info(`
151
- ${se(Ft(`${r}${o}`))}`)}async function lv(e=process.cwd(),t,n,r){let o=Ca(e),i=Vi(u,e),s={...r?{COSMIC_MOUNT_PATH:r}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...n&&!t?{COSMIC_DEPLOY_URL:ST(n)}:{}},a={cwd:e,log:u,packageJson:o??{},userEnv:s},{isStatic:l}=Oa(e,o,i);if(l)return new cn(a);if(!o)throw new Error("No package.json file found");return vm(a,i)}async function cv(e,t={}){let n=t.projectPath||process.cwd(),r=Date.now(),o=ce.join(n,".tmp",`webflow-build-${r}`),i=t.outputDir||ce.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=xm(n),c=t.telemetry,d=e.getBuildCommand(),p=e.getOutputDeployMetadata(),m=p.deploymentType==="static";await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),ee.mkdirSync(o,{recursive:!0});try{nr("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${p.deploymentType}`);let h=e.getNodeVersionRequirement();h&&Tr(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),nr("\u2699\uFE0F ","Configure wrangler"),await ov(e,n),u.info("Preparing framework configuration..."),await e.prepareConfig()),fu(u,n,e.info.name,e),m||(nr("\u{1F4E6}","Install dependencies"),await vT(n,e.info.name,t.telemetry),iv(n),nr("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${d}...`),await xT(n,d,t.telemetry),await e.postBuild(),nr("\u{1F9EA}","Wrangler dry-run"),await CT(n,i)),nr("\u{1F4C1}","Copy assets"),await _T(n,i,e,s),nr("\u{1F381}","Create tarball");let g=await AT(i),y=Date.now()-a;return u.info(`${$} Build completed in ${(y/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:y,framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),g}catch(h){let g=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:g,framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function xm(e){let t=ce.join(e,"wrangler.json");if(!ee.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let n=JSON.parse(ee.readFileSync(t,"utf8")),r=n.kv_namespaces||[],o=n.d1_databases||[],i=n.r2_buckets||[],s=n.vars||{};return{hasKV:r.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:r.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(n){return console.debug("Failed to parse wrangler.json for bindings detection:",n),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function uv(e){try{let t=ce.dirname(e);t.includes(".tmp/webflow-build-")&&(nr("\u{1F9F9}","Clean up build artifacts"),ee.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function dv(e,t){try{nr("\u{1F9F9}","Revert framework configuration");let n=t.getUserConfigPatterns(),r=new Set;for(let s of n){let a=ce.extname(s).slice(1),l=ce.basename(s,`.${a}`);if(!r.has(l)){r.add(l);for(let c of["mjs","cjs","js","ts"]){let d=ce.join(e,`clouduser.${l}.${c}`),p=ce.join(e,`${l}.${c}`);if(ee.existsSync(d)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),ee.existsSync(p)&&ee.unlinkSync(p),ee.renameSync(d,p);break}}}}for(let s of[".jsonc",".json"]){let a=ce.join(e,`clouduser.wrangler${s}`);if(ee.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=ce.join(e,"wrangler.json");ee.existsSync(l)&&ee.unlinkSync(l);let c=ce.join(e,`wrangler${s}`);ee.renameSync(a,c);break}}let o=ce.join(e,"clouduser");ee.existsSync(o)&&(u.info("cleaning up clouduser directory..."),ee.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=ce.join(e,ce.basename(s));ee.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),ee.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=ce.join(e,i.destinationName);ee.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),ee.unlinkSync(s))}}catch(n){u.warn(`Warning: Failed to cleanup framework configuration: ${n}`)}}async function vT(e,t,n){let r=Date.now(),o=["--no-update-notifier","--no-progress"],i=ce.join(e,"package-lock.json");try{ee.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,La.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,La.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-r;await n?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:ee.existsSync(i)})}catch(s){let a=Date.now()-r;throw await n?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:ee.existsSync(i)}),s}}function ST(e){let t="production",n;switch(t){case"development":n="wf-app-dev";break;case"acceptance":n="wf-app-acceptance";break;default:n="wf-app-prod"}return`https://${e}.${n}.cosmic.webflow.services`}async function xT(e,t,n){let r=Date.now();try{(0,La.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-r;await n?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-r;throw await n?.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 CT(e,t){ee.mkdirSync(t,{recursive:!0});let n=ce.join(e,"wrangler.json"),r=ce.join(e,"wrangler.jsonc");if(!ee.existsSync(n)&&!ee.existsSync(r))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,La.execSync)(`npx wrangler@${ET} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function sv(e,t){let n=ce.join(e,"webflow.json");ee.existsSync(n)?(u.info("including webflow.json in output..."),ee.copyFileSync(n,ce.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function FT(e,t,n){let r=n.replace(/\/+$/,"").replace(/^\/+/,""),o=ce.join(t,"assets"),i=ce.join(o,r||"");ee.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${r}...`);for(let s of ee.readdirSync(e))Pr(u,ce.join(e,s),ce.join(i,s),{excludeFn:Ta,followSymlinks:!1});for(let s of Ra){let a=ce.join(e,s);ee.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),ee.copyFileSync(a,ce.join(o,s)))}}async function _T(e,t,n,r){let o=n.getOutputDeployMetadata();if(o.deploymentType==="static"){FT(e,t,r),sv(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=r.replace(/\/+$/,"").replace(/^\/+/,"");if(!a&&l&&(n.info.name==="nextjs"||n.info.name==="astro")){let m=ce.join(e,i);if(ee.existsSync(m)&&ee.statSync(m).isDirectory()){let g=ee.readdirSync(m,{withFileTypes:!0}).find(y=>!(!y.isDirectory()||s&&y.name===s||n.info.name==="astro"&&(y.name==="_routes.json"||y.name==="_worker.js")));g&&(i=`${i}/${g.name}`)}}let c=ce.join(t,"assets",l||"");ee.mkdirSync(c,{recursive:!0});let d=ce.join(e,i);if(ee.existsSync(d)&&ee.statSync(d).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Pr(u,d,c,{exclude:s})):Pr(u,d,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");sv(e,t);let p=null;for(let m of[".json",".jsonc"]){let h=ce.join(e,`clouduser.wrangler${m}`);if(ee.existsSync(h)){p=h;break}}if(p){u.info("including user wrangler config in output..."),ee.copyFileSync(p,ce.join(t,"clouduser.wrangler.json"));let m=ce.join(e,"clouduser","migrations");if(ee.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let h=ce.join(t,"migrations");Pr(u,m,h)}}}async function AT(e){let t=`${e}.tar.gz`;try{return await av.create({gzip:!0,file:t,cwd:ce.dirname(e)},[ce.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(n){throw new f(n,{prefix:"Failed to create tarball:"})}}We();be();_();var IT="DUPLICATE_ENVIRONMENT_MOUNT",RT="ENVIRONMENT_MOUNT_MISMATCH",TT="DUPLICATE_ENVIRONMENT_BRANCH",PT="INVALID_MOUNT_PATH_FORMAT",$T="INVALID_PROJECT_ID",OT="DUPLICATE_PROJECT_NAME",LT="MAX_PROJECTS_PER_SITE",pv={[IT]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[RT]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[TT]:"An environment with this branch already exists for this app.",[PT]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[$T]:"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.",[OT]:"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.",[LT]:"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 fv(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 n=t.msg||"",r=t.status??t.code,o=typeof r=="number"?r:typeof r=="string"&&/^\d+$/.test(r)?Number(r):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 pv)if(n.includes(i))return pv[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var Yi=w(require("fs")),Fm=require("child_process"),hv=w(require("semver"));_();C();M();C();we();_();C();function Xi(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var NT={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 Cm(e){return typeof e=="string"&&e.trim()!==""}async function Io(e,t={}){let n=NT[e],{flagValue:r,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??Ye();if(Cm(r))return Xi(r,e),r;let c=process.env[n.env];if(Cm(c))return Xi(c,e),c;let d=n.manifest(o??{});if(Cm(d))return l||u.info(`Using ${e} from webflow.json`),Xi(d,e),d;if(!a&&s){let m=await s();return Xi(m,e),m}let p=i??n.flagHint;throw new f(`Missing required ${e}. Pass ${p}, set ${n.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:n.missingFlag})}async function $r(e,t={}){try{return await Io(e,t)}catch(n){if(n instanceof f&&n.missingFlag===e)return;throw n}}C();var jT=/[\x00-\x1f?#%/\\]/;function Or(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(jT.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function Oe(e,t){Or(e,t)}function MT(e){if(!e)return"unknown";let t=hv.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var mv=104857600;function gv(e){if(e===0)return"0 B";let t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function BT(){try{let e=(0,Fm.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,Fm.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 _m(e,t,n){let r=await fetch(`${P}${t}`,{method:n.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:n.body?JSON.stringify(n.body):void 0});if(!r.ok){let o=await r.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=fv(i);throw new Error(s)}return r.json()}async function yv(e,t,n,r){let{manifest:o}=ne(),i=o.cloud||{},s=i.framework,a=await $r("appId",{flagValue:r?.appId,manifest:o});if(!s)throw new f("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=MT(i.framework_version),c=await UT({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:n,environment:t,projectId:a,projectName:r?.projectName,description:r?.description,directory:r?.directory,version:BT()});return!a&&c.project_id&&(Se({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function UT(e){let{siteId:t,framework:n,frameworkVersion:r,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:d}=e,p={framework:n,framework_version:r,mount_path:o,environment:i,version:s};a&&(p.project_id=a),l&&(p.project_name=l),c&&(p.description=c),d&&(p.app_path=d);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return _m(e.apiToken,m,{method:"POST",body:p})}async function wv(e,t){let{siteId:n,accessToken:r}=e,o=n?`/cosmic/${n}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return _m(r,o,{method:"GET"})}async function Dv(e){let{siteId:t,accessToken:n}=e,r=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return _m(n,r,{method:"GET"})}async function bv(e,t){if(!Yi.existsSync(e))throw new Error(`Tarball not found at ${e}`);let n=Yi.statSync(e);if(n.size>mv)throw new Error(`Build output is too large (${gv(n.size)}). Maximum allowed size is ${gv(mv)}.`);let r=Yi.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([r],{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 f(l,{prefix:`${k} Upload failed with response:`})}}async function kv(e,t){if(!e||e==="undefined")throw new f("Completion URL is undefined or invalid");let n=new URL(e);t&&n.searchParams.set("failed","true");let r=await fetch(n.toString(),{method:"GET"});if(!r.ok)throw new f(`Failed to trigger deployment: ${r.status} ${r.statusText}`)}var Ev=require("webflow-api");be();be();C();function Am(e){return new Ev.WebflowClient({accessToken:e,environment:{base:`${P}/v2`,dataApi:`${P}/v2`,contentDeliveryApi:`${di}/v2`}})}async function Na(e,t){try{let r=await Am(e).sites.get(t);return{id:r.id||t,displayName:r.displayName||"Unknown Site",shortName:r.shortName||"unknown-site",customDomains:r.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching site details:"})}}async function Im(e,t){try{return{customDomains:(await Am(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching custom domains:"})}}async function Rm(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 f(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function Tm(e,t,n){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(r=>{if(r.mountPath!==t)return!1;if(!n)return!0;if(r.workerUrl)try{return new URL(r.workerUrl).hostname.split(".")[0]===n}catch{return!1}return!1}):!1}async function vv(e,t,n){try{let r=Am(e),o=await Na(e,t),i=[];if(n?.domains&&n.domains.length>0)for(let s of n.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await r.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:n?.publishToWebflowSubdomain??!0})}catch(r){throw new f(r,{prefix:"Error publishing site:"})}}Te();_();async function Sv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)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 Na(o,r),a=await Im(o,r),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(g=>g.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let d=l.map(async g=>{try{let y=await Rm(g),b=Array.isArray(y.cosmic)?y.cosmic.map(A=>A.mountPath).filter(A=>typeof A=="string"):[],S=Tm(y,t,n);return{domain:g,mountPaths:b,isValid:S===!0}}catch(y){return{domain:g,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})`)}}),p=await Promise.all(d),m=p.some(g=>!g.isValid),h=p.every(g=>g.isValid);return i.succeed("Mount path validation completed"),{isValid:h,domains:p,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function xv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)return[];try{let i=await Na(o,r),s=await Im(o,r),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(d=>d.url)||[]].map(async d=>{try{let p=await Rm(d),m=Tm(p,t,n);return{domain:d,isValid:m}}catch(p){return u.debug(`Could not verify mount path for ${d}: ${p}`),{domain:d,isValid:!1}}});return(await Promise.all(l)).filter(d=>d.isValid).map(d=>d.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function Cv(e,t){return e.map(n=>`${n.startsWith("localhost")||n.startsWith("127.0.0.1")?"http":"https"}://${n}${t}`)}async function Fv(e){let t=e.map(r=>({name:r,value:r,checked:!0})),n=await En({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:r=>r.length===0?"Please select at least one domain to publish to.":!0});return n??[]}async function _v(){return await Re({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 Pm(e,t){let{siteId:n,accessToken:r}=e;if(!n)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 Na(r,n)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await vv(r,n,{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")}}_();pe();var Ro=w(require("path"));We();be();we();var Av="apps";function $m(e){Av=e}function Zi(){return Av}var hu=w(require("fs"));C();be();Te();C();_();async function Qi(e){let t=await fetch(`${P}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let r=await t.text(),o={};try{o=JSON.parse(r)}catch{}throw t.status===403&&o.code==="missing_scopes"?new f(`Missing required scopes for workspace access.
145
+ `)}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=this.hasCustomWorkerEntry();Tn(t,n,"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"),Xt.writeFileSync(Pt.join(n,"clouduser.vite.config.ts"),`export default {};
146
+ `));let s=Pt.join(bu,"vite.config.webflow.ts");kt(s)&&(t.info("Copying vite.config.webflow.ts..."),Xt.copyFileSync(s,Pt.join(n,"vite.config.webflow.ts")));let a=Pt.join(bu,"vite.config.ts.template"),l=Pt.join(n,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await In(t,a,l,{...process.env,...r}),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}}};var uv=w(require("fs")),La=w(require("path"));var BT=yt(La.join(__dirname,"templates","static"),La.join(__dirname,"templates")),Na=["_headers","_redirects"],$m=["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"];function UT(e,t){if(!t.includes("*"))return e===t;let n=t.split("*").map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${n}$`).test(e)}function ja(e){return e===".well-known"?!1:e.startsWith(".")||Na.includes(e)?!0:$m.some(t=>UT(e,t))}var WT=["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"],HT=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],VT=new Set([...WT,...HT]);function Ma(e){let t=[],n=(r,o)=>{let i;try{i=uv.readdirSync(r,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){ja(s.name)||n(La.join(r,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||VT.has(s.name))&&t.push(a)}};return n(e,""),t}var un=class extends pt{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,n){return n?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Ma(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 La.join(BT,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}};var fv=[zi,To,Io,Xi,Yi,un],Ba=["astro","nextjs","vite","static"];function Du(e,t){for(let n of fv){let r=n.detect(e,t);if(r.detected)return{Builder:n,result:r}}return null}function Om(e,t){let n=Du(e.packageJson,t);if(!n)throw new rr("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Ba.join(", ")})`});return e.log.info(`Detected framework: ${n.result.reason}`),new n.Builder(e)}function mv(e){let{hasPackageJson:t,specifiedFramework:n,hasRootIndexHtmlFile:r,hasRuntimeIndicators:o}=e;if(n==="static")return!0;let i=n!=null&&n!=="static";return!t&&!i&&r&&!o}function Ua(e,t,n){let r=n?.cloud?.framework,i=dv.lstatSync(pv.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Ma(e),a=mv({hasPackageJson:t!=null,specifiedFramework:r,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&r==null)throw new rr(`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}}function ku(e,t,n,r){let o=gv.join(t,"webflow.json"),i={cloud:{}};if(Zi.existsSync(o))try{let a=Zi.readFileSync(o,"utf8"),l=JSON.parse(a),c=yu.safeParse(l);if(c.success)i=c.data;else{let p=c.error.issues.map(d=>`${d.path.join(".")}: ${d.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=n,r){let a=r.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=r.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,hv.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${n}`),Zi.writeFileSync(o,JSON.stringify(i,null,2))}function yv(e,t){let n=Ki(e,t);if(n?.cloud?.framework)return n.cloud.framework;let r=Ia(t),{isStatic:o}=Ua(t,r,n);if(o)return e.info("Detected static app (no framework, no build)"),ku(e,t,un.frameworkName),un.frameworkName;if(!r)throw new rr("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=Du(r,n);if(!i)throw new rr("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}`),ku(e,t,s),s}A();var wv=j.object({name:j.string(),main:j.string().optional(),compatibility_date:j.string(),compatibility_flags:j.array(j.string()).optional(),placement:j.object({mode:j.string()}).passthrough().optional(),assets:j.object({directory:j.string(),binding:j.string().optional()}).passthrough().optional(),d1_databases:j.array(j.object({database_name:j.string(),database_id:j.string(),binding:j.string(),migrations_dir:j.string().optional()}).passthrough()).default([]),kv_namespaces:j.array(j.object({binding:j.string(),id:j.string()}).passthrough()).default([]),r2_buckets:j.array(j.object({binding:j.string(),bucket_name:j.string()}).passthrough()).default([])}).passthrough();function bv(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
147
+ `)}function Dv(e,t="wrangler.json"){let n=dn.join(e,t);if(!ft.existsSync(n)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),Dv(e,t+"c");u.warn(`/${t} not found`);return}let r=ft.readFileSync(n,"utf8");u.info(`reading /${t}...`);let o;try{o=_o(r)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=wv.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
148
+ ${bv(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function kv(e,t){let n=null,r=null,o=dn.join(t,"wrangler.json"),i=dn.join(t,"wrangler.jsonc");ft.existsSync(o)?(n=o,r=".json"):ft.existsSync(i)&&(n=i,r=".jsonc"),n&&r&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${r}...`),ft.copyFileSync(n,dn.join(t,`clouduser.wrangler${r}`)));let s=n?Dv(t,dn.basename(n)):null,a=e.getWranglerTemplatePath(),l=dn.join(t,"wrangler.json");if(!ft.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`),ft.copyFileSync(a,l),!s)return;let c=JSON.parse(ft.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`)),ft.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let p in s.d1_databases){let d=s.d1_databases[p];if(!d.migrations_dir){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir is not defined`);continue}let m=d.migrations_dir,h=dn.join(t,m);if(!ft.existsSync(h)){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let g=dn.join(t,"clouduser","migrations",m),y=Or(u,h,g);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 GT(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 Ev(e){let t=null;for(let s of[".json",".jsonc"]){let a=dn.join(e,`clouduser.wrangler${s}`);if(ft.existsSync(a)){t=a;break}}if(!t)return;let n=ft.readFileSync(t,"utf8"),r;try{r=_o(n)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=wv.safeParse(r);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
149
+ ${bv(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)GT(s.bucket_name)}}A();C();M();pe();var Eu=w(require("fs")),vv=w(require("path"));function Sv(e,t,n){if(!n)return t;let r=`${t}/${n}`,o=vv.join(e,r);return Eu.existsSync(o)&&Eu.statSync(o).isDirectory()?r:t}var KT="4.82.1",vu=60;function or(e,t){let n=Math.min(vu,process.stdout.columns??vu),r=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,n-r.length));u.info(`
150
+ ${se(`${r}${o}`)}`)}function Lm(e,t){let n=Math.min(vu,process.stdout.columns??vu),r=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,n-r.length));u.info(`
151
+ ${se(_t(`${r}${o}`))}`)}async function Fv(e=process.cwd(),t,n,r){let o=Ia(e),i=Ki(u,e),s={...r?{COSMIC_MOUNT_PATH:r}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...n&&!t?{COSMIC_DEPLOY_URL:zT(n)}:{}},a={cwd:e,log:u,packageJson:o??{},userEnv:s},{isStatic:l}=Ua(e,o,i);if(l)return new un(a);if(!o)throw new Error("No package.json file found");return Om(a,i)}async function _v(e,t={}){let n=t.projectPath||process.cwd(),r=Date.now(),o=ue.join(n,".tmp",`webflow-build-${r}`),i=t.outputDir||ue.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=Nm(n),c=t.telemetry,p=e.getBuildCommand(),d=e.getOutputDeployMetadata(),m=d.deploymentType==="static";await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),oe.mkdirSync(o,{recursive:!0});try{or("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${d.deploymentType}`);let h=e.getNodeVersionRequirement();h&&$r(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),or("\u2699\uFE0F ","Configure wrangler"),await kv(e,n),u.info("Preparing framework configuration..."),await e.prepareConfig()),ku(u,n,e.info.name,e),m||(or("\u{1F4E6}","Install dependencies"),await JT(n,e.info.name,t.telemetry),Ev(n),or("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await qT(n,p,t.telemetry),await e.postBuild(),or("\u{1F9EA}","Wrangler dry-run"),await XT(n,i)),or("\u{1F4C1}","Copy assets"),await ZT(n,i,e,s),or("\u{1F381}","Create tarball");let g=await QT(i),y=Date.now()-a;return u.info(`${$} Build completed in ${(y/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:y,framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),g}catch(h){let g=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:g,framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function Nm(e){let t=ue.join(e,"wrangler.json");if(!oe.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let n=JSON.parse(oe.readFileSync(t,"utf8")),r=n.kv_namespaces||[],o=n.d1_databases||[],i=n.r2_buckets||[],s=n.vars||{};return{hasKV:r.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:r.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(n){return console.debug("Failed to parse wrangler.json for bindings detection:",n),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function Av(e){try{let t=ue.dirname(e);t.includes(".tmp/webflow-build-")&&(or("\u{1F9F9}","Clean up build artifacts"),oe.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function Rv(e,t){try{or("\u{1F9F9}","Revert framework configuration");let n=t.getUserConfigPatterns(),r=new Set;for(let s of n){let a=ue.extname(s).slice(1),l=ue.basename(s,`.${a}`);if(!r.has(l)){r.add(l);for(let c of["mjs","cjs","js","ts"]){let p=ue.join(e,`clouduser.${l}.${c}`),d=ue.join(e,`${l}.${c}`);if(oe.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),oe.existsSync(d)&&oe.unlinkSync(d),oe.renameSync(p,d);break}}}}for(let s of[".jsonc",".json"]){let a=ue.join(e,`clouduser.wrangler${s}`);if(oe.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=ue.join(e,"wrangler.json");oe.existsSync(l)&&oe.unlinkSync(l);let c=ue.join(e,`wrangler${s}`);oe.renameSync(a,c);break}}let o=ue.join(e,"clouduser");oe.existsSync(o)&&(u.info("cleaning up clouduser directory..."),oe.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=ue.join(e,ue.basename(s));oe.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),oe.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=ue.join(e,i.destinationName);oe.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),oe.unlinkSync(s))}}catch(n){u.warn(`Warning: Failed to cleanup framework configuration: ${n}`)}}async function JT(e,t,n){let r=Date.now(),o=["--no-update-notifier","--no-progress"],i=ue.join(e,"package-lock.json");try{oe.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,Wa.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,Wa.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-r;await n?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:oe.existsSync(i)})}catch(s){let a=Date.now()-r;throw await n?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:oe.existsSync(i)}),s}}function zT(e){let t="production",n;switch(t){case"development":n="wf-app-dev";break;case"acceptance":n="wf-app-acceptance";break;default:n="wf-app-prod"}return`https://${e}.${n}.cosmic.webflow.services`}async function qT(e,t,n){let r=Date.now();try{(0,Wa.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-r;await n?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-r;throw await n?.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 XT(e,t){oe.mkdirSync(t,{recursive:!0});let n=ue.join(e,"wrangler.json"),r=ue.join(e,"wrangler.jsonc");if(!oe.existsSync(n)&&!oe.existsSync(r))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,Wa.execSync)(`npx wrangler@${KT} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function xv(e,t){let n=ue.join(e,"webflow.json");oe.existsSync(n)?(u.info("including webflow.json in output..."),oe.copyFileSync(n,ue.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function YT(e,t,n){let r=n.replace(/\/+$/,"").replace(/^\/+/,""),o=ue.join(t,"assets"),i=ue.join(o,r||"");oe.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${r}...`);for(let s of oe.readdirSync(e))Or(u,ue.join(e,s),ue.join(i,s),{excludeFn:ja,followSymlinks:!1});for(let s of Na){let a=ue.join(e,s);oe.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),oe.copyFileSync(a,ue.join(o,s)))}}async function ZT(e,t,n,r){let o=n.getOutputDeployMetadata();if(o.deploymentType==="static"){YT(e,t,r),xv(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=r.replace(/\/+$/,"").replace(/^\/+/,"");a?i=Sv(e,i,l):i=Rm(e,i,l,n.info.name,s);let c=ue.join(t,"assets",l||"");oe.mkdirSync(c,{recursive:!0});let p=ue.join(e,i);if(oe.existsSync(p)&&oe.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Or(u,p,c,{exclude:s})):Or(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");xv(e,t);let d=null;for(let m of[".json",".jsonc"]){let h=ue.join(e,`clouduser.wrangler${m}`);if(oe.existsSync(h)){d=h;break}}if(d){u.info("including user wrangler config in output..."),oe.copyFileSync(d,ue.join(t,"clouduser.wrangler.json"));let m=ue.join(e,"clouduser","migrations");if(oe.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let h=ue.join(t,"migrations");Or(u,m,h)}}}async function QT(e){let t=`${e}.tar.gz`;try{return await Cv.create({gzip:!0,file:t,cwd:ue.dirname(e)},[ue.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(n){throw new f(n,{prefix:"Failed to create tarball:"})}}Me();De();A();var eP="DUPLICATE_ENVIRONMENT_MOUNT",tP="ENVIRONMENT_MOUNT_MISMATCH",nP="DUPLICATE_ENVIRONMENT_BRANCH",rP="INVALID_MOUNT_PATH_FORMAT",oP="INVALID_PROJECT_ID",iP="DUPLICATE_PROJECT_NAME",sP="MAX_PROJECTS_PER_SITE",Iv={[eP]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[tP]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[nP]:"An environment with this branch already exists for this app.",[rP]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[oP]:"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.",[iP]:"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.",[sP]:"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 Tv(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 n=t.msg||"",r=t.status??t.code,o=typeof r=="number"?r:typeof r=="string"&&/^\d+$/.test(r)?Number(r):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 Iv)if(n.includes(i))return Iv[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var es=w(require("fs")),Mm=require("child_process"),Ov=w(require("semver"));A();C();M();C();be();A();C();function Qi(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var aP={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 jm(e){return typeof e=="string"&&e.trim()!==""}async function Po(e,t={}){let n=aP[e],{flagValue:r,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??et();if(jm(r))return Qi(r,e),r;let c=process.env[n.env];if(jm(c))return Qi(c,e),c;let p=n.manifest(o??{});if(jm(p))return l||u.info(`Using ${e} from webflow.json`),Qi(p,e),p;if(!a&&s){let m=await s();return Qi(m,e),m}let d=i??n.flagHint;throw new f(`Missing required ${e}. Pass ${d}, set ${n.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:n.missingFlag})}async function Lr(e,t={}){try{return await Po(e,t)}catch(n){if(n instanceof f&&n.missingFlag===e)return;throw n}}C();var lP=/[\x00-\x1f?#%/\\]/;function Nr(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(lP.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Nr(e,t)}function cP(e){if(!e)return"unknown";let t=Ov.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var Pv=104857600;function $v(e){if(e===0)return"0 B";let t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function uP(){try{let e=(0,Mm.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,Mm.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 Bm(e,t,n){let r=await fetch(`${P()}${t}`,{method:n.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:n.body?JSON.stringify(n.body):void 0});if(!r.ok){let o=await r.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=Tv(i);throw new Error(s)}return r.json()}async function Lv(e,t,n,r){let{manifest:o}=ee(),i=o.cloud||{},s=i.framework,a=await Lr("appId",{flagValue:r?.appId,manifest:o});if(!s)throw new f("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=cP(i.framework_version),c=await dP({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:n,environment:t,projectId:a,projectName:r?.projectName,description:r?.description,directory:r?.directory,version:uP()});return!a&&c.project_id&&(xe({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function dP(e){let{siteId:t,framework:n,frameworkVersion:r,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,d={framework:n,framework_version:r,mount_path:o,environment:i,version:s};a&&(d.project_id=a),l&&(d.project_name=l),c&&(d.description=c),p&&(d.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Bm(e.apiToken,m,{method:"POST",body:d})}async function Nv(e,t){let{siteId:n,accessToken:r}=e,o=n?`/cosmic/${n}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Bm(r,o,{method:"GET"})}async function jv(e){let{siteId:t,accessToken:n}=e,r=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Bm(n,r,{method:"GET"})}async function Mv(e,t){if(!es.existsSync(e))throw new Error(`Tarball not found at ${e}`);let n=es.statSync(e);if(n.size>Pv)throw new Error(`Build output is too large (${$v(n.size)}). Maximum allowed size is ${$v(Pv)}.`);let r=es.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([r],{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 f(l,{prefix:`${k} Upload failed with response:`})}}async function Bv(e,t){if(!e||e==="undefined")throw new f("Completion URL is undefined or invalid");let n=new URL(e);t&&n.searchParams.set("failed","true");let r=await fetch(n.toString(),{method:"GET"});if(!r.ok)throw new f(`Failed to trigger deployment: ${r.status} ${r.statusText}`)}var Uv=require("webflow-api");De();De();C();function Um(e){return new Uv.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/v2`}})}async function Ha(e,t){try{let r=await Um(e).sites.get(t);return{id:r.id||t,displayName:r.displayName||"Unknown Site",shortName:r.shortName||"unknown-site",customDomains:r.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching site details:"})}}async function Wm(e,t){try{return{customDomains:(await Um(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching custom domains:"})}}async function Hm(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 f(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function Vm(e,t,n){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(r=>{if(r.mountPath!==t)return!1;if(!n)return!0;if(r.workerUrl)try{return new URL(r.workerUrl).hostname.split(".")[0]===n}catch{return!1}return!1}):!1}async function Wv(e,t,n){try{let r=Um(e),o=await Ha(e,t),i=[];if(n?.domains&&n.domains.length>0)for(let s of n.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await r.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:n?.publishToWebflowSubdomain??!0})}catch(r){throw new f(r,{prefix:"Error publishing site:"})}}Oe();A();async function Hv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)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 Ha(o,r),a=await Wm(o,r),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(g=>g.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let p=l.map(async g=>{try{let y=await Hm(g),b=Array.isArray(y.cosmic)?y.cosmic.map(_=>_.mountPath).filter(_=>typeof _=="string"):[],S=Vm(y,t,n);return{domain:g,mountPaths:b,isValid:S===!0}}catch(y){return{domain:g,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})`)}}),d=await Promise.all(p),m=d.some(g=>!g.isValid),h=d.every(g=>g.isValid);return i.succeed("Mount path validation completed"),{isValid:h,domains:d,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function Vv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)return[];try{let i=await Ha(o,r),s=await Wm(o,r),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let d=await Hm(p),m=Vm(d,t,n);return{domain:p,isValid:m}}catch(d){return u.debug(`Could not verify mount path for ${p}: ${d}`),{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 Gv(e,t){return e.map(n=>`${n.startsWith("localhost")||n.startsWith("127.0.0.1")?"http":"https"}://${n}${t}`)}async function Kv(e){let t=e.map(r=>({name:r,value:r,checked:!0})),n=await vn({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:r=>r.length===0?"Please select at least one domain to publish to.":!0});return n??[]}async function Jv(){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 Gm(e,t){let{siteId:n,accessToken:r}=e;if(!n)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 Ha(r,n)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await Wv(r,n,{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")}}A();pe();var $o=w(require("path"));Me();De();be();var zv="apps";function Km(e){zv=e}function ts(){return zv}var xu=w(require("fs"));C();De();Oe();C();A();async function ns(e){let t=await fetch(`${P()}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let r=await t.text(),o={};try{o=JSON.parse(r)}catch{}throw t.status===403&&o.code==="missing_scopes"?new f(`Missing required scopes for workspace access.
152
152
  ${o.message??""}
153
153
  Re-run 'webflow auth login' to grant the necessary permissions.`):new f(`Failed to fetch workspaces: ${t.status} ${t.statusText}`+(o.message?`
154
- ${o.message}`:""))}return(await t.json()).workspaces}async function es(e){if(e.length===1)return e[0];let t=await Me({message:"Select the workspace for this app:",choices:e.map(n=>({name:n.name,value:n}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}yc();M();_();M();pe();async function Om(e,t){u.warn(`${re} ${le("webflow cloud create")} is deprecated and will be removed in the next major release.
155
- Use ${K("webflow cloud init")} instead.
156
- `);let{framework:n}=t;if(!(await ts()).find(i=>i===n)){u.error(`Framework ${n} not found`);return}await gu(e,"/app",n,void 0,xe.Existing,void 0)}_();pe();M();Wn();async function Lm(){let e=tt()?"webflow apps init":"webflow cloud init",t=tt()?`
157
- To list your Cloud apps, use ${K("webflow apps list")}.`:"";u.warn(`${re} ${le("webflow cloud list")} is deprecated and will be removed in the next major release.
154
+ ${o.message}`:""))}return(await t.json()).workspaces}async function rs(e){if(e.length===1)return e[0];let t=await Be({message:"Select the workspace for this app:",choices:e.map(n=>({name:n.name,value:n}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}Sc();M();A();M();pe();async function Jm(e,t){u.warn(`${re} ${le("webflow cloud create")} is deprecated and will be removed in the next major release.
155
+ Use ${J("webflow cloud init")} instead.
156
+ `);let{framework:n}=t;if(!(await os()).find(i=>i===n)){u.error(`Framework ${n} not found`);return}await Su(e,"/app",n,void 0,Fe.Existing,void 0)}A();pe();M();Vn();async function zm(){let e=Je()?"webflow apps init":"webflow cloud init",t=Je()?`
157
+ To list your Cloud apps, use ${J("webflow apps list")}.`:"";u.warn(`${re} ${le("webflow cloud list")} is deprecated and will be removed in the next major release.
158
158
  It lists scaffold templates, not your apps.
159
- Use ${K(`${e} --framework`)} / ${K("--help")} for available templates.${t}
160
- `);let n=await ts();u.info("Available app templates:"),n.length>0?n.forEach(r=>u.info(`- ${r}`)):u.info("No templates found.")}q();C();we();Te();_();M();var Iv=w(require("path"));function Lr(e){if(!e||e.trim()==="")return"/";let t=Iv.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((r,o)=>o===0?r:encodeURIComponent(r)).join("/"),t}function ja(e){return!(!e||e.trim()===""||!e.startsWith("/")||e.includes(".."))}pe();_();M();function Ma(e,t){u.warn(`${re} ${le(e)} is deprecated; use ${K(t)} instead.`)}async function Nm(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--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&&Ma("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new f("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new f("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let n=process.stdin.isTTY,r;n&&on()&&(r=await T());let o=!1;if(r&&!e.new&&!e.siteId)try{(await hr(r)).length===0&&(u.info(`${je} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(h){u.debug(`Skipped sites lookup in cloud init preflight: ${h}`)}let i=await ts(),s={};if(n&&on()){if(!e.new&&!o&&(s.initMode=await Me({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:xe.New},{name:"Existing site",value:xe.Existing}],default:xe.New})),e?.framework||(s.scaffoldName=await Me({message:"Which framework would you like to use?",choices:i.map(g=>({name:g,value:g})),default:"astro"})),!t){let g=await Je({message:"What would you like to name your app?",validate:y=>{let b=y.trim();return b===""?"App name cannot be empty":b.length<zn||b.length>qn?`App name must be between ${zn} and ${qn} characters`:!0}});if(g==null)throw new f("When --no-input mode is enabled please provide the --app-name option.");s.appName=g}let h=e.new||o||s.initMode===xe.New;if(!e.mount&&!h){let g=await Je({message:"What path do you want to use locally? (e.g., /app)",default:"/app"});s.mountPath=Lr(g)}}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?xe.New:s.initMode??(e.siteId?xe.Existing:V()?xe.New:xe.Existing),d=c===xe.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",p=e.siteId,m=Lr(d);if(!a||typeof a!="string"||a.trim()==="")throw new f("--app-name cannot be empty");if(a.length<zn||a.length>qn)throw new f(`--app-name must be between ${zn} and ${qn} characters`);if(!l)throw new f("--framework is required");if(!i.includes(l)){let h=i.join(`
159
+ Use ${J(`${e} --framework`)} / ${J("--help")} for available templates.${t}
160
+ `);let n=await os();u.info("Available app templates:"),n.length>0?n.forEach(r=>u.info(`- ${r}`)):u.info("No templates found.")}q();C();be();Oe();A();M();var qv=w(require("path"));function jr(e){if(!e||e.trim()==="")return"/";let t=qv.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((r,o)=>o===0?r:encodeURIComponent(r)).join("/"),t}function Va(e){return!(!e||e.trim()===""||!e.startsWith("/")||e.includes(".."))}pe();A();M();function Ga(e,t){u.warn(`${re} ${le(e)} is deprecated; use ${J(t)} instead.`)}async function qm(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--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&&Ga("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new f("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new f("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let n=process.stdin.isTTY,r;n&&sn()&&(r=await T());let o=!1;if(r&&!e.new&&!e.siteId)try{(await wr(r)).length===0&&(u.info(`${Ce} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(h){u.debug(`Skipped sites lookup in cloud init preflight: ${h}`)}let i=await os(),s={};if(n&&sn()){if(!e.new&&!o&&(s.initMode=await Be({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Fe.New},{name:"Existing site",value:Fe.Existing}],default:Fe.New})),e?.framework||(s.scaffoldName=await Be({message:"Which framework would you like to use?",choices:i.map(g=>({name:g,value:g})),default:"astro"})),!t){let g=await Ke({message:"What would you like to name your app?",validate:y=>{let b=y.trim();return b===""?"App name cannot be empty":b.length<Xn||b.length>Yn?`App name must be between ${Xn} and ${Yn} characters`:!0}});if(g==null)throw new f("When --no-input mode is enabled please provide the --app-name option.");s.appName=g}let h=e.new||o||s.initMode===Fe.New;if(!e.mount&&!h){let g=await Ke({message:"What path do you want to use locally? (e.g., /app)",default:"/app"});s.mountPath=jr(g)}}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?Fe.New:s.initMode??(e.siteId?Fe.Existing:V()?Fe.New:Fe.Existing),p=c===Fe.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",d=e.siteId,m=jr(p);if(!a||typeof a!="string"||a.trim()==="")throw new f("--app-name cannot be empty");if(a.length<Xn||a.length>Yn)throw new f(`--app-name must be between ${Xn} and ${Yn} characters`);if(!l)throw new f("--framework is required");if(!i.includes(l)){let h=i.join(`
161
161
  - `);throw new f(`--framework "${l}" not found
162
162
 
163
163
  Available frameworks:
164
- - ${h}`)}if(typeof m!="string"||!ja(m))throw new f("Invalid mount path: "+m);if(c===xe.Existing&&!p&&(!n||V()))throw new f("--site-id is required when connecting to an existing site in non-interactive mode.");await gu(a,m,l,p,c,e.workspaceId)}var Lv=w(require("path"));q();C();we();Te();_();M();We();X();var Rv=require("crypto");be();C();async function Tv(e){let{accessToken:t,workspaceId:n,displayName:r,description:o,appPath:i}=e,a={requestId:(0,Rv.randomUUID)(),cloudApp:{displayName:r,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:pE}}}},l=`${P}/cosmic/workspaces/${n}/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 d=await c.text();throw WT(c.status,c.statusText,d)}return c.json()}function WT(e,t,n){let r={};try{r=JSON.parse(n)}catch{}return e===403?r.publicErrorCode==="missing_scopes"?new f(`Missing required scopes to create a Cloud app.
164
+ - ${h}`)}if(typeof m!="string"||!Va(m))throw new f("Invalid mount path: "+m);if(c===Fe.Existing&&!d&&(!n||V()))throw new f("--site-id is required when connecting to an existing site in non-interactive mode.");await Su(a,m,l,d,c,e.workspaceId)}var tS=w(require("path"));q();C();be();Oe();A();M();Me();X();var Xv=require("crypto");De();C();async function Yv(e){let{accessToken:t,workspaceId:n,displayName:r,description:o,appPath:i}=e,a={requestId:(0,Xv.randomUUID)(),cloudApp:{displayName:r,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:_E}}}},l=`${P()}/cosmic/workspaces/${n}/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 pP(c.status,c.statusText,p)}return c.json()}function pP(e,t,n){let r={};try{r=JSON.parse(n)}catch{}return e===403?r.publicErrorCode==="missing_scopes"?new f(`Missing required scopes to create a Cloud app.
165
165
  ${r.msg??""}
166
- Re-run 'webflow auth login' to grant the necessary permissions.`):new f(r.msg??"You don't have permission to create apps in this workspace."):e===404?new f("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?r.publicErrorCode==="workspace_unhosted_project_limit"?new f(HT(r.planName,r.limit)):r.msg?.includes("No new sites can be created")?new f(`Failed to create app: your workspace has reached its app limit.
166
+ Re-run 'webflow auth login' to grant the necessary permissions.`):new f(r.msg??"You don't have permission to create apps in this workspace."):e===404?new f("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?r.publicErrorCode==="workspace_unhosted_project_limit"?new f(fP(r.planName,r.limit)):r.msg?.includes("No new sites can be created")?new f(`Failed to create app: your workspace has reached its app limit.
167
167
  Upgrade your plan or remove unused apps to create a new one.`):new f(r.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new f(`Failed to create app: ${e} ${t}`+(r.msg?`
168
- ${r.msg}`:""))}function HT(e,t){let n="Upgrade your plan or remove unused apps to create a new one.",r=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${r}.
168
+ ${r.msg}`:""))}function fP(e,t){let n="Upgrade your plan or remove unused apps to create a new one.",r=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${r}.
169
169
  ${n}`:typeof t=="number"&&t>0?`Your workspace is limited to ${t} ${r}.
170
170
  ${n}`:e?`Your "${e}" workspace has reached its Cloud app limit.
171
171
  ${n}`:`Failed to create app: your workspace has reached its app limit.
172
- `+n}We();C();we();Te();q();async function Ov(e={}){VT(e);let t=await GT(e,ne().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:ne().manifest}}function VT(e){if(e.siteId&&e.workspaceId)throw new f("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function GT(e,t){if(e.siteId)return Pv(t,e.siteId);if(e.workspaceId)return $v(e.workspaceId);let n=await $r("siteId",{manifest:t});if(n)return Pv(t,n);let r=await $r("workspaceId",{manifest:t});if(r)return $v(r);if(V()||!on())throw new f(`No identity configured for this app.
172
+ `+n}Me();C();be();Oe();q();async function eS(e={}){mP(e);let t=await gP(e,ee().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:ee().manifest}}function mP(e){if(e.siteId&&e.workspaceId)throw new f("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function gP(e,t){if(e.siteId)return Zv(t,e.siteId);if(e.workspaceId)return Qv(e.workspaceId);let n=await Lr("siteId",{manifest:t});if(n)return Zv(t,n);let r=await Lr("workspaceId",{manifest:t});if(r)return Qv(r);if(V()||!sn())throw new f(`No identity configured for this app.
173
173
  Pass one of:
174
174
  --site-id <id> (deploy to an existing Webflow site)
175
175
  --workspace-id <id> (create a new Cloud app)
176
- Or run 'webflow cloud init' to scaffold a new app.`);return KT(t)}async function Pv(e,t){return{credentials:await Ke(e,{site:t})}}async function $v(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function JT(){let e=await T(),t=await Qi(e);if(t.length===0)throw new yr("No workspaces found in your account. Please make sure you have at least one workspace.");let n=await es(t);return Se({cloud:{workspace_id:n.id}}),{workspaceId:n.id,credentials:{accessToken:e,siteId:""}}}async function KT(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 f("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?JT():{credentials:await Ke(e,{})}}async function jm(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--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 f("--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&&Ma("--project-name","--app-name"),e.projectId!==void 0&&Ma("--project-id","--app-id");let t=e.appName??e.projectName,n=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(g){throw u.error(`Error: Could not change to directory ${e.directory}`),new f(g)}if(e.framework){if(!$a.includes(e.framework))throw new f(`Framework "${e.framework}" is not supported. Allowed: ${$a.join(", ")}.`);Se({cloud:{framework:e.framework}})}let r=await Ov({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=r,{credentials:i,manifest:s}=r,a=!!o;if(o){let g=Lv.default.basename(process.cwd()).trim(),y=g.length>=zn&&g.length<=qn,b=t??(y?g:"Cloud App");if(b.length<zn||b.length>qn)throw new f(`App name must be between ${zn} and ${qn} characters (got ${b.length}).
177
- Use --app-name to provide a valid name.`);let S=u.spinner("Creating Cloud app...");try{let v=await Tv({accessToken:i.accessToken,workspaceId:o,displayName:b});S.succeed(`Cloud app created: ${v.cloudApp.displayName}`),Se({siteId:v.cloudApp.siteId,cloud:{...s.cloud,app_id:v.cloudApp.project.id,environment_id:v.cloudApp.environment.id}}),Hn({siteId:v.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=v.cloudApp.siteId,{manifest:s}=ne()}catch(v){throw S.fail("Failed to create app"),new f(v,{prefix:"Could not create app:"})}let A=s.siteId;if(!A)throw new f("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:A}}let l;try{l=F.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(g){u.debug(`Failed to initialize telemetry: ${g}`)}let c=await $r("appId",{flagValue:n,manifest:s}),d,p,m=t,h=e.description;if(e.environment&&e.mount){if(d=e.environment,p=Lr(e.mount),!ja(p))throw new f("Invalid mount path: "+p)}else{let g=[];if(!c){if(!m&&V())throw new f("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 b=await Dv(i);if(b.projects.length>0){let S=await Me({message:"Select an app to deploy to:",choices:[...b.projects.map(A=>({name:`${A.name} (${A.description||"No description"})`,value:A.id})),{name:"Create new app",value:null}]});S?(c=S,Se({cloud:{app_id:S}}),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(b){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(b instanceof Error?b.message:String(b))}}if(!c&&!m&&(m=await Je({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:b=>b.trim()===""?"App name cannot be empty":!0})),c)try{let S=(await wv(i,c)).environments.map(A=>({name:`${A.branch} (${A.mount})`,value:{branch:A.branch,mount:A.mount}}));g.push(...S)}catch(b){throw new f(b,{prefix:"Error fetching app environments:"})}g.push({name:"Create new environment",value:null});let y=await Me({message:"Select an environment to deploy to:",choices:g});if(y)d=y.branch,p=Lr(y.mount);else if(e.environment?d=e.environment:d=await Je({message:"What environment would you like to deploy to?",default:"main",validate:b=>b.trim()===""?"Environment cannot be empty":!0}),e.mount)p=Lr(e.mount);else{let b=await Je({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"});p=Lr(b)}}if(!ja(p))throw new f("Invalid mount path: "+p);await Nv(i,d,p,{projectName:m,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new f(t,{prefix:"Error during deployment setup:"})}}var Ba=null;process.once("exit",()=>Ba?.());var jv=(e,t,n)=>t instanceof ro?"no-sites":t instanceof yr?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&n===xe.New?"no-workspaces":"unknown",ts=async()=>{try{let e=lm(),t=cm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},zT=async(e,t,n)=>{let r;if("content"in n)r=n.content.files;else{let l=n[t];if(!l)throw new Error(`Scaffold "${t}" not found`);r=l}let o=r.find(l=>l.includes(ao));if(!o)throw new Error(`No ${ao} found in scaffold "${t}"`);await hu.promises.mkdir(e,{recursive:!0});let s=(await hu.promises.readFile(o,"utf8")).replace(Zc,e),a=Ro.join(e,ao);await hu.promises.writeFile(a,s,"utf8")},gu=async(e,t,n=Yc,r,o=xe.Existing,i)=>{if(o===xe.New){try{let s=await pm(n);await qT(e,t,s.scaffoldId,{content:s},n,i)}catch(s){if(s instanceof Ze){let a=s.message;throw s.supportedIds?.length&&(a+=`
179
- Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}return}try{let s=await eu(n);await XT(e,t,n,{content:s},r)}catch(s){if(s instanceof Ze){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
- Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},qT=async(e,t,n,r,o,i)=>{let s=`./${e}`,a="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,l=a?Ro.dirname(a.extractionRoot):null,c="auth",d=!1,p=!1,m=null;try{let h=Date.now(),g=await T();c="workspaces";let y;if(i)y={id:i};else{let A=await Qi(g);if(A.length===0)throw new yr("No workspaces found in your account. Please make sure you have at least one workspace.");y=await es(A)}c="scaffold",await Da(e,t,n,r,void 0,void 0),p=!0,process.chdir(s);let b=o??n;Se({cloud:{framework:b,workspace_id:y.id}}),Hn({apiToken:g,directory:"."}),process.env.WEBFLOW_API_TOKEN=g;let S=Date.now()-h;try{await F.forCloud({authToken:g}).sendUsage("project_init",{scaffold:b,scaffoldName:b,initMode:xe.New,workspaceId:y.id,totalDuration:S,mountPath:t,namespace:Zi()})}catch{}d=!0}catch(h){if(m=h,h instanceof f||h instanceof Error&&h.message.includes("OAuth")){try{await Da(e,t,n,r),process.chdir(s),Se({cloud:{framework:o??n}}),Hn({directory:"."}),p=!0}catch{}throw u.error(h),new f(h,{skipLogging:!0})}throw h}finally{if(l)try{Mm.default.removeSync(l)}catch{}if(d){let h=Bv(e,xe.New);Ba=()=>u.info(h)}else{let h=jv(c,m,xe.New),g=Uv(e,xe.New,h,p);Ba=()=>u.info(g)}}},XT=async(e,t,n,r,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,c=l?Ro.dirname(l.extractionRoot):null,d="auth",p=!1,m=!1,h=null;try{let g=Date.now();await zT(e,n,r),process.chdir(i);let{manifest:y}=ne(),b=await Ke(y,{site:o}),S=b.accessToken,A=b.siteId;if(s=F.forCloud({authToken:S,siteId:A}),d="scaffold",await Da(".",t,n,r,A,S),m=!0,d="devlink",A){u.info(`${je} Running devlink export to fetch your Webflow components`);try{await YT({site:A,apiToken:S}),a=!0}catch(x){io(x)?u.info(`${je} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(x,{prefix:"Failed to run devlink export:"})}}let v=Date.now()-g;await s?.sendUsage("project_init",{scaffold:n,scaffoldName:n,devlinkSyncStatus:a,totalDuration:v,mountPath:t,namespace:Zi()}),p=!0}catch(g){h=g,u.error(g);try{await Da(".",t,n,r),m=!0}catch{}throw new f(g,{skipLogging:!0})}finally{if(c)try{Mm.default.removeSync(c)}catch{}if(p){let g=Bv(e,xe.Existing);Ba=()=>u.info(g)}else{let g=jv(d,h,xe.Existing),y=Uv(e,xe.Existing,g,m);Ba=()=>u.info(y)}}},YT=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(yc(),Cb));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},ZT=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=ne();return sm(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},QT=async(e,t,n,r)=>{u.info(Ne("Validating mount path configuration..."));let o=await Sv(e,t,n);if(o.isValid)u.info(K("Mount path validation passed"));else if(u.info(R(`
181
- Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:re,a=i.isValid?K(`${i.domain} (mountPath: ${i.mountPaths[0]})`):le(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(r){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 Pm(e,i)}else if(await _v()&&on()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await Fv(s);await Pm(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},eP=async(e,t,n,r)=>{Sm("\u{1F3D7}\uFE0F ","Building app");let o=await cv(e,{mountPath:n,telemetry:r?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id});Sm("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await bv(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},tP=async(e,t,n,r)=>{u.success(`
182
- \u{1F310} Your cloud app will soon be available at:`);try{let o=r?.domainsOverride??await xv(e,t,n),i=Cv(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}`)}},nP=e=>{e.site_slug?u.success(`Visit your deployment:
176
+ Or run 'webflow cloud init' to scaffold a new app.`);return yP(t)}async function Zv(e,t){return{credentials:await ze(e,{site:t})}}async function Qv(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function hP(){let e=await T(),t=await ns(e);if(t.length===0)throw new br("No workspaces found in your account. Please make sure you have at least one workspace.");let n=await rs(t);return xe({cloud:{workspace_id:n.id}}),{workspaceId:n.id,credentials:{accessToken:e,siteId:""}}}async function yP(e){let t=await Be({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 f("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?hP():{credentials:await ze(e,{})}}async function Xm(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--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 f("--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&&Ga("--project-name","--app-name"),e.projectId!==void 0&&Ga("--project-id","--app-id");let t=e.appName??e.projectName,n=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(g){throw u.error(`Error: Could not change to directory ${e.directory}`),new f(g)}if(e.framework){if(!Ba.includes(e.framework))throw new f(`Framework "${e.framework}" is not supported. Allowed: ${Ba.join(", ")}.`);xe({cloud:{framework:e.framework}})}let r=await eS({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=r,{credentials:i,manifest:s}=r,a=!!o;if(o){let g=tS.default.basename(process.cwd()).trim(),y=g.length>=Xn&&g.length<=Yn,b=t??(y?g:"Cloud App");if(b.length<Xn||b.length>Yn)throw new f(`App name must be between ${Xn} and ${Yn} characters (got ${b.length}).
177
+ Use --app-name to provide a valid name.`);let S=u.spinner("Creating Cloud app...");try{let v=await Yv({accessToken:i.accessToken,workspaceId:o,displayName:b});S.succeed(`Cloud app created: ${v.cloudApp.displayName}`),xe({siteId:v.cloudApp.siteId,cloud:{...s.cloud,app_id:v.cloudApp.project.id,environment_id:v.cloudApp.environment.id}}),Gn({siteId:v.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=v.cloudApp.siteId,{manifest:s}=ee()}catch(v){throw S.fail("Failed to create app"),new f(v,{prefix:"Could not create app:"})}let _=s.siteId;if(!_)throw new f("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:_}}let l;try{l=F.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(g){u.debug(`Failed to initialize telemetry: ${g}`)}let c=await Lr("appId",{flagValue:n,manifest:s}),p,d,m=t,h=e.description;if(e.environment&&e.mount){if(p=e.environment,d=jr(e.mount),!Va(d))throw new f("Invalid mount path: "+d)}else{let g=[];if(!c){if(!m&&V())throw new f("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 b=await jv(i);if(b.projects.length>0){let S=await Be({message:"Select an app to deploy to:",choices:[...b.projects.map(_=>({name:`${_.name} (${_.description||"No description"})`,value:_.id})),{name:"Create new app",value:null}]});S?(c=S,xe({cloud:{app_id:S}}),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(b){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(b instanceof Error?b.message:String(b))}}if(!c&&!m&&(m=await Ke({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:b=>b.trim()===""?"App name cannot be empty":!0})),c)try{let S=(await Nv(i,c)).environments.map(_=>({name:`${_.branch} (${_.mount})`,value:{branch:_.branch,mount:_.mount}}));g.push(...S)}catch(b){throw new f(b,{prefix:"Error fetching app environments:"})}g.push({name:"Create new environment",value:null});let y=await Be({message:"Select an environment to deploy to:",choices:g});if(y)p=y.branch,d=jr(y.mount);else if(e.environment?p=e.environment:p=await Ke({message:"What environment would you like to deploy to?",default:"main",validate:b=>b.trim()===""?"Environment cannot be empty":!0}),e.mount)d=jr(e.mount);else{let b=await Ke({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"});d=jr(b)}}if(!Va(d))throw new f("Invalid mount path: "+d);await nS(i,p,d,{projectName:m,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new f(t,{prefix:"Error during deployment setup:"})}}var Ka=null;process.once("exit",()=>Ka?.());var rS=(e,t,n)=>t instanceof io?"no-sites":t instanceof br?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&n===Fe.New?"no-workspaces":"unknown",os=async()=>{try{let e=bm(),t=Dm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},wP=async(e,t,n)=>{let r;if("content"in n)r=n.content.files;else{let l=n[t];if(!l)throw new Error(`Scaffold "${t}" not found`);r=l}let o=r.find(l=>l.includes(uo));if(!o)throw new Error(`No ${uo} found in scaffold "${t}"`);await xu.promises.mkdir(e,{recursive:!0});let s=(await xu.promises.readFile(o,"utf8")).replace(iu,e),a=$o.join(e,uo);await xu.promises.writeFile(a,s,"utf8")},Su=async(e,t,n=ou,r,o=Fe.Existing,i)=>{if(o===Fe.New){try{let s=await vm(n);await bP(e,t,s.scaffoldId,{content:s},n,i)}catch(s){if(s instanceof tt){let a=s.message;throw s.supportedIds?.length&&(a+=`
179
+ Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}return}try{let s=await au(n);await DP(e,t,n,{content:s},r)}catch(s){if(s instanceof tt){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
+ Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},bP=async(e,t,n,r,o,i)=>{let s=`./${e}`,a="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,l=a?$o.dirname(a.extractionRoot):null,c="auth",p=!1,d=!1,m=null;try{let h=Date.now(),g=await T();c="workspaces";let y;if(i)y={id:i};else{let _=await ns(g);if(_.length===0)throw new br("No workspaces found in your account. Please make sure you have at least one workspace.");y=await rs(_)}c="scaffold",await Sa(e,t,n,r,void 0,void 0),d=!0,process.chdir(s);let b=o??n;xe({cloud:{framework:b,workspace_id:y.id}}),Gn({apiToken:g,directory:"."}),process.env.WEBFLOW_API_TOKEN=g;let S=Date.now()-h;try{await F.forCloud({authToken:g}).sendUsage("project_init",{scaffold:b,scaffoldName:b,initMode:Fe.New,workspaceId:y.id,totalDuration:S,mountPath:t,namespace:ts()})}catch{}p=!0}catch(h){if(m=h,h instanceof f||h instanceof Error&&h.message.includes("OAuth")){try{await Sa(e,t,n,r),process.chdir(s),xe({cloud:{framework:o??n}}),Gn({directory:"."}),d=!0}catch{}throw u.error(h),new f(h,{skipLogging:!0})}throw h}finally{if(l)try{Ym.default.removeSync(l)}catch{}if(p){let h=iS(e,Fe.New);Ka=()=>u.info(h)}else{let h=rS(c,m,Fe.New),g=sS(e,Fe.New,h,d);Ka=()=>u.info(g)}}},DP=async(e,t,n,r,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,c=l?$o.dirname(l.extractionRoot):null,p="auth",d=!1,m=!1,h=null;try{let g=Date.now();await wP(e,n,r),process.chdir(i);let{manifest:y}=ee(),b=await ze(y,{site:o}),S=b.accessToken,_=b.siteId;if(s=F.forCloud({authToken:S,siteId:_}),p="scaffold",await Sa(".",t,n,r,_,S),m=!0,p="devlink",_){u.info(`${Ce} Running devlink export to fetch your Webflow components`);try{await kP({site:_,apiToken:S}),a=!0}catch(x){ao(x)?u.info(`${Ce} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(x,{prefix:"Failed to run devlink export:"})}}let v=Date.now()-g;await s?.sendUsage("project_init",{scaffold:n,scaffoldName:n,devlinkSyncStatus:a,totalDuration:v,mountPath:t,namespace:ts()}),d=!0}catch(g){h=g,u.error(g);try{await Sa(".",t,n,r),m=!0}catch{}throw new f(g,{skipLogging:!0})}finally{if(c)try{Ym.default.removeSync(c)}catch{}if(d){let g=iS(e,Fe.Existing);Ka=()=>u.info(g)}else{let g=rS(p,h,Fe.Existing),y=sS(e,Fe.Existing,g,m);Ka=()=>u.info(y)}}},kP=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Sc(),HD));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},EP=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=ee();return ym(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},vP=async(e,t,n,r)=>{u.info(je("Validating mount path configuration..."));let o=await Hv(e,t,n);if(o.isValid)u.info(J("Mount path validation passed"));else if(u.info(I(`
181
+ Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:re,a=i.isValid?J(`${i.domain} (mountPath: ${i.mountPaths[0]})`):le(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(r){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 Gm(e,i)}else if(await Jv()&&sn()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await Kv(s);await Gm(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},SP=async(e,t,n,r)=>{Lm("\u{1F3D7}\uFE0F ","Building app");let o=await _v(e,{mountPath:n,telemetry:r?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id});Lm("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await Mv(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},xP=async(e,t,n,r)=>{u.success(`
182
+ \u{1F310} Your cloud app will soon be available at:`);try{let o=r?.domainsOverride??await Vv(e,t,n),i=Gv(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}`)}},CP=e=>{e.site_slug?u.success(`Visit your deployment:
183
183
 
184
- ${kn}/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`)},rP=async(e,t,n,r,o)=>{try{if(await kv(t.completion_url,!!r),r)u.error(`
184
+ ${En()}/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`)},FP=async(e,t,n,r,o)=>{try{if(await Bv(t.completion_url,!!r),r)u.error(`
186
186
  ${k} Deployment failed due to build error.`);else{u.success(`
187
- ${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=ne();sm(s)&&(i=[`${o?.projectName??Ro.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 tP(e,n,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),nP(t)}}catch(i){throw new f(i,{prefix:"Failed to trigger deployment:"})}},oP=(e,t)=>{e&&dv(process.cwd(),e),t&&uv(t)},Nv=async(e,t,n,r)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=xm(process.cwd()),d=r?.telemetry;await d?.sendUsage("cloud_deploy_start",{environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,cloudflareBindings:c,namespace:Zi()});try{ev(u,process.cwd()),o=await yv(e,t,n,r),u.info("\u{1F527} Detecting framework..."),a=await lv(process.cwd(),o.deploy_url,o.environment_id,n),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),ZT(r)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await QT(e,n,o.environment_id,r?.autoPublish),i=await eP(a,o,n,r),u.info(`Starting deployment process for environment: ${t} at mount path: ${n}`);let p=Date.now()-s;await d?.sendUsage("cloud_deploy_success",{duration:p,environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:Zi()})}catch(p){l=p instanceof Error?p:new Error(String(p)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await d?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:n,projectName:r?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:Zi()})}finally{if(oP(a,i),o&&await rP(e,o,n,l,{projectName:r?.projectName}),l)throw new f(l,{skipLogging:!0})}},Mv=e=>{let t=Math.max(...e.map(i=>wt(i).length)),n=R(`\u250C${"\u2500".repeat(t+2)}\u2510`),r=R(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-wt(i).length);return`${R("\u2502")} ${i}${s} ${R("\u2502")}`});return[n,...o,r].join(`
188
- `)},Bv=(e,t)=>{let n=[Ft(`${at} Get started with the following commands:`),K(`cd ${e}`),K("npm install"),K("npm run dev"),K("webflow cloud deploy")];return t!==xe.New&&(n.push(""),n.push(Ft(`${at} Run the following command to export Webflow components when they update:`)),n.push(K("webflow devlink export"))),Mv(n)},Uv=(e,t,n,r=!0)=>{let o=[],i=t===xe.New?"webflow cloud init --new":"webflow cloud init",s=l=>r?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=r?[K(`cd ${e}`)]:[];switch(n){case"auth":o.push(Ft(`${at} ${s("Webflow authentication did not complete.")}`),"",Ft(r?"To finish setup:":"To retry:"),...a,K("webflow auth login"),K(i));break;case"no-sites":o.push(Ft(`${at} ${s("no Webflow sites were found in your account.")}`),"",Ft(r?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,K("webflow cloud init"));break;case"no-workspaces":o.push(Ft(`${at} ${s("no Webflow workspaces were found in your account.")}`),"",Ft(r?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,K("webflow cloud init --new"));break;default:o.push(Ft(`${at} ${s("setup did not complete.")}`),"",Ft(r?"To retry setup:":"To retry:"),...a,K(i));break}return Mv(o)};M();Wn();var To=require("commander");pe();_();M();Wn();function Wv(e,t,n){tt()&&e==="cloud"&&(n.json||u.warn(`${re} ${le(`webflow cloud ${t}`)} is deprecated \u2014 use ${le(`webflow apps ${t}`)} instead.`))}function yu(e,{namespace:t}){e.command("init").description("Bootstrap a new Webflow Cloud app").addOption(new To.Option("-n, --app-name <name>","App name")).addOption(new To.Option("--project-name <name>",`${Mn} 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)").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)").action(async(n,r)=>{$m(t),Wv(t,"init",n),await iP(n,r)})}function wu(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 To.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new To.Option("--project-name <name>",`${Mn} 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 To.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new To.Option("--project-id <appId>",`${Mn} 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(n,r)=>{$m(t),Wv(t,"deploy",n),await sP(n,r)})}var iP=Nm,sP=jm;var Hv=e=>{let t=tt(),n=e.command("cloud").description(t?`${Mn} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");n.command("create").description(`${Mn} 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(Om),n.command("list").description(t?`${Mn} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Mn} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(Lm),yu(n,{namespace:"cloud"}),wu(n,{namespace:"cloud"})};var aS=require("commander");q();C();_();M();X();be();C();lt();lt();C();async function Ua(e,t,n,r){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 J(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new f(`${r}: ${l.status} ${l.statusText}`);let c=await l.json(),d=c[n]??[];o.push(...d);let p=c.pagination?.total??d.length;if(i+=d.length,i>=p||d.length<s)break}return o}function Po(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let n=e;return{items:n[t]??[],nextCursor:n.nextCursor??null}}return{items:[],nextCursor:null}}var aP=100;async function Wa(e,t){let n=[],r=t?.maxPages??aP,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(n.push(...a),s+=1,!l)break;if(o.has(l))throw new f("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=r)throw new f(`Pagination aborted after ${r} pages (safety cap). The result set is larger than expected.`);i=l}return n}var Du=100;function ns(e){return Object.values(e).some(t=>t!==void 0)}function rs(e,t={}){let n=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&n.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&n.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[r,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new f(`List filter "${r}" must be a non-empty value.`,{isUserError:!0});n.push(`${r}=${encodeURIComponent(i)}`)}return n.length>0?`${e}?${n.join("&")}`:e}var lP="1.0.0";function yt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":lP}}async function Tt(e,t={}){let{scopeLabel:n="apps",fallbackPrefix:r,userErrorOn4xx:o=!1}=t,i={};try{i=JSON.parse(await e.text())}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new f(`Missing required scopes for ${n}.
187
+ ${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=ee();ym(s)&&(i=[`${o?.projectName??$o.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 xP(e,n,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),CP(t)}}catch(i){throw new f(i,{prefix:"Failed to trigger deployment:"})}},_P=(e,t)=>{e&&Rv(process.cwd(),e),t&&Av(t)},nS=async(e,t,n,r)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=Nm(process.cwd()),p=r?.telemetry;await p?.sendUsage("cloud_deploy_start",{environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,cloudflareBindings:c,namespace:ts()});try{yv(u,process.cwd()),o=await Lv(e,t,n,r),u.info("\u{1F527} Detecting framework..."),a=await Fv(process.cwd(),o.deploy_url,o.environment_id,n),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),EP(r)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await vP(e,n,o.environment_id,r?.autoPublish),i=await SP(a,o,n,r),u.info(`Starting deployment process for environment: ${t} at mount path: ${n}`);let d=Date.now()-s;await p?.sendUsage("cloud_deploy_success",{duration:d,environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:ts()})}catch(d){l=d instanceof Error?d:new Error(String(d)),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:n,projectName:r?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:ts()})}finally{if(_P(a,i),o&&await FP(e,o,n,l,{projectName:r?.projectName}),l)throw new f(l,{skipLogging:!0})}},oS=e=>{let t=Math.max(...e.map(i=>wt(i).length)),n=I(`\u250C${"\u2500".repeat(t+2)}\u2510`),r=I(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-wt(i).length);return`${I("\u2502")} ${i}${s} ${I("\u2502")}`});return[n,...o,r].join(`
188
+ `)},iS=(e,t)=>{let n=[_t(`${at} Get started with the following commands:`),J(`cd ${e}`),J("npm install"),J("npm run dev"),J("webflow cloud deploy")];return t!==Fe.New&&(n.push(""),n.push(_t(`${at} Run the following command to export Webflow components when they update:`)),n.push(J("webflow devlink export"))),oS(n)},sS=(e,t,n,r=!0)=>{let o=[],i=t===Fe.New?"webflow cloud init --new":"webflow cloud init",s=l=>r?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=r?[J(`cd ${e}`)]:[];switch(n){case"auth":o.push(_t(`${at} ${s("Webflow authentication did not complete.")}`),"",_t(r?"To finish setup:":"To retry:"),...a,J("webflow auth login"),J(i));break;case"no-sites":o.push(_t(`${at} ${s("no Webflow sites were found in your account.")}`),"",_t(r?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,J("webflow cloud init"));break;case"no-workspaces":o.push(_t(`${at} ${s("no Webflow workspaces were found in your account.")}`),"",_t(r?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,J("webflow cloud init --new"));break;default:o.push(_t(`${at} ${s("setup did not complete.")}`),"",_t(r?"To retry setup:":"To retry:"),...a,J(i));break}return oS(o)};M();Vn();var Oo=require("commander");pe();A();M();Vn();function aS(e,t,n){Je()&&e==="cloud"&&(n.json||u.warn(`${re} ${le(`webflow cloud ${t}`)} is deprecated \u2014 use ${le(`webflow apps ${t}`)} instead.`))}function Cu(e,{namespace:t}){e.command("init").description("Bootstrap a new Webflow Cloud app").addOption(new Oo.Option("-n, --app-name <name>","App name")).addOption(new Oo.Option("--project-name <name>",`${Un} 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)").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)").action(async(n,r)=>{Km(t),aS(t,"init",n),await AP(n,r)})}function Fu(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 Oo.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new Oo.Option("--project-name <name>",`${Un} 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 Oo.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new Oo.Option("--project-id <appId>",`${Un} 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(n,r)=>{Km(t),aS(t,"deploy",n),await RP(n,r)})}var AP=qm,RP=Xm;var lS=e=>{let t=Je(),n=e.command("cloud").description(t?`${Un} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");n.command("create").description(`${Un} 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(Jm),n.command("list").description(t?`${Un} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Un} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(zm),Cu(n,{namespace:"cloud"}),Fu(n,{namespace:"cloud"})};var AS=require("commander");q();C();A();M();X();De();C();lt();lt();C();async function Ja(e,t,n,r){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 G(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new f(`${r}: ${l.status} ${l.statusText}`);let c=await l.json(),p=c[n]??[];o.push(...p);let d=c.pagination?.total??p.length;if(i+=p.length,i>=d||p.length<s)break}return o}function Lo(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let n=e;return{items:n[t]??[],nextCursor:n.nextCursor??null}}return{items:[],nextCursor:null}}var IP=100;async function za(e,t){let n=[],r=t?.maxPages??IP,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(n.push(...a),s+=1,!l)break;if(o.has(l))throw new f("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=r)throw new f(`Pagination aborted after ${r} pages (safety cap). The result set is larger than expected.`);i=l}return n}var _u=100;function is(e){return Object.values(e).some(t=>t!==void 0)}function ss(e,t={}){let n=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&n.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&n.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[r,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new f(`List filter "${r}" must be a non-empty value.`,{isUserError:!0});n.push(`${r}=${encodeURIComponent(i)}`)}return n.length>0?`${e}?${n.join("&")}`:e}var TP="1.0.0";function mt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":TP}}async function xt(e,t={}){let{scopeLabel:n="apps",fallbackPrefix:r,userErrorOn4xx:o=!1}=t,i={};try{i=JSON.parse(await e.text())}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new f(`Missing required scopes for ${n}.
189
189
  ${s??""}
190
190
  Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=r?`${r}: `:"",l=o&&e.status>=400&&e.status<500;return new f(`${a}${e.status} ${e.statusText}`+(s?`
191
- ${s}`:""),l?{isUserError:!0}:void 0)}async function cP(e,t,n={}){let r=await J(rs(`${P}/cosmic/apps`,{limit:Du,cursor:t,filters:n}),{headers:yt(e)});if(!r.ok)throw await Tt(r);return Po(await r.json(),"apps")}async function bu(e,t={}){return Wa(n=>cP(e,n,t))}async function ku(e,t){Oe(t,"appId");let n=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}`,{headers:yt(e)});if(!n.ok)throw await Tt(n);return await n.json()}async function Vv(e,t,n){Oe(t,"appId");let r=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...yt(e),"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await Tt(r);return await r.json()}async function Gv(e,t){Oe(t,"appId");let n=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:yt(e)});if(!n.ok)throw await Tt(n);return await n.json()}async function Jv(e,t,n={}){Oe(t,"appId");let r=rs(`${P}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:n.limit,cursor:n.cursor}),o=await J(r,{headers:yt(e)});if(!o.ok)throw await Tt(o);let{items:i,nextCursor:s}=Po(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function uP(e,t,n,r={}){let o=await J(rs(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:Du,cursor:n,filters:r}),{headers:yt(e)});if(!o.ok)throw await Tt(o);return Po(await o.json(),"environments")}async function Eu(e,t,n={}){return Oe(t,"appId"),Wa(r=>uP(e,t,r,n))}function Kv(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 zv(e,t,n,r,o={}){Oe(t,"appId"),Oe(n,"environmentId"),Or(r,"deploymentId");let i=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/buildLogs${Kv(o)}`,{headers:yt(e)});if(!i.ok)throw await Tt(i);return await i.json()}async function qv(e,t,n,r={}){Oe(t,"appId"),Oe(n,"environmentId");let o=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/logs${Kv(r)}`,{headers:yt(e)});if(!o.ok)throw await Tt(o);return await o.json()}async function Xv(e,t,n,r={}){Oe(t,"appId"),Oe(n,"environmentId");let o=await J(rs(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{limit:r.limit,cursor:r.cursor}),{headers:yt(e)});if(!o.ok)throw await Tt(o);let{items:i,nextCursor:s}=Po(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function vu(e,t,n,r,o={}){Oe(t,"appId"),Oe(n,"environmentId"),Or(r,"deploymentId");let i=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}`,{headers:yt(e),signal:o.signal});if(!i.ok)throw await Tt(i);return await i.json()}async function Yv(e,t,n,r,o={}){Oe(t,"appId"),Oe(n,"environmentId"),Or(r,"deploymentId");let i=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/redeploy`,{method:"POST",headers:{...yt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await Tt(i);return await i.json()}async function Bm(e){let t=await T(),n=F.forApps({authToken:t}),r=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=ns(o),s=await bu(t,o);if(await n.sendUsage("apps_list",{duration:Date.now()-r,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=Ce(e.fields,Bc,vr());u.info(Uc(s,a))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list apps:`}))}}q();C();_();M();X();We();C();we();Te();async function Su(e,t={}){let n=await bu(e);if(n.length===0)throw new f("No apps found in this workspace.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||t.json){let o=n.map(i=>` ${i.id} (${i.name})`).join(`
191
+ ${s}`:""),l?{isUserError:!0}:void 0)}async function PP(e,t,n={}){let r=await G(ss(`${P()}/cosmic/apps`,{limit:_u,cursor:t,filters:n}),{headers:mt(e)});if(!r.ok)throw await xt(r);return Lo(await r.json(),"apps")}async function Au(e,t={}){return za(n=>PP(e,n,t))}async function Ru(e,t){ve(t,"appId");let n=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:mt(e)});if(!n.ok)throw await xt(n);return await n.json()}async function cS(e,t,n){ve(t,"appId");let r=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...mt(e),"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await xt(r);return await r.json()}async function uS(e,t){ve(t,"appId");let n=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:mt(e)});if(!n.ok)throw await xt(n);return await n.json()}async function dS(e,t,n={}){ve(t,"appId");let r=ss(`${P()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:n.limit,cursor:n.cursor}),o=await G(r,{headers:mt(e)});if(!o.ok)throw await xt(o);let{items:i,nextCursor:s}=Lo(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function $P(e,t,n,r={}){let o=await G(ss(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:_u,cursor:n,filters:r}),{headers:mt(e)});if(!o.ok)throw await xt(o);return Lo(await o.json(),"environments")}async function as(e,t,n={}){return ve(t,"appId"),za(r=>$P(e,t,r,n))}function pS(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 fS(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Nr(r,"deploymentId");let i=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/buildLogs${pS(o)}`,{headers:mt(e)});if(!i.ok)throw await xt(i);return await i.json()}async function mS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/logs${pS(r)}`,{headers:mt(e)});if(!o.ok)throw await xt(o);return await o.json()}async function gS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(ss(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{limit:r.limit,cursor:r.cursor}),{headers:mt(e)});if(!o.ok)throw await xt(o);let{items:i,nextCursor:s}=Lo(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function Iu(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Nr(r,"deploymentId");let i=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}`,{headers:mt(e),signal:o.signal});if(!i.ok)throw await xt(i);return await i.json()}async function hS(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Nr(r,"deploymentId");let i=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/redeploy`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await xt(i);return await i.json()}async function yS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json",...r.idempotencyKey?{"Idempotency-Key":r.idempotencyKey}:{}},body:JSON.stringify({})});if(!o.ok)throw await xt(o);return await o.json()}async function Zm(e){let t=await T(),n=F.forApps({authToken:t}),r=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=is(o),s=await Au(t,o);if(await n.sendUsage("apps_list",{duration:Date.now()-r,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=_e(e.fields,Jc,xr());u.info(zc(s,a))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list apps:`}))}}q();C();A();M();X();Me();C();be();Oe();async function Tu(e,t={}){let n=await Au(e);if(n.length===0)throw new f("No apps found in this workspace.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||t.json){let o=n.map(i=>` ${i.id} (${i.name})`).join(`
192
192
  `);throw new f(`This workspace has multiple apps. Pass the app id to choose one:
193
- ${o}`,{isUserError:!0,missingFlag:"appId"})}let r=await Me({message:"Select an app:",choices:n.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!r)throw new f("No app selected.",{isUserError:!0});return r}async function Rn(e,t,n){let{manifest:r}=ne();return Io("appId",{flagValue:t,manifest:r,isNoInput:!1,json:n.json,prompt:()=>Su(e,{json:n.json})})}async function Um(e,t){let n=await T(),r=await Rn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await ku(n,r);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=Ce(t.fields,Bc,vr());u.info(Uc([s],a))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app:`}))}}q();C();_();M();X();async function Wm(e,t){let n=await T(),r=await Rn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await Jv(n,r,{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=Ce(t.fields,zk,ua());u.info(Xk(s.customDomains,a)+_i(s.nextCursor))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app domains:`}))}}q();C();_();M();X();async function Hm(e,t){let n=await T(),r=await Rn(n,e,t),o=t.json?void 0:Ce(t.fields,qk,da()),i=F.forApps({authToken:n}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=ns(a),c=await Eu(n,r,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(Yk(c,o))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list app environments:`}))}}q();C();_();M();X();pe();var Vm=["timestamp","message","phase"],Ha="timestamp,message",xu=ut(Vm);function Nr(){return Vm}function dP(e,t){return e==null||e===""?R("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function pP(e,t=Ha.split(",")){return e.map(n=>t.map(r=>dP(n[r],r)).join(" ")).join(`
194
- `)}function Cu(e,t,n){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":pP(e.logs,n)+_i(e.nextCursor)}We();C();we();Te();async function Zv(e,t,n={}){let r=await Eu(e,t);if(r.length===0)throw new f("No environments found for this app.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||n.json){let i=r.map(s=>` ${s.id} (${s.branch})`).join(`
193
+ ${o}`,{isUserError:!0,missingFlag:"appId"})}let r=await Be({message:"Select an app:",choices:n.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!r)throw new f("No app selected.",{isUserError:!0});return r}async function Pn(e,t,n){let{manifest:r}=ee();return Po("appId",{flagValue:t,manifest:r,isNoInput:!1,json:n.json,prompt:()=>Tu(e,{json:n.json})})}async function Qm(e,t){let n=await T(),r=await Pn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await Ru(n,r);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=_e(t.fields,Jc,xr());u.info(zc([s],a))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app:`}))}}q();C();A();M();X();async function eg(e,t){let n=await T(),r=await Pn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await dS(n,r,{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=_e(t.fields,uE,ga());u.info(pE(s.customDomains,a)+Ri(s.nextCursor))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app domains:`}))}}q();C();A();M();X();async function tg(e,t){let n=await T(),r=await Pn(n,e,t),o=t.json?void 0:_e(t.fields,dE,ha()),i=F.forApps({authToken:n}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=is(a),c=await as(n,r,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(fE(c,o))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list app environments:`}))}}q();C();A();M();X();pe();var ng=["timestamp","message","phase"],qa="timestamp,message",Pu=ut(ng);function Mr(){return ng}function OP(e,t){return e==null||e===""?I("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function LP(e,t=qa.split(",")){return e.map(n=>t.map(r=>OP(n[r],r)).join(" ")).join(`
194
+ `)}function $u(e,t,n){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":LP(e.logs,n)+Ri(e.nextCursor)}Me();C();be();Oe();async function wS(e,t,n={}){let r=await as(e,t);if(r.length===0)throw new f("No environments found for this app.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||n.json){let i=r.map(s=>` ${s.id} (${s.branch})`).join(`
195
195
  `);throw new f(`This app has multiple environments. Pass the environment id to choose one:
196
- ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await Me({message:"Select an environment:",choices:r.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new f("No environment selected.",{isUserError:!0});return o}async function et(e,t){let{manifest:n}=ne(),r=await Io("appId",{flagValue:t.appId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Su(e,{json:t.json})}),o=await Io("environmentId",{flagValue:t.environmentId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Zv(e,r,{json:t.json})});return{appId:r,envId:o}}async function Gm(e,t){if(!e)throw new f("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let n=await T(),{appId:r,envId:o}=await et(n,{json:t.json}),i=t.json?void 0:Ce(t.fields,xu,Nr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await zv(n,r,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(Cu(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read build logs:`}))}}q();C();_();M();X();async function Jm(e,t){let n=await T(),{appId:r,envId:o}=await et(n,{environmentId:e,json:t.json}),i=t.json?void 0:Ce(t.fields,xu,Nr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await qv(n,r,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(Cu(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read runtime logs:`}))}}q();C();_();M();X();async function Km(e){let t=await T(),{appId:n,envId:r}=await et(t,{json:e.json}),o=e.json?void 0:Ce(e.fields,Vc,Sr()),i=F.forApps({authToken:t}),s=Date.now();try{let a=await Xv(t,n,r,{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(fa(a.deployments,o)+_i(a.nextCursor))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list deployments:`}))}}q();pe();C();we();_();M();X();var fP=5,Qv=1800;function mP(e){return new Promise(t=>setTimeout(t,e))}async function eS(e,t,n,r,o={}){let i=Math.min(Qv,Math.max(fP,o.interval??Wc)),s=Math.min(Qv,Math.max(1,o.timeout??Hc)),a=Date.now()+s*1e3,l,c,d=!1;for(;;){let p=new AbortController,m=setTimeout(()=>p.abort(),Math.max(0,a-Date.now())),h;try{h=await vu(e,t,n,r,{signal:p.signal})}catch(b){if(p.signal.aborted){d=!0;break}throw b}finally{clearTimeout(m)}c=h;let g=h.status;if(Qk(g))break;let y=a-Date.now();if(y<=0){d=!0;break}if(g!==l&&o.onStatusChange?.(l,g),l=g,await mP(Math.min(i*1e3,y)),Date.now()>=a){d=!0;break}}return{deployment:c,timedOut:d,timeoutSeconds:s}}async function zm(e,t){let n=await T(),{appId:r,envId:o}=await et(n,{json:t.json}),i=t.json?void 0:Ce(t.fields,Vc,Sr()),s=F.forApps({authToken:n}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let d=!t.json&&!V(),{deployment:p,timedOut:m,timeoutSeconds:h}=await eS(n,r,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:d?(y,b)=>u.info(R(y===void 0?b:`${y} \u2192 ${b}`)):void 0}),g=m?"timeout":p?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:g}),process.exitCode=!m&&p?.status==="success"?0:1,t.json){u.info(JSON.stringify(p??null,null,2));return}p&&u.info(fa([p],i)),m&&u.warn(`Timed out after ${h}s waiting for a terminal status (last status: ${p?.status??"unknown"}).`);return}let c=await vu(n,r,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(fa([c],i))}catch(c){throw c instanceof f&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new f(c,{prefix:`${k} Failed to ${t.wait?"watch":"get"} deployment:`}))}}q();pe();C();_();M();X();async function qm(e,t){let n=await T(),{appId:r,envId:o}=await et(n,{json:t.json});if(t.dryRun){Oe(r,"appId"),Oe(o,"environmentId"),Or(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:r,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${r}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:n,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await Yv(n,r,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(`${je} Redeploy in progress \u2014 commit ${l} ${R("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to redeploy deployment:`}))}}q();C();_();M();X();async function Xm(e,t){if(t.name===void 0&&t.description===void 0)throw new f("Provide --name or --description",{isUserError:!0});let n=await T(),r=await Rn(n,e,t);if(Oe(r,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${r}`),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=F.forApps({authToken:n}),i=Date.now();try{let s=await Vv(n,r,{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 f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to update app:`}))}}q();C();we();Te();_();M();X();async function Ym(e,t){let n=await T(),r=await Rn(n,e,t);if(Oe(r,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new f("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await ku(n,r),a=Zk(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${r}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await Re({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=F.forApps({authToken:n}),i=Date.now();try{let s=await Gv(n,r);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 f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to delete app:`}))}}q();C();_();M();X();be();C();lt();var os=100;function Zm(e,t){return`${P}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function Qm(e,t){return Tt(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function gP(e,t,n,r,o={}){let i=rs(Zm(t,n),{limit:Du,cursor:r,filters:o}),s=await J(i,{headers:yt(e)});if(!s.ok)throw await Qm(s,"Failed to list environment variables");return Po(await s.json(),"variables")}async function eg(e,t,n,r={}){return Wa(o=>gP(e,t,n,o,r))}async function tg(e,t,n,r){let o=await J(`${Zm(t,n)}/${encodeURIComponent(r)}`,{method:"DELETE",headers:yt(e)});if(!o.ok)throw await Qm(o,"Failed to delete environment variable")}async function Va(e,t,n,r,o){let i=Object.keys(r).length;if(i>os)throw new f(`Cannot import more than ${os} variables at once (received ${i}).`,{isUserError:!0});let s=await J(`${Zm(t,n)}/bulk`,{method:"POST",headers:{...yt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:r,overwriteExisting:o})});if(!s.ok)throw await Qm(s,"Failed to import environment variables");return await s.json()}var tS=require("dotenv");pe();var nS=["key","isSecret","value","id","environmentId"],Ga=["key","isSecret"];function is(){return nS}var ng=ut(nS);function hP(e,t){switch(t){case"value":return e.isSecret?R("(secret)"):e.value!==""?e.value:R("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):R("\u2014")}}function rg(e,t=Ga){if(e.length===0)return R("No environment variables found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>hP(o,i)));return ze(n,r)}function og(e){let t=e.split(/\r?\n/).map(n=>n.replace(/^\s*export\s+/,"")).join(`
197
- `);return(0,tS.parse)(t)}async function ig(e){let t=await T(),n=F.forAppsEnvVars({authToken:t}),r=Date.now();try{let{appId:o,envId:i}=await et(t,e),s={key:e.key,q:e.q},a=ns(s),l=await eg(t,o,i,s);if(await n.sendUsage("apps_env_vars_list",{duration:Date.now()-r,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=Ce(e.fields,ng,is());u.info(rg(l,c))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list environment variables:`}))}}q();C();_();M();X();C();we();Te();_();M();async function rS(){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 sg(e){u.warn(`${re} 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 oS(e,t){if(e!==void 0)return t.secret&&!t.json&&sg(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let n=await rS();if(n==="")throw new f(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:n,source:"stdin"}}if(!V()){let n=t.secret?await rD({message:`Enter the value for ${t.key}:`}):await Je({message:`Enter the value for ${t.key}:`});if(n===null||n==="")throw new f(`No value provided for ${t.key}.`,{isUserError:!0});return{value:n,source:"prompt"}}throw new f(`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 ag(e,t,n){let r=n.secret?" (secret)":"",o=await T(),i=F.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await et(o,n);if(n.dryRun){t!==void 0&&n.secret&&!n.json&&sg(e),n.json?u.info(JSON.stringify({key:e,...n.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${r} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:d}=await oS(t,{key:e,secret:n.secret,json:n.json}),p={[e]:{value:c,...n.secret?{isSecret:!0}:{}}},m=await Va(o,a,l,p,!0),h=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!h){let y=m.errors.find(b=>b.key===e);throw new f(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let g=h.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:n.secret?"secret":"plain",valueSource:d}),n.json){u.info(JSON.stringify({key:e,isSecret:g,status:"set"},null,2));return}u.info(`${$} Set ${e}${g?" (secret)":""}`)}catch(c){throw c instanceof f&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new f(c,{prefix:`${k} Failed to set environment variable:`}))}}q();C();_();M();X();async function lg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await et(n,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 tg(n,i,s,e),await r.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 f&&a.isUserError?a:(await r.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new f(a,{prefix:`${k} Failed to delete environment variable:`}))}}var iS=require("fs"),sS=require("path");q();C();_();M();X();function cg(e){return e.map(({id:t,environmentId:n,key:r,isSecret:o})=>({id:t,environmentId:n,key:r,isSecret:o}))}async function ug(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await et(n,t),a;try{a=(0,iS.readFileSync)((0,sS.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=og(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>os)throw new f(`Cannot import more than ${os} variables at once (${e} has ${c.length}).`,{isUserError:!0});let d={};for(let p of c)d[p]={value:l[p],...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 p of c)u.info(` ${p}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let p=await Va(n,i,s,d,!0);if(await r.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:p.created.length,updatedCount:p.updated.length,skippedCount:p.skipped.length,errorCount:p.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:cg(p.created),updated:cg(p.updated),skipped:cg(p.skipped),errors:p.errors},null,2));else{u.info(`${$} Imported: ${p.created.length} created, ${p.updated.length} updated, ${p.skipped.length} skipped, ${p.errors.length} failed`);for(let m of p.errors)u.warn(` ${m.key}: ${m.error}`)}if(p.errors.length>0)throw new f(`Import completed with ${p.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(p){throw p instanceof f&&p.isUserError?p:(await r.sendError(p instanceof Error?p:new Error(String(p)),"apps_env_vars_import",{duration:Date.now()-o}),new f(p,{prefix:`${k} Failed to import environment variables:`}))}}Wn();var lS=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");yu(t,{namespace:"apps"}),wu(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. ${Gc("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.",Ai).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ai).addOption(Jc("the app name")).addOption(oe()).addOption(He([...vr()]).default(Nc)).action(Bm),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(oe()).addOption(He([...vr()]).default(Yf)).action(Um),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(He([...ua()]).default(jc)).addOption(oe()).option("--limit <n>","Max number of domains to return (server caps at 100)",Xc).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Wm),tt()&&(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(oe()).addOption(Pe()).action(Xm),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(oe()).addOption(Pe()).action(Ym)),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). ${Gc("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.",Ai).addOption(Jc("the environment branch")).addOption(He([...da()]).default(Mc)).addOption(oe()).action(Hm);let r=t.command("deployments").description("Inspect Webflow Cloud deployments");r.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(nE()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(oe()).addOption(He([...Sr()]).default(pa)).action(Km),r.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 aS.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(oE()).addOption(iE()).addOption(oe()).addOption(He([...Sr()]).default(pa)).action(zm),r.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(oe()).addOption(Pe()).action(qm);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(oe()).addOption(He([...Nr()]).default(Ha)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(rm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Gm),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(oe()).addOption(He([...Nr()]).default(Ha)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(rm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Jm);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). ${Gc("variable","--key")} Secret values are never returned.`).addOption(ma()).addOption(ga()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ai).addOption(Jc("the variable key")).addOption(oe()).addOption(He([...is()]).default(Ga.join(","))).action(ig),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(ma()).addOption(ga()).addOption(nm()).addOption(Pe()).addOption(oe()).action(ag),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ma()).addOption(ga()).addOption(Pe()).addOption(oe()).action(lg),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(ma()).addOption(ga()).addOption(nm()).addOption(Pe()).addOption(oe()).action(ug)};be();C();lt();C();function Z(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new f(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}async function Tn(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function cS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok){let o=await Tn(n);throw n.status>=400&&n.status<500?new f(o,{isUserError:!0}):new f(`Failed to list collections: ${o}`)}return(await n.json()).collections??[]}async function uS(e,t){Z(t,"collectionId");let n=await J(`${P}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!n.ok)throw new f(`Failed to get collection: ${await Tn(n)}`);let r=await n.json();return{...r,fields:r.fields??[]}}async function dS(e,t,n){Z(t,"siteId");let r={displayName:n.displayName,singularName:n.singularName};n.slug&&(r.slug=n.slug);let o=await J(`${P}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!o.ok){let i=await Tn(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create collection: ${i}`)}return await o.json()}async function pS(e,t,n){Z(t,"collectionId");let r=await J(`${P}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:n.displayName,type:n.type,isRequired:n.isRequired??!1})});if(!r.ok){let o=await Tn(r);throw r.status===404?new f(`Collection "${t}" not found`,{isUserError:!0}):r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to create field: ${o}`)}return await r.json()}async function dg(e,t,n={}){Z(t,"collectionId");let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset)),n.cmsLocaleId&&r.set("cmsLocaleId",n.cmsLocaleId);let o=r.toString()?`?${r.toString()}`:"",i=await J(`${P}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to list items: ${await Tn(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??n.limit??100,offset:s.offset??n.offset??0}}async function fS(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=r?`?cmsLocaleId=${encodeURIComponent(r)}`:"",i=await J(`${P}/v2/collections/${t}/items/${n}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to get item: ${await Tn(i)}`);return await i.json()}async function pg(e,t,n,r=!1){Z(t,"collectionId");let o=await J(`${P}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n,isDraft:r})});if(!o.ok){let i=await Tn(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create item: ${i}`)}return await o.json()}async function fg(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=await J(`${P}/v2/collections/${t}/items/${n}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r})});if(o.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!o.ok)throw new f(`Failed to update item: ${await Tn(o)}`);return await o.json()}async function mS(e,t,n){Z(t,"collectionId"),Z(n,"itemId");let r=await J(`${P}/v2/collections/${t}/items/${n}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!r.ok)throw new f(`Failed to delete item: ${await Tn(r)}`)}async function gS(e,t,n){Z(t,"collectionId"),n.forEach(o=>Z(o,"itemId"));let r=await J(`${P}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:n})});if(!r.ok){let o=await Tn(r);throw r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to publish items: ${o}`)}return await r.json()}pe();q();We();async function Fu(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=ne(),n=await Ke(t);return{token:n.accessToken,siteId:n.siteId}}function hS(e,t=["id","displayName","slug"]){if(e.length===0)return R("No collections found.");let n=["id","displayName","singularName","slug","lastUpdated"],r=Object.fromEntries(n.map(a=>[a.toLowerCase(),a])),o=t.map(a=>r[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Mt(`Invalid fields. Available: ${n.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:R("\u2014")}));return ze(i,s)}function yS(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(R(" No fields defined.")),t.join(`
198
- `);let n=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),r=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(ze(n,r)),t.join(`
199
- `)}function wS(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return R("No items found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?le("draft"):K("live");if(i==="isArchived")return o.isArchived?R("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"}):R("\u2014")}let s=o[i];return s==null?R("\u2014"):String(s)}));return ze(n,r)}C();_();M();function _u(e,t,n="asc"){return[...e].sort((r,o)=>{let i=r[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)),n==="desc"?-a:a})}X();async function mg(e){let{token:t,siteId:n}=await Fu(e),r=F.forCms({authToken:t,siteId:n}),o=Date.now();try{let i=await cS(t,n);if(await r.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 f(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=_u(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(hS(a,l))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list collections:`})}}q();C();_();M();X();async function gg(e,t){let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await uS(n,e);if(await r.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(yS(i))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get collection:`})}}C();_();M();X();async function hg(e){let t=e.singularName??e.name,n=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:n},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:r,siteId:o}=await Fu(e),i=F.forCms({authToken:r,siteId:o}),s=Date.now();try{let a=await dS(r,o,{displayName:e.name,singularName:t,slug:n});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(`
200
- Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof f&&a.isUserError){u.info(`${k} ${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 f(a,{prefix:`${k} Failed to create collection:`})}}q();C();_();M();X();async function yg(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(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await pS(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await n.sendUsage("cms_fields_create",{duration:Date.now()-r}),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 f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to create field:`})}}q();C();_();M();X();async function wg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await dg(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await n.sendUsage("cms_items_list",{duration:Date.now()-r,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(p=>p.trim());u.info(wS(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let p=s.total>0?` of ${s.total}`:"";u.info(`
201
- Showing ${l}\u2013${c}${p} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof f&&s.isUserError){u.info(`${k} ${s.message}`),process.exitCode=1;return}throw await n.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-r}),new f(s,{prefix:`${k} Failed to list items:`})}}q();C();_();M();X();async function Dg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await fS(t,e.collection,e.item,e.locale);if(await n.sendUsage("cms_items_get",{duration:Date.now()-r}),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 f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get item:`})}}q();C();_();M();X();async function bg(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`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 n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await pg(n,e.collection,t,e.draft??!1);if(await r.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 f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to create item:`})}}q();C();_();M();X();async function kg(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`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 n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await fg(n,e.collection,e.item,t);if(await r.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 f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update item:`})}}q();C();_();M();X();async function Eg(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(),n=F.forCms({authToken:t}),r=Date.now();try{await mS(t,e.collection,e.item),await n.sendUsage("cms_items_delete",{duration:Date.now()-r,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to delete item:`})}}q();C();_();M();X();async function vg(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 n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await gS(n,e.collection,t);if(await r.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 f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to publish items:`})}}var DS=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),n=t.command("collections").description("Manage CMS collections");n.command("list").description("List all CMS collections for a site").addOption(It()).addOption(oe()).addOption(He(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Ti(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ri()).action(mg),n.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(oe()).action(gg),n.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(It()).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(Pe()).addOption(oe()).action(hg),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(Pe()).addOption(oe()).action(yg);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(zc()).addOption(qc()).addOption(oe()).addOption(He(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(wg),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(oe()).action(Dg),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(Pe()).addOption(oe()).action(bg),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(Pe()).addOption(oe()).action(kg),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(Pe()).action(Eg),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(Pe()).addOption(oe()).action(vg)};q();pe();C();_();M();We();X();be();lt();C();C();pe();var bS={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 Au(e,t){let n=e.split(".").pop()?.toLowerCase()??"",r=bS[n];if(!r){let o=Object.keys(bS).join(", ");throw new f(`Unsupported file type ".${n}". Allowed types: ${o}`,{isUserError:!0})}if(t>r.maxBytes){let o=r.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new f(`File too large: ${i} MB exceeds the ${o} MB limit for ${r.category} files.`,{isUserError:!0})}}var Sg=["id","displayName","originalFileName","contentType","size","lastUpdated"];function kS(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return R("No assets found.");let n=Object.fromEntries(Sg.map(l=>[l.toLowerCase(),l])),r=t.map(l=>n[l.toLowerCase()]).filter(l=>l!=null);if(r.length===0)return Mt(`Invalid fields. Available: ${Sg.join(", ")}`);let o=t.filter(l=>n[l.toLowerCase()]==null),i=o.length>0?le(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Sg.join(", ")}
202
- `):"",s=r.map(l=>se(l)),a=e.map(l=>r.map(c=>{let d=l[c];if(d==null||c==="size"&&d===0)return R("\u2014");if(c==="size")return yP(Number(d));if(c==="lastUpdated"){let m=new Date(String(d)),h=String(m.getMonth()+1).padStart(2,"0"),g=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),b=String(m.getHours()).padStart(2,"0"),S=String(m.getMinutes()).padStart(2,"0");return`${h}/${g}/${y} ${b}:${S}`}let p=String(d);return c==="displayName"&&p.length>40?R("\u2026")+p.slice(-39):p}));return i+ze(s,a)}function yP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ES(e){if(e.length===0)return R("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),n=["id","displayName","assets","lastUpdated"].map(o=>se(o)),r=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(n,r)}async function vS(e,t,n={}){if(Z(t,"siteId"),n.folderId){Z(n.folderId,"folderId");let a=await wP(e,n.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],d=0,p=100;for(;;){let b=await J(`${P}/v2/sites/${t}/assets?limit=${p}&offset=${d}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!b.ok)throw new f(`Failed to list assets: ${b.status} ${b.statusText}`);let S=await b.json(),A=S.assets??[];c.push(...A);let v=S.pagination?.total??0;if(d+=A.length,d>=v||A.length===0)break}let m=c.filter(b=>l.has(b.id)),h=n.offset??0,g=n.limit??m.length,y=m.slice(h,h+g);return{assets:y,pagination:{total:m.length,limit:y.length,offset:h}}}let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset));let o=r.toString(),i=await J(`${P}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new f(`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 SS(e,t,n,r,o){Z(t,"siteId"),o&&Z(o,"folderId");let i=na(n);Au(i.meta.title,i.meta.size);let s=r??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await J(`${P}/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 f(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),d={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 oa(i,d)}catch(p){throw await J(`${P}/v2/assets/${d._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),p}return{id:d._id,hostedUrl:d.s3Url,displayName:s,originalFileName:i.meta.title}}async function xS(e,t,n){Z(t,"assetId");let r=await J(`${P}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new f(`Failed to update asset: ${r.status} ${r.statusText}`);return await r.json()}async function wP(e,t){Z(t,"folderId");let n=await J(`${P}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get folder: ${n.status} ${n.statusText}`);return await n.json()}async function CS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to list folders: ${n.status} ${n.statusText}`);return(await n.json()).assetFolders??[]}async function FS(e,t,n,r){Z(t,"siteId"),r&&Z(r,"parentFolderId");let o={displayName:n};r&&(o.parentFolder=r);let i=await J(`${P}/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 f(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function xg(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ne(),s=await Ke(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let{assets:i,pagination:s}=await vS(t,n,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await r.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 d=_u(i,l,c);if(e.json){u.info(JSON.stringify({assets:d,pagination:s},null,2));return}let p=e.fields.split(",").map(h=>h.trim());u.info(kS(d,p));let m=(e.offset??0)+i.length;m<s.total&&u.info(R(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list assets:`})}}q();C();_();M();We();X();async function Cg(e,t){let n=na(e);if(Au(n.meta.title,n.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 r,o;if(t.site)r=await T(),o=t.site;else{let{manifest:a}=ne(),l=await Ke(a);r=l.accessToken,o=l.siteId}let i=F.forAssets({authToken:r,siteId:o}),s=Date.now();try{let a=await SS(r,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 f(a,{prefix:`${k} Failed to upload asset:`})}}q();C();_();M();X();async function Fg(e,t){if(!t.altText&&!t.displayName)throw new f("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 n=await T(),r=F.forAssets({authToken:n}),o=Date.now();try{let i=await xS(n,e,{altText:t.altText,displayName:t.displayName});if(await r.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 r.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update asset:`})}}q();C();_();M();We();X();async function _g(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ne(),s=await Ke(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let i=await CS(t,n);if(await r.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(ES(i))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list folders:`})}}q();C();_();M();js();X();async function Ag(e,t){let n,r;if(t.site)n=await T(),r=t.site;else{let{manifest:s}=ne(),a=await Ke(s);n=a.accessToken,r=a.siteId}let o=F.forAssets({authToken:n,siteId:r}),i=Date.now();try{let s=await FS(n,r,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 f(s,{prefix:`${k} Failed to create folder:`})}}var _S=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(It()).option("--folder <folderId>","Filter by folder ID").addOption(oe()).addOption(He(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(zc()).addOption(qc()).addOption(Ti(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ri()).action(xg),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
203
- 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(It()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(Pe()).addOption(oe()).action(Cg),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(Pe()).addOption(oe()).action(Fg);let n=t.command("folders").description("Manage asset folders");n.command("list").description("List all asset folders for a site").addOption(It()).addOption(oe()).action(_g),n.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(It()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(oe()).action(Ag)};q();C();_();M();X();be();C();lt();async function AS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get site: ${n.status} ${n.statusText}`);return await n.json()}async function IS(e){return Ua(`${P}/v2/sites`,e,"sites","Failed to list sites")}async function RS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get custom domains: ${n.status} ${n.statusText}`);return(await n.json()).customDomains??[]}async function TS(e,t,n=[],r){Z(t,"siteId"),r&&Z(r,"pageId");let o=n.length>0?{customDomains:n}:{publishToWebflowSubdomain:!0};r&&(o.pageId=r);let i=await J(`${P}/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 f(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();pe();var Ig=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],PS=ut(Ig);function $S(){return Ig}function OS(e,t=["id","displayName","lastPublished"]){if(e.length===0)return R("No sites found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${Ig.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=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:R("\u2014")}));return ze(n,r)}function LS(e){if(e.length===0)return R("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],n=e.map(r=>[r.id,r.url,r.lastPublished?new Date(r.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):R("\u2014")]);return ze(t,n)}async function Rg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await IS(t);if(await n.sendUsage("sites_list",{duration:Date.now()-r,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=Ce(e.fields,PS,$S());u.info(OS(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list sites:`}))}}q();C();_();M();X();async function Tg(e,t){let n=await T(),r=F.forSites({authToken:n}),o=Date.now();try{let i=await AS(n,e);if(await r.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 f&&i.isUserError?i:(await r.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get site:`}))}}q();C();_();M();X();async function Pg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await RS(t,e.site);if(await n.sendUsage("sites_domains",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(LS(o))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get custom domains:`}))}}q();C();_();M();X();async function $g(e){if(Z(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(),n=F.forSites({authToken:t}),r=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await TS(t,e.site,o,e.page);if(await n.sendUsage("sites_publish",{duration:Date.now()-r,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 f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to publish site:`}))}}q();q();be();C();we();Te();_();M();We();X();be();lt();C();var Iu="not_enterprise_plan_workspace";async function NS(e,t,n){Z(t,"workspaceId");let r=n.trim();if(!r)throw new f("Site name cannot be empty.",{isUserError:!0});let o=await J(`${P}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:r})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===Iu?new f("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:Iu}):a==="missing_scopes"?new f(`Your token is missing the 'workspace:write' scope.
204
- Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new f(`Failed to create site "${r}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new f("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??r,shortName:i.shortName??""}}function DP(e){Se({siteId:e.id});let{manifestPath:t}=ne();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function bP(e,t){let n=new Map;for(let i of t)i.workspaceId&&n.set(i.workspaceId,(n.get(i.workspaceId)??0)+1);let r=[...n.keys()];if(r.length===1)return r[0];if(r.length===0){let i=await Qi(e);if(i.length===0)throw new f("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new f(`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 es(i)).id}if(V())throw new f(`This token's sites span ${r.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:r.map(i=>({name:`${i} (${n.get(i)} site${n.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new f("No workspace selected.",{isUserError:!0});return o}async function kP(e,t){if(u.warn(`${k} ${t.message}
205
- Create the site in the Webflow dashboard: ${kn}/dashboard
206
- then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await Re({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let r=await hr(e);if(r.length===0)throw new f("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 hi(r),created:!1}}async function EP(e,t,n){let r=await bP(e,t),o=n.name;if(o||(o=await Je({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new f("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await NS(e,r,o)}catch(s){if(s instanceof f&&s.code===Iu)return kP(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function Ru(e={}){let t=await T({apiToken:e.apiToken}),n=F.forSites({authToken:t}),r=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new f("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await hr(t),s;if(e.siteId){Z(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new f(`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 f("`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 EP(t,i,e);s=l.site,o=l.created}else s=await hi(i)}DP(s),await n.sendUsage("site_init",{duration:Date.now()-r,created:o})}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-r}),i instanceof f?i:new f(i,{prefix:`${k} Failed to initialize site:`})}}q();pe();C();_();M();X();be();lt();C();function vP(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function SP(e,t){let n=await t.text(),r;try{r=JSON.parse(n)}catch{}throw t.status===404&&r?.error==="Not found"&&!r.code?new f(`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}):r?.code==="SCHEMA_STALE"?new f(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):r?.code&&r.error?new f(`Failed to ${e}: ${r.error} (${r.code})`,{isUserError:t.status<500}):new f(`Failed to ${e}: ${t.status} ${t.statusText}${vP(n)}`)}async function jS(e,t,n,r){let o=await J(`${kn}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});o.ok||await SP(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new f(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function Ja(e,t,n){Z(t,"siteId");let r=await jS("pull the site files","pull",e,{siteId:t,...n?.pageIds&&n.pageIds.length>0?{pageIds:n.pageIds}:{},...n?.manifestOnly?{manifestOnly:!0}:{}});return{...r,pages:r.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function MS(e,t,n,r){Z(t,"siteId");let o=await jS("push the site files","push",e,{siteId:t,changes:n,...r?.conflictPolicy?{conflictPolicy:r.conflictPolicy}:{},...r?.schemaHash?{schemaHash:r.schemaHash}:{}});if(!Array.isArray(o.results))throw new f("Invalid response from the WFS Sync API: expected a `results` array.");return o}We();q();C();var Tu=require("path");function Og(e){return e.split(Tu.sep).join("/").replace(/\\/g,"/")}function $o(e){if(e===""||e.includes("\0")||(0,Tu.isAbsolute)(e))return!1;let t=Og(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(n=>n==="..")}var xP={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},BS={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 CP(e){return e.endsWith("/")?e.slice(0,-1):e}function US(e,t,n){let r=e.trim();if(!$o(r))throw new f(`"site.layout.${t}" in ${n} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=r.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new f(`"site.layout.${t}" in ${n} must name a directory inside the project, not "${e}".`,{isUserError:!0});return CP(o)}function FP(e,t,n){let r=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(r.length,o.length)-1&&r[s]===o[s];s++)i.push(r[s]);return i.length>0?`${i.join("/")}/${n}`:n}function _P(e,t){let n=e?.layout;if(!n)return xP;let r=n.preset?BS[n.preset]:void 0;if(n.preset&&!r)throw new f(`Unknown "site.layout.preset" value "${n.preset}" in ${t}. Known presets: ${Object.keys(BS).join(", ")}.`,{isUserError:!0});let o=n.pagesRoot??r?.pagesRoot,i=n.componentsRoot??r?.componentsRoot;if(!o||!i)throw new f(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=n.pagesShape??r?.pagesShape??"flat",a=US(o,"pagesRoot",t),l=US(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:FP(a,l,"theme")}}function ss(e){let{manifest:t,manifestPath:n}=ne(),r=e?.trim();r&&Z(r,"site-id");let o=r||no(t);if(!o||o.trim()==="")throw new f(`Missing "siteId" in ${n}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=_P(t.site,n);return{siteId:o,layout:i}}var rr=require("@babel/types");var WS=require("@babel/parser");function Xt(e){try{return(0,WS.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function*jr(e){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let t of e)yield*jr(t);return}if(typeof e.type=="string"){yield e;for(let[t,n]of Object.entries(e))t==="loc"||t==="leadingComments"||t==="trailingComments"||(yield*jr(n))}}}function Mr(e,t){if(t.length===0)return e;let n=e;for(let{start:r,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))n=n.slice(0,r)+i+n.slice(o);return n}function HS(e){let t;for(let n of jr(e.program))if((0,rr.isCallExpression)(n)&&(0,rr.isIdentifier)(n.callee,{name:"component"})&&(0,rr.isObjectExpression)(n.arguments[0])){let r=n.arguments[0];(t===void 0||(r.start??0)<(t.start??0))&&(t=r)}return t}function VS(e){return e.properties.some(t=>(0,rr.isObjectProperty)(t)&&!t.computed&&(0,rr.isIdentifier)(t.key,{name:"id"}))}function GS(e,t){let n=Xt(e),r=n&&HS(n);if(!r||r.start==null||VS(r))return;let o=r.start,i=e.slice(o+1);if(i.slice(0,i.includes(`
196
+ ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await Be({message:"Select an environment:",choices:r.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new f("No environment selected.",{isUserError:!0});return o}async function Xe(e,t){let{manifest:n}=ee(),r=await Po("appId",{flagValue:t.appId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Tu(e,{json:t.json})}),o=await Po("environmentId",{flagValue:t.environmentId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>wS(e,r,{json:t.json})});return{appId:r,envId:o}}async function rg(e,t){if(!e)throw new f("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json}),i=t.json?void 0:_e(t.fields,Pu,Mr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await fS(n,r,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($u(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read build logs:`}))}}q();C();A();M();X();async function og(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{environmentId:e,json:t.json}),i=t.json?void 0:_e(t.fields,Pu,Mr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await mS(n,r,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($u(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read runtime logs:`}))}}q();C();A();M();X();async function ig(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=e.json?void 0:_e(e.fields,Yc,Cr()),i=F.forApps({authToken:t}),s=Date.now();try{let a=await gS(t,n,r,{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(wa(a.deployments,o)+Ri(a.nextCursor))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list deployments:`}))}}q();pe();C();be();A();M();X();var NP=5,bS=1800;function jP(e){return new Promise(t=>setTimeout(t,e))}async function DS(e,t,n,r,o={}){let i=Math.min(bS,Math.max(NP,o.interval??qc)),s=Math.min(bS,Math.max(1,o.timeout??Xc)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let d=new AbortController,m=setTimeout(()=>d.abort(),Math.max(0,a-Date.now())),h;try{h=await Iu(e,t,n,r,{signal:d.signal})}catch(b){if(d.signal.aborted){p=!0;break}throw b}finally{clearTimeout(m)}c=h;let g=h.status;if(gE(g))break;let y=a-Date.now();if(y<=0){p=!0;break}if(g!==l&&o.onStatusChange?.(l,g),l=g,await jP(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function sg(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json}),i=t.json?void 0:_e(t.fields,Yc,Cr()),s=F.forApps({authToken:n}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!V(),{deployment:d,timedOut:m,timeoutSeconds:h}=await DS(n,r,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,b)=>u.info(I(y===void 0?b:`${y} \u2192 ${b}`)):void 0}),g=m?"timeout":d?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:g}),process.exitCode=!m&&d?.status==="success"?0:1,t.json){u.info(JSON.stringify(d??null,null,2));return}d&&u.info(wa([d],i)),m&&u.warn(`Timed out after ${h}s waiting for a terminal status (last status: ${d?.status??"unknown"}).`);return}let c=await Iu(n,r,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(wa([c],i))}catch(c){throw c instanceof f&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new f(c,{prefix:`${k} Failed to ${t.wait?"watch":"get"} deployment:`}))}}q();pe();C();A();M();X();async function ag(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json});if(t.dryRun){ve(r,"appId"),ve(o,"environmentId"),Nr(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:r,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${r}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:n,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await hS(n,r,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(`${Ce} Redeploy in progress \u2014 commit ${l} ${I("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to redeploy deployment:`}))}}q();pe();C();var kS=require("child_process");function ES(){try{let e=(0,kS.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}A();M();X();function MP(e){let t=ES();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function BP(e,t,n){try{return(await as(e,t)).find(o=>o.id===n)}catch{return}}async function lg(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=await BP(t,n,r);if(MP(o?.branch),e.dryRun){ve(n,"appId"),ve(r,"environmentId"),e.json?u.info(JSON.stringify({appId:n,environmentId:r,branch:o?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${o?.branch?`\`${o.branch}\` `:""}in app ${n}, environment ${r}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:t,suppressCommand:!!e.idempotencyKey}),s=Date.now();try{let a=await yS(t,n,r,{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(`${Ce} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${Ce} Trigger in progress ${I("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_trigger",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to trigger deployment:`}))}}q();C();A();M();X();async function cg(e,t){if(t.name===void 0&&t.description===void 0)throw new f("Provide --name or --description",{isUserError:!0});let n=await T(),r=await Pn(n,e,t);if(ve(r,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${r}`),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=F.forApps({authToken:n}),i=Date.now();try{let s=await cS(n,r,{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 f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to update app:`}))}}q();C();be();Oe();A();M();X();async function ug(e,t){let n=await T(),r=await Pn(n,e,t);if(ve(r,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new f("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await Ru(n,r),a=mE(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${r}`),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=F.forApps({authToken:n}),i=Date.now();try{let s=await uS(n,r);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 f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to delete app:`}))}}q();C();A();M();X();De();C();lt();var ls=100;function dg(e,t){return`${P()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function pg(e,t){return xt(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function UP(e,t,n,r,o={}){let i=ss(dg(t,n),{limit:_u,cursor:r,filters:o}),s=await G(i,{headers:mt(e)});if(!s.ok)throw await pg(s,"Failed to list environment variables");return Lo(await s.json(),"variables")}async function fg(e,t,n,r={}){return za(o=>UP(e,t,n,o,r))}async function mg(e,t,n,r){let o=await G(`${dg(t,n)}/${encodeURIComponent(r)}`,{method:"DELETE",headers:mt(e)});if(!o.ok)throw await pg(o,"Failed to delete environment variable")}async function Xa(e,t,n,r,o){let i=Object.keys(r).length;if(i>ls)throw new f(`Cannot import more than ${ls} variables at once (received ${i}).`,{isUserError:!0});let s=await G(`${dg(t,n)}/bulk`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:r,overwriteExisting:o})});if(!s.ok)throw await pg(s,"Failed to import environment variables");return await s.json()}var vS=require("dotenv");pe();var SS=["key","isSecret","value","id","environmentId"],Ya=["key","isSecret"];function cs(){return SS}var gg=ut(SS);function WP(e,t){switch(t){case"value":return e.isSecret?I("(secret)"):e.value!==""?e.value:I("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):I("\u2014")}}function hg(e,t=Ya){if(e.length===0)return I("No environment variables found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>WP(o,i)));return qe(n,r)}function yg(e){let t=e.split(/\r?\n/).map(n=>n.replace(/^\s*export\s+/,"")).join(`
197
+ `);return(0,vS.parse)(t)}async function wg(e){let t=await T(),n=F.forAppsEnvVars({authToken:t}),r=Date.now();try{let{appId:o,envId:i}=await Xe(t,e),s={key:e.key,q:e.q},a=is(s),l=await fg(t,o,i,s);if(await n.sendUsage("apps_env_vars_list",{duration:Date.now()-r,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=_e(e.fields,gg,cs());u.info(hg(l,c))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list environment variables:`}))}}q();C();A();M();X();C();be();Oe();A();M();async function xS(){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 bg(e){u.warn(`${re} 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 CS(e,t){if(e!==void 0)return t.secret&&!t.json&&bg(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let n=await xS();if(n==="")throw new f(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:n,source:"stdin"}}if(!V()){let n=t.secret?await Db({message:`Enter the value for ${t.key}:`}):await Ke({message:`Enter the value for ${t.key}:`});if(n===null||n==="")throw new f(`No value provided for ${t.key}.`,{isUserError:!0});return{value:n,source:"prompt"}}throw new f(`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 Dg(e,t,n){let r=n.secret?" (secret)":"",o=await T(),i=F.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await Xe(o,n);if(n.dryRun){t!==void 0&&n.secret&&!n.json&&bg(e),n.json?u.info(JSON.stringify({key:e,...n.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${r} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:p}=await CS(t,{key:e,secret:n.secret,json:n.json}),d={[e]:{value:c,...n.secret?{isSecret:!0}:{}}},m=await Xa(o,a,l,d,!0),h=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!h){let y=m.errors.find(b=>b.key===e);throw new f(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let g=h.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:n.secret?"secret":"plain",valueSource:p}),n.json){u.info(JSON.stringify({key:e,isSecret:g,status:"set"},null,2));return}u.info(`${$} Set ${e}${g?" (secret)":""}`)}catch(c){throw c instanceof f&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new f(c,{prefix:`${k} Failed to set environment variable:`}))}}q();C();A();M();X();async function kg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await Xe(n,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 mg(n,i,s,e),await r.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 f&&a.isUserError?a:(await r.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new f(a,{prefix:`${k} Failed to delete environment variable:`}))}}var FS=require("fs"),_S=require("path");q();C();A();M();X();function Eg(e){return e.map(({id:t,environmentId:n,key:r,isSecret:o})=>({id:t,environmentId:n,key:r,isSecret:o}))}async function vg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await Xe(n,t),a;try{a=(0,FS.readFileSync)((0,_S.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=yg(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>ls)throw new f(`Cannot import more than ${ls} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let d of c)p[d]={value:l[d],...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 d of c)u.info(` ${d}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let d=await Xa(n,i,s,p,!0);if(await r.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:d.created.length,updatedCount:d.updated.length,skippedCount:d.skipped.length,errorCount:d.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:Eg(d.created),updated:Eg(d.updated),skipped:Eg(d.skipped),errors:d.errors},null,2));else{u.info(`${$} Imported: ${d.created.length} created, ${d.updated.length} updated, ${d.skipped.length} skipped, ${d.errors.length} failed`);for(let m of d.errors)u.warn(` ${m.key}: ${m.error}`)}if(d.errors.length>0)throw new f(`Import completed with ${d.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(d){throw d instanceof f&&d.isUserError?d:(await r.sendError(d instanceof Error?d:new Error(String(d)),"apps_env_vars_import",{duration:Date.now()-o}),new f(d,{prefix:`${k} Failed to import environment variables:`}))}}Vn();var RS=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");Cu(t,{namespace:"apps"}),Fu(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. ${Zc("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.",Ii).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ii).addOption(Qc("the app name")).addOption(ne()).addOption(He([...xr()]).default(Vc)).action(Zm),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(ne()).addOption(He([...xr()]).default(am)).action(Qm),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(He([...ga()]).default(Gc)).addOption(ne()).option("--limit <n>","Max number of domains to return (server caps at 100)",ru).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(eg),Je()&&(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(ne()).addOption(Ae()).action(cg),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(Ti()).addOption(ne()).addOption(Ae()).action(ug)),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). ${Zc("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.",Ii).addOption(Qc("the environment branch")).addOption(He([...ha()]).default(Kc)).addOption(ne()).action(tg);let r=t.command("deployments").description("Inspect Webflow Cloud deployments");r.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(wE()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(ne()).addOption(He([...Cr()]).default(ya)).action(ig),r.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 AS.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(DE()).addOption(kE()).addOption(ne()).addOption(He([...Cr()]).default(ya)).action(sg),r.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(ne()).addOption(Ae()).action(ag),r.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(ne()).addOption(Ae()).action(lg);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(ne()).addOption(He([...Mr()]).default(qa)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(mm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(rg),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(ne()).addOption(He([...Mr()]).default(qa)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(mm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(og);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). ${Zc("variable","--key")} Secret values are never returned.`).addOption(ba()).addOption(Da()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ii).addOption(Qc("the variable key")).addOption(ne()).addOption(He([...cs()]).default(Ya.join(","))).action(wg),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(ba()).addOption(Da()).addOption(fm()).addOption(Ae()).addOption(ne()).action(Dg),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ba()).addOption(Da()).addOption(Ae()).addOption(ne()).action(kg),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(ba()).addOption(Da()).addOption(fm()).addOption(Ae()).addOption(ne()).action(vg)};De();C();lt();C();function Z(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new f(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}async function $n(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function IS(e,t){Z(t,"siteId");let n=await G(`${P()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok){let o=await $n(n);throw n.status>=400&&n.status<500?new f(o,{isUserError:!0}):new f(`Failed to list collections: ${o}`)}return(await n.json()).collections??[]}async function TS(e,t){Z(t,"collectionId");let n=await G(`${P()}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!n.ok)throw new f(`Failed to get collection: ${await $n(n)}`);let r=await n.json();return{...r,fields:r.fields??[]}}async function PS(e,t,n){Z(t,"siteId");let r={displayName:n.displayName,singularName:n.singularName};n.slug&&(r.slug=n.slug);let o=await G(`${P()}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!o.ok){let i=await $n(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create collection: ${i}`)}return await o.json()}async function $S(e,t,n){Z(t,"collectionId");let r=await G(`${P()}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:n.displayName,type:n.type,isRequired:n.isRequired??!1})});if(!r.ok){let o=await $n(r);throw r.status===404?new f(`Collection "${t}" not found`,{isUserError:!0}):r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to create field: ${o}`)}return await r.json()}async function Sg(e,t,n={}){Z(t,"collectionId");let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset)),n.cmsLocaleId&&r.set("cmsLocaleId",n.cmsLocaleId);let o=r.toString()?`?${r.toString()}`:"",i=await G(`${P()}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to list items: ${await $n(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??n.limit??100,offset:s.offset??n.offset??0}}async function OS(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=r?`?cmsLocaleId=${encodeURIComponent(r)}`:"",i=await G(`${P()}/v2/collections/${t}/items/${n}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to get item: ${await $n(i)}`);return await i.json()}async function xg(e,t,n,r=!1){Z(t,"collectionId");let o=await G(`${P()}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n,isDraft:r})});if(!o.ok){let i=await $n(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create item: ${i}`)}return await o.json()}async function Cg(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=await G(`${P()}/v2/collections/${t}/items/${n}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r})});if(o.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!o.ok)throw new f(`Failed to update item: ${await $n(o)}`);return await o.json()}async function LS(e,t,n){Z(t,"collectionId"),Z(n,"itemId");let r=await G(`${P()}/v2/collections/${t}/items/${n}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!r.ok)throw new f(`Failed to delete item: ${await $n(r)}`)}async function NS(e,t,n){Z(t,"collectionId"),n.forEach(o=>Z(o,"itemId"));let r=await G(`${P()}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:n})});if(!r.ok){let o=await $n(r);throw r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to publish items: ${o}`)}return await r.json()}pe();q();Me();async function Ou(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=ee(),n=await ze(t);return{token:n.accessToken,siteId:n.siteId}}function jS(e,t=["id","displayName","slug"]){if(e.length===0)return I("No collections found.");let n=["id","displayName","singularName","slug","lastUpdated"],r=Object.fromEntries(n.map(a=>[a.toLowerCase(),a])),o=t.map(a=>r[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Bt(`Invalid fields. Available: ${n.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:I("\u2014")}));return qe(i,s)}function MS(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(I(" No fields defined.")),t.join(`
198
+ `);let n=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),r=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(qe(n,r)),t.join(`
199
+ `)}function BS(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return I("No items found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?le("draft"):J("live");if(i==="isArchived")return o.isArchived?I("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"}):I("\u2014")}let s=o[i];return s==null?I("\u2014"):String(s)}));return qe(n,r)}C();A();M();function Lu(e,t,n="asc"){return[...e].sort((r,o)=>{let i=r[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)),n==="desc"?-a:a})}X();async function Fg(e){let{token:t,siteId:n}=await Ou(e),r=F.forCms({authToken:t,siteId:n}),o=Date.now();try{let i=await IS(t,n);if(await r.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 f(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=Lu(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(jS(a,l))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list collections:`})}}q();C();A();M();X();async function _g(e,t){let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await TS(n,e);if(await r.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(MS(i))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get collection:`})}}C();A();M();X();async function Ag(e){let t=e.singularName??e.name,n=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:n},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:r,siteId:o}=await Ou(e),i=F.forCms({authToken:r,siteId:o}),s=Date.now();try{let a=await PS(r,o,{displayName:e.name,singularName:t,slug:n});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(`
200
+ Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof f&&a.isUserError){u.info(`${k} ${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 f(a,{prefix:`${k} Failed to create collection:`})}}q();C();A();M();X();async function Rg(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(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await $S(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await n.sendUsage("cms_fields_create",{duration:Date.now()-r}),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 f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to create field:`})}}q();C();A();M();X();async function Ig(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await Sg(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await n.sendUsage("cms_items_list",{duration:Date.now()-r,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(d=>d.trim());u.info(BS(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let d=s.total>0?` of ${s.total}`:"";u.info(`
201
+ Showing ${l}\u2013${c}${d} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof f&&s.isUserError){u.info(`${k} ${s.message}`),process.exitCode=1;return}throw await n.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-r}),new f(s,{prefix:`${k} Failed to list items:`})}}q();C();A();M();X();async function Tg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await OS(t,e.collection,e.item,e.locale);if(await n.sendUsage("cms_items_get",{duration:Date.now()-r}),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 f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get item:`})}}q();C();A();M();X();async function Pg(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`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 n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await xg(n,e.collection,t,e.draft??!1);if(await r.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 f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to create item:`})}}q();C();A();M();X();async function $g(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`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 n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await Cg(n,e.collection,e.item,t);if(await r.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 f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update item:`})}}q();C();A();M();X();async function Og(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(),n=F.forCms({authToken:t}),r=Date.now();try{await LS(t,e.collection,e.item),await n.sendUsage("cms_items_delete",{duration:Date.now()-r,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to delete item:`})}}q();C();A();M();X();async function Lg(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 n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await NS(n,e.collection,t);if(await r.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 f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to publish items:`})}}var US=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),n=t.command("collections").description("Manage CMS collections");n.command("list").description("List all CMS collections for a site").addOption(Tt()).addOption(ne()).addOption(He(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption($i(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Pi()).action(Fg),n.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(ne()).action(_g),n.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Tt()).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(Ae()).addOption(ne()).action(Ag),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(Ae()).addOption(ne()).action(Rg);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(tu()).addOption(nu()).addOption(ne()).addOption(He(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(Ig),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(ne()).action(Tg),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(Ae()).addOption(ne()).action(Pg),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(Ae()).addOption(ne()).action($g),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(Ae()).action(Og),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(Ae()).addOption(ne()).action(Lg)};q();pe();C();A();M();Me();X();De();lt();C();C();pe();var WS={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 Nu(e,t){let n=e.split(".").pop()?.toLowerCase()??"",r=WS[n];if(!r){let o=Object.keys(WS).join(", ");throw new f(`Unsupported file type ".${n}". Allowed types: ${o}`,{isUserError:!0})}if(t>r.maxBytes){let o=r.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new f(`File too large: ${i} MB exceeds the ${o} MB limit for ${r.category} files.`,{isUserError:!0})}}var Ng=["id","displayName","originalFileName","contentType","size","lastUpdated"];function HS(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return I("No assets found.");let n=Object.fromEntries(Ng.map(l=>[l.toLowerCase(),l])),r=t.map(l=>n[l.toLowerCase()]).filter(l=>l!=null);if(r.length===0)return Bt(`Invalid fields. Available: ${Ng.join(", ")}`);let o=t.filter(l=>n[l.toLowerCase()]==null),i=o.length>0?le(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Ng.join(", ")}
202
+ `):"",s=r.map(l=>se(l)),a=e.map(l=>r.map(c=>{let p=l[c];if(p==null||c==="size"&&p===0)return I("\u2014");if(c==="size")return HP(Number(p));if(c==="lastUpdated"){let m=new Date(String(p)),h=String(m.getMonth()+1).padStart(2,"0"),g=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),b=String(m.getHours()).padStart(2,"0"),S=String(m.getMinutes()).padStart(2,"0");return`${h}/${g}/${y} ${b}:${S}`}let d=String(p);return c==="displayName"&&d.length>40?I("\u2026")+d.slice(-39):d}));return i+qe(s,a)}function HP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function VS(e){if(e.length===0)return I("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),n=["id","displayName","assets","lastUpdated"].map(o=>se(o)),r=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 qe(n,r)}async function GS(e,t,n={}){if(Z(t,"siteId"),n.folderId){Z(n.folderId,"folderId");let a=await VP(e,n.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],p=0,d=100;for(;;){let b=await G(`${P()}/v2/sites/${t}/assets?limit=${d}&offset=${p}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!b.ok)throw new f(`Failed to list assets: ${b.status} ${b.statusText}`);let S=await b.json(),_=S.assets??[];c.push(..._);let v=S.pagination?.total??0;if(p+=_.length,p>=v||_.length===0)break}let m=c.filter(b=>l.has(b.id)),h=n.offset??0,g=n.limit??m.length,y=m.slice(h,h+g);return{assets:y,pagination:{total:m.length,limit:y.length,offset:h}}}let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset));let o=r.toString(),i=await G(`${P()}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new f(`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 KS(e,t,n,r,o){Z(t,"siteId"),o&&Z(o,"folderId");let i=aa(n);Nu(i.meta.title,i.meta.size);let s=r??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await G(`${P()}/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 f(`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 ca(i,p)}catch(d){throw await G(`${P()}/v2/assets/${p._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),d}return{id:p._id,hostedUrl:p.s3Url,displayName:s,originalFileName:i.meta.title}}async function JS(e,t,n){Z(t,"assetId");let r=await G(`${P()}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new f(`Failed to update asset: ${r.status} ${r.statusText}`);return await r.json()}async function VP(e,t){Z(t,"folderId");let n=await G(`${P()}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get folder: ${n.status} ${n.statusText}`);return await n.json()}async function zS(e,t){Z(t,"siteId");let n=await G(`${P()}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to list folders: ${n.status} ${n.statusText}`);return(await n.json()).assetFolders??[]}async function qS(e,t,n,r){Z(t,"siteId"),r&&Z(r,"parentFolderId");let o={displayName:n};r&&(o.parentFolder=r);let i=await G(`${P()}/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 f(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function jg(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ee(),s=await ze(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let{assets:i,pagination:s}=await GS(t,n,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await r.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=Lu(i,l,c);if(e.json){u.info(JSON.stringify({assets:p,pagination:s},null,2));return}let d=e.fields.split(",").map(h=>h.trim());u.info(HS(p,d));let m=(e.offset??0)+i.length;m<s.total&&u.info(I(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list assets:`})}}q();C();A();M();Me();X();async function Mg(e,t){let n=aa(e);if(Nu(n.meta.title,n.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 r,o;if(t.site)r=await T(),o=t.site;else{let{manifest:a}=ee(),l=await ze(a);r=l.accessToken,o=l.siteId}let i=F.forAssets({authToken:r,siteId:o}),s=Date.now();try{let a=await KS(r,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 f(a,{prefix:`${k} Failed to upload asset:`})}}q();C();A();M();X();async function Bg(e,t){if(!t.altText&&!t.displayName)throw new f("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 n=await T(),r=F.forAssets({authToken:n}),o=Date.now();try{let i=await JS(n,e,{altText:t.altText,displayName:t.displayName});if(await r.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 r.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update asset:`})}}q();C();A();M();Me();X();async function Ug(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ee(),s=await ze(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let i=await zS(t,n);if(await r.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(VS(i))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list folders:`})}}q();C();A();M();Ws();X();async function Wg(e,t){let n,r;if(t.site)n=await T(),r=t.site;else{let{manifest:s}=ee(),a=await ze(s);n=a.accessToken,r=a.siteId}let o=F.forAssets({authToken:n,siteId:r}),i=Date.now();try{let s=await qS(n,r,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 f(s,{prefix:`${k} Failed to create folder:`})}}var XS=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Tt()).option("--folder <folderId>","Filter by folder ID").addOption(ne()).addOption(He(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(tu()).addOption(nu()).addOption($i(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Pi()).action(jg),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
203
+ 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(Tt()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(Ae()).addOption(ne()).action(Mg),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(Ae()).addOption(ne()).action(Bg);let n=t.command("folders").description("Manage asset folders");n.command("list").description("List all asset folders for a site").addOption(Tt()).addOption(ne()).action(Ug),n.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Tt()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(ne()).action(Wg)};q();C();A();M();X();De();C();lt();async function YS(e,t){Z(t,"siteId");let n=await G(`${P()}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get site: ${n.status} ${n.statusText}`);return await n.json()}async function ZS(e){return Ja(`${P()}/v2/sites`,e,"sites","Failed to list sites")}async function QS(e,t){Z(t,"siteId");let n=await G(`${P()}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get custom domains: ${n.status} ${n.statusText}`);return(await n.json()).customDomains??[]}async function ex(e,t,n=[],r){Z(t,"siteId"),r&&Z(r,"pageId");let o=n.length>0?{customDomains:n}:{publishToWebflowSubdomain:!0};r&&(o.pageId=r);let i=await G(`${P()}/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 f(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();pe();var Hg=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],tx=ut(Hg);function nx(){return Hg}function rx(e,t=["id","displayName","lastPublished"]){if(e.length===0)return I("No sites found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${Hg.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=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:I("\u2014")}));return qe(n,r)}function ox(e){if(e.length===0)return I("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],n=e.map(r=>[r.id,r.url,r.lastPublished?new Date(r.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):I("\u2014")]);return qe(t,n)}async function Vg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await ZS(t);if(await n.sendUsage("sites_list",{duration:Date.now()-r,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=_e(e.fields,tx,nx());u.info(rx(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list sites:`}))}}q();C();A();M();X();async function Gg(e,t){let n=await T(),r=F.forSites({authToken:n}),o=Date.now();try{let i=await YS(n,e);if(await r.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 f&&i.isUserError?i:(await r.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get site:`}))}}q();C();A();M();X();async function Kg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await QS(t,e.site);if(await n.sendUsage("sites_domains",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(ox(o))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get custom domains:`}))}}q();C();A();M();X();async function Jg(e){if(Z(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(),n=F.forSites({authToken:t}),r=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await ex(t,e.site,o,e.page);if(await n.sendUsage("sites_publish",{duration:Date.now()-r,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 f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to publish site:`}))}}q();q();De();C();be();Oe();A();M();Me();X();De();lt();C();var ju="not_enterprise_plan_workspace";async function ix(e,t,n){Z(t,"workspaceId");let r=n.trim();if(!r)throw new f("Site name cannot be empty.",{isUserError:!0});let o=await G(`${P()}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:r})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===ju?new f("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:ju}):a==="missing_scopes"?new f(`Your token is missing the 'workspace:write' scope.
204
+ Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new f(`Failed to create site "${r}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new f("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??r,shortName:i.shortName??""}}function GP(e){xe({siteId:e.id});let{manifestPath:t}=ee();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function KP(e,t){let n=new Map;for(let i of t)i.workspaceId&&n.set(i.workspaceId,(n.get(i.workspaceId)??0)+1);let r=[...n.keys()];if(r.length===1)return r[0];if(r.length===0){let i=await ns(e);if(i.length===0)throw new f("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new f(`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 rs(i)).id}if(V())throw new f(`This token's sites span ${r.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 Be({message:"Which workspace should the new site be created in?",choices:r.map(i=>({name:`${i} (${n.get(i)} site${n.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new f("No workspace selected.",{isUserError:!0});return o}async function JP(e,t){if(u.warn(`${k} ${t.message}
205
+ Create the site in the Webflow dashboard: ${En()}/dashboard
206
+ 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 r=await wr(e);if(r.length===0)throw new f("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(r),created:!1}}async function zP(e,t,n){let r=await KP(e,t),o=n.name;if(o||(o=await Ke({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new f("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await ix(e,r,o)}catch(s){if(s instanceof f&&s.code===ju)return JP(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function Mu(e={}){let t=await T({apiToken:e.apiToken}),n=F.forSites({authToken:t}),r=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new f("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await wr(t),s;if(e.siteId){Z(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new f(`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 f("`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 Be({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 zP(t,i,e);s=l.site,o=l.created}else s=await bi(i)}GP(s),await n.sendUsage("site_init",{duration:Date.now()-r,created:o})}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-r}),i instanceof f?i:new f(i,{prefix:`${k} Failed to initialize site:`})}}q();pe();C();A();M();X();De();lt();C();function qP(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function XP(e,t){let n=await t.text(),r;try{r=JSON.parse(n)}catch{}throw t.status===404&&r?.error==="Not found"&&!r.code?new f(`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}):r?.code==="SCHEMA_STALE"?new f(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):r?.code&&r.error?new f(`Failed to ${e}: ${r.error} (${r.code})`,{isUserError:t.status<500}):new f(`Failed to ${e}: ${t.status} ${t.statusText}${qP(n)}`)}async function sx(e,t,n,r){let o=await G(`${En()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});o.ok||await XP(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new f(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function Za(e,t,n){Z(t,"siteId");let r=await sx("pull the site files","pull",e,{siteId:t,...n?.pageIds&&n.pageIds.length>0?{pageIds:n.pageIds}:{},...n?.manifestOnly?{manifestOnly:!0}:{}});return{...r,pages:r.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function ax(e,t,n,r){Z(t,"siteId");let o=await sx("push the site files","push",e,{siteId:t,changes:n,...r?.conflictPolicy?{conflictPolicy:r.conflictPolicy}:{},...r?.schemaHash?{schemaHash:r.schemaHash}:{}});if(!Array.isArray(o.results))throw new f("Invalid response from the WFS Sync API: expected a `results` array.");return o}Me();q();C();var Bu=require("path");function zg(e){return e.split(Bu.sep).join("/").replace(/\\/g,"/")}function No(e){if(e===""||e.includes("\0")||(0,Bu.isAbsolute)(e))return!1;let t=zg(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(n=>n==="..")}var YP={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},lx={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 ZP(e){return e.endsWith("/")?e.slice(0,-1):e}function cx(e,t,n){let r=e.trim();if(!No(r))throw new f(`"site.layout.${t}" in ${n} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=r.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new f(`"site.layout.${t}" in ${n} must name a directory inside the project, not "${e}".`,{isUserError:!0});return ZP(o)}function QP(e,t,n){let r=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(r.length,o.length)-1&&r[s]===o[s];s++)i.push(r[s]);return i.length>0?`${i.join("/")}/${n}`:n}function e$(e,t){let n=e?.layout;if(!n)return YP;let r=n.preset?lx[n.preset]:void 0;if(n.preset&&!r)throw new f(`Unknown "site.layout.preset" value "${n.preset}" in ${t}. Known presets: ${Object.keys(lx).join(", ")}.`,{isUserError:!0});let o=n.pagesRoot??r?.pagesRoot,i=n.componentsRoot??r?.componentsRoot;if(!o||!i)throw new f(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=n.pagesShape??r?.pagesShape??"flat",a=cx(o,"pagesRoot",t),l=cx(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:QP(a,l,"theme")}}function us(e){let{manifest:t,manifestPath:n}=ee(),r=e?.trim();r&&Z(r,"site-id");let o=r||oo(t);if(!o||o.trim()==="")throw new f(`Missing "siteId" in ${n}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=e$(t.site,n);return{siteId:o,layout:i}}var ir=require("@babel/types");var ux=require("@babel/parser");function Yt(e){try{return(0,ux.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function*Br(e){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let t of e)yield*Br(t);return}if(typeof e.type=="string"){yield e;for(let[t,n]of Object.entries(e))t==="loc"||t==="leadingComments"||t==="trailingComments"||(yield*Br(n))}}}function Ur(e,t){if(t.length===0)return e;let n=e;for(let{start:r,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))n=n.slice(0,r)+i+n.slice(o);return n}function dx(e){let t;for(let n of Br(e.program))if((0,ir.isCallExpression)(n)&&(0,ir.isIdentifier)(n.callee,{name:"component"})&&(0,ir.isObjectExpression)(n.arguments[0])){let r=n.arguments[0];(t===void 0||(r.start??0)<(t.start??0))&&(t=r)}return t}function px(e){return e.properties.some(t=>(0,ir.isObjectProperty)(t)&&!t.computed&&(0,ir.isIdentifier)(t.key,{name:"id"}))}function fx(e,t){let n=Yt(e),r=n&&dx(n);if(!r||r.start==null||px(r))return;let o=r.start,i=e.slice(o+1);if(i.slice(0,i.includes(`
207
207
  `)?i.indexOf(`
208
208
  `):i.length).trim()===""){let l=i.split(`
209
- `),c=" ";for(let d of l.slice(1))if(d.trim()!==""){c=d.match(/^\s*/)?.[0]??c;break}return e.slice(0,o+1)+`
210
- ${c}id: ${t},`+e.slice(o+1)}let a=i.startsWith(" ")?"":" ";return e.slice(0,o+1)+` id: ${t},${a}`+e.slice(o+1)}function JS(e,t){return GS(e,`"${t}"`)}function KS(e){return GS(e,"null")}function zS(e){let t=Xt(e),n=t&&HS(t);return n?VS(n):!0}var XS=require("crypto"),te=require("@babel/types");function qS(e){return(0,XS.createHash)("sha256").update(e,"utf8").digest("hex").slice(0,16)}var dn=e=>e.join(",");function YS(e){let t=Xt(e),n=t&&Ng(t);if(!n)return[];let r=[],o=s=>s.start!=null&&s.end!=null?e.slice(s.start,s.end):"";function i(s,a){let l=ZS(s);r.push({path:a,kind:"element",...l?{tag:l}:{},hash:qS(o(s))});let c=0;for(let d of s.children){if(jg(d))continue;let p=Mg(d)!==void 0,m=ex(d)!==void 0;if(p||m){r.push({path:[...a,c++],kind:"string",hash:qS(o(d))});continue}(0,te.isJSXElement)(d)&&i(d,[...a,c++])}}return i(n,[]),r}function AP(e,t){let n=new Map,r=new Set,o=(l,c)=>l.kind===c.kind&&(l.tag===void 0||l.tag===c.tag),i=(l,c)=>{r.add(c),n.set(dn(l.path),c)},s=new Map(t.map(l=>[dn(l.path),l])),a=new Map;for(let l of t)l.hash!==void 0&&a.set(l.hash,[...a.get(l.hash)??[],l]);for(let l of e){let c=s.get(dn(l.path));c&&c.hash!==void 0&&c.hash===l.hash&&!r.has(c)&&o(c,l)&&i(l,c)}for(let l of e){if(n.has(dn(l.path)))continue;let c=(a.get(l.hash)??[]).find(d=>!r.has(d)&&o(d,l));c&&i(l,c)}for(let l of e){if(n.has(dn(l.path)))continue;let c=s.get(dn(l.path));c&&!r.has(c)&&o(c,l)&&i(l,c)}return n}function Ng(e){for(let t of jr(e.program)){if(!(0,te.isCallExpression)(t)||!((0,te.isIdentifier)(t.callee,{name:"page"})||(0,te.isIdentifier)(t.callee,{name:"component"})))continue;let n=t.arguments[t.arguments.length-1];if(!n||!(0,te.isArrowFunctionExpression)(n)&&!(0,te.isFunctionExpression)(n))continue;let{body:r}=n;if((0,te.isJSXElement)(r))return r;if((0,te.isBlockStatement)(r)){for(let o of r.body)if((0,te.isReturnStatement)(o)&&o.argument&&(0,te.isJSXElement)(o.argument))return o.argument}}}function ZS(e){let{name:t}=e.openingElement;if((0,te.isJSXIdentifier)(t))return t.name;if((0,te.isJSXMemberExpression)(t)){let n=t.object;if((0,te.isJSXIdentifier)(n))return`${n.name}.${t.property.name}`}}function jg(e){if(!(0,te.isJSXElement)(e))return!1;let t=e.openingElement.name;return(0,te.isJSXMemberExpression)(t)&&(0,te.isJSXIdentifier)(t.object,{name:"Basic"})&&(0,te.isJSXIdentifier)(t.property,{name:"String"})}function Lg(e){for(let t of e.openingElement.attributes)if((0,te.isJSXAttribute)(t)&&(0,te.isJSXIdentifier)(t.name,{name:"uid"})&&(0,te.isStringLiteral)(t.value))return t.value.value}function IP(e){return e.replace(/^\s*\n\s*/,"").replace(/\s*\n\s*$/,"").replace(/\s*\n\s*/g," ")}function RP(e){let t=e.children.filter(r=>!((0,te.isJSXText)(r)&&r.value.trim()===""));if(t.length!==1)return;let[n]=t;if((0,te.isJSXText)(n))return IP(n.value);if((0,te.isJSXExpressionContainer)(n)&&(0,te.isStringLiteral)(n.expression))return n.expression.value}function Mg(e){if(!(!(0,te.isJSXExpressionContainer)(e)||!(0,te.isStringLiteral)(e.expression)))return e.expression.value}function QS(e){return(0,te.isIdentifier)(e)}function TP(e){let t=e.children.filter(o=>!((0,te.isJSXText)(o)&&o.value.trim()===""));if(t.length!==1)return;let[n]=t;if(!(0,te.isJSXExpressionContainer)(n))return;let{expression:r}=n;if(QS(r)&&!(r.start==null||r.end==null))return{start:r.start,end:r.end}}function ex(e){if(!(0,te.isJSXExpressionContainer)(e))return;let{expression:t}=e;if(QS(t)&&!(t.start==null||t.end==null))return{start:t.start,end:t.end}}function PP(e,t){let r=t.openingElement.attributes.find(a=>(0,te.isJSXAttribute)(a)&&(0,te.isJSXIdentifier)(a.name,{name:"uid"})&&(0,te.isStringLiteral)(a.value));if(!r||r.start==null||r.end==null)return;let o=e.lastIndexOf(`
209
+ `),c=" ";for(let p of l.slice(1))if(p.trim()!==""){c=p.match(/^\s*/)?.[0]??c;break}return e.slice(0,o+1)+`
210
+ ${c}id: ${t},`+e.slice(o+1)}let a=i.startsWith(" ")?"":" ";return e.slice(0,o+1)+` id: ${t},${a}`+e.slice(o+1)}function mx(e,t){return fx(e,`"${t}"`)}function gx(e){return fx(e,"null")}function hx(e){let t=Yt(e),n=t&&dx(t);return n?px(n):!0}var wx=require("crypto"),te=require("@babel/types");function yx(e){return(0,wx.createHash)("sha256").update(e,"utf8").digest("hex").slice(0,16)}var pn=e=>e.join(",");function bx(e){let t=Yt(e),n=t&&Xg(t);if(!n)return[];let r=[],o=s=>s.start!=null&&s.end!=null?e.slice(s.start,s.end):"";function i(s,a){let l=Dx(s);r.push({path:a,kind:"element",...l?{tag:l}:{},hash:yx(o(s))});let c=0;for(let p of s.children){if(Yg(p))continue;let d=Zg(p)!==void 0,m=Ex(p)!==void 0;if(d||m){r.push({path:[...a,c++],kind:"string",hash:yx(o(p))});continue}(0,te.isJSXElement)(p)&&i(p,[...a,c++])}}return i(n,[]),r}function t$(e,t){let n=new Map,r=new Set,o=(l,c)=>l.kind===c.kind&&(l.tag===void 0||l.tag===c.tag),i=(l,c)=>{r.add(c),n.set(pn(l.path),c)},s=new Map(t.map(l=>[pn(l.path),l])),a=new Map;for(let l of t)l.hash!==void 0&&a.set(l.hash,[...a.get(l.hash)??[],l]);for(let l of e){let c=s.get(pn(l.path));c&&c.hash!==void 0&&c.hash===l.hash&&!r.has(c)&&o(c,l)&&i(l,c)}for(let l of e){if(n.has(pn(l.path)))continue;let c=(a.get(l.hash)??[]).find(p=>!r.has(p)&&o(p,l));c&&i(l,c)}for(let l of e){if(n.has(pn(l.path)))continue;let c=s.get(pn(l.path));c&&!r.has(c)&&o(c,l)&&i(l,c)}return n}function Xg(e){for(let t of Br(e.program)){if(!(0,te.isCallExpression)(t)||!((0,te.isIdentifier)(t.callee,{name:"page"})||(0,te.isIdentifier)(t.callee,{name:"component"})))continue;let n=t.arguments[t.arguments.length-1];if(!n||!(0,te.isArrowFunctionExpression)(n)&&!(0,te.isFunctionExpression)(n))continue;let{body:r}=n;if((0,te.isJSXElement)(r))return r;if((0,te.isBlockStatement)(r)){for(let o of r.body)if((0,te.isReturnStatement)(o)&&o.argument&&(0,te.isJSXElement)(o.argument))return o.argument}}}function Dx(e){let{name:t}=e.openingElement;if((0,te.isJSXIdentifier)(t))return t.name;if((0,te.isJSXMemberExpression)(t)){let n=t.object;if((0,te.isJSXIdentifier)(n))return`${n.name}.${t.property.name}`}}function Yg(e){if(!(0,te.isJSXElement)(e))return!1;let t=e.openingElement.name;return(0,te.isJSXMemberExpression)(t)&&(0,te.isJSXIdentifier)(t.object,{name:"Basic"})&&(0,te.isJSXIdentifier)(t.property,{name:"String"})}function qg(e){for(let t of e.openingElement.attributes)if((0,te.isJSXAttribute)(t)&&(0,te.isJSXIdentifier)(t.name,{name:"uid"})&&(0,te.isStringLiteral)(t.value))return t.value.value}function n$(e){return e.replace(/^\s*\n\s*/,"").replace(/\s*\n\s*$/,"").replace(/\s*\n\s*/g," ")}function r$(e){let t=e.children.filter(r=>!((0,te.isJSXText)(r)&&r.value.trim()===""));if(t.length!==1)return;let[n]=t;if((0,te.isJSXText)(n))return n$(n.value);if((0,te.isJSXExpressionContainer)(n)&&(0,te.isStringLiteral)(n.expression))return n.expression.value}function Zg(e){if(!(!(0,te.isJSXExpressionContainer)(e)||!(0,te.isStringLiteral)(e.expression)))return e.expression.value}function kx(e){return(0,te.isIdentifier)(e)}function o$(e){let t=e.children.filter(o=>!((0,te.isJSXText)(o)&&o.value.trim()===""));if(t.length!==1)return;let[n]=t;if(!(0,te.isJSXExpressionContainer)(n))return;let{expression:r}=n;if(kx(r)&&!(r.start==null||r.end==null))return{start:r.start,end:r.end}}function Ex(e){if(!(0,te.isJSXExpressionContainer)(e))return;let{expression:t}=e;if(kx(t)&&!(t.start==null||t.end==null))return{start:t.start,end:t.end}}function i$(e,t){let r=t.openingElement.attributes.find(a=>(0,te.isJSXAttribute)(a)&&(0,te.isJSXIdentifier)(a.name,{name:"uid"})&&(0,te.isStringLiteral)(a.value));if(!r||r.start==null||r.end==null)return;let o=e.lastIndexOf(`
211
211
  `,r.start-1)+1,i=e.indexOf(`
212
- `,r.end),s=i===-1?e.length:i;return/^\s*$/.test(e.slice(o,r.start))&&/^\s*$/.test(e.slice(r.end,s))?{start:o,end:i===-1?e.length:i+1}:e[r.end]===" "?{start:r.start,end:r.end+1}:r.start>0&&e[r.start-1]===" "?{start:r.start-1,end:r.end}:{start:r.start,end:r.end}}function Pu(e){let t=Xt(e),n=t&&Ng(t);if(!n)return{sugared:e,entries:[]};let r=[],o=[];function i(l,c){let d=Lg(l);if(d===void 0)return;let p=PP(e,l);if(!p)return;let m=ZS(l);r.push({path:c,uid:d,kind:"element",...m?{tag:m}:{}}),o.push({start:p.start,end:p.end,text:""})}function s(l,c){let d=0;for(let p of l.children){if(jg(p)){let m=Lg(p);if(m===void 0||p.start==null||p.end==null)continue;let h=RP(p),g=h===void 0?TP(p):void 0;if(h===void 0&&g===void 0)continue;r.push({path:[...c,d++],uid:m,kind:"string"}),o.push({start:p.start,end:p.end,text:h!==void 0?`{${JSON.stringify(h)}}`:`{${e.slice(g.start,g.end)}}`});continue}if(Mg(p)!==void 0){d++;continue}if((0,te.isJSXElement)(p)){let m=[...c,d++];i(p,m),s(p,m)}}}if(i(n,[]),s(n,[]),o.length===0)return{sugared:e,entries:[]};let a=Mr(e,o);return{sugared:a,entries:Bg(a,r)}}function Bg(e,t){if(t.length===0)return t;let n=new Map(YS(e).map(r=>[dn(r.path),r.hash]));return t.map(r=>{let o=n.get(dn(r.path));return o?{...r,hash:o}:r})}function tx(e,t){let n=Xt(e),r=n&&Ng(n);if(!r)return{desugared:e,hasNewNodes:!1};let o=AP(YS(e),t),i=[],s=!1;function a(c,d){if(Lg(c)!==void 0)return;let p=o.get(dn(d));if(!p||p.kind!=="element"){s=!0;return}let m=c.openingElement.name.end;m!=null&&i.push({start:m,end:m,text:` uid=${JSON.stringify(p.uid)}`})}function l(c,d){let p=0;for(let m of c.children){if(jg(m))continue;let h=Mg(m);if(h!==void 0){let y=[...d,p++];if(m.start==null||m.end==null)continue;let b=o.get(dn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${JSON.stringify(h)}}</Basic.String>`});continue}let g=ex(m);if(g!==void 0){let y=[...d,p++];if(m.start==null||m.end==null)continue;let b=o.get(dn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${e.slice(g.start,g.end)}}</Basic.String>`});continue}if((0,te.isJSXElement)(m)){let y=[...d,p++];a(m,y),l(m,y)}}}return a(r,[]),l(r,[]),{desugared:Mr(e,i),hasNewNodes:s}}var mt=require("@babel/types");function $P(e){if(!(0,mt.isVariableDeclarator)(e)||!(0,mt.isIdentifier)(e.id)||!e.init)return;let{init:t}=e;if(!(!(0,mt.isCallExpression)(t)||!(0,mt.isIdentifier)(t.callee,{name:"style"})))return{ident:e.id.name,call:t}}function nx(e){let t=e.arguments[2];return t&&(0,mt.isObjectExpression)(t)?t:void 0}function rx(e){for(let t of e.properties){if(!(0,mt.isObjectProperty)(t)||t.computed)continue;if(((0,mt.isIdentifier)(t.key,{name:"__wfId"})||(0,mt.isStringLiteral)(t.key)&&t.key.value==="__wfId")&&(0,mt.isStringLiteral)(t.value))return t}}function ox(e){let t=[];for(let n of jr(e.program)){let r=$P(n);r&&t.push(r)}return t.sort((n,r)=>(n.call.start??0)-(r.call.start??0))}function $u(e){let t=Xt(e);if(!t)return{sugared:e,entries:[]};let n=[],r=[];for(let{ident:o,call:i}of ox(t)){let s=nx(i);if(!s)continue;let a=rx(s);if(!a||!(0,mt.isStringLiteral)(a.value))continue;let l=i.arguments[1];if(!(a.start==null||a.end==null))if(n.push({ident:o,wfId:a.value.value}),s.properties.length===1){if(l?.end==null||s.end==null)continue;r.push({start:l.end,end:s.end,text:""})}else{let c=s.properties[1];if(c?.start==null)continue;r.push({start:a.start,end:c.start,text:""})}}return r.length===0?{sugared:e,entries:[]}:{sugared:Mr(e,r),entries:n}}function ix(e,t){let n=Xt(e);if(!n)return{desugared:e,hasNewStyles:!1};let r=new Map(t.map(s=>[s.ident,s])),o=[],i=!1;for(let{ident:s,call:a}of ox(n)){let l=nx(a);if(l&&rx(l))continue;let c=r.get(s);if(!c){i=!0;continue}let d=JSON.stringify(c.wfId);if(l){let p=l.properties[0];p?.start!=null?o.push({start:p.start,end:p.start,text:`__wfId: ${d}, `}):l.start!=null&&o.push({start:l.start+1,end:l.start+1,text:` __wfId: ${d} `})}else{let p=a.arguments[1];p?.end!=null&&o.push({start:p.end,end:p.end,text:`, { __wfId: ${d} }`})}}return{desugared:Mr(e,o),hasNewStyles:i}}var Ur=require("fs"),as=require("path"),hx=w(require("fast-glob"));C();var sx=require("crypto"),gt=require("fs"),Oo=require("path");C();var Br=".webflow/wfs";function pn(e){return(0,sx.createHash)("sha256").update(e,"utf8").digest("hex")}function ax(e){return(0,Oo.join)(e,Br,"index.json")}function Ug(e,t){return $o(t)?(0,Oo.join)(e,Br,`${t}.json`):void 0}function lx(e){let t=ax(e);if((0,gt.existsSync)(t))try{let n=JSON.parse((0,gt.readFileSync)(t,"utf8"));return!n||typeof n.schemaHash!="string"||!Array.isArray(n.files)?"corrupt":{...typeof n.siteId=="string"?{siteId:n.siteId}:{},schemaHash:n.schemaHash,files:n.files}}catch{return"corrupt"}}function Ou(e=process.cwd()){let t=lx(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${Br}/index.json could not be read`};let n={},r=[];for(let{wirePath:o}of t.files){let i=Ug(e,o);if(!i){r.push(o);continue}if(!(0,gt.existsSync)(i)){r.push(o);continue}try{let s=JSON.parse((0,gt.readFileSync)(i,"utf8"));if(s.localPath!==void 0&&!$o(s.localPath)){r.push(o);continue}n[o]=s}catch{r.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},schemaHash:t.schemaHash,files:n},corruptPaths:r}}function Ka(e,t=process.cwd()){let n=lx(t),r=new Set(n&&n!=="corrupt"?n.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=Ug(t,s);if(!a)throw new f(`Refusing to write a lock entry outside ${Br}: "${s}"`);(0,gt.mkdirSync)((0,Oo.dirname)(a),{recursive:!0}),(0,gt.writeFileSync)(a,`${JSON.stringify(e.files[s],null,2)}
213
- `,"utf8")}for(let s of r){if(s in e.files)continue;let a=Ug(t,s);a&&(0,gt.existsSync)(a)&&(0,gt.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=ax(t);(0,gt.mkdirSync)((0,Oo.dirname)(i),{recursive:!0}),(0,gt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
214
- `,"utf8")}function cx(e=process.cwd()){(0,gt.rmSync)((0,Oo.join)(e,Br),{recursive:!0,force:!0})}C();function ux(e){if(!$o(e))throw new f(`Refusing to write unsafe path from server: "${e}"`)}var OP=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function za(e){return OP.exec(e)?.[1]}var dx=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function LP(e){return dx.exec(e)?.[2]}function NP(e){let t=dx.exec(e);return t?t[1]??"":void 0}function Hg(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function Vg(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function Gg(e,t){let r=e.slice(t.length+1).split("/");if(r.length===1)return"";if(r.length===2)return r[0]}function px(e,t){if(t.pagesShape==="nested"){let r=e.isDefault?[]:[...e.folderSegments,e.slug];return r.length>0?`${t.pagesRoot}/${r.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let n=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${n.join("/")}.tsw`}function Jg(e,t,n){if(n)return n;let r=LP(e);if(!r)return;let o=NP(e)??"";return o?`${t.componentsRoot}/${o}/${r}.tsw`:`${t.componentsRoot}/${r}.tsw`}function fx(e,t){let n=Vg(e,t);if(!n)return;let r=Gg(e,t);if(r!==void 0)return Hg(n,r)}var Wg="site/theme/";function mx(e,t){if(e.startsWith(Wg))return`${t.themeRoot}/${e.slice(Wg.length)}`}function Lu(e,t){let n=`${t}/`;if(e.startsWith(n))return`${Wg}${e.slice(n.length)}`}async function yx(e,t,n=process.cwd(),r=!1){let o=[],i=[],s=[],a=[],l=[],c=[],d={},p=new Map,m=new Map;for(let[y,b]of Object.entries(e.files)){let S=b.localPath??y;p.set(y,S),m.set(S,y)}let h=new Set((await(0,hx.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:n,onlyFiles:!0,dot:!1})).map(Og)),g=new Map;for(let y of Object.keys(e.files).sort()){let b=e.files[y],S=p.get(y);if(b.deletedUpstream){(0,Ur.existsSync)((0,as.join)(n,S))&&c.push(S);continue}if(!(0,Ur.existsSync)((0,as.join)(n,S))){i.push(S),g.set(b.contentSha256,S);continue}d[y]=S;let A=(0,Ur.readFileSync)((0,as.join)(n,S),"utf8");(r||pn(A)!==b.contentSha256)&&o.push({path:y,content:A,baseHash:b.serverHash})}for(let y of[...h].sort()){if(m.has(y))continue;let b=(0,Ur.readFileSync)((0,as.join)(n,y),"utf8"),S=g.get(pn(b));if(S!==void 0){s.push({oldPath:S,newPath:y});continue}let A=MP(y,t);if(A.kind==="unmappable"){a.push(y);continue}let{wirePath:v}=A,x=p.get(v);if(x!==void 0&&x!==y){l.push(y);continue}d[v]=y;let O=e.files[v];o.push(O?{path:v,content:b,baseHash:O.serverHash}:{path:v,content:b})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:d}}function MP(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let r=Vg(e,t.componentsRoot);if(!r)return{kind:"unmappable"};let o=Gg(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:Hg(r,o)}}let n=Lu(e,t.themeRoot);return n!==void 0?{kind:"theme",wirePath:n}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function Nu(e){let t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20));return t}function wx(e){let t=e.filter(a=>!za(a.path)),n=new Map;for(let a of e){let l=za(a.path);if(!l)continue;let c=n.get(l)??[];c.push(a),n.set(l,c)}let r=n.size>0?199:200;if(t.length>r)throw new f(`Too many changed site-global files to push in one request (${t.length} > ${r}). 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 n)!(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 ju(e,t=process.cwd()){let n=(0,as.join)(t,e);if((0,Ur.existsSync)(n))return(0,Ur.readFileSync)(n,"utf8")}var BP="site/current-page.tsw";function Mu(e){return za(e)!==void 0?BP:e}function UP(e,t){let n=e.split("/").slice(0,-1);for(let r of t.split("/"))if(!(r===""||r===".")){if(r===".."){n.length>0&&n.pop();continue}n.push(r)}return n.join("/")}function WP(e,t){let n=e.split("/").slice(0,-1),r=t.split("/"),o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;let i=n.length-o,s=r.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function Bu(e,t,n,r){let o=Xt(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=r(UP(t,l));if(c===void 0)continue;let d=WP(n,c);if(d===l)continue;let p=e[a.start],m=p==="'"||p==='"'?`${p}${d}${p}`:JSON.stringify(d);i.push({start:a.start,end:a.end,text:m})}return Mr(e,i)}function HP(e,t){return n=>t[n]??e.files[n]?.localPath??n}function VP(e,t){let n=e.outcome==="committed"||e.outcome==="noop"?$:k,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${n} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(R(` ${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(R(" 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(R(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${re} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
215
- `)}function GP(e,t,n,r){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(n[i.path]??i.path,i.path);return e.map(i=>{let s=n[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=Bu(i.content,s,Mu(i.path),l=>o.get(l)??Lu(l,r.themeRoot)??fx(l,r.componentsRoot));return{...i,content:a}})}function JP(e,t){let n=new Set,r=new Set;return{pushChanges:e.map(i=>{if(!i.path.endsWith(".tsw")||i.content===void 0)return i;let s=t.files[i.path]?.nodeIds??[],{desugared:a,hasNewNodes:l}=tx(i.content,s);l&&n.add(i.path);let c=t.files[i.path]?.styleIds??[],{desugared:d,hasNewStyles:p}=ix(a,c);return p&&r.add(i.path),{...i,content:d}}),pathsWithNewNodes:n,pathsWithNewStyles:r}}function KP(e,t){let n=[],r=[];for(let o of e){let i=t.files[o.path]?.componentId;if(o.content===void 0){r.push(o);continue}if(i){let a=JS(o.content,i);if(a===void 0){n.push(o.path);continue}r.push({...o,content:a});continue}if(o.baseHash!==void 0){r.push(o);continue}let s=KS(o.content);r.push(s===void 0?o:{...o,content:s})}return{pushChanges:r,spliceFailures:n}}function zP(e,t,n,r){let o=GP(e,t,n,r),{pushChanges:i,pathsWithNewNodes:s,pathsWithNewStyles:a}=JP(o,t),{pushChanges:l,spliceFailures:c}=KP(i,t);return{pushChanges:l,pathsWithNewNodes:s,pathsWithNewStyles:a,spliceFailures:c}}async function qP(e,t,n,r,o){let i=[],s=!1,a=!1;for(let[l,c]of n.entries()){let d;try{d=await MS(e,t,c,{conflictPolicy:r,schemaHash:o})}catch(m){throw s&&u.warn(`${re} The push failed after ${l} of ${n.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),m}o=d.schemaHash,i.push(...d.results);let p=d.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(d.results.some(m=>m.outcome==="committed")&&(s=!0),p&&l<n.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function XP(e){let t=[];for(let n of e)if(n.outcome==="committed")for(let[r,o]of Object.entries(n.createdComponents??{}))t.push({path:r,componentId:o,hash:n.hashes?.[r]});return t}function YP(e,t,n,r,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,d]of Object.entries(l.hashes??{})){let p=r.get(c);if(!p||p.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:d,contentSha256:pn(p.content),...m?{localPath:m}:{}}}let a=XP(i);for(let{path:l,componentId:c,hash:d}of a){let p=r.get(l)?.content;if(p===void 0||d===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:d,contentSha256:pn(p),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{siteId:e.siteId??t,schemaHash:n,files:s},created:a}}function ZP(e,t){for(let{path:n,componentId:r}of e)u.info(`${$} Created component ${t(n)} (id ${r})`),u.info(R(" id tracked locally \u2014 it will be spliced into this file on future pushes without changing it on disk"))}async function QP(e,t,n,r,o,i){let s=new Set([...r,...o]),a=[...new Set(n.filter(c=>c.outcome==="committed"&&Object.keys(c.hashes??{}).some(d=>s.has(d))).map(c=>c.pageId))];if(a.length===0)return i;let l={...i.files};for(let c of Nu(a)){let d=await Ja(e,t,{pageIds:c});for(let p of d.files){let m=l[p.path];if(!m)continue;let h={};if(r.has(p.path)){let{entries:g}=Pu(p.content);g.length>0&&(h.nodeIds=g)}if(o.has(p.path)){let{entries:g}=$u(p.content);g.length>0&&(h.styleIds=g)}Object.keys(h).length>0&&(l[p.path]={...m,...h})}}return{...i,files:l}}function e$({missing:e,renameCandidates:t,unmappable:n,stale:r,orphanedUpstream:o},i){for(let s of e)u.warn(`${re} ${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(`${re} ${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(`${re} ${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 r)u.warn(`${re} ${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 n){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${re} ${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\`.`:`${re} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function t$(e){let t=Ou();if(t.kind==="missing")throw new f("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new f(`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 f(`${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 n=t.lockfile;if(n.siteId!==void 0&&n.siteId!==e)throw new f(`This project's sync state was pulled from site ${n.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return n}function n$(e,t,n,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(o=>({path:o.path,localPath:n[o.path]??o.path,isNew:o.baseHash===void 0})),...r.length>0?{blocked:r.map(o=>n[o]??o)}:{}},null,2)}function r$(e,t,n,r,o){let i=new Set(r),s=e.filter(a=>!i.has(a.path));u.info(`Would push ${s.length} file(s) to site ${o}:`);for(let a of s){let l=a.baseHash===void 0&&a.path.startsWith("site/components/")&&a.path.endsWith(".tsw")&&a.content!==void 0&&!zS(a.content),c=t.files[a.path]?.componentId,d=n[a.path]??a.path,p=l?R(" (new component \u2014 the platform will assign an id, tracked locally without changing this file)"):c?R(` (previously assigned id ${c} will be spliced in on push)`):a.baseHash?"":R(" (new)");u.info(` ${d}${p}`)}u.info("Dry run \u2014 no changes made.")}async function Uu(e={}){let t=ss(),n=t$(t.siteId),r=await yx(n,t.layout,void 0,e.force),{changes:o,localPaths:i}=r;if(e$(r,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:n.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=F.forSites({authToken:s}),l=Date.now(),c=HP(n,i);try{let{pushChanges:d,pathsWithNewNodes:p,pathsWithNewStyles:m,spliceFailures:h}=zP(o,n,i,t.layout);for(let E of h)u.warn(`${re} ${c(E)} no longer matches the shape its assigned component id can be spliced into \u2014 run \`webflow sites pull\` to restore the canonical module before pushing this file again.`);if(e.dryRun){e.json?u.info(n$(t.siteId,o,i,h)):r$(o,n,i,h,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let g=wx(d),{results:y,schemaHash:b,aborted:S}=await qP(s,t.siteId,g,e.force?"rebase":void 0,n.schemaHash),A=new Map(o.map(E=>[E.path,E])),{lockfile:v,created:x}=YP(n,t.siteId,b,A,i,y);Ka(v);let O=new Set(y.flatMap(E=>E.outcome==="committed"?Object.keys(E.hashes??{}):[])),H=new Set([...p].filter(E=>O.has(E))),B=new Set([...m].filter(E=>O.has(E)));if(H.size>0||B.size>0)try{Ka(await QP(s,t.siteId,y,H,B,v))}catch(E){u.warn(`${re} The push committed, but the follow-up fetch of newly created element/style ids failed (${E instanceof Error?E.message:String(E)}). Run \`webflow sites pull\` before pushing again \u2014 otherwise the new nodes are sent without ids and duplicated.`)}let ye=y.filter(E=>E.outcome==="conflict"),ve=y.filter(E=>E.outcome==="error"),me=y.filter(E=>E.outcome==="skipped"),Le=y.flatMap(E=>E.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:b,results:y},null,2));else{ZP(x,c);for(let U of y)u.info(VP(U,c));let E=y.filter(U=>U.outcome==="committed").length,z=x.length>0?` Created ${x.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length-h.length} file(s) across ${y.length} page group(s): ${E} committed, ${ye.length} conflicted, ${ve.length} failed, ${me.length} skipped.${z}`),S&&u.warn(`${re} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(ye.length>0||ve.length>0||me.length>0||Le.length>0||h.length>0)throw new f(`${re} Push finished with ${ye.length} conflict(s), ${ve.length} error(s), ${me.length} skipped page(s), ${Le.length} rejected file(s), ${h.length} file(s) that could not be sent. 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:x.length,dryRun:!1})}catch(d){throw await a.sendError(d instanceof Error?d:new Error(String(d)),"site_push",{duration:Date.now()-l}),d instanceof f?d:new f(d,{prefix:`${k} Failed to push site files:`})}}var No=require("fs"),Dx=require("module"),Lo=require("path");q();pe();C();_();M();X();function o$(e,t,n,r){let o=n.get(e.path);if(o)return px(o,t);let i=mx(e.path,t);if(i)return i;let s=r?.files[e.path]?.localPath;return Jg(e.path,t,s)??e.path}function i$(e,t,n){if(!Array.isArray(e)||e.length===0)return;let r=(0,Dx.createRequire)((0,Lo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(r.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${n} without it.`)}}return o}async function s$(e,t){try{let{format:n,resolveConfig:r}=await import("prettier"),o=await r(t,{editorconfig:!0}),i=i$(o?.plugins,process.cwd(),t);return await n(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(n){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${n instanceof Error?n.message:String(n)}`),e}}function a$(e,t){if(t){cx();return}let n=Ou();if(n.kind==="missing")return;if(n.kind==="corrupt")throw new f(`This project's sync state is unreadable (${n.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${Br}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(n.corruptPaths.length>0)throw new f(`${n.corruptPaths.length} tracked file(s) have unreadable sync state (${n.corruptPaths.slice(0,3).join(", ")}${n.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${Br}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let r=n.lockfile;if(r?.siteId!==void 0&&r.siteId!==e&&Object.keys(r.files).length>0)throw new f(`This project's sync state was pulled from site ${r.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 r}async function Wu(e={}){let t=ss(e.siteId),n=a$(t.siteId,!!e.reset),r=await T({apiToken:e.apiToken}),o=F.forSites({authToken:r}),i=Date.now();try{let s=await Ja(r,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new f("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(E=>E.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,d={},p=[];for(let E of Nu(a)){let z=await Ja(r,t.siteId,{pageIds:E});c=z.schemaHash,d=z.componentIds??d,z.warnings&&p.push(...z.warnings);for(let U of z.files)l.set(U.path,U)}let m=[...l.values()].sort((E,z)=>E.path.localeCompare(z.path)),h=new Map(s.pages.map(E=>[E.path,E])),g=new Map;for(let E of m){let z=n?.files[E.path];if(!z)continue;let U=z.localPath??E.path,ge=ju(U),lr=ge!==void 0&&pn(ge)!==z.contentSha256,cr=E.hash!==z.serverHash;lr&&cr&&g.set(E.path,U)}let y=!e.force,b=[...g.values()],S=process.cwd(),A=new Map(m.map(E=>[E.path,o$(E,t.layout,h,n)])),v=new Map;for(let[E,z]of A)v.set(z,[...v.get(z)??[],E]);let x=[...v.entries()].filter(([,E])=>E.length>1);if(x.length>0){let E=x.map(([z,U])=>`${z} \u2190 ${U.join(", ")}`).join("; ");throw new f(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${E}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let O={siteId:t.siteId,schemaHash:c,files:{}},H=new Set(A.values()),B=[],ye=[],ve=[],me=[];for(let E of m){let z=n?.files[E.path];if(y&&g.has(E.path)){z&&(O.files[E.path]=z);continue}let U=A.get(E.path);ux(U);let ge=(0,Lo.join)(S,U);(0,No.mkdirSync)((0,Lo.dirname)(ge),{recursive:!0});let lr=U.endsWith(".tsw")?Bu(E.content,Mu(E.path),U,ii=>A.get(ii)??Jg(ii,t.layout,n?.files[ii]?.localPath)):E.content,{sugared:cr,entries:x_}=Pu(lr),{sugared:hy,entries:yy}=$u(cr),Ud=U.endsWith(".tsw")?await s$(hy,ge):hy;(0,No.writeFileSync)(ge,Ud,"utf8");let wy=Bg(Ud,x_);B.push(E);let zr=z?z.localPath??E.path:void 0;if(z&&zr&&zr!==U&&!H.has(zr)){let ii=ju(zr);ii===void 0||(pn(ii)===z.contentSha256?((0,No.rmSync)((0,Lo.join)(S,zr),{force:!0}),ye.push({from:zr,to:U})):ve.push({from:zr,to:U}))}let Dy=d[E.path],Cl=h.get(E.path);O.files[E.path]={serverHash:E.hash,contentSha256:pn(Ud),localPath:U,...Dy?{componentId:Dy}:{},...wy.length>0?{nodeIds:wy}:{},...yy.length>0?{styleIds:yy}:{},...Cl?{slug:Cl.slug,isDefault:Cl.isDefault,folderSegments:Cl.folderSegments}:{}}}let Le=new Set(m.map(E=>E.path));for(let[E,z]of Object.entries(n?.files??{})){if(Le.has(E))continue;let U=z.localPath??E;if(H.has(U))continue;let ge=ju(U);ge!==void 0&&(pn(ge)===z.contentSha256?((0,No.rmSync)((0,Lo.join)(S,U),{force:!0}),me.push(U)):(ve.push({from:U,to:"(no longer on the site)"}),O.files[E]={...z,deletedUpstream:!0}))}if(Ka(O),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:E,slug:z,title:U,path:ge,folderSegments:lr})=>({pageId:E,slug:z,title:U,path:ge,folderSegments:lr})),files:B.map(E=>({path:E.path,hash:E.hash,size:E.size,localPath:O.files[E.path]?.localPath})),...y&&b.length>0?{skipped:b}:{},...me.length>0?{removed:me}:{},...ye.length>0?{relocated:ye}:{},...ve.length>0?{orphaned:ve}:{}},null,2));else{for(let E of B){let z=h.get(E.path),U=O.files[E.path]?.localPath??E.path,ge=z?R(` (page, slug: "${z.slug}")`):"";u.info(`${$} ${U}${ge}`)}u.info(`Pulled ${B.length} file(s) across ${a.length} page(s).`);for(let E of me)u.info(R(` removed ${E} (no longer on the site)`));for(let{from:E,to:z}of ye)u.info(R(` moved ${E} \u2192 ${z}`))}for(let E of b)u.warn(y?`${re} ${E} 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).`:`${re} ${E} 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:E,to:z}of ve)u.warn(`${re} ${E} is now at ${z}, 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 ${z} and delete ${E}, since while it's there the two copies disagree.`);for(let{path:E,reason:z}of p){let U=O.files[E]?.localPath??E;u.warn(`${re} ${U}: ${z}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:B.length,skipped:y?b.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof f?s:new f(s,{prefix:`${k} Failed to pull site files:`})}}Wn();var bx=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(oe()).addOption(He(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Rg),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(oe()).action(Tg),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(oe()).action(Pg),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(Pe()).addOption(oe()).action($g),tt()&&(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(Kn()).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(Ru),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(Kn()).addOption(Pe()).addOption(oe()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(Uu),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(Kn()).addOption(oe()).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(Wu))};q();C();_();M();X();be();async function kx(e,t){return Z(t,"siteId"),Ua(`${P}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function Ex(e,t,n){return Z(t,"siteId"),Z(n,"formId"),Ua(`${P}/v2/sites/${t}/forms/${n}/submissions`,e,"formSubmissions","Failed to list submissions")}C();pe();var zg=["id","displayName","name","slug","createdOn","lastUpdated"],vx=ut(zg);function Sx(){return zg}function xx(e,t=["id","displayName","slug"]){if(e.length===0)return R("No forms found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${zg.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=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:R("\u2014")}));return ze(n,r)}function Cx(e){if(e.length===0)return R("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),n=["id","dateSubmitted",...t].map(o=>se(o)),r=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?R("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return ze(n,r)}function Fx(e){if(e.length===0)return"";let n=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],r=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
212
+ `,r.end),s=i===-1?e.length:i;return/^\s*$/.test(e.slice(o,r.start))&&/^\s*$/.test(e.slice(r.end,s))?{start:o,end:i===-1?e.length:i+1}:e[r.end]===" "?{start:r.start,end:r.end+1}:r.start>0&&e[r.start-1]===" "?{start:r.start-1,end:r.end}:{start:r.start,end:r.end}}function Uu(e){let t=Yt(e),n=t&&Xg(t);if(!n)return{sugared:e,entries:[]};let r=[],o=[];function i(l,c){let p=qg(l);if(p===void 0)return;let d=i$(e,l);if(!d)return;let m=Dx(l);r.push({path:c,uid:p,kind:"element",...m?{tag:m}:{}}),o.push({start:d.start,end:d.end,text:""})}function s(l,c){let p=0;for(let d of l.children){if(Yg(d)){let m=qg(d);if(m===void 0||d.start==null||d.end==null)continue;let h=r$(d),g=h===void 0?o$(d):void 0;if(h===void 0&&g===void 0)continue;r.push({path:[...c,p++],uid:m,kind:"string"}),o.push({start:d.start,end:d.end,text:h!==void 0?`{${JSON.stringify(h)}}`:`{${e.slice(g.start,g.end)}}`});continue}if(Zg(d)!==void 0){p++;continue}if((0,te.isJSXElement)(d)){let m=[...c,p++];i(d,m),s(d,m)}}}if(i(n,[]),s(n,[]),o.length===0)return{sugared:e,entries:[]};let a=Ur(e,o);return{sugared:a,entries:Qg(a,r)}}function Qg(e,t){if(t.length===0)return t;let n=new Map(bx(e).map(r=>[pn(r.path),r.hash]));return t.map(r=>{let o=n.get(pn(r.path));return o?{...r,hash:o}:r})}function vx(e,t){let n=Yt(e),r=n&&Xg(n);if(!r)return{desugared:e,hasNewNodes:!1};let o=t$(bx(e),t),i=[],s=!1;function a(c,p){if(qg(c)!==void 0)return;let d=o.get(pn(p));if(!d||d.kind!=="element"){s=!0;return}let m=c.openingElement.name.end;m!=null&&i.push({start:m,end:m,text:` uid=${JSON.stringify(d.uid)}`})}function l(c,p){let d=0;for(let m of c.children){if(Yg(m))continue;let h=Zg(m);if(h!==void 0){let y=[...p,d++];if(m.start==null||m.end==null)continue;let b=o.get(pn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${JSON.stringify(h)}}</Basic.String>`});continue}let g=Ex(m);if(g!==void 0){let y=[...p,d++];if(m.start==null||m.end==null)continue;let b=o.get(pn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${e.slice(g.start,g.end)}}</Basic.String>`});continue}if((0,te.isJSXElement)(m)){let y=[...p,d++];a(m,y),l(m,y)}}}return a(r,[]),l(r,[]),{desugared:Ur(e,i),hasNewNodes:s}}var gt=require("@babel/types");function s$(e){if(!(0,gt.isVariableDeclarator)(e)||!(0,gt.isIdentifier)(e.id)||!e.init)return;let{init:t}=e;if(!(!(0,gt.isCallExpression)(t)||!(0,gt.isIdentifier)(t.callee,{name:"style"})))return{ident:e.id.name,call:t}}function Sx(e){let t=e.arguments[2];return t&&(0,gt.isObjectExpression)(t)?t:void 0}function xx(e){for(let t of e.properties){if(!(0,gt.isObjectProperty)(t)||t.computed)continue;if(((0,gt.isIdentifier)(t.key,{name:"__wfId"})||(0,gt.isStringLiteral)(t.key)&&t.key.value==="__wfId")&&(0,gt.isStringLiteral)(t.value))return t}}function Cx(e){let t=[];for(let n of Br(e.program)){let r=s$(n);r&&t.push(r)}return t.sort((n,r)=>(n.call.start??0)-(r.call.start??0))}function Wu(e){let t=Yt(e);if(!t)return{sugared:e,entries:[]};let n=[],r=[];for(let{ident:o,call:i}of Cx(t)){let s=Sx(i);if(!s)continue;let a=xx(s);if(!a||!(0,gt.isStringLiteral)(a.value))continue;let l=i.arguments[1];if(!(a.start==null||a.end==null))if(n.push({ident:o,wfId:a.value.value}),s.properties.length===1){if(l?.end==null||s.end==null)continue;r.push({start:l.end,end:s.end,text:""})}else{let c=s.properties[1];if(c?.start==null)continue;r.push({start:a.start,end:c.start,text:""})}}return r.length===0?{sugared:e,entries:[]}:{sugared:Ur(e,r),entries:n}}function Fx(e,t){let n=Yt(e);if(!n)return{desugared:e,hasNewStyles:!1};let r=new Map(t.map(s=>[s.ident,s])),o=[],i=!1;for(let{ident:s,call:a}of Cx(n)){let l=Sx(a);if(l&&xx(l))continue;let c=r.get(s);if(!c){i=!0;continue}let p=JSON.stringify(c.wfId);if(l){let d=l.properties[0];d?.start!=null?o.push({start:d.start,end:d.start,text:`__wfId: ${p}, `}):l.start!=null&&o.push({start:l.start+1,end:l.start+1,text:` __wfId: ${p} `})}else{let d=a.arguments[1];d?.end!=null&&o.push({start:d.end,end:d.end,text:`, { __wfId: ${p} }`})}}return{desugared:Ur(e,o),hasNewStyles:i}}var Hr=require("fs"),ds=require("path"),jx=w(require("fast-glob"));C();var _x=require("crypto"),ht=require("fs"),jo=require("path");C();var Wr=".webflow/wfs";function fn(e){return(0,_x.createHash)("sha256").update(e,"utf8").digest("hex")}function Ax(e){return(0,jo.join)(e,Wr,"index.json")}function eh(e,t){return No(t)?(0,jo.join)(e,Wr,`${t}.json`):void 0}function Rx(e){let t=Ax(e);if((0,ht.existsSync)(t))try{let n=JSON.parse((0,ht.readFileSync)(t,"utf8"));return!n||typeof n.schemaHash!="string"||!Array.isArray(n.files)?"corrupt":{...typeof n.siteId=="string"?{siteId:n.siteId}:{},schemaHash:n.schemaHash,files:n.files}}catch{return"corrupt"}}function Hu(e=process.cwd()){let t=Rx(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${Wr}/index.json could not be read`};let n={},r=[];for(let{wirePath:o}of t.files){let i=eh(e,o);if(!i){r.push(o);continue}if(!(0,ht.existsSync)(i)){r.push(o);continue}try{let s=JSON.parse((0,ht.readFileSync)(i,"utf8"));if(s.localPath!==void 0&&!No(s.localPath)){r.push(o);continue}n[o]=s}catch{r.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},schemaHash:t.schemaHash,files:n},corruptPaths:r}}function Qa(e,t=process.cwd()){let n=Rx(t),r=new Set(n&&n!=="corrupt"?n.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=eh(t,s);if(!a)throw new f(`Refusing to write a lock entry outside ${Wr}: "${s}"`);(0,ht.mkdirSync)((0,jo.dirname)(a),{recursive:!0}),(0,ht.writeFileSync)(a,`${JSON.stringify(e.files[s],null,2)}
213
+ `,"utf8")}for(let s of r){if(s in e.files)continue;let a=eh(t,s);a&&(0,ht.existsSync)(a)&&(0,ht.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=Ax(t);(0,ht.mkdirSync)((0,jo.dirname)(i),{recursive:!0}),(0,ht.writeFileSync)(i,`${JSON.stringify(o,null,2)}
214
+ `,"utf8")}function Ix(e=process.cwd()){(0,ht.rmSync)((0,jo.join)(e,Wr),{recursive:!0,force:!0})}C();function Tx(e){if(!No(e))throw new f(`Refusing to write unsafe path from server: "${e}"`)}var a$=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function el(e){return a$.exec(e)?.[1]}var Px=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function l$(e){return Px.exec(e)?.[2]}function c$(e){let t=Px.exec(e);return t?t[1]??"":void 0}function nh(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function rh(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function oh(e,t){let r=e.slice(t.length+1).split("/");if(r.length===1)return"";if(r.length===2)return r[0]}function $x(e,t){if(t.pagesShape==="nested"){let r=e.isDefault?[]:[...e.folderSegments,e.slug];return r.length>0?`${t.pagesRoot}/${r.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let n=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${n.join("/")}.tsw`}function ih(e,t,n){if(n)return n;let r=l$(e);if(!r)return;let o=c$(e)??"";return o?`${t.componentsRoot}/${o}/${r}.tsw`:`${t.componentsRoot}/${r}.tsw`}function Ox(e,t){let n=rh(e,t);if(!n)return;let r=oh(e,t);if(r!==void 0)return nh(n,r)}var th="site/theme/";function Lx(e,t){if(e.startsWith(th))return`${t.themeRoot}/${e.slice(th.length)}`}function Vu(e,t){let n=`${t}/`;if(e.startsWith(n))return`${th}${e.slice(n.length)}`}async function Mx(e,t,n=process.cwd(),r=!1){let o=[],i=[],s=[],a=[],l=[],c=[],p={},d=new Map,m=new Map;for(let[y,b]of Object.entries(e.files)){let S=b.localPath??y;d.set(y,S),m.set(S,y)}let h=new Set((await(0,jx.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:n,onlyFiles:!0,dot:!1})).map(zg)),g=new Map;for(let y of Object.keys(e.files).sort()){let b=e.files[y],S=d.get(y);if(b.deletedUpstream){(0,Hr.existsSync)((0,ds.join)(n,S))&&c.push(S);continue}if(!(0,Hr.existsSync)((0,ds.join)(n,S))){i.push(S),g.set(b.contentSha256,S);continue}p[y]=S;let _=(0,Hr.readFileSync)((0,ds.join)(n,S),"utf8");(r||fn(_)!==b.contentSha256)&&o.push({path:y,content:_,baseHash:b.serverHash})}for(let y of[...h].sort()){if(m.has(y))continue;let b=(0,Hr.readFileSync)((0,ds.join)(n,y),"utf8"),S=g.get(fn(b));if(S!==void 0){s.push({oldPath:S,newPath:y});continue}let _=d$(y,t);if(_.kind==="unmappable"){a.push(y);continue}let{wirePath:v}=_,x=d.get(v);if(x!==void 0&&x!==y){l.push(y);continue}p[v]=y;let O=e.files[v];o.push(O?{path:v,content:b,baseHash:O.serverHash}:{path:v,content:b})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:p}}function d$(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let r=rh(e,t.componentsRoot);if(!r)return{kind:"unmappable"};let o=oh(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:nh(r,o)}}let n=Vu(e,t.themeRoot);return n!==void 0?{kind:"theme",wirePath:n}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function Gu(e){let t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20));return t}function Bx(e){let t=e.filter(a=>!el(a.path)),n=new Map;for(let a of e){let l=el(a.path);if(!l)continue;let c=n.get(l)??[];c.push(a),n.set(l,c)}let r=n.size>0?199:200;if(t.length>r)throw new f(`Too many changed site-global files to push in one request (${t.length} > ${r}). 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 n)!(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 Ku(e,t=process.cwd()){let n=(0,ds.join)(t,e);if((0,Hr.existsSync)(n))return(0,Hr.readFileSync)(n,"utf8")}var p$="site/current-page.tsw";function Ju(e){return el(e)!==void 0?p$:e}function f$(e,t){let n=e.split("/").slice(0,-1);for(let r of t.split("/"))if(!(r===""||r===".")){if(r===".."){n.length>0&&n.pop();continue}n.push(r)}return n.join("/")}function m$(e,t){let n=e.split("/").slice(0,-1),r=t.split("/"),o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;let i=n.length-o,s=r.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function zu(e,t,n,r){let o=Yt(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=r(f$(t,l));if(c===void 0)continue;let p=m$(n,c);if(p===l)continue;let d=e[a.start],m=d==="'"||d==='"'?`${d}${p}${d}`:JSON.stringify(p);i.push({start:a.start,end:a.end,text:m})}return Ur(e,i)}function g$(e,t){return n=>t[n]??e.files[n]?.localPath??n}function h$(e,t){let n=e.outcome==="committed"||e.outcome==="noop"?$:k,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${n} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(I(` ${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(I(" 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(I(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${re} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
215
+ `)}function y$(e,t,n,r){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(n[i.path]??i.path,i.path);return e.map(i=>{let s=n[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=zu(i.content,s,Ju(i.path),l=>o.get(l)??Vu(l,r.themeRoot)??Ox(l,r.componentsRoot));return{...i,content:a}})}function w$(e,t){let n=new Set,r=new Set;return{pushChanges:e.map(i=>{if(!i.path.endsWith(".tsw")||i.content===void 0)return i;let s=t.files[i.path]?.nodeIds??[],{desugared:a,hasNewNodes:l}=vx(i.content,s);l&&n.add(i.path);let c=t.files[i.path]?.styleIds??[],{desugared:p,hasNewStyles:d}=Fx(a,c);return d&&r.add(i.path),{...i,content:p}}),pathsWithNewNodes:n,pathsWithNewStyles:r}}function b$(e,t){let n=[],r=[];for(let o of e){let i=t.files[o.path]?.componentId;if(o.content===void 0){r.push(o);continue}if(i){let a=mx(o.content,i);if(a===void 0){n.push(o.path);continue}r.push({...o,content:a});continue}if(o.baseHash!==void 0){r.push(o);continue}let s=gx(o.content);r.push(s===void 0?o:{...o,content:s})}return{pushChanges:r,spliceFailures:n}}function D$(e,t,n,r){let o=y$(e,t,n,r),{pushChanges:i,pathsWithNewNodes:s,pathsWithNewStyles:a}=w$(o,t),{pushChanges:l,spliceFailures:c}=b$(i,t);return{pushChanges:l,pathsWithNewNodes:s,pathsWithNewStyles:a,spliceFailures:c}}async function k$(e,t,n,r,o){let i=[],s=!1,a=!1;for(let[l,c]of n.entries()){let p;try{p=await ax(e,t,c,{conflictPolicy:r,schemaHash:o})}catch(m){throw s&&u.warn(`${re} The push failed after ${l} of ${n.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),m}o=p.schemaHash,i.push(...p.results);let d=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),d&&l<n.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function E$(e){let t=[];for(let n of e)if(n.outcome==="committed")for(let[r,o]of Object.entries(n.createdComponents??{}))t.push({path:r,componentId:o,hash:n.hashes?.[r]});return t}function v$(e,t,n,r,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 d=r.get(c);if(!d||d.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:fn(d.content),...m?{localPath:m}:{}}}let a=E$(i);for(let{path:l,componentId:c,hash:p}of a){let d=r.get(l)?.content;if(d===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:fn(d),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{siteId:e.siteId??t,schemaHash:n,files:s},created:a}}function S$(e,t){for(let{path:n,componentId:r}of e)u.info(`${$} Created component ${t(n)} (id ${r})`),u.info(I(" id tracked locally \u2014 it will be spliced into this file on future pushes without changing it on disk"))}async function x$(e,t,n,r,o,i){let s=new Set([...r,...o]),a=[...new Set(n.filter(c=>c.outcome==="committed"&&Object.keys(c.hashes??{}).some(p=>s.has(p))).map(c=>c.pageId))];if(a.length===0)return i;let l={...i.files};for(let c of Gu(a)){let p=await Za(e,t,{pageIds:c});for(let d of p.files){let m=l[d.path];if(!m)continue;let h={};if(r.has(d.path)){let{entries:g}=Uu(d.content);g.length>0&&(h.nodeIds=g)}if(o.has(d.path)){let{entries:g}=Wu(d.content);g.length>0&&(h.styleIds=g)}Object.keys(h).length>0&&(l[d.path]={...m,...h})}}return{...i,files:l}}function C$({missing:e,renameCandidates:t,unmappable:n,stale:r,orphanedUpstream:o},i){for(let s of e)u.warn(`${re} ${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(`${re} ${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(`${re} ${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 r)u.warn(`${re} ${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 n){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${re} ${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\`.`:`${re} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function F$(e){let t=Hu();if(t.kind==="missing")throw new f("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new f(`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 f(`${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 n=t.lockfile;if(n.siteId!==void 0&&n.siteId!==e)throw new f(`This project's sync state was pulled from site ${n.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return n}function _$(e,t,n,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(o=>({path:o.path,localPath:n[o.path]??o.path,isNew:o.baseHash===void 0})),...r.length>0?{blocked:r.map(o=>n[o]??o)}:{}},null,2)}function A$(e,t,n,r,o){let i=new Set(r),s=e.filter(a=>!i.has(a.path));u.info(`Would push ${s.length} file(s) to site ${o}:`);for(let a of s){let l=a.baseHash===void 0&&a.path.startsWith("site/components/")&&a.path.endsWith(".tsw")&&a.content!==void 0&&!hx(a.content),c=t.files[a.path]?.componentId,p=n[a.path]??a.path,d=l?I(" (new component \u2014 the platform will assign an id, tracked locally without changing this file)"):c?I(` (previously assigned id ${c} will be spliced in on push)`):a.baseHash?"":I(" (new)");u.info(` ${p}${d}`)}u.info("Dry run \u2014 no changes made.")}async function qu(e={}){let t=us(),n=F$(t.siteId),r=await Mx(n,t.layout,void 0,e.force),{changes:o,localPaths:i}=r;if(C$(r,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:n.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=F.forSites({authToken:s}),l=Date.now(),c=g$(n,i);try{let{pushChanges:p,pathsWithNewNodes:d,pathsWithNewStyles:m,spliceFailures:h}=D$(o,n,i,t.layout);for(let E of h)u.warn(`${re} ${c(E)} no longer matches the shape its assigned component id can be spliced into \u2014 run \`webflow sites pull\` to restore the canonical module before pushing this file again.`);if(e.dryRun){e.json?u.info(_$(t.siteId,o,i,h)):A$(o,n,i,h,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let g=Bx(p),{results:y,schemaHash:b,aborted:S}=await k$(s,t.siteId,g,e.force?"rebase":void 0,n.schemaHash),_=new Map(o.map(E=>[E.path,E])),{lockfile:v,created:x}=v$(n,t.siteId,b,_,i,y);Qa(v);let O=new Set(y.flatMap(E=>E.outcome==="committed"?Object.keys(E.hashes??{}):[])),H=new Set([...d].filter(E=>O.has(E))),B=new Set([...m].filter(E=>O.has(E)));if(H.size>0||B.size>0)try{Qa(await x$(s,t.siteId,y,H,B,v))}catch(E){u.warn(`${re} The push committed, but the follow-up fetch of newly created element/style ids failed (${E instanceof Error?E.message:String(E)}). Run \`webflow sites pull\` before pushing again \u2014 otherwise the new nodes are sent without ids and duplicated.`)}let we=y.filter(E=>E.outcome==="conflict"),Se=y.filter(E=>E.outcome==="error"),me=y.filter(E=>E.outcome==="skipped"),Ne=y.flatMap(E=>E.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:b,results:y},null,2));else{S$(x,c);for(let U of y)u.info(h$(U,c));let E=y.filter(U=>U.outcome==="committed").length,z=x.length>0?` Created ${x.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length-h.length} file(s) across ${y.length} page group(s): ${E} committed, ${we.length} conflicted, ${Se.length} failed, ${me.length} skipped.${z}`),S&&u.warn(`${re} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(we.length>0||Se.length>0||me.length>0||Ne.length>0||h.length>0)throw new f(`${re} Push finished with ${we.length} conflict(s), ${Se.length} error(s), ${me.length} skipped page(s), ${Ne.length} rejected file(s), ${h.length} file(s) that could not be sent. 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:x.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 f?p:new f(p,{prefix:`${k} Failed to push site files:`})}}var Bo=require("fs"),Ux=require("module"),Mo=require("path");q();pe();C();A();M();X();function R$(e,t,n,r){let o=n.get(e.path);if(o)return $x(o,t);let i=Lx(e.path,t);if(i)return i;let s=r?.files[e.path]?.localPath;return ih(e.path,t,s)??e.path}function I$(e,t,n){if(!Array.isArray(e)||e.length===0)return;let r=(0,Ux.createRequire)((0,Mo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(r.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${n} without it.`)}}return o}async function T$(e,t){try{let{format:n,resolveConfig:r}=await import("prettier"),o=await r(t,{editorconfig:!0}),i=I$(o?.plugins,process.cwd(),t);return await n(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(n){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${n instanceof Error?n.message:String(n)}`),e}}function P$(e,t){if(t){Ix();return}let n=Hu();if(n.kind==="missing")return;if(n.kind==="corrupt")throw new f(`This project's sync state is unreadable (${n.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${Wr}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(n.corruptPaths.length>0)throw new f(`${n.corruptPaths.length} tracked file(s) have unreadable sync state (${n.corruptPaths.slice(0,3).join(", ")}${n.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${Wr}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let r=n.lockfile;if(r?.siteId!==void 0&&r.siteId!==e&&Object.keys(r.files).length>0)throw new f(`This project's sync state was pulled from site ${r.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 r}async function Xu(e={}){let t=us(e.siteId),n=P$(t.siteId,!!e.reset),r=await T({apiToken:e.apiToken}),o=F.forSites({authToken:r}),i=Date.now();try{let s=await Za(r,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new f("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(E=>E.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={},d=[];for(let E of Gu(a)){let z=await Za(r,t.siteId,{pageIds:E});c=z.schemaHash,p=z.componentIds??p,z.warnings&&d.push(...z.warnings);for(let U of z.files)l.set(U.path,U)}let m=[...l.values()].sort((E,z)=>E.path.localeCompare(z.path)),h=new Map(s.pages.map(E=>[E.path,E])),g=new Map;for(let E of m){let z=n?.files[E.path];if(!z)continue;let U=z.localPath??E.path,ge=Ku(U),ur=ge!==void 0&&fn(ge)!==z.contentSha256,dr=E.hash!==z.serverHash;ur&&dr&&g.set(E.path,U)}let y=!e.force,b=[...g.values()],S=process.cwd(),_=new Map(m.map(E=>[E.path,R$(E,t.layout,h,n)])),v=new Map;for(let[E,z]of _)v.set(z,[...v.get(z)??[],E]);let x=[...v.entries()].filter(([,E])=>E.length>1);if(x.length>0){let E=x.map(([z,U])=>`${z} \u2190 ${U.join(", ")}`).join("; ");throw new f(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${E}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let O={siteId:t.siteId,schemaHash:c,files:{}},H=new Set(_.values()),B=[],we=[],Se=[],me=[];for(let E of m){let z=n?.files[E.path];if(y&&g.has(E.path)){z&&(O.files[E.path]=z);continue}let U=_.get(E.path);Tx(U);let ge=(0,Mo.join)(S,U);(0,Bo.mkdirSync)((0,Mo.dirname)(ge),{recursive:!0});let ur=U.endsWith(".tsw")?zu(E.content,Ju(E.path),U,li=>_.get(li)??ih(li,t.layout,n?.files[li]?.localPath)):E.content,{sugared:dr,entries:J_}=Uu(ur),{sugared:Ay,entries:Ry}=Wu(dr),qd=U.endsWith(".tsw")?await T$(Ay,ge):Ay;(0,Bo.writeFileSync)(ge,qd,"utf8");let Iy=Qg(qd,J_);B.push(E);let Xr=z?z.localPath??E.path:void 0;if(z&&Xr&&Xr!==U&&!H.has(Xr)){let li=Ku(Xr);li===void 0||(fn(li)===z.contentSha256?((0,Bo.rmSync)((0,Mo.join)(S,Xr),{force:!0}),we.push({from:Xr,to:U})):Se.push({from:Xr,to:U}))}let Ty=p[E.path],Tl=h.get(E.path);O.files[E.path]={serverHash:E.hash,contentSha256:fn(qd),localPath:U,...Ty?{componentId:Ty}:{},...Iy.length>0?{nodeIds:Iy}:{},...Ry.length>0?{styleIds:Ry}:{},...Tl?{slug:Tl.slug,isDefault:Tl.isDefault,folderSegments:Tl.folderSegments}:{}}}let Ne=new Set(m.map(E=>E.path));for(let[E,z]of Object.entries(n?.files??{})){if(Ne.has(E))continue;let U=z.localPath??E;if(H.has(U))continue;let ge=Ku(U);ge!==void 0&&(fn(ge)===z.contentSha256?((0,Bo.rmSync)((0,Mo.join)(S,U),{force:!0}),me.push(U)):(Se.push({from:U,to:"(no longer on the site)"}),O.files[E]={...z,deletedUpstream:!0}))}if(Qa(O),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:E,slug:z,title:U,path:ge,folderSegments:ur})=>({pageId:E,slug:z,title:U,path:ge,folderSegments:ur})),files:B.map(E=>({path:E.path,hash:E.hash,size:E.size,localPath:O.files[E.path]?.localPath})),...y&&b.length>0?{skipped:b}:{},...me.length>0?{removed:me}:{},...we.length>0?{relocated:we}:{},...Se.length>0?{orphaned:Se}:{}},null,2));else{for(let E of B){let z=h.get(E.path),U=O.files[E.path]?.localPath??E.path,ge=z?I(` (page, slug: "${z.slug}")`):"";u.info(`${$} ${U}${ge}`)}u.info(`Pulled ${B.length} file(s) across ${a.length} page(s).`);for(let E of me)u.info(I(` removed ${E} (no longer on the site)`));for(let{from:E,to:z}of we)u.info(I(` moved ${E} \u2192 ${z}`))}for(let E of b)u.warn(y?`${re} ${E} 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).`:`${re} ${E} 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:E,to:z}of Se)u.warn(`${re} ${E} is now at ${z}, 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 ${z} and delete ${E}, since while it's there the two copies disagree.`);for(let{path:E,reason:z}of d){let U=O.files[E]?.localPath??E;u.warn(`${re} ${U}: ${z}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:B.length,skipped:y?b.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof f?s:new f(s,{prefix:`${k} Failed to pull site files:`})}}Vn();var Wx=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(ne()).addOption(He(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Vg),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(ne()).action(Gg),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(ne()).action(Kg),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(Ae()).addOption(ne()).action(Jg),Je()&&(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(qn()).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(Mu),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(qn()).addOption(Ae()).addOption(ne()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(qu),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(qn()).addOption(ne()).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(Xu))};q();C();A();M();X();De();async function Hx(e,t){return Z(t,"siteId"),Ja(`${P()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function Vx(e,t,n){return Z(t,"siteId"),Z(n,"formId"),Ja(`${P()}/v2/sites/${t}/forms/${n}/submissions`,e,"formSubmissions","Failed to list submissions")}C();pe();var ah=["id","displayName","name","slug","createdOn","lastUpdated"],Gx=ut(ah);function Kx(){return ah}function Jx(e,t=["id","displayName","slug"]){if(e.length===0)return I("No forms found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${ah.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=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:I("\u2014")}));return qe(n,r)}function zx(e){if(e.length===0)return I("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),n=["id","dateSubmitted",...t].map(o=>se(o)),r=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?I("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return qe(n,r)}function qx(e){if(e.length===0)return"";let n=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],r=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
216
216
  `)?`"${s.replace(/"/g,'""')}"`:s};return[n.join(","),...e.map(i=>n.map(s=>r(s==="id"?i.id:s==="formId"?i.formId:s==="displayName"?i.displayName:s==="dateSubmitted"?i.dateSubmitted:i.formResponse[s])).join(","))].join(`
217
- `)}async function qg(e){Z(e.site,"siteId");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await kx(t,e.site);if(await n.sendUsage("forms_list",{duration:Date.now()-r,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=Ce(e.fields,vx,Sx());u.info(xx(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list forms:`}))}}var _x=w(require("fs"));q();C();_();M();X();async function Xg(e){Z(e.site,"siteId"),Z(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await Ex(t,e.site,e.form);if(await n.sendUsage("forms_submissions",{duration:Date.now()-r,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=Fx(o);_x.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(Cx(o))}catch(o){throw await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to fetch submissions:`})}}var Ax=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(It()).addOption(oe()).addOption(He(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(qg),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(Xg)};var mh=w(require("fs")),gh=w(require("path"));_();var Bo=w(require("fs")),Mo=w(require("path")),Gu=w(require("tar"));C();_();var Zg=w(require("fs")),Wr=w(require("path"));C();var l$=[/\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],c$=/[\r\n\u2028\u2029]+/g;function Yg(e){if(e==null)return"";let t=String(e);for(let n of l$)t=t.replace(n,"");return t}function D(e){return Yg(e).replace(c$," ").trim()}var Ix={impl:Wr.default.posix,caseInsensitive:!1},Qg={impl:Wr.default.win32,caseInsensitive:!0};function jo(){let e=process.platform;return e==="win32"?Qg:{impl:Wr.default.posix,caseInsensitive:e==="darwin"}}function Hu(e,t){let n=t.impl.resolve(e);return t.caseInsensitive?n.toLowerCase():n}function Hr(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function rt(e,t,n=jo()){if(Hr(e)||Hr(t))return!1;let r=Hu(e,n),o=Hu(t,n);if(r===o)return!0;let i=n.impl.relative(r,o);return i===""?!0:n.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function Vu(e,t,n=jo()){if(Hr(e)||Hr(t))return!1;let[r,o]=await Promise.all([fn(e),fn(t)]);return rt(r,o,n)}function Be(e,t,n,r=jo()){if(!rt(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside.
217
+ `)}async function lh(e){Z(e.site,"siteId");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await Hx(t,e.site);if(await n.sendUsage("forms_list",{duration:Date.now()-r,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=_e(e.fields,Gx,Kx());u.info(Jx(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list forms:`}))}}var Xx=w(require("fs"));q();C();A();M();X();async function ch(e){Z(e.site,"siteId"),Z(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await Vx(t,e.site,e.form);if(await n.sendUsage("forms_submissions",{duration:Date.now()-r,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=qx(o);Xx.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(zx(o))}catch(o){throw await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to fetch submissions:`})}}var Yx=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Tt()).addOption(ne()).addOption(He(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(lh),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(ch)};var Fh=w(require("fs")),_h=w(require("path"));A();var Ho=w(require("fs")),Wo=w(require("path")),Qu=w(require("tar"));C();A();var dh=w(require("fs")),Vr=w(require("path"));C();var $$=[/\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],O$=/[\r\n\u2028\u2029]+/g;function uh(e){if(e==null)return"";let t=String(e);for(let n of $$)t=t.replace(n,"");return t}function D(e){return uh(e).replace(O$," ").trim()}var Zx={impl:Vr.default.posix,caseInsensitive:!1},ph={impl:Vr.default.win32,caseInsensitive:!0};function Uo(){let e=process.platform;return e==="win32"?ph:{impl:Vr.default.posix,caseInsensitive:e==="darwin"}}function Yu(e,t){let n=t.impl.resolve(e);return t.caseInsensitive?n.toLowerCase():n}function Gr(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function rt(e,t,n=Uo()){if(Gr(e)||Gr(t))return!1;let r=Yu(e,n),o=Yu(t,n);if(r===o)return!0;let i=n.impl.relative(r,o);return i===""?!0:n.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function Zu(e,t,n=Uo()){if(Gr(e)||Gr(t))return!1;let[r,o]=await Promise.all([mn(e),mn(t)]);return rt(r,o,n)}function Ue(e,t,n,r=Uo()){if(!rt(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside.
218
218
  expected inside: ${D(e)}
219
219
  resolved to: ${D(t)}
220
- Please report this.`)}async function ls(e,t,n,r=jo()){if(!await Vu(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside once symlinks are followed.
220
+ Please report this.`)}async function ps(e,t,n,r=Uo()){if(!await Zu(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside once symlinks are followed.
221
221
  expected inside: ${D(e)}
222
222
  resolved to: ${D(t)}
223
- Please report this.`)}function u$(e,t,n=jo()){return rt(e,t,n)||rt(t,e,n)}async function eh(e,t,n=jo()){if(Hr(e)||Hr(t))return!1;let[r,o]=await Promise.all([fn(e),fn(t)]);return u$(r,o,n)}function qe(e,t,n=jo()){return typeof e!="string"||typeof t!="string"||Hr(e)||Hr(t)?!1:Hu(e,n)===Hu(t,n)}async function fn(e){let t=Wr.default.resolve(e);try{return await Zg.default.promises.realpath(t)}catch{}try{let n=await Zg.default.promises.realpath(Wr.default.dirname(t));return Wr.default.join(n,Wr.default.basename(t))}catch{return t}}var d$=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function cs(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(d$.test(t))return"Windows reserved device name in entry path"}return null}var rh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),p$=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),f$=32,m$=512,th=10,Px=100,Rx=100;function $x(){return{retained:[],fatal:[],fatalCount:0,count:0}}function Ox(e,t,n){e.count+=1;let r={code:t,message:Yg(n)};e.retained.length<Rx&&e.retained.push(r),p$.has(t)&&(e.fatalCount+=1,e.fatal.length<Rx&&e.fatal.push(r))}async function Lx(e,t,n){let r=await g$(n.containmentRoot),o=await h$(r,t),i=await Tx(e),s=await w$(e,n),a=await b$(e,o,n);if(a.warnings.fatal.length>0)throw Wx(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 v$(a.refused,a.refusedCount);let l=await Tx(e);if(i!==l)throw new f("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 k$(r,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 Tx(e){try{let t=await Bo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new f(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function g$(e){try{return await Bo.default.promises.realpath(Mo.default.resolve(e))}catch(t){throw new f(`Refusing to extract: the directory the extraction must stay inside ("${D(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function h$(e,t){let n=Mo.default.resolve(t);Be(e,n,"the extraction directory");let o=Mo.default.relative(e,n).split(Mo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Mo.default.join(i,s);let a=await y$(i);if(a===null){await Bo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new f(`Refusing to extract: "${D(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 f(`Refusing to extract: "${D(i)}" exists and is not a directory.`)}return n}async function y$(e){try{return await Bo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new f(`Could not inspect "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function w$(e,t){let n=Nx(t.limits),r=Bx(t.consumedSubtrees),o=[],i=[],s=$x(),a=0,l=0,c=0,d=!1,p=!1,m=(h,g)=>{c+=1,o.length<Px&&o.push({entryPath:h,reason:g})};try{await Gu.list({file:e,onReadEntry:h=>{let g=h.path,y=h.type;if(jx(y)||(a+=1,a>n.maxFiles&&!d&&(d=!0,m(g,`archive has more than ${n.maxFiles} files`))),!rh.has(y)){let A=`unsupported entry type ${y}`;r(g)?m(g,A):d||i.push({entryPath:g,reason:A});return}let b=cs(g)??Mx(g,n);if(b){m(g,b);return}let S=h.size;S>n.maxEntryBytes&&m(g,`entry is ${us(S)}, over the ${us(n.maxEntryBytes)} per-file cap`),l+=S,l>n.maxUnpackedBytes&&!p&&(p=!0,m(g,`unpacked total passes the ${us(n.maxUnpackedBytes)} cap`))},onwarn:(h,g)=>{Ox(s,h,g)}})}catch(h){throw h instanceof f?h:new f(`Could not read the downloaded archive: ${h instanceof Error?h.message:String(h)}`)}if(o.length>0)throw E$(o,c);if(s.fatal.length>0)throw Wx(s.fatal,s.fatalCount);for(let h of i)u.debug(`Skipped archive entry "${D(h.entryPath)}": ${h.reason}`);return{skipped:i,warnings:s}}function D$(e,t,n,r){if(!rh.has(t))return`unsupported entry type ${t}`;let o=cs(e)??Mx(e,r);return o||(n>r.maxEntryBytes?`entry is ${us(n)}, over the ${us(r.maxEntryBytes)} per-file cap`:null)}async function b$(e,t,n){let r=Nx(n.limits),o=Bx(n.consumedSubtrees),i=$x(),s=[],a=0,l=0,c=0,d=(h,g)=>(a+=1,s.length<Px&&s.push({entryPath:h,reason:g}),!1),p=()=>!1,m=(h,g)=>{let y="type"in g?g.type:g.isDirectory()?"Directory":"File",b=g.size;if(!rh.has(y)&&!o(h))return p();let S=D$(h,y,b,r);if(S)return d(h,S);if(c+b>r.maxUnpackedBytes)return d(h,`unpacked total passes the ${us(r.maxUnpackedBytes)} cap`);if(!jx(y)){if(l+1>r.maxFiles)return d(h,`archive has more than ${r.maxFiles} files`);l+=1}return c+=b,!0};try{await Gu.extract({file:e,cwd:t,strip:n.strip??0,preservePaths:!1,filter:m,onwarn:(h,g)=>{Ox(i,h,g)}})}catch(h){throw h instanceof f?h:new f(`Could not extract the downloaded archive: ${h instanceof Error?h.message:String(h)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function k$(e,t){Be(e,await Bo.default.promises.realpath(t),"the extracted directory");let n=[t];for(;n.length>0;){let r=n.pop(),o=await Bo.default.promises.readdir(r,{withFileTypes:!0});for(let i of o){let s=Mo.default.join(r,i.name);if(!i.isFile()&&!i.isDirectory())throw new f(`Refusing to continue: extraction produced a non-regular entry at "${D(s)}". Please report this.`);Be(e,s,"an extracted archive entry"),i.isDirectory()&&n.push(s)}}}function Nx(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??f$,maxPathLength:e.maxPathLength??m$}}function jx(e){return e==="Directory"||e==="GNUDumpDir"}function nh(e){return e.replace(/\/+$/,"")}function Mx(e,t){let n=nh(e);if(n.length>t.maxPathLength)return`entry path is ${n.length} characters, over the ${t.maxPathLength}-character limit`;let r=n.split("/").filter(o=>o!=="").length;return r>t.maxPathDepth?`entry path is ${r} levels deep, over the ${t.maxPathDepth}-level limit`:null}function Bx(e){let t=e.map(nh);return n=>{let r=nh(n).split("/").slice(1).join("/");return t.some(o=>r===o||r.startsWith(`${o}/`))}}function us(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],n=e/1024,r=t[0];for(let o=1;o<t.length&&n>=1024;o+=1)n/=1024,r=t[o];return`${parseFloat(n.toFixed(1))} ${r}`}function E$(e,t){return new f(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
224
- ${Ux(e,t).join(`
223
+ Please report this.`)}function L$(e,t,n=Uo()){return rt(e,t,n)||rt(t,e,n)}async function fh(e,t,n=Uo()){if(Gr(e)||Gr(t))return!1;let[r,o]=await Promise.all([mn(e),mn(t)]);return L$(r,o,n)}function Ye(e,t,n=Uo()){return typeof e!="string"||typeof t!="string"||Gr(e)||Gr(t)?!1:Yu(e,n)===Yu(t,n)}async function mn(e){let t=Vr.default.resolve(e);try{return await dh.default.promises.realpath(t)}catch{}try{let n=await dh.default.promises.realpath(Vr.default.dirname(t));return Vr.default.join(n,Vr.default.basename(t))}catch{return t}}var N$=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function fs(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(N$.test(t))return"Windows reserved device name in entry path"}return null}var hh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),j$=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),M$=32,B$=512,mh=10,tC=100,Qx=100;function nC(){return{retained:[],fatal:[],fatalCount:0,count:0}}function rC(e,t,n){e.count+=1;let r={code:t,message:uh(n)};e.retained.length<Qx&&e.retained.push(r),j$.has(t)&&(e.fatalCount+=1,e.fatal.length<Qx&&e.fatal.push(r))}async function oC(e,t,n){let r=await U$(n.containmentRoot),o=await W$(r,t),i=await eC(e),s=await V$(e,n),a=await K$(e,o,n);if(a.warnings.fatal.length>0)throw uC(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 q$(a.refused,a.refusedCount);let l=await eC(e);if(i!==l)throw new f("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 J$(r,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 eC(e){try{let t=await Ho.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new f(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function U$(e){try{return await Ho.default.promises.realpath(Wo.default.resolve(e))}catch(t){throw new f(`Refusing to extract: the directory the extraction must stay inside ("${D(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function W$(e,t){let n=Wo.default.resolve(t);Ue(e,n,"the extraction directory");let o=Wo.default.relative(e,n).split(Wo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Wo.default.join(i,s);let a=await H$(i);if(a===null){await Ho.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new f(`Refusing to extract: "${D(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 f(`Refusing to extract: "${D(i)}" exists and is not a directory.`)}return n}async function H$(e){try{return await Ho.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new f(`Could not inspect "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function V$(e,t){let n=iC(t.limits),r=lC(t.consumedSubtrees),o=[],i=[],s=nC(),a=0,l=0,c=0,p=!1,d=!1,m=(h,g)=>{c+=1,o.length<tC&&o.push({entryPath:h,reason:g})};try{await Qu.list({file:e,onReadEntry:h=>{let g=h.path,y=h.type;if(sC(y)||(a+=1,a>n.maxFiles&&!p&&(p=!0,m(g,`archive has more than ${n.maxFiles} files`))),!hh.has(y)){let _=`unsupported entry type ${y}`;r(g)?m(g,_):p||i.push({entryPath:g,reason:_});return}let b=fs(g)??aC(g,n);if(b){m(g,b);return}let S=h.size;S>n.maxEntryBytes&&m(g,`entry is ${ms(S)}, over the ${ms(n.maxEntryBytes)} per-file cap`),l+=S,l>n.maxUnpackedBytes&&!d&&(d=!0,m(g,`unpacked total passes the ${ms(n.maxUnpackedBytes)} cap`))},onwarn:(h,g)=>{rC(s,h,g)}})}catch(h){throw h instanceof f?h:new f(`Could not read the downloaded archive: ${h instanceof Error?h.message:String(h)}`)}if(o.length>0)throw z$(o,c);if(s.fatal.length>0)throw uC(s.fatal,s.fatalCount);for(let h of i)u.debug(`Skipped archive entry "${D(h.entryPath)}": ${h.reason}`);return{skipped:i,warnings:s}}function G$(e,t,n,r){if(!hh.has(t))return`unsupported entry type ${t}`;let o=fs(e)??aC(e,r);return o||(n>r.maxEntryBytes?`entry is ${ms(n)}, over the ${ms(r.maxEntryBytes)} per-file cap`:null)}async function K$(e,t,n){let r=iC(n.limits),o=lC(n.consumedSubtrees),i=nC(),s=[],a=0,l=0,c=0,p=(h,g)=>(a+=1,s.length<tC&&s.push({entryPath:h,reason:g}),!1),d=()=>!1,m=(h,g)=>{let y="type"in g?g.type:g.isDirectory()?"Directory":"File",b=g.size;if(!hh.has(y)&&!o(h))return d();let S=G$(h,y,b,r);if(S)return p(h,S);if(c+b>r.maxUnpackedBytes)return p(h,`unpacked total passes the ${ms(r.maxUnpackedBytes)} cap`);if(!sC(y)){if(l+1>r.maxFiles)return p(h,`archive has more than ${r.maxFiles} files`);l+=1}return c+=b,!0};try{await Qu.extract({file:e,cwd:t,strip:n.strip??0,preservePaths:!1,filter:m,onwarn:(h,g)=>{rC(i,h,g)}})}catch(h){throw h instanceof f?h:new f(`Could not extract the downloaded archive: ${h instanceof Error?h.message:String(h)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function J$(e,t){Ue(e,await Ho.default.promises.realpath(t),"the extracted directory");let n=[t];for(;n.length>0;){let r=n.pop(),o=await Ho.default.promises.readdir(r,{withFileTypes:!0});for(let i of o){let s=Wo.default.join(r,i.name);if(!i.isFile()&&!i.isDirectory())throw new f(`Refusing to continue: extraction produced a non-regular entry at "${D(s)}". Please report this.`);Ue(e,s,"an extracted archive entry"),i.isDirectory()&&n.push(s)}}}function iC(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??M$,maxPathLength:e.maxPathLength??B$}}function sC(e){return e==="Directory"||e==="GNUDumpDir"}function gh(e){return e.replace(/\/+$/,"")}function aC(e,t){let n=gh(e);if(n.length>t.maxPathLength)return`entry path is ${n.length} characters, over the ${t.maxPathLength}-character limit`;let r=n.split("/").filter(o=>o!=="").length;return r>t.maxPathDepth?`entry path is ${r} levels deep, over the ${t.maxPathDepth}-level limit`:null}function lC(e){let t=e.map(gh);return n=>{let r=gh(n).split("/").slice(1).join("/");return t.some(o=>r===o||r.startsWith(`${o}/`))}}function ms(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],n=e/1024,r=t[0];for(let o=1;o<t.length&&n>=1024;o+=1)n/=1024,r=t[o];return`${parseFloat(n.toFixed(1))} ${r}`}function z$(e,t){return new f(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
224
+ ${cC(e,t).join(`
225
225
  `)}
226
- Nothing was extracted. Please report this.`)}function v$(e,t){return new f(`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.
227
- ${Ux(e,t).join(`
226
+ Nothing was extracted. Please report this.`)}function q$(e,t){return new f(`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.
227
+ ${cC(e,t).join(`
228
228
  `)}
229
- The extracted directory cannot be trusted. Please retry.`)}function Ux(e,t){let n=e.slice(0,th),r=n.map(i=>` - "${D(i.entryPath)}": ${i.reason}`),o=t-n.length;return o>0&&r.push(` \u2026 and ${o} more.`),r}function Wx(e,t){let n=e.slice(0,th).map(o=>` - ${o.code}: ${o.message}`),r=t-Math.min(e.length,th);return r>0&&n.push(` \u2026 and ${r} more.`),new f(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
229
+ The extracted directory cannot be trusted. Please retry.`)}function cC(e,t){let n=e.slice(0,mh),r=n.map(i=>` - "${D(i.entryPath)}": ${i.reason}`),o=t-n.length;return o>0&&r.push(` \u2026 and ${o} more.`),r}function uC(e,t){let n=e.slice(0,mh).map(o=>` - ${o.code}: ${o.message}`),r=t-Math.min(e.length,mh);return r>0&&n.push(` \u2026 and ${r} more.`),new f(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
230
230
  ${n.join(`
231
231
  `)}
232
- This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var S$="webflow",oh="webflow-skills",he=`${S$}/${oh}`,Ge="main",Ju=`plugins/${oh}`,or=`${Ju}/.claude-plugin/plugin.json`,ih=[`${Ju}/skills`,"skills"],Hx=[`${Ju}/skills`,`${Ju}/.claude-plugin`];function Vx(e){return`${oh}-${e}`}var Yt=/^[0-9a-f]{40}$/,Ku=/^[A-Za-z0-9._/-]{1,255}$/,x$=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function Gx(e){let t=e.split(":",1)[0];return x$.includes(t)}var Pt="https://api.github.com",Uo="https://codeload.github.com";var Jx="skills",zu="download-",qu="extract-";var sr=w(require("fs")),Zu=w(require("path"));ql();C();_();C();function zx(e){let t=n=>Math.round(n*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function mn(e){try{return new URL(e).hostname}catch{return e}}function C$(e){return new f(`Could not find ref "${D(e)}" in ${he}.
232
+ This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var X$="webflow",yh="webflow-skills",he=`${X$}/${yh}`,Ge="main",ed=`plugins/${yh}`,sr=`${ed}/.claude-plugin/plugin.json`,wh=[`${ed}/skills`,"skills"],dC=[`${ed}/skills`,`${ed}/.claude-plugin`];function pC(e){return`${yh}-${e}`}var Zt=/^[0-9a-f]{40}$/,td=/^[A-Za-z0-9._/-]{1,255}$/,Y$=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function fC(e){let t=e.split(":",1)[0];return Y$.includes(t)}var $t="https://api.github.com",Vo="https://codeload.github.com";var mC="skills",nd="download-",rd="extract-";var lr=w(require("fs")),sd=w(require("path"));nc();C();A();C();function hC(e){let t=n=>Math.round(n*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function gn(e){try{return new URL(e).hostname}catch{return e}}function Z$(e){return new f(`Could not find ref "${D(e)}" in ${he}.
233
233
  \u2022 The default branch is "${Ge}".
234
234
  \u2022 This repo has no tags or releases yet, so "--ref v1.0.7" will not resolve.
235
- \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function F$(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let n=new Date(t*1e3);if(Number.isNaN(n.getTime()))return"a few minutes";let r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0");return`${r}:${o} local time`}function _$(e){return new f(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
236
- \u2022 Retry after ${F$(e)}.
235
+ \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function Q$(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let n=new Date(t*1e3);if(Number.isNaN(n.getTime()))return"a few minutes";let r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0");return`${r}:${o} local time`}function eO(e){return new f(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
236
+ \u2022 Retry after ${Q$(e)}.
237
237
  \u2022 Or set GITHUB_TOKEN / GH_TOKEN in your environment to raise the limit to 5,000/hour.
238
- \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function A$(){return new f(`GitHub refused the request (403). This is a permission error, not a rate limit.
239
- \u2022 If you are behind a proxy that filters ${mn(Pt)}, set HTTPS_PROXY.
240
- \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function I$(e,t){return new f(`${mn(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function R$(e,t,n){return new f(`${mn(e)} returned an unexpected ${t} ${D(n)} response. Please report this if it persists.`)}function ds(e,t,n){let{status:r}=t;if(r===404)return C$(n??Ge);let o=t.headers.get("x-ratelimit-remaining");return r===429||r===403&&o==="0"?_$(t.headers.get("x-ratelimit-reset")):r===403?A$():r>=500?I$(e,r):R$(e,r,t.statusText)}function qx(e){let t=e?mn(e):"an unnamed host";return new f(`Refusing to follow a redirect to ${D(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 ${mn(Pt)} is genuinely redirecting.`,{isUserError:!0})}function Kx(e,t){return new f(`Could not reach ${mn(e)}${t?` (${t})`:""}.
238
+ \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function tO(){return new f(`GitHub refused the request (403). This is a permission error, not a rate limit.
239
+ \u2022 If you are behind a proxy that filters ${gn($t)}, set HTTPS_PROXY.
240
+ \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function nO(e,t){return new f(`${gn(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function rO(e,t,n){return new f(`${gn(e)} returned an unexpected ${t} ${D(n)} response. Please report this if it persists.`)}function gs(e,t,n){let{status:r}=t;if(r===404)return Z$(n??Ge);let o=t.headers.get("x-ratelimit-remaining");return r===429||r===403&&o==="0"?eO(t.headers.get("x-ratelimit-reset")):r===403?tO():r>=500?nO(e,r):rO(e,r,t.statusText)}function yC(e){let t=e?gn(e):"an unnamed host";return new f(`Refusing to follow a redirect to ${D(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 ${gn($t)} is genuinely redirecting.`,{isUserError:!0})}function gC(e,t){return new f(`Could not reach ${gn(e)}${t?` (${t})`:""}.
241
241
  \u2022 Check your network connection.
242
242
  \u2022 Behind a corporate proxy, set HTTPS_PROXY. Note that the CLI's HTTP client does not read proxy environment variables automatically.
243
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Xu(e,t){return new f(`Timed out after ${Math.round(t/1e3)}s waiting for ${mn(e)}.
243
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function od(e,t){return new f(`Timed out after ${Math.round(t/1e3)}s waiting for ${gn(e)}.
244
244
  \u2022 Check your network connection, then retry.
245
245
  \u2022 Behind a corporate proxy, set HTTPS_PROXY.
246
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Yu(){return new f(`The skills catalog download exceeded ${zx(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function Xx(e){return new f(`Commit ${D(e)} of ${he} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
247
- \u2022 Retry without --ref to take the current "${Ge}".`,{isUserError:!0})}function Yx(){return new f("The skills catalog download returned no response body. Please retry.")}function qa(e){return new f(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function Zx(){return new f(`${mn(Pt)} 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 Qx(){return new f(`${mn(Pt)} answered the ref lookup with more than ${zx(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
248
- \u2022 If a proxy is intercepting ${mn(Pt)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function ps(e){return new f(`Expected a full 40-character commit SHA but got "${D(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function ir(e,t){return new f(`Invalid --ref "${D(e)}": ${t}.
249
- \u2022 Pass a branch name (e.g. "${Ge}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function eC(e,t){let n=t.length===0?"nothing":t.map(r=>`"${D(r)}"`).join(", ");return new f(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${n}. Please report this.`)}var T$=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function P$(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 Ya(e,t,n){if(n instanceof f)return n;let r=P$(n);if(r==="ENOSPC"||r==="EDQUOT"||r==="EFBIG")return qa("writing the skills catalog");if(r&&T$.has(r))return Kx(e,r);let o=n?.type;if(o==="request-timeout")return Xu(e,t);if(o==="max-size")return Yu();let i=n instanceof Error?n.message:String(n);return/network timeout|timed? ?out/i.test(i)?Xu(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?Kx(e,""):new f(`Could not fetch the skills catalog from ${mn(e)}: ${D(i)}`)}function fs(){return Zu.default.join(dD(),Jx)}function ah(e){if(!Yt.test(e))throw ps(e);return Zu.default.join(fs(),e)}async function Za(){let e=fs();try{return await sr.default.promises.mkdir(e,{recursive:!0,mode:448}),await sr.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?qa("creating the skills cache directory"):new f(`Could not create the skills cache directory "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function lh(e){let t=ah(e),n;try{n=await sr.default.promises.lstat(t)}catch(r){return r.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${r instanceof Error?r.message:String(r)}`),null}if(n.isSymbolicLink())throw new f(`Refusing to use the skills cache: "${D(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return n.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var O$=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function L$(e){try{return(await sr.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function ch(e,t){let n=ah(e),r=fs();await ls(r,n,"the skills cache entry"),await ls(r,t,"the extracted skills catalog being published");try{return await sr.default.promises.rename(t,n),{dir:n,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw qa("publishing the skills catalog to the cache");if(i!==void 0&&O$.has(i)&&await L$(n))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:n,published:!1};throw new f(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Wo(e){await ls(fs(),e,"the skills cache path being removed");try{await sr.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}function N$(e){return Yt.test(e)||e.startsWith(zu)||e.startsWith(qu)}async function Qu(e){let t=fs(),n;try{n=await sr.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 r=Date.now()-6048e5;for(let o of n){if(o.name===e||!N$(o.name))continue;let i=Zu.default.join(t,o.name);try{if((await sr.default.promises.lstat(i)).mtimeMs>=r)continue;await Wo(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 ph=w(require("fs")),uh=w(require("path")),rC=require("stream"),oC=require("stream/promises");lt();_();var j$="catalog.tar.gz",Qa=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},ed=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},dh=class extends rC.Transform{constructor(n){super();this.cap=n}bytes=0;_transform(n,r,o){let i=Buffer.isBuffer(n)?n:Buffer.from(n);if(this.bytes+=i.length,this.bytes>this.cap){o(new ed);return}o(null,i)}};async function fh(e){if(!Yt.test(e))throw ps(e);let t=await Za(),n=await ph.default.promises.mkdtemp(uh.default.join(t,zu)),r=uh.default.join(n,j$),o=`${Uo}/${he}/tar.gz/${e}`;try{let i=await M$(o,e),s=await B$(i,r);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:r,downloadDir:n,bytes:s}}catch(i){throw await Wo(n),Ya(Uo,6e4,i)}}async function M$(e,t){let n=0;for(let r=0;r<2;r+=1){let o=await J(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 Yu();return o}if(o.status>=500&&r===0){n=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?Xx(t):ds(Uo,o)}throw ds(Uo,{status:n||500,statusText:"Server Error",headers:{get:()=>null}})}async function B$(e,t){let n=e.body;if(!n)throw Yx();let r=new dh(33554432),o=setTimeout(()=>{n.destroy?.(new Qa),r.destroy(new Qa)},6e4);o.unref?.();try{await(0,oC.pipeline)(n,r,ph.default.createWriteStream(t,{mode:384}))}catch(i){throw nC(i,ed)?Yu():nC(i,Qa)?Xu(Uo,6e4):i}finally{clearTimeout(o)}return r.bytes}function nC(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let n=e.cause;if(n instanceof t||n instanceof Error&&n.name===t.name)return!0}return!1}lt();_();var U$=["GITHUB_TOKEN","GH_TOKEN"];function W$(){for(let e of U$){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function H$(e){if(e==="")throw ir(e,"it is empty");if(!Ku.test(e))throw ir(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw ir(e,"it starts with '-'");if(e.includes(".."))throw ir(e,"it contains '..'");if(e.endsWith(".lock"))throw ir(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw ir(e,"it starts or ends with '/'");if(e.includes("//"))throw ir(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw ir(e,"a path component ends with '.'")}function V$(e){return e.split("/").map(encodeURIComponent).join("/")}function G$(e){return new Promise(t=>{setTimeout(t,e)})}async function nl(e=Ge){if(Yt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};H$(e);let t=W$(),n=`${Pt}/repos/${he}/commits/${V$(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let r=await J$(n,e,t),o=await z$(r);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function J$(e,t,n){let r=null;for(let o=0;o<2;o+=1){let i;try{i=await J(e,{headers:{Accept:"application/vnd.github.sha",...n?{Authorization:`Bearer ${n}`}:{}},timeout:1e4,...n?{redirect:"manual"}:{}})}catch(s){throw Ya(Pt,1e4,s)}if(n&&i.status>=300&&i.status<400)throw qx(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(r=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await G$(1e3);continue}throw ds(Pt,i,t)}throw ds(Pt,{status:r??500,statusText:"Server Error",headers:{get:()=>null}},t)}var nd=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function K$(e){let t=e.body;if(!t)return"";let n=[],r=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(r+=i.length,r>4096)throw new nd;n.push(i)}return Buffer.concat(n).toString("utf8")}async function z$(e){let t;try{t=await K$(e)}catch(r){throw r instanceof nd?Qx():Ya(Pt,1e4,r)}let n=t.trim();if(!Yt.test(n))throw Zx();return n}async function ms(e={}){let t=await q$(e),{commit:n,ref:r}=t,o=await lh(n);if(o)return u.debug(`Using cached skills catalog for ${n}.`),await Qu(n),{ref:r,commit:n,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await X$(n);return await Qu(n),{ref:r,commit:n,...i}}async function q$(e){if(e.commit!==void 0){if(!Yt.test(e.commit))throw ps(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return nl(e.ref)}async function X$(e){let t=await Za(),n=await fh(e),r=await mh.default.promises.mkdtemp(gh.default.join(t,qu));try{let o=await Lx(n.tarPath,r,{strip:0,containmentRoot:t,consumedSubtrees:Hx,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await Y$(r,e),{dir:s,published:a}=await ch(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:n.bytes}}finally{await Wo(r),await Wo(n.downloadDir)}}async function Y$(e,t){let n=Vx(t),r=await mh.default.promises.readdir(e,{withFileTypes:!0}),o=r.filter(i=>i.isDirectory());if(r.length!==1||o.length!==1||o[0].name!==n)throw eC(n,r.map(i=>i.name));return gh.default.join(e,n)}var Ho=`https://github.com/${he}/issues`,$t="SKILL.md",rl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Vo=new Set([".git","node_modules","__pycache__"]),Go=new Set([".DS_Store","Thumbs.db"]),Jo=8,rd=512,od=128,lC=1024,cC=32,uC=256,dC=64,pC=64,hh=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,fC=256,mC=4;var yh=w(require("fs")),gs=w(require("path"));C();async function hs(e){let t=gs.default.join(e,...or.split("/"));Be(e,t,"the catalog plugin manifest");let n;try{n=await yh.default.promises.readFile(t,"utf8")}catch(i){if(!eO(i))throw new f(`Failed to read the catalog manifest at ${or}: ${i instanceof Error?i.message:String(i)}`)}if(n===void 0)return{...await gC(e),version:"",source:"fallback"};let r=Q$(n);if(r.skills===void 0)return{...await gC(e),version:r.version,source:"fallback"};let o=await Z$(t,r.skills,e);if(!o)throw new f(`The catalog manifest at ${or} declares its skills directory as "${D(r.skills)}", which does not exist in the downloaded catalog. This is a bug in ${he}. Please report it.`);return{version:r.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function Z$(e,t,n){let r=gs.default.dirname(e),o=[{base:gs.default.dirname(r),relativeTo:"plugin root"},{base:r,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=gs.default.resolve(s.base,t);if(Be(n,a,"the catalog skills directory"),!!await hC(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${or} declares "skills": "${D(t)}", which only resolves relative to the ${s.relativeTo}. This means ${he} changed its layout; please report it at ${Ho}.`]}}}function Q$(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${or} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${he}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new f(`The catalog manifest at ${or} is not a JSON object. This is a bug in ${he}. Please report it.`);let n=t,r=n.skills;if(r!==void 0&&(typeof r!="string"||r.trim()===""))throw new f(`The catalog manifest at ${or} declares "skills" as ${tO(r)}, but it must be a non-empty string. This is a bug in ${he}. Please report it.`);return{version:typeof n.version=="string"?n.version.trim():"",skills:typeof r=="string"?r:void 0}}async function gC(e){for(let t of ih){let n=gs.default.join(e,...t.split("/"));if(Be(e,n,"the catalog skills directory"),!!await hC(n))return{skillsDir:n,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${he} changed its layout; please report it at ${Ho}.`]}}throw new f(`The downloaded catalog has no skills directory: ${or} is absent and none of ${ih.join(", ")} exists. This is a bug in ${he}. Please report it.`)}async function hC(e){try{return(await yh.default.promises.stat(e)).isDirectory()}catch{return!1}}function eO(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function tO(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 yC=require("yaml");var Ot=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},nO=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,rO=/^\uFEFF/,oO="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",wC="\u2014 wrap the value in double quotes",iO={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},sO=100,aO=j.object({name:j.string().trim().min(1).max(od),description:j.string().trim().min(1).max(lC),"mcp-version":j.string().max(cC).optional(),compatibility:j.string().max(uC).optional(),license:j.string().max(dC).optional(),metadata:j.record(j.unknown()).optional()}).passthrough(),wh=["name","description"];function Ko(e){let t=e.replace(rO,""),n=nO.exec(t);if(!n){if(t.trimStart().startsWith("---"))throw new Ot(oO);return{frontmatter:Dh({}),body:t,raw:e}}let r=n[1]??"",o=n[2]??"",i=lO(r,1);return{frontmatter:Dh(i),body:o,raw:e}}function lO(e,t){let n=(0,yC.parseDocument)(e,iO),[r]=n.errors;if(r)throw new Ot(cO(r,e,t));let o;try{o=n.toJS({maxAliasCount:sO})}catch(i){throw new Ot(`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 Ot(`frontmatter is not a YAML mapping (parsed as ${bh(o)})`);return o}function cO(e,t,n){let r=e.pos?.[0],o="",i="";if(typeof r=="number"&&r>=0){let a=t.slice(0,r),l=a.split(`
246
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function id(){return new f(`The skills catalog download exceeded ${hC(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function wC(e){return new f(`Commit ${D(e)} of ${he} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
247
+ \u2022 Retry without --ref to take the current "${Ge}".`,{isUserError:!0})}function bC(){return new f("The skills catalog download returned no response body. Please retry.")}function tl(e){return new f(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function DC(){return new f(`${gn($t)} 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 kC(){return new f(`${gn($t)} answered the ref lookup with more than ${hC(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
248
+ \u2022 If a proxy is intercepting ${gn($t)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function hs(e){return new f(`Expected a full 40-character commit SHA but got "${D(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function ar(e,t){return new f(`Invalid --ref "${D(e)}": ${t}.
249
+ \u2022 Pass a branch name (e.g. "${Ge}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function EC(e,t){let n=t.length===0?"nothing":t.map(r=>`"${D(r)}"`).join(", ");return new f(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${n}. Please report this.`)}var oO=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function iO(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 rl(e,t,n){if(n instanceof f)return n;let r=iO(n);if(r==="ENOSPC"||r==="EDQUOT"||r==="EFBIG")return tl("writing the skills catalog");if(r&&oO.has(r))return gC(e,r);let o=n?.type;if(o==="request-timeout")return od(e,t);if(o==="max-size")return id();let i=n instanceof Error?n.message:String(n);return/network timeout|timed? ?out/i.test(i)?od(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?gC(e,""):new f(`Could not fetch the skills catalog from ${gn(e)}: ${D(i)}`)}function ys(){return sd.default.join(_b(),mC)}function Dh(e){if(!Zt.test(e))throw hs(e);return sd.default.join(ys(),e)}async function ol(){let e=ys();try{return await lr.default.promises.mkdir(e,{recursive:!0,mode:448}),await lr.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?tl("creating the skills cache directory"):new f(`Could not create the skills cache directory "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function kh(e){let t=Dh(e),n;try{n=await lr.default.promises.lstat(t)}catch(r){return r.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${r instanceof Error?r.message:String(r)}`),null}if(n.isSymbolicLink())throw new f(`Refusing to use the skills cache: "${D(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return n.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var aO=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function lO(e){try{return(await lr.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function Eh(e,t){let n=Dh(e),r=ys();await ps(r,n,"the skills cache entry"),await ps(r,t,"the extracted skills catalog being published");try{return await lr.default.promises.rename(t,n),{dir:n,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw tl("publishing the skills catalog to the cache");if(i!==void 0&&aO.has(i)&&await lO(n))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:n,published:!1};throw new f(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Go(e){await ps(ys(),e,"the skills cache path being removed");try{await lr.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}function cO(e){return Zt.test(e)||e.startsWith(nd)||e.startsWith(rd)}async function ad(e){let t=ys(),n;try{n=await lr.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 r=Date.now()-6048e5;for(let o of n){if(o.name===e||!cO(o.name))continue;let i=sd.default.join(t,o.name);try{if((await lr.default.promises.lstat(i)).mtimeMs>=r)continue;await Go(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 xh=w(require("fs")),vh=w(require("path")),xC=require("stream"),CC=require("stream/promises");lt();A();var uO="catalog.tar.gz",il=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},ld=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},Sh=class extends xC.Transform{constructor(n){super();this.cap=n}bytes=0;_transform(n,r,o){let i=Buffer.isBuffer(n)?n:Buffer.from(n);if(this.bytes+=i.length,this.bytes>this.cap){o(new ld);return}o(null,i)}};async function Ch(e){if(!Zt.test(e))throw hs(e);let t=await ol(),n=await xh.default.promises.mkdtemp(vh.default.join(t,nd)),r=vh.default.join(n,uO),o=`${Vo}/${he}/tar.gz/${e}`;try{let i=await dO(o,e),s=await pO(i,r);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:r,downloadDir:n,bytes:s}}catch(i){throw await Go(n),rl(Vo,6e4,i)}}async function dO(e,t){let n=0;for(let r=0;r<2;r+=1){let o=await G(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 id();return o}if(o.status>=500&&r===0){n=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?wC(t):gs(Vo,o)}throw gs(Vo,{status:n||500,statusText:"Server Error",headers:{get:()=>null}})}async function pO(e,t){let n=e.body;if(!n)throw bC();let r=new Sh(33554432),o=setTimeout(()=>{n.destroy?.(new il),r.destroy(new il)},6e4);o.unref?.();try{await(0,CC.pipeline)(n,r,xh.default.createWriteStream(t,{mode:384}))}catch(i){throw SC(i,ld)?id():SC(i,il)?od(Vo,6e4):i}finally{clearTimeout(o)}return r.bytes}function SC(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let n=e.cause;if(n instanceof t||n instanceof Error&&n.name===t.name)return!0}return!1}lt();A();var fO=["GITHUB_TOKEN","GH_TOKEN"];function mO(){for(let e of fO){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function gO(e){if(e==="")throw ar(e,"it is empty");if(!td.test(e))throw ar(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw ar(e,"it starts with '-'");if(e.includes(".."))throw ar(e,"it contains '..'");if(e.endsWith(".lock"))throw ar(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw ar(e,"it starts or ends with '/'");if(e.includes("//"))throw ar(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw ar(e,"a path component ends with '.'")}function hO(e){return e.split("/").map(encodeURIComponent).join("/")}function yO(e){return new Promise(t=>{setTimeout(t,e)})}async function ll(e=Ge){if(Zt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};gO(e);let t=mO(),n=`${$t}/repos/${he}/commits/${hO(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let r=await wO(n,e,t),o=await DO(r);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function wO(e,t,n){let r=null;for(let o=0;o<2;o+=1){let i;try{i=await G(e,{headers:{Accept:"application/vnd.github.sha",...n?{Authorization:`Bearer ${n}`}:{}},timeout:1e4,...n?{redirect:"manual"}:{}})}catch(s){throw rl($t,1e4,s)}if(n&&i.status>=300&&i.status<400)throw yC(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(r=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await yO(1e3);continue}throw gs($t,i,t)}throw gs($t,{status:r??500,statusText:"Server Error",headers:{get:()=>null}},t)}var ud=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function bO(e){let t=e.body;if(!t)return"";let n=[],r=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(r+=i.length,r>4096)throw new ud;n.push(i)}return Buffer.concat(n).toString("utf8")}async function DO(e){let t;try{t=await bO(e)}catch(r){throw r instanceof ud?kC():rl($t,1e4,r)}let n=t.trim();if(!Zt.test(n))throw DC();return n}async function ws(e={}){let t=await kO(e),{commit:n,ref:r}=t,o=await kh(n);if(o)return u.debug(`Using cached skills catalog for ${n}.`),await ad(n),{ref:r,commit:n,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await EO(n);return await ad(n),{ref:r,commit:n,...i}}async function kO(e){if(e.commit!==void 0){if(!Zt.test(e.commit))throw hs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return ll(e.ref)}async function EO(e){let t=await ol(),n=await Ch(e),r=await Fh.default.promises.mkdtemp(_h.default.join(t,rd));try{let o=await oC(n.tarPath,r,{strip:0,containmentRoot:t,consumedSubtrees:dC,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await vO(r,e),{dir:s,published:a}=await Eh(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:n.bytes}}finally{await Go(r),await Go(n.downloadDir)}}async function vO(e,t){let n=pC(t),r=await Fh.default.promises.readdir(e,{withFileTypes:!0}),o=r.filter(i=>i.isDirectory());if(r.length!==1||o.length!==1||o[0].name!==n)throw EC(n,r.map(i=>i.name));return _h.default.join(e,n)}var Ko=`https://github.com/${he}/issues`,Ot="SKILL.md",cl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Jo=new Set([".git","node_modules","__pycache__"]),zo=new Set([".DS_Store","Thumbs.db"]),qo=8,dd=512,pd=128,RC=1024,IC=32,TC=256,PC=64,$C=64,Ah=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,OC=256,LC=4;var Rh=w(require("fs")),bs=w(require("path"));C();async function Ds(e){let t=bs.default.join(e,...sr.split("/"));Ue(e,t,"the catalog plugin manifest");let n;try{n=await Rh.default.promises.readFile(t,"utf8")}catch(i){if(!CO(i))throw new f(`Failed to read the catalog manifest at ${sr}: ${i instanceof Error?i.message:String(i)}`)}if(n===void 0)return{...await NC(e),version:"",source:"fallback"};let r=xO(n);if(r.skills===void 0)return{...await NC(e),version:r.version,source:"fallback"};let o=await SO(t,r.skills,e);if(!o)throw new f(`The catalog manifest at ${sr} declares its skills directory as "${D(r.skills)}", which does not exist in the downloaded catalog. This is a bug in ${he}. Please report it.`);return{version:r.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function SO(e,t,n){let r=bs.default.dirname(e),o=[{base:bs.default.dirname(r),relativeTo:"plugin root"},{base:r,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=bs.default.resolve(s.base,t);if(Ue(n,a,"the catalog skills directory"),!!await jC(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${sr} declares "skills": "${D(t)}", which only resolves relative to the ${s.relativeTo}. This means ${he} changed its layout; please report it at ${Ko}.`]}}}function xO(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${sr} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${he}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new f(`The catalog manifest at ${sr} is not a JSON object. This is a bug in ${he}. Please report it.`);let n=t,r=n.skills;if(r!==void 0&&(typeof r!="string"||r.trim()===""))throw new f(`The catalog manifest at ${sr} declares "skills" as ${FO(r)}, but it must be a non-empty string. This is a bug in ${he}. Please report it.`);return{version:typeof n.version=="string"?n.version.trim():"",skills:typeof r=="string"?r:void 0}}async function NC(e){for(let t of wh){let n=bs.default.join(e,...t.split("/"));if(Ue(e,n,"the catalog skills directory"),!!await jC(n))return{skillsDir:n,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${he} changed its layout; please report it at ${Ko}.`]}}throw new f(`The downloaded catalog has no skills directory: ${sr} is absent and none of ${wh.join(", ")} exists. This is a bug in ${he}. Please report it.`)}async function jC(e){try{return(await Rh.default.promises.stat(e)).isDirectory()}catch{return!1}}function CO(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function FO(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 MC=require("yaml");var Lt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},_O=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,AO=/^\uFEFF/,RO="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",BC="\u2014 wrap the value in double quotes",IO={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},TO=100,PO=j.object({name:j.string().trim().min(1).max(pd),description:j.string().trim().min(1).max(RC),"mcp-version":j.string().max(IC).optional(),compatibility:j.string().max(TC).optional(),license:j.string().max(PC).optional(),metadata:j.record(j.unknown()).optional()}).passthrough(),Ih=["name","description"];function Xo(e){let t=e.replace(AO,""),n=_O.exec(t);if(!n){if(t.trimStart().startsWith("---"))throw new Lt(RO);return{frontmatter:Th({}),body:t,raw:e}}let r=n[1]??"",o=n[2]??"",i=$O(r,1);return{frontmatter:Th(i),body:o,raw:e}}function $O(e,t){let n=(0,MC.parseDocument)(e,IO),[r]=n.errors;if(r)throw new Lt(OO(r,e,t));let o;try{o=n.toJS({maxAliasCount:TO})}catch(i){throw new Lt(`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 Lt(`frontmatter is not a YAML mapping (parsed as ${Ph(o)})`);return o}function OO(e,t,n){let r=e.pos?.[0],o="",i="";if(typeof r=="number"&&r>=0){let a=t.slice(0,r),l=a.split(`
250
250
  `).length,c=r-(a.lastIndexOf(`
251
- `)+1)+1;o=` at line ${l+n}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${wC}`:"";return`YAML parse error: ${e.message}${o}${s}`}function Dh(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Ot(`frontmatter is not a YAML mapping (parsed as ${bh(e)})`);let t={...e},n=wh.filter(i=>!(i in t)||t[i]===void 0);if(n.length>0)throw new Ot(`missing required frontmatter field(s): ${n.join(", ")}`);let r=wh.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(r.length>0){let i=wh.map(a=>bh(t[a])).join(" and "),s=r.some(a=>dO(t[a]));throw new Ot(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${wC}`:""}`)}t.metadata=uO(t.metadata),t.metadata===void 0&&delete t.metadata;let o=aO.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Ot(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function uO(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function dO(e){return!(e==null||typeof e=="string")}function bh(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 kh(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function Eh(e){let t=e.metadata?.category;if(typeof t!="string")return;let n=t.trim();return n===""?void 0:n}var id=w(require("path"));C();var pO=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),vh="/webflow-skills-store";function ys(e){if(typeof e!="string")return;let t=DC(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,pC),n=DC(t);if(n&&!pO.has(n)&&fO(n))return n}function DC(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function fO(e){return[Ix,Qg].every(n=>{let r=n.impl.join(vh,e);return!rt(vh,r,n)||n.impl.basename(r)!==e?!1:n.impl.dirname(r)===n.impl.normalize(vh)})}function Sh(e){return hh.test(e)}var Vr=e=>id.default.posix.basename(id.default.posix.dirname(e.split(id.default.win32.sep).join("/")));function ar(e,t){let n=typeof e=="string"?e.trim():"",r=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(n==="")return r();let o=[s=>s.name===n,s=>s.folderName===n,s=>s.dir===n],i=ys(n);i!==void 0&&o.push(s=>s.dir===i||ys(s.name)===i||ys(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 r()}function bC(e){return kC(e,t=>t.dir)}function xh(e){let[t]=bC(e);if(!t)return;let n=t.skills.length,r=t.skills.map(o=>` "${D(o.name)}" (${D(o.skillPath)})`);throw new f(`${n===2?"Two":String(n)} skills resolve to the same install directory "${D(t.value)}":
251
+ `)+1)+1;o=` at line ${l+n}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${BC}`:"";return`YAML parse error: ${e.message}${o}${s}`}function Th(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Lt(`frontmatter is not a YAML mapping (parsed as ${Ph(e)})`);let t={...e},n=Ih.filter(i=>!(i in t)||t[i]===void 0);if(n.length>0)throw new Lt(`missing required frontmatter field(s): ${n.join(", ")}`);let r=Ih.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(r.length>0){let i=Ih.map(a=>Ph(t[a])).join(" and "),s=r.some(a=>NO(t[a]));throw new Lt(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${BC}`:""}`)}t.metadata=LO(t.metadata),t.metadata===void 0&&delete t.metadata;let o=PO.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Lt(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function LO(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function NO(e){return!(e==null||typeof e=="string")}function Ph(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 $h(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function Oh(e){let t=e.metadata?.category;if(typeof t!="string")return;let n=t.trim();return n===""?void 0:n}var fd=w(require("path"));C();var jO=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),Lh="/webflow-skills-store";function ks(e){if(typeof e!="string")return;let t=UC(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,$C),n=UC(t);if(n&&!jO.has(n)&&MO(n))return n}function UC(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function MO(e){return[Zx,ph].every(n=>{let r=n.impl.join(Lh,e);return!rt(Lh,r,n)||n.impl.basename(r)!==e?!1:n.impl.dirname(r)===n.impl.normalize(Lh)})}function Nh(e){return Ah.test(e)}var Kr=e=>fd.default.posix.basename(fd.default.posix.dirname(e.split(fd.default.win32.sep).join("/")));function cr(e,t){let n=typeof e=="string"?e.trim():"",r=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(n==="")return r();let o=[s=>s.name===n,s=>s.folderName===n,s=>s.dir===n],i=ks(n);i!==void 0&&o.push(s=>s.dir===i||ks(s.name)===i||ks(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 r()}function WC(e){return HC(e,t=>t.dir)}function jh(e){let[t]=WC(e);if(!t)return;let n=t.skills.length,r=t.skills.map(o=>` "${D(o.name)}" (${D(o.skillPath)})`);throw new f(`${n===2?"Two":String(n)} skills resolve to the same install directory "${D(t.value)}":
252
252
  ${r.join(`
253
253
  `)}
254
- This is a bug in ${he}. Please report it.`)}function Ch(e){return kC(e,t=>t.name)}function Fh(e){let[t,...n]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${D(e.value)}": ${e.skills.map(r=>D(r.skillPath)).join(", ")}. Using ${D(t?.skillPath??"")} and ignoring ${n.length===1?"the other":"the others"}. This is a bug in ${he}. Please report it.`}function kC(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r])}return[...n.entries()].filter(([,r])=>r.length>1).map(([r,o])=>({value:r,skills:o}))}var ws=w(require("fs")),Zt=w(require("path"));C();async function Ds(e,t){Be(t,e,"the catalog skills directory");let n=[],r=[],o=[],i=new Set,s=p=>(o.push(...p.warnings),p.kind==="skipped"?(r.push({skillPath:p.skillPath,reason:p.reason}),!1):(n.push(p.skill),!p.skill.internal));for(let p of await ol(e,"the catalog skills directory")){if(rl.has(p.name))continue;let m=Zt.default.join(e,p.name);if(!await _h(m,p))continue;let h=await vC(m);if(h.kind!=="none"&&i.add(h.path),!(h.kind!=="none"&&s(await EC({skillDir:m,manifest:h,extractRoot:t}))))for(let g of await ol(m)){if(rl.has(g.name))continue;let y=Zt.default.join(m,g.name);if(!await _h(y,g))continue;let b=await vC(y);b.kind!=="none"&&(i.add(b.path),s(await EC({skillDir:y,manifest:b,extractRoot:t,parentCategory:p.name})))}}let a=await gO(n),l=Ch(a),c=new Set;for(let p of l){o.push(Fh(p));for(let m of p.skills.slice(1))c.add(m.skillPath)}let d=a.filter(p=>!c.has(p.skillPath));xh(d),o.push(...await hO(e,t,i));for(let p of r)o.push(`Skipped ${p.skillPath} \u2014 ${p.reason}`);return r.length>0&&o.push(`${r.length} skill${r.length===1?" was":"s were"} skipped. ${r.length===1?"This is a defect":"These are defects"} in ${he} \u2014 please report ${r.length===1?"it":"them"} at ${Ho}.`),{skills:d,skipped:r,warnings:o}}async function EC(e){let{skillDir:t,manifest:n,extractRoot:r,parentCategory:o}=e,i=CC(r,n.path),s=[],a=g=>({kind:"skipped",skillPath:i,reason:D(g),warnings:s});if(n.kind==="symlink")return a(`${$t} is a symbolic link; skill files must be regular files`);let l;try{l=await ws.default.promises.readFile(n.path,"utf8")}catch(g){return a(`failed to read file: ${g instanceof Error?g.message:String(g)}`)}let c;try{c=Ko(l).frontmatter}catch(g){if(g instanceof Ot)return a(g.reason);throw g}let d=D(c.name),p=D(c.description);if(d==="")return a(`frontmatter name "${D(c.name)}" cannot be used as a directory name`);let m=ys(d);if(m===void 0)return a(`frontmatter name "${d}" cannot be used as a directory name`);Sh(d)||s.push(`${i} declares a non-standard skill name "${d}"; it installs as "${m}". This is a bug in ${he}.`);let h=await mO(t,n.path);return h.symlink?a(`contains a symbolic link (${h.symlink}); skill files must be regular files`):(h.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:d,dir:m,folderName:Vr(i),description:p,category:Eh(c)??o,internal:kh(c),path:t,skillPath:i,supplementaryFiles:h.files}})}async function vC(e){let t=Zt.default.join(e,$t),n=await SC(t);if(n)return n;let r=$t.toLowerCase();for(let o of await ol(e)){if(o.name===$t||o.name.toLowerCase()!==r)continue;let i=await SC(Zt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function SC(e){try{let t=await ws.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function _h(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await ws.default.promises.stat(e)).isDirectory()}catch{return!1}}async function ol(e,t){try{return(await ws.default.promises.readdir(e,{withFileTypes:!0})).sort((r,o)=>r.name<o.name?-1:r.name>o.name?1:0)}catch(n){if(!t)return[];throw new f(`Failed to read ${t} (${D(e)}): ${n instanceof Error?n.message:String(n)}`)}}async function mO(e,t){let n=[],r,o=!1,i=async(s,a)=>{if(!(a>Jo||r!==void 0))for(let l of await ol(s)){if(r!==void 0)return;let c=Zt.default.join(s,l.name);if(l.isSymbolicLink()){r=xC(e,c);return}if(l.isDirectory()){if(Vo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Go.has(l.name)&&c!==t){if(n.length>=rd){o=!0;return}n.push(xC(e,c))}}};return await i(e,1),{files:n.sort(),symlink:r,truncated:o}}async function gO(e){let t=new Set,n=[];for(let r of e){let o;try{o=await ws.default.promises.realpath(r.path)}catch{o=Zt.default.resolve(r.path)}t.has(o)||(t.add(o),n.push(r))}return n}async function hO(e,t,n){let r=[],o=fC,i=async(s,a)=>{if(!(a>mC||o<=0)){o-=1;for(let l of await ol(s)){if(rl.has(l.name))continue;let c=Zt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===$t.toLowerCase()){n.has(c)||r.push(CC(t,c));continue}await _h(c,l)&&await i(c,a+1)}}};return await i(e,1),r.length===0?[]:[`${r.length} ${$t} file(s) in the catalog sit outside the layout this CLI reads (for example ${r[0]}) and were ignored. ${he} may have changed its layout; please report it at ${Ho}.`]}function CC(e,t){return Zt.default.relative(e,t).split(Zt.default.sep).join("/")}function xC(e,t){return Zt.default.relative(e,t).split(Zt.default.sep).join("/")}var gn=w(require("os")),Pn=w(require("path"));function zo(e,t){let n=process.env[e]?.trim();return n||t}function FC(e){let t=process.env[e]?.trim();return t||void 0}var ue={home:()=>gn.default.homedir(),configHome:()=>zo("XDG_CONFIG_HOME",Pn.default.join(gn.default.homedir(),".config")),hardcodedConfigHome:()=>Pn.default.join(gn.default.homedir(),".config"),claudeHome:()=>zo("CLAUDE_CONFIG_DIR",Pn.default.join(gn.default.homedir(),".claude")),codexHome:()=>zo("CODEX_HOME",Pn.default.join(gn.default.homedir(),".codex")),vibeHome:()=>zo("VIBE_HOME",Pn.default.join(gn.default.homedir(),".vibe")),hermesHome:()=>zo("HERMES_HOME",Pn.default.join(gn.default.homedir(),".hermes")),autohandHome:()=>zo("AUTOHAND_HOME",Pn.default.join(gn.default.homedir(),".autohand")),grokHome:()=>zo("GROK_HOME",Pn.default.join(gn.default.homedir(),".grok")),appData:()=>FC("APPDATA"),flatpakConfigHome:()=>FC("FLATPAK_XDG_CONFIG_HOME")};function hn(...e){return Pn.default.join(gn.default.homedir(),...e)}var jC=w(require("fs")),ke=w(require("path"));C();M();var xt=w(require("path"));var Ah=[".openclaw",".clawdbot",".moltbot"];function _C(e,t){let n=Ah.find(r=>t(xt.default.join(e,r)));return xt.default.join(e,n??Ah[0],"skills")}function AC(e,t){return Ah.some(n=>t(xt.default.join(e,n)))}function IC(e,t,n=ue.appData(),r=ue.flatpakConfigHome()){return!!(t(xt.default.join(e,"zed"))||n&&t(xt.default.join(n,"Zed"))||r&&t(xt.default.join(r,"zed")))}var wO="/Applications/ZCode.app";function RC(e,t){return t(xt.default.join(e,".zcode"))||t(wO)}function TC(e,t){return t(xt.default.join(e,"kimchi"))}var DO="/etc/codex";function PC(e,t){return t(e)||t(DO)}function $C(e,t){return t(xt.default.join(e,".replit"))}function OC(e,t){return t(xt.default.join(e,".promptscript"))||t(xt.default.join(e,"promptscript.yaml"))}function LC(e,t,n){return n(xt.default.join(t,"data","skills"))||n(xt.default.join(e,".astrbot"))}function NC(){return!1}function bO(e){try{return jC.default.existsSync(e)}catch{return!1}}function fe(e,t,n){return{id:e,displayName:t,skillsDir:`${n}/skills`,globalSkillsDir:()=>hn(n,"skills"),detect:r=>r.pathExists(ke.default.join(r.homeDir,n)),sharedStore:!1}}function ot(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>hn(...e.global),detect:t=>t.pathExists(ke.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Xe=".agents/skills",il=[fe("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"agents","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"amp")),sharedStore:!0},ot({id:"antigravity",displayName:"Antigravity",project:Xe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),ot({id:"antigravity-cli",displayName:"Antigravity CLI",project:Xe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>hn(".astrbot","data","skills"),detect:e=>LC(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>ke.default.join(ue.autohandHome(),"skills"),detect:e=>e.pathExists(ue.autohandHome()),sharedStore:!1},fe("augment","Augment",".augment"),fe("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>ke.default.join(ue.claudeHome(),"skills"),detect:e=>e.pathExists(ue.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>_C(ue.home(),bO),detect:e=>AC(e.homeDir,e.pathExists),sharedStore:!1},ot({id:"cline",displayName:"Cline",project:Xe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),fe("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>hn(".codebuddy","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".codebuddy"))||e.pathExists(ke.default.join(e.homeDir,".codebuddy")),sharedStore:!1},fe("codemaker","Codemaker",".codemaker"),fe("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.codexHome(),"skills"),detect:e=>PC(ue.codexHome(),e.pathExists),sharedStore:!0},fe("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>hn(".continue","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".continue"))||e.pathExists(ke.default.join(e.homeDir,".continue")),sharedStore:!1},ot({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>ke.default.join(ue.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(ke.default.join(ue.hardcodedConfigHome(),"crush")),sharedStore:!1},ot({id:"cursor",displayName:"Cursor",project:Xe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),ot({id:"deepagents",displayName:"Deep Agents",project:Xe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>ke.default.join(ue.configHome(),"devin","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"devin")),sharedStore:!1},ot({id:"dexto",displayName:"Dexto",project:Xe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),fe("droid","Droid",".factory"),ot({id:"firebender",displayName:"Firebender",project:Xe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),fe("forgecode","ForgeCode",".forge"),ot({id:"gemini-cli",displayName:"Gemini CLI",project:Xe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),ot({id:"github-copilot",displayName:"GitHub Copilot",project:Xe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>ke.default.join(ue.configHome(),"goose","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>ke.default.join(ue.grokHome(),"skills"),detect:e=>e.pathExists(ue.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>ke.default.join(ue.hermesHome(),"skills"),detect:e=>e.pathExists(ue.hermesHome()),sharedStore:!1},fe("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>hn(".jazz","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".jazz"))||e.pathExists(ke.default.join(e.cwd,".jazz")),sharedStore:!1},fe("junie","Junie",".junie"),fe("iflow-cli","iFlow CLI",".iflow"),fe("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>ke.default.join(ue.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>TC(ue.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Xe,globalSkillsDir:()=>hn(".agents","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".kimi-code"))||e.pathExists(ke.default.join(e.homeDir,".kimi")),sharedStore:!0},fe("kiro-cli","Kiro CLI",".kiro"),fe("kode","Kode",".kode"),fe("lingma","Lingma",".lingma"),ot({id:"loaf",displayName:"Loaf",project:Xe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),fe("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>ke.default.join(ue.vibeHome(),"skills"),detect:e=>e.pathExists(ue.vibeHome()),sharedStore:!1},fe("moxby","Moxby",".moxby"),fe("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"opencode","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"opencode")),sharedStore:!0},fe("openhands","OpenHands",".openhands"),fe("ona","Ona",".ona"),ot({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),fe("qoder","Qoder",".qoder"),ot({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),fe("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"agents","skills"),detect:e=>$C(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},fe("reasonix","Reasonix",".reasonix"),fe("rovodev","Rovo Dev",".rovodev"),fe("roo","Roo Code",".roo"),ot({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),fe("terramind","Terramind",".terramind"),fe("tinycloud","Tinycloud",".tinycloud"),fe("trae","Trae",".trae"),ot({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),ot({id:"warp",displayName:"Warp",project:Xe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),ot({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Xe,globalSkillsDir:()=>hn(".agents","skills"),detect:e=>IC(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>hn(".zcode","skills"),detect:e=>RC(e.homeDir,e.pathExists),sharedStore:!1},fe("zencoder","Zencoder",".zencoder"),fe("zenflow","Zenflow",".zencoder"),fe("neovate","Neovate",".neovate"),fe("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Xe,globalSkillsDir:()=>{},detect:e=>OC(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},fe("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"agents","skills"),detect:NC,sharedStore:!0,showInSharedList:!1}],Ih=new Map(il.map(e=>[e.id,e])),qo=il.map(e=>e.id);function sl(e){return Ih.has(e)}function $n(e){return Ih.get(e)}function sd(e){let t=Ih.get(e);if(t)return t;throw new f(`${k} Unknown agent: ${D(e)}
255
- ${qo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function ad(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function On(e){return il.filter(t=>ad(t,e))}var Rh=w(require("path"));C();M();var ld=".agents",cd="skills";function it(e,t){let n=e==="global"?ue.home():t;return Rh.default.join(n,ld,cd)}function Lt(e,t,n){if(t==="global")return e.globalSkillsDir()??null;let r=Rh.default.resolve(n,...e.skillsDir.split("/"));return Be(n,r,`${e.id} project skills directory`),r}function Th(e,t,n){return qe(Lt(e,t,n),it(t,n))}var Ph=w(require("fs")),MC=w(require("path"));function kO(e){try{return Ph.default.existsSync(e)}catch{return!1}}function EO(e){try{let t=JSON.parse(Ph.default.readFileSync(MC.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function BC(e){return{homeDir:ue.home(),configHome:ue.configHome(),cwd:e,pathExists:kO,readPackageJson:EO}}async function al(e,t,n=BC(t)){return UC(On(e),n).map(r=>r.id)}function UC(e,t){return e.filter(n=>{try{return n.detect(t)}catch{return!1}})}var WC=w(require("fs")),HC=w(require("path"));C();we();Te();_();M();var ll=[".git","package.json","webflow.json"];function cl(e){for(let t of ll)try{if(WC.default.existsSync(HC.default.join(e,t)))return t}catch{}return null}function ul(e){return cl(e)===null?"global":"project"}function VC(e){let t=cl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${ll.join(", ")} found in this directory.`}async function ud(e,t){if(e.global&&e.project)throw new f(`${k} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let n=ul(t);return e.yes||V()?(u.info(VC(t)),n):Me({message:"Where should these skills be installed?",default:n,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();we();Te();_();M();var dl="all",Qt="universal",vO=6,SO=20,xO=80;function bs(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function CO(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r+=1){let o=[r];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+(e[r-1]===t[i-1]?0:1));n=o}return n[t.length]}function KC(e){let t=e.toLowerCase(),n=Math.max(1,Math.floor(t.length/3)),r=null,o=Number.POSITIVE_INFINITY;for(let i of qo){let s=CO(t,i);s<o&&(o=s,r=i)}return o<=n?r:null}function ks(e){let t=e.filter(n=>!sl(n));if(t.length>0){let n=Array.from(new Set(t.map(o=>KC(o)).filter(o=>o!==null))),r=n.length>0?` Did you mean: ${n.join(", ")}?
254
+ This is a bug in ${he}. Please report it.`)}function Mh(e){return HC(e,t=>t.name)}function Bh(e){let[t,...n]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${D(e.value)}": ${e.skills.map(r=>D(r.skillPath)).join(", ")}. Using ${D(t?.skillPath??"")} and ignoring ${n.length===1?"the other":"the others"}. This is a bug in ${he}. Please report it.`}function HC(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r])}return[...n.entries()].filter(([,r])=>r.length>1).map(([r,o])=>({value:r,skills:o}))}var Es=w(require("fs")),Qt=w(require("path"));C();async function vs(e,t){Ue(t,e,"the catalog skills directory");let n=[],r=[],o=[],i=new Set,s=d=>(o.push(...d.warnings),d.kind==="skipped"?(r.push({skillPath:d.skillPath,reason:d.reason}),!1):(n.push(d.skill),!d.skill.internal));for(let d of await ul(e,"the catalog skills directory")){if(cl.has(d.name))continue;let m=Qt.default.join(e,d.name);if(!await Uh(m,d))continue;let h=await GC(m);if(h.kind!=="none"&&i.add(h.path),!(h.kind!=="none"&&s(await VC({skillDir:m,manifest:h,extractRoot:t}))))for(let g of await ul(m)){if(cl.has(g.name))continue;let y=Qt.default.join(m,g.name);if(!await Uh(y,g))continue;let b=await GC(y);b.kind!=="none"&&(i.add(b.path),s(await VC({skillDir:y,manifest:b,extractRoot:t,parentCategory:d.name})))}}let a=await UO(n),l=Mh(a),c=new Set;for(let d of l){o.push(Bh(d));for(let m of d.skills.slice(1))c.add(m.skillPath)}let p=a.filter(d=>!c.has(d.skillPath));jh(p),o.push(...await WO(e,t,i));for(let d of r)o.push(`Skipped ${d.skillPath} \u2014 ${d.reason}`);return r.length>0&&o.push(`${r.length} skill${r.length===1?" was":"s were"} skipped. ${r.length===1?"This is a defect":"These are defects"} in ${he} \u2014 please report ${r.length===1?"it":"them"} at ${Ko}.`),{skills:p,skipped:r,warnings:o}}async function VC(e){let{skillDir:t,manifest:n,extractRoot:r,parentCategory:o}=e,i=zC(r,n.path),s=[],a=g=>({kind:"skipped",skillPath:i,reason:D(g),warnings:s});if(n.kind==="symlink")return a(`${Ot} is a symbolic link; skill files must be regular files`);let l;try{l=await Es.default.promises.readFile(n.path,"utf8")}catch(g){return a(`failed to read file: ${g instanceof Error?g.message:String(g)}`)}let c;try{c=Xo(l).frontmatter}catch(g){if(g instanceof Lt)return a(g.reason);throw g}let p=D(c.name),d=D(c.description);if(p==="")return a(`frontmatter name "${D(c.name)}" cannot be used as a directory name`);let m=ks(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);Nh(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${he}.`);let h=await BO(t,n.path);return h.symlink?a(`contains a symbolic link (${h.symlink}); skill files must be regular files`):(h.truncated&&s.push(`${i} sits in a directory with more than ${dd} files; only the first ${dd} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Kr(i),description:d,category:Oh(c)??o,internal:$h(c),path:t,skillPath:i,supplementaryFiles:h.files}})}async function GC(e){let t=Qt.default.join(e,Ot),n=await KC(t);if(n)return n;let r=Ot.toLowerCase();for(let o of await ul(e)){if(o.name===Ot||o.name.toLowerCase()!==r)continue;let i=await KC(Qt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function KC(e){try{let t=await Es.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Uh(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Es.default.promises.stat(e)).isDirectory()}catch{return!1}}async function ul(e,t){try{return(await Es.default.promises.readdir(e,{withFileTypes:!0})).sort((r,o)=>r.name<o.name?-1:r.name>o.name?1:0)}catch(n){if(!t)return[];throw new f(`Failed to read ${t} (${D(e)}): ${n instanceof Error?n.message:String(n)}`)}}async function BO(e,t){let n=[],r,o=!1,i=async(s,a)=>{if(!(a>qo||r!==void 0))for(let l of await ul(s)){if(r!==void 0)return;let c=Qt.default.join(s,l.name);if(l.isSymbolicLink()){r=JC(e,c);return}if(l.isDirectory()){if(Jo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!zo.has(l.name)&&c!==t){if(n.length>=dd){o=!0;return}n.push(JC(e,c))}}};return await i(e,1),{files:n.sort(),symlink:r,truncated:o}}async function UO(e){let t=new Set,n=[];for(let r of e){let o;try{o=await Es.default.promises.realpath(r.path)}catch{o=Qt.default.resolve(r.path)}t.has(o)||(t.add(o),n.push(r))}return n}async function WO(e,t,n){let r=[],o=OC,i=async(s,a)=>{if(!(a>LC||o<=0)){o-=1;for(let l of await ul(s)){if(cl.has(l.name))continue;let c=Qt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Ot.toLowerCase()){n.has(c)||r.push(zC(t,c));continue}await Uh(c,l)&&await i(c,a+1)}}};return await i(e,1),r.length===0?[]:[`${r.length} ${Ot} file(s) in the catalog sit outside the layout this CLI reads (for example ${r[0]}) and were ignored. ${he} may have changed its layout; please report it at ${Ko}.`]}function zC(e,t){return Qt.default.relative(e,t).split(Qt.default.sep).join("/")}function JC(e,t){return Qt.default.relative(e,t).split(Qt.default.sep).join("/")}var hn=w(require("os")),On=w(require("path"));function Yo(e,t){let n=process.env[e]?.trim();return n||t}function qC(e){let t=process.env[e]?.trim();return t||void 0}var ce={home:()=>hn.default.homedir(),configHome:()=>Yo("XDG_CONFIG_HOME",On.default.join(hn.default.homedir(),".config")),hardcodedConfigHome:()=>On.default.join(hn.default.homedir(),".config"),claudeHome:()=>Yo("CLAUDE_CONFIG_DIR",On.default.join(hn.default.homedir(),".claude")),codexHome:()=>Yo("CODEX_HOME",On.default.join(hn.default.homedir(),".codex")),vibeHome:()=>Yo("VIBE_HOME",On.default.join(hn.default.homedir(),".vibe")),hermesHome:()=>Yo("HERMES_HOME",On.default.join(hn.default.homedir(),".hermes")),autohandHome:()=>Yo("AUTOHAND_HOME",On.default.join(hn.default.homedir(),".autohand")),grokHome:()=>Yo("GROK_HOME",On.default.join(hn.default.homedir(),".grok")),appData:()=>qC("APPDATA"),flatpakConfigHome:()=>qC("FLATPAK_XDG_CONFIG_HOME")};function yn(...e){return On.default.join(hn.default.homedir(),...e)}var sF=w(require("fs")),ke=w(require("path"));C();M();var Ct=w(require("path"));var Wh=[".openclaw",".clawdbot",".moltbot"];function XC(e,t){let n=Wh.find(r=>t(Ct.default.join(e,r)));return Ct.default.join(e,n??Wh[0],"skills")}function YC(e,t){return Wh.some(n=>t(Ct.default.join(e,n)))}function ZC(e,t,n=ce.appData(),r=ce.flatpakConfigHome()){return!!(t(Ct.default.join(e,"zed"))||n&&t(Ct.default.join(n,"Zed"))||r&&t(Ct.default.join(r,"zed")))}var VO="/Applications/ZCode.app";function QC(e,t){return t(Ct.default.join(e,".zcode"))||t(VO)}function eF(e,t){return t(Ct.default.join(e,"kimchi"))}var GO="/etc/codex";function tF(e,t){return t(e)||t(GO)}function nF(e,t){return t(Ct.default.join(e,".replit"))}function rF(e,t){return t(Ct.default.join(e,".promptscript"))||t(Ct.default.join(e,"promptscript.yaml"))}function oF(e,t,n){return n(Ct.default.join(t,"data","skills"))||n(Ct.default.join(e,".astrbot"))}function iF(){return!1}function KO(e){try{return sF.default.existsSync(e)}catch{return!1}}function fe(e,t,n){return{id:e,displayName:t,skillsDir:`${n}/skills`,globalSkillsDir:()=>yn(n,"skills"),detect:r=>r.pathExists(ke.default.join(r.homeDir,n)),sharedStore:!1}}function ot(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>yn(...e.global),detect:t=>t.pathExists(ke.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",dl=[fe("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"amp")),sharedStore:!0},ot({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),ot({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:()=>yn(".astrbot","data","skills"),detect:e=>oF(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>ke.default.join(ce.autohandHome(),"skills"),detect:e=>e.pathExists(ce.autohandHome()),sharedStore:!1},fe("augment","Augment",".augment"),fe("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>ke.default.join(ce.claudeHome(),"skills"),detect:e=>e.pathExists(ce.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>XC(ce.home(),KO),detect:e=>YC(e.homeDir,e.pathExists),sharedStore:!1},ot({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),fe("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>yn(".codebuddy","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".codebuddy"))||e.pathExists(ke.default.join(e.homeDir,".codebuddy")),sharedStore:!1},fe("codemaker","Codemaker",".codemaker"),fe("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.codexHome(),"skills"),detect:e=>tF(ce.codexHome(),e.pathExists),sharedStore:!0},fe("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>yn(".continue","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".continue"))||e.pathExists(ke.default.join(e.homeDir,".continue")),sharedStore:!1},ot({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>ke.default.join(ce.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(ke.default.join(ce.hardcodedConfigHome(),"crush")),sharedStore:!1},ot({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),ot({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:()=>ke.default.join(ce.configHome(),"devin","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"devin")),sharedStore:!1},ot({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),fe("droid","Droid",".factory"),ot({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),fe("forgecode","ForgeCode",".forge"),ot({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),ot({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>ke.default.join(ce.configHome(),"goose","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>ke.default.join(ce.grokHome(),"skills"),detect:e=>e.pathExists(ce.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>ke.default.join(ce.hermesHome(),"skills"),detect:e=>e.pathExists(ce.hermesHome()),sharedStore:!1},fe("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>yn(".jazz","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".jazz"))||e.pathExists(ke.default.join(e.cwd,".jazz")),sharedStore:!1},fe("junie","Junie",".junie"),fe("iflow-cli","iFlow CLI",".iflow"),fe("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>ke.default.join(ce.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>eF(ce.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>yn(".agents","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".kimi-code"))||e.pathExists(ke.default.join(e.homeDir,".kimi")),sharedStore:!0},fe("kiro-cli","Kiro CLI",".kiro"),fe("kode","Kode",".kode"),fe("lingma","Lingma",".lingma"),ot({id:"loaf",displayName:"Loaf",project:Qe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),fe("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>ke.default.join(ce.vibeHome(),"skills"),detect:e=>e.pathExists(ce.vibeHome()),sharedStore:!1},fe("moxby","Moxby",".moxby"),fe("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"opencode","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"opencode")),sharedStore:!0},fe("openhands","OpenHands",".openhands"),fe("ona","Ona",".ona"),ot({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),fe("qoder","Qoder",".qoder"),ot({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),fe("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>nF(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},fe("reasonix","Reasonix",".reasonix"),fe("rovodev","Rovo Dev",".rovodev"),fe("roo","Roo Code",".roo"),ot({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),fe("terramind","Terramind",".terramind"),fe("tinycloud","Tinycloud",".tinycloud"),fe("trae","Trae",".trae"),ot({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),ot({id:"warp",displayName:"Warp",project:Qe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),ot({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Qe,globalSkillsDir:()=>yn(".agents","skills"),detect:e=>ZC(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>yn(".zcode","skills"),detect:e=>QC(e.homeDir,e.pathExists),sharedStore:!1},fe("zencoder","Zencoder",".zencoder"),fe("zenflow","Zenflow",".zencoder"),fe("neovate","Neovate",".neovate"),fe("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Qe,globalSkillsDir:()=>{},detect:e=>rF(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},fe("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:iF,sharedStore:!0,showInSharedList:!1}],Hh=new Map(dl.map(e=>[e.id,e])),Zo=dl.map(e=>e.id);function pl(e){return Hh.has(e)}function Ln(e){return Hh.get(e)}function md(e){let t=Hh.get(e);if(t)return t;throw new f(`${k} Unknown agent: ${D(e)}
255
+ ${Zo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function gd(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Nn(e){return dl.filter(t=>gd(t,e))}var Vh=w(require("path"));C();M();var hd=".agents",yd="skills";function it(e,t){let n=e==="global"?ce.home():t;return Vh.default.join(n,hd,yd)}function Nt(e,t,n){if(t==="global")return e.globalSkillsDir()??null;let r=Vh.default.resolve(n,...e.skillsDir.split("/"));return Ue(n,r,`${e.id} project skills directory`),r}function Gh(e,t,n){return Ye(Nt(e,t,n),it(t,n))}var Kh=w(require("fs")),aF=w(require("path"));function JO(e){try{return Kh.default.existsSync(e)}catch{return!1}}function zO(e){try{let t=JSON.parse(Kh.default.readFileSync(aF.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function lF(e){return{homeDir:ce.home(),configHome:ce.configHome(),cwd:e,pathExists:JO,readPackageJson:zO}}async function fl(e,t,n=lF(t)){return cF(Nn(e),n).map(r=>r.id)}function cF(e,t){return e.filter(n=>{try{return n.detect(t)}catch{return!1}})}var uF=w(require("fs")),dF=w(require("path"));C();be();Oe();A();M();var ml=[".git","package.json","webflow.json"];function gl(e){for(let t of ml)try{if(uF.default.existsSync(dF.default.join(e,t)))return t}catch{}return null}function hl(e){return gl(e)===null?"global":"project"}function pF(e){let t=gl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${ml.join(", ")} found in this directory.`}async function wd(e,t){if(e.global&&e.project)throw new f(`${k} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let n=hl(t);return e.yes||V()?(u.info(pF(t)),n):Be({message:"Where should these skills be installed?",default:n,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();be();Oe();A();M();var yl="all",en="universal",qO=6,XO=20,YO=80;function Ss(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function ZO(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r+=1){let o=[r];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+(e[r-1]===t[i-1]?0:1));n=o}return n[t.length]}function gF(e){let t=e.toLowerCase(),n=Math.max(1,Math.floor(t.length/3)),r=null,o=Number.POSITIVE_INFINITY;for(let i of Zo){let s=ZO(t,i);s<o&&(o=s,r=i)}return o<=n?r:null}function xs(e){let t=e.filter(n=>!pl(n));if(t.length>0){let n=Array.from(new Set(t.map(o=>gF(o)).filter(o=>o!==null))),r=n.length>0?` Did you mean: ${n.join(", ")}?
256
256
  `:"";throw new f(`${k} Unknown agent(s): ${t.map(o=>D(o)).join(", ")}
257
- `+r+` ${qo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(n=>$n(n))}function pd(e,t){return On(e).filter(n=>Th(n,e,t))}function zC(e,t){return pd(e,t).filter(n=>n.showInSharedList!==!1)}function qC(e,t){let r=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-r.length,i=r.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function XC(e,t,n=vO){return qC(zC(e,t),n)}function GC(e,t){let n=process.stdout.columns??xO,r=Math.max(20,n-t);return e.length<=r?e:`${e.slice(0,r-1)}\u2026`}function FO(e,t,n){return t==="project"?e.skillsDir:Lt(e,t,n)??""}function dd(e,...t){let n=new Set(t.flat());return On(e).filter(r=>n.has(r.id))}async function JC(e,t,n){let r=pd(e,t),o=new Set(r.map(p=>p.id)),i=On(e).filter(p=>!o.has(p.id)),s=new Set(n),a=XC(e,t),l=it(e,t),c=[];r.length>0&&c.push({value:"",name:GC(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let p of i){let m=FO(p,e,t),h=s.has(p.id)?" (detected)":"";c.push({value:p.id,name:GC(`${p.displayName} ${m}${h}`,8),checked:s.has(p.id)})}let d=await En({message:r.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(SO,Math.max(4,c.length)),validate:p=>p.length>0||r.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return dd(e,r.map(p=>p.id),(d??[]).filter(Boolean))}async function pl(e){let{scope:t,cwd:n,options:r}=e,o=bs(r.agent),i=r.allAgents===!0||o.includes(dl),s=o.filter(c=>c!==dl),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(d=>sl(d));return{agents:dd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(d=>!sl(d))}}if(s.length>0&&!i){let c=ks(s),d=c.filter(p=>!ad(p,t));if(d.length>0){let p=d.map(m=>m.displayName).join(", ");throw new f(`${k} ${p} does not support global skill installation \u2014 its skills live inside a project.
258
- Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:dd(t,c.map(p=>p.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...On(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await al(t,n);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${it(t,n)}).`);let c=$n(Qt);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await JC(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}return r.yes||V()?{agents:dd(t,pd(t,n).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await JC(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}var eF=w(require("os")),Gr=w(require("path"));pe();M();var Jr=1,_O=24,AO=100,tF=8,IO=5;function Xo(e,t={}){if(e==="")return"";let n=Gr.default.resolve(e),r=Gr.default.resolve(t.cwd??process.cwd()),o=Gr.default.resolve(t.home??eF.default.homedir()),i=YC(r,n);if(i!==null)return D(i===""?".":`.${Gr.default.sep}${i}`);let s=YC(o,n);return s!==null?D(s===""?"~":`~${Gr.default.sep}${s}`):D(n)}function fd(e={}){return t=>Xo(t,e)}function YC(e,t){let n=Gr.default.relative(e,t);return n===""?"":n.startsWith("..")||Gr.default.isAbsolute(n)?null:n}var ZC={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function Oh(e){let{plan:t,materialized:n,dryRun:r}=e,o=[],i=[];for(let h of t.skills){let g=ZC[h.storeOverwrite];g!==void 0&&!t.force&&o.push({name:h.name,dir:h.dir,overwrite:h.storeOverwrite,reason:g,requiredFlag:"--force",...h.detail!==void 0?{detail:h.detail}:{}});for(let y of h.targets){if(!y.blocked)continue;let b=ZC[y.overwrite];b!==void 0&&o.push({name:h.name,dir:h.dir,agent:y.agent,overwrite:y.overwrite,reason:b,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let h of t.skills)for(let g of h.targets){if(!g.blocked)continue;let y=s.get(h.name)??new Set;y.add(g.path),s.set(h.name,y)}let a=0,l=0,c=0,d=0,p=0,m=0;for(let h of n){if(h.storeAction==="written"&&(l+=1),h.storeAction==="failed"){i.push({name:h.name,message:h.error??"the canonical store could not be written"});continue}if(h.storeAction!=="blocked"){(h.storeAction==="written"||h.storeAction==="adopted"||h.storeAction==="unchanged")&&(a+=1);for(let g of h.targets){if(g.skipped===!0){m+=1;continue}if(!g.success){if(s.get(h.name)?.has(g.path))continue;i.push({name:h.name,agent:g.agent,...g.errno!==void 0?{errno:g.errno}:{},message:g.error??"the destination could not be written"});continue}g.link==="symlink"&&(c+=1),g.link==="copy"&&g.requestedMode==="copy"&&(d+=1),g.symlinkFailed===!0&&(p+=1)}}}return r&&(m=t.skills.reduce((h,g)=>h+g.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:d,symlinkFallbacks:p}}}function Lh(e,t){let n=t.display??(o=>o),r=[];r.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),r.push(` scope ${e.scope} (${n(e.root)})`),r.push(` source ${RO(e.source)}`),r.push(` store ${n(e.storeBase)}`),r.push(` mode ${e.mode}`);for(let o of e.skills)r.push(""),r.push(` ${D(o.dir)}`),r.push(` store ${n(o.storePath)}`),r.push(...TO(o,n)),o.blocked&&o.detail!==void 0&&r.push(` ${le("blocked")} ${o.detail}`);if(e.warnings.length>0){r.push("");for(let o of e.warnings)r.push(` ${le("\u26A0")} ${o}`)}return r.join(`
259
- `)}function RO(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${nF(e.commit)}${t}`}function nF(e){return e.slice(0,tF)}function TO(e,t){let n=[],r=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");r.length>0&&n.push(` shared ${fl(r)}`),o.length>0&&n.push(` symlink \u2192 ${QC(o,t)}`),i.length>0&&n.push(` copy \u2192 ${QC(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&n.push(` ${R("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&n.push(` overwrites ${s.label} ${R(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return n}function QC(e,t){if(e.length===1){let n=e[0];return`${n.label} (${t(n.path)})`}return fl(e)}function fl(e,t=IO){let n=e.map(r=>D(r.label));return n.length<=t?n.join(", "):`${n.slice(0,t).join(", ")} +${n.length-t} more`}function rF(e,t={}){let n=t.display??(i=>i),r=[],{summary:o}=e;r.push(K(`Installed ${o.installed} ${$h(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;r.push(` ${D(n(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&&r.push(` shared: ${fl(s)}`),a.length>0&&r.push(` symlinked: ${fl(a)}`),l.length>0&&r.push(` copied: ${fl(l)}`),i.detail!==void 0&&r.push(` ${R(i.detail)}`)}if(o.symlinkFallbacks>0){let i=PO(e.materialized);r.push(`${le("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${$h(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),r.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return r.push(...$O(e.blocked)),r.push(...OO(e.failures)),r.push(...md(e.plan.warnings)),r.join(`
260
- `)}function PO(e){let t=new Set;for(let n of e)for(let r of n.targets)r.symlinkFailed===!0&&r.errno!==void 0&&t.add(r.errno);return[...t].sort()}function $O(e){if(e.length===0)return[];let t=["",le(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let n of e){let r=n.agent===void 0?"shared store":D(n.agent);t.push(` \u2022 ${D(n.name)} (${r})`),n.detail!==void 0&&t.push(` ${n.detail}`)}return t}function OO(e){if(e.length===0)return[];let t=["",Mt(`${e.length} ${$h(e.length,"failure")}:`)];for(let n of e){let r=n.agent===void 0?"":` (${D(n.agent)})`;t.push(` \u2022 ${D(n.name)}${r}: ${D(n.message)}`)}return t}function md(e){return e.length===0?[]:["",...e.map(t=>`${le("\u26A0")} ${t}`)]}function $h(e,t){return e===1?t:`${t}s`}function gd(e){let{plan:t}=e,n=new Map(e.materialized.map(r=>[r.name,r]));return{kind:"skills.install",schemaVersion:Jr,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(r=>LO(r,n.get(r.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function LO(e,t){let n=new Map((t?.targets??[]).map(r=>[r.path,r]));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(r=>NO(r,n.get(r.path)))}}function NO(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 Yo=["name","dir","description","status","mode","agents","scope"],ml="name,status,agents",Es=["name","dir","status","scope"],jO={"up-to-date":K,modified:le,missing:Mt,unmanaged:R};function oF(e,t,n={}){let r=n.columns??process.stdout.columns??AO,o=e.map(l=>t.map(c=>MO(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((d,p,m)=>{if(m===i)return d;let h=Math.max(p.length,...o.map(g=>g[m].length),0);return d+h+2},0),c=Math.max(_O,r-l-2);for(let d of o)d[i]=UO(d[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((d,p)=>t[p]==="status"?jO[e[c].status](d):d));return ze(s,a)}function MO(e,t){switch(t){case"name":return D(e.name);case"dir":return D(e.dir);case"description":return D(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return BO(e);case"scope":return e.scope}}var iF="shared";function BO(e){let t=[],n=0;for(let r of e.agents){let o=D(r.id);if(!r.present){t.push(`${o} (missing)`);continue}if(r.link==="canonical"){n+=1;continue}t.push(o)}return n>0?[iF,...t].join(", "):t.join(", ")}function sF(e,t={}){let n=t.display??(s=>s),r=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&r.add(a.id);if(r.size===0)return"";let o=[...r].sort().join(", "),i=t.store===void 0?"":` = ${n(t.store)}`;return R(`${iF}${i}, read directly by ${r.size} agent${r.size===1?"":"s"}:
261
- ${o}`)}function UO(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function aF(e,t={}){let n=t.display??(l=>l),r=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${nF(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${r} skills \u2014 ${n(a)}${s}`)}function Nh(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let n of e)for(let r of n.skills)t.total+=1,r.status==="up-to-date"?t.upToDate+=1:r.status==="modified"?t.modified+=1:r.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function lF(e){return{kind:"skills.list",schemaVersion:Jr,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(n=>({name:n.name,dir:n.dir,description:n.description,skillPath:n.skillPath??null,storePath:n.storePath,recordedHash:n.recordedHash,onDiskHash:n.onDiskHash,status:n.status,statusDetail:n.statusDetail??null,mode:n.mode,commit:n.commit??null,ref:n.ref??null,category:n.category??null,agents:n.agents.map(r=>({id:r.id,label:r.label,path:r.path,link:r.link,present:r.present,diverged:r.diverged??!1}))}))})),summary:Nh(e.inventories),warnings:[...e.warnings]}}var jh="No skills installed. Run `webflow skills install` to get started.";function cF(e,t){let n=t==="desc"?-1:1;return(r,o)=>{let i=String(r[e]??""),s=String(o[e]??"");return i===s?r.name<o.name?-1:r.name>o.name?1:0:(i<s?-1:1)*n}}function uF(e){let t=[],{summary:n}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return jh;if(e.source.upToDate)t.push(`${$} ${D(e.source.repo)}@${D(e.source.ref)} is still ${WO(e.source.resolvedCommit)} \u2014 all ${n.checked} skill${n.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${je} ${n.outdated+n.conflicts} of ${n.checked} skills would change.`:`${$} Updated ${n.updated} skill${n.updated===1?"":"s"}`+(n.blocked>0?`, skipped ${n.blocked}`:"")+(n.failed>0?`, ${n.failed} failed`:"");t.push(o)}let r=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[D(o.dir),o.action,o.detail?D(o.detail):""]);r.length>0&&t.push("",ze(["SKILL","ACTION","DETAIL"],r));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${D(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${D(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
262
- `)}function WO(e){return e===null?"unknown":e.slice(0,tF)}function Mh(e,t,n={}){let r=i=>D((n.display??Xo)(i)),o=[];o.push(`${n.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${D(i.name)} \u2192 ${D(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(` ${r(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>D(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${r(s.path)} ${D(s.label)} (unlink)`)}return n.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
263
- `)}function dF(e,t={}){let n=o=>D((t.display??Xo)(o));if(e.skills.length===0)return"No skills removed.";let r=[];r.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=>D(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";r.push(` ${D(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&r.push(` removed empty directories: ${e.removedDirectories.map(o=>n(o)).join(", ")}`);for(let o of e.failures)r.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.lockfileDeleted?r.push(`${je} ${n(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&r.push(`${je} ${n(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),r.join(`
264
- `)}q();C();we();Te();_();M();X();we();_();function HO(e){let t=cl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${ll.join(", ")} found in this directory.`}async function hd(e,t,n){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(n||u.info(HO(t)),ul(t)):ud(e,t)}function vs(e){return e==="locally-modified"||e==="unmanaged"}var Qo=w(require("fs")),yn=w(require("path"));C();var Uh=require("crypto"),bd=w(require("fs"));C();var Zo=w(require("fs")),Ln=w(require("path"));C();var Bh=2e3,fF=8;async function yd(e){let t=Ln.default.resolve(e),n=[],r=[],o=async(i,s)=>{if(s>Jo)throw new f(`Skill directory ${D(t)} nests deeper than ${Jo} levels at ${D(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=Ln.default.join(i,l.name);if(Be(t,c,"a skill file"),l.isSymbolicLink()){r.push(pF(t,c));continue}if(l.isDirectory()){if(Vo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Go.has(l.name))continue;let d=await Zo.default.promises.lstat(c);if(n.length>=Bh)throw new f(`Skill directory ${D(t)} contains more than ${Bh} files. Refusing to copy or hash it.`);let p=pF(t,c);n.push({rel:p,key:p.normalize("NFC"),abs:c,mode:d.mode&511,size:d.size})}};return await o(t,1),n.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),r.sort(),{files:n,symlinks:r}}function wd(e,t){let[n]=t.symlinks;if(n!==void 0)throw new f(`Skill directory ${D(e)} contains a symbolic link ("${D(n)}"); skill files must be regular files. If this came from ${he}, please report it.`)}async function Dd(e,t){let n=Ln.default.resolve(e),r=Ln.default.resolve(t),o=await yd(n);wd(n,o),await Zo.default.promises.mkdir(r,{recursive:!0});let i=new Set;for(let a of o.files){let l=Ln.default.dirname(Ln.default.join(r,...a.rel.split("/")));l!==r&&i.add(l)}for(let a of[...i].sort())Be(r,a,"a skill destination directory"),await Zo.default.promises.mkdir(a,{recursive:!0});let s=0;return await VO(o.files,fF,async a=>{let l=Ln.default.join(r,...a.rel.split("/"));Be(r,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 pF(e,t){return Ln.default.relative(e,t).split(Ln.default.sep).join("/")}async function VO(e,t,n){let r=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;r<e.length;){let i=e[r++];if(i===void 0)return;await n(i)}});await Promise.all(o)}var gF=1024*1024,hF=4294967295,Wh=Buffer.from([0]);async function kd(e){let t=await yd(e);wd(e,t);let n=(0,Uh.createHash)("sha256"),r=(0,Uh.createHash)("sha256"),o=0;for(let i of t.files)await GO(n,i),JO(r,i),o+=i.size;return{contentHash:`sha256:${n.digest("hex")}`,modeHash:`sha256:${r.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function en(e){try{return await kd(e)}catch(t){if(qO(t))return null;throw t}}function Nt(e,t,n=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:n==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function GO(e,t){if(t.size<=gF){let o=await bd.default.promises.readFile(t.abs);return mF(e,t,o.length),e.update(o),o.length}let n=await KO(t.abs);mF(e,t,n);let r=await zO(e,t.abs,n);if(r!==n)throw new f(`${D(t.abs)} changed while it was being hashed (${n} bytes, then ${r}). Re-run the command.`);return r}function mF(e,t,n){if(n>hF)throw new f(`${D(t.abs)} is ${n} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(Wh);let r=Buffer.alloc(4);r.writeUInt32BE(n,0),e.update(r)}function JO(e,t){e.update(t.key,"utf8"),e.update(Wh),e.update((t.mode&73)!==0?"x":"-"),e.update(Wh)}async function KO(e){let t=0;for await(let n of bd.default.createReadStream(e))t+=n.length;return t}async function zO(e,t,n){let r=0;for await(let o of bd.default.createReadStream(t)){let i=o;if(r+=i.length,r>n)return e.update(i.subarray(0,i.length-(r-n))),r;e.update(i)}return r}function qO(e){return Kr(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:Kr(e.cause)==="ENOENT"}function Kr(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var DF=require("crypto"),_e=w(require("fs")),Ee=w(require("path"));C();_();var XO=/\.[0-9a-f]{6}\.tmp$/,bF=3600*1e3;async function Vh(e,t=n=>n){let n=Ee.default.join(e,ld);for(let r of[n,Ee.default.join(n,cd)]){if(await kF(r)==="other")throw new f(`${D(t(r))} 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 Ed(e,r))throw new f(`${D(t(r))} resolves outside ${D(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 Ed(e,t){if(!rt(e,t)||await Gh(e,t)!==void 0)return!0;try{await _e.default.promises.lstat(t)}catch{return!1}return!await Vu(e,t)}async function Gh(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await _e.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await Vu(n,i))return i}}async function vd(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await kF(i);if(a==="absent")return;if(a==="other")return i}}async function gl(e,t={}){if(t.dryRun)return[];let n=t.maxAgeMs??bF,r=t.now??Date.now(),o=[],i;try{i=await _e.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!XO.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Be(e,a,"a stale staging directory");let l=await _e.default.promises.lstat(a);if(r-l.mtimeMs<n)continue;await _e.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 Sd(e){let{storeDir:t,slug:n,root:r,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},d=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==n)return d(`Refusing to write ${D(l)}: its final component is not "${D(n)}".`);let p=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${D(l)} for ${D(s)}: ${y}`});if(!rt(r,l))return p(`it resolves outside ${D(r)}.`);let m=await Gh(r,l);if(m!==void 0)return p(`${D(m)} is a symbolic link that leaves ${D(r)}.`);let h=await vd(r,l);if(h!==void 0)return d(`${D(h)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(qe(t,l))return{...c,success:!0,link:"canonical"};let g=await QO(l,t);if(g&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!g){let[y,b]=await Promise.all([fn(t),fn(l)]);if(qe(y,b))return{...c,success:!0,link:"canonical"};if(qe(await wF(t),await wF(l)))return{...c,success:!0,link:"canonical"};if(await eh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await yF(t,l,n),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:Kr(y),error:Hh(y)}}try{if(await eL(l,n),await _e.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await _e.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await fn(Ee.default.dirname(l));await _e.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let b=Kr(y);try{return await yF(t,l,n),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:b}}catch(S){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:Kr(S)??b,error:Hh(S)}}}}async function hl(e,t,n={}){if(Be(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new f(`Refusing to write ${D(t.storePath)}: its final component is not "${D(t.dir)}". Please report this.`);let r={name:t.name,dir:t.dir,storePath:t.storePath};if(vs(t.storeOverwrite)&&!e.force)return{...r,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 eh(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 YO(t),i="written")}catch(l){return{...r,storeAction:"failed",hashes:null,targets:[],success:!1,error:Hh(l)}}let a=[];for(let l of t.targets)a.push(await ZO(e,t,l,n));return{...r,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function YO(e){await _e.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=Kh(e.storePath);try{await Dd(e.sourceDir,t),await Jh(e.storePath,e.dir),await _e.default.promises.rename(t,e.storePath)}finally{await _e.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return kd(e.storePath)}async function ZO(e,t,n,r){let o={agent:n.agent,label:n.label,path:n.path,canonicalPath:t.storePath,requestedMode:e.mode};return n.link==="canonical"?{...o,success:!0,link:"canonical"}:n.skipped?{...o,success:!0,link:n.link,skipped:!0,skipReason:n.skipReason,error:void 0}:n.blocked?{...o,success:!1,link:n.link,error:n.detail}:Sd({storeDir:t.storePath,linkPath:n.path,slug:t.dir,root:e.root,mode:e.mode,agent:n.agent,label:n.label,platform:r.platform})}async function yF(e,t,n){await _e.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let r=Kh(t);try{await Dd(e,r),await Jh(t,n),await _e.default.promises.rename(r,t)}finally{await _e.default.promises.rm(r,{recursive:!0,force:!0}).catch(()=>{})}}async function QO(e,t){let n;try{n=await _e.default.promises.lstat(e)}catch{return!1}if(!n.isSymbolicLink())return!1;let r=await _e.default.promises.readlink(e).catch(()=>null);if(r===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),r);if(qe(o,t))return!0;let[i,s]=await Promise.all([fn(o),fn(t)]);return qe(i,s)}async function eL(e,t){let n;try{n=await _e.default.promises.lstat(e)}catch(r){Kr(r)==="ELOOP"&&await _e.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(n.isSymbolicLink()){await _e.default.promises.rm(e,{force:!0});return}await Jh(e,t)}async function Jh(e,t){if(Ee.default.basename(e)!==t)throw new f(`Refusing to delete ${D(e)}: its final component is not "${D(t)}". Please report this.`);let n;try{n=await _e.default.promises.lstat(e)}catch{return}if(n.isSymbolicLink()){await _e.default.promises.rm(e,{force:!0});return}await _e.default.promises.rm(e,{recursive:!0,force:!0})}function Kh(e){return`${e}.${(0,DF.randomBytes)(3).toString("hex")}.tmp`}async function wF(e){let t=Ee.default.resolve(e),n=await fn(Ee.default.dirname(t));return Ee.default.join(n,Ee.default.basename(t))}async function kF(e){let t;try{t=await _e.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await _e.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Hh(e){let t=e instanceof Error?e.message:String(e);return D(t)}var tL=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],nL=64;async function yl(e){let t=e.platform??process.platform,n=e.display??(c=>c),r=yn.default.resolve(e.root),o=it(e.scope,r),i=e.recorded??{},s=new Set(e.warnings??[]);await Vh(r,n);let a=await rL({targets:e.targets,scope:e.scope,root:r,storeBase:o,display:n,warn:c=>s.add(c)});for(let c of await aL({groups:a,skills:e.skills,display:n}))s.add(c);let l=[];for(let c of e.skills)l.push(await sL({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:n}));return{scope:e.scope,root:r,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function rL(e){let{targets:t,scope:n,root:r,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let d=Lt(c.agent,n,r);if(d===null){s(`${D(c.agent.displayName)} does not support ${n} installation and was skipped.`);continue}let p=a.get(d);p?(p.agents.push(c.agent),p.explicit=p.explicit||c.explicit):a.set(d,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,d]of a){let p=d.agents.slice().sort((g,y)=>g.id<y.id?-1:g.id>y.id?1:0);if(qe(c,o)){l.push({dir:c,agents:p,canonical:!0});continue}if(await Ed(r,c)){let g=xd(c),y=`${D(i(c))} resolves outside ${D(i(r))}`+(g?` (check $${g})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:p,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await vd(r,c);if(m!==void 0){let g=`${D(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(g),l.push({dir:c,agents:p,canonical:!1,skipReason:"path-conflict",detail:g});continue}if(!(d.explicit||await iL(d.agents,n,r,c))){l.push({dir:c,agents:p,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${D(i(o))}`});continue}l.push({dir:c,agents:p,canonical:!1})}return l}function oL(e,t,n,r){if(t==="global")return yn.default.dirname(r);let[o]=e.skillsDir.split(/[\\/]/);return yn.default.join(n,o??e.skillsDir)}async function iL(e,t,n,r){for(let o of e)if(await lL(oL(o,t,n,r)))return!0;return!1}async function sL(e){let{discovered:t,groups:n,storeBase:r,mode:o,force:i,platform:s,display:a}=e,l=yn.default.join(r,t.dir),c=await cL(t.path),d=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,p=e.recorded!==null&&d===null,m=await vF({dest:l,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),h=[];for(let S of n){let A=S.canonical?l:yn.default.join(S.dir,t.dir),v=S.canonical?"canonical":o;if(S.canonical||S.skipReason!==void 0){h.push({agent:SF(S),agents:S.agents.map(H=>H.id),label:xF(S),path:A,link:v,overwrite:S.canonical?m.overwrite:"fresh",blocked:S.canonical?m.blocked:!1,skipped:!S.canonical,...S.skipReason!==void 0?{skipReason:S.skipReason}:{},...S.detail!==void 0?{detail:S.detail}:{}});continue}let x=await vF({dest:A,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),O=vs(x.overwrite)&&!i;h.push({agent:SF(S),agents:S.agents.map(H=>H.id),label:xF(S),path:A,link:v,overwrite:x.overwrite,blocked:O,skipped:!1,...O?{detail:EF(x,A,a)}:{}})}let g=vs(m.overwrite)&&!i,y=h.find(S=>S.blocked),b=g?EF(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:h,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:d,blocked:g||y!==void 0,...b!==void 0?{detail:b}:{}}}function EF(e,t,n){return e.problem===void 0?FF(e.overwrite,t,n):`${D(n(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 vF(e){let{dest:t,storePath:n,recorded:r,upstream:o,platform:i}=e,s=(c,d,p)=>({overwrite:c,upToDate:d,onDisk:p,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),d=c===null?null:yn.default.resolve(yn.default.dirname(t),c);return d!==null&&qe(d,n)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await en(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:D(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(r===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(r!==null)return Nt(l,r,i)?s("managed-update",Nt(l,o,i),l):s("locally-modified",!1,l);if(Nt(l,o,i)){let c=await CF(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 "${D(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function CF(e,t="",n=0){if(n>Jo)return;let r;try{r=await Qo.default.promises.readdir(e,{withFileTypes:!0})}catch{return}r.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of r){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(Vo.has(o.name))return i;let s=await CF(yn.default.join(e,o.name),i,n+1);if(s!==void 0)return s;continue}if(!o.isFile()||Go.has(o.name))return i}}function FF(e,t,n=r=>r){let r=D(n(t));return e==="locally-modified"?`${r} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${r} 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 aL(e){let{groups:t,skills:n,display:r}=e,o=new Map(n.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,d)=>c.name<d.name?-1:c.name>d.name?1:0);let l=nL;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let d=yn.default.join(s.dir,c.name,$t),p;try{p=Ko(await Qo.default.promises.readFile(d,"utf8")).frontmatter.name}catch{continue}let m=o.get(p);m===void 0||m===c.name||i.push(`${D(r(s.dir))} already contains "${D(c.name)}", whose ${$t} declares the name "${D(p)}" \u2014 the same skill this install writes to "${D(m)}". Your agent would load it twice; remove one of them.`)}}return i}function xd(e){let t=yn.default.resolve(e);for(let n of tL){let r=process.env[n]?.trim();if(r&&rt(r,t))return n}}function SF(e){return e.agents[0]?.id??""}function xF(e){let t=e.agents.map(n=>n.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function lL(e){try{return await Qo.default.promises.lstat(e),!0}catch{return!1}}async function cL(e){let t=await en(e);if(t!==null)return t;throw new f(`The extracted skill directory ${D(e)} is no longer present. Re-run the command.`)}var jt=1,TF=/^sha256:[0-9a-f]{64}$/,zh=128,qh=1024,_F=256,uL=/[\x00-\x1f\x7f]/;function PF(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>zh?`must be at most ${zh} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":cs(e)}function Cd(e){return e.trim()===""?"must not be empty":e.length>qh?`must be at most ${qh} characters`:cs(e)}function AF(e){return(t,n)=>{let r=e(t);r!==null&&n.addIssue({code:j.ZodIssueCode.custom,message:r})}}var $F=j.string().regex(Yt,"must be a 40-character lowercase commit SHA"),OF=j.string().regex(Ku,"is not a usable git ref for this repository"),IF=j.string().regex(TF,'must look like "sha256:<64 lowercase hex>"'),dL=j.string().min(1,"must not be empty").max(od).refine(e=>e.trim()!=="","must not be blank").refine(e=>!uL.test(e),"must not contain control characters"),RF=j.string().datetime({offset:!0}),LF=j.object({commit:$F,dir:j.string().superRefine(AF(PF)),skillPath:j.string().superRefine(AF(Cd)).optional(),contentHash:IF.optional(),modeHash:IF.optional(),ref:OF.optional(),agents:j.array(j.string().min(1).max(64)).default([]),mode:j.enum(["symlink","copy"]).default("symlink"),category:j.string().min(1).max(64).optional(),installedAt:RF.optional(),updatedAt:RF.optional()}).passthrough(),NF=j.object({repo:j.string().min(1).max(_F).default(he),ref:OF.default(Ge),commit:$F.optional(),pluginVersion:j.string().min(1).max(_F).optional()}).passthrough(),jF=j.object({lockfileVersion:j.number().int().min(0),source:NF.default({}),skills:j.record(dL,LF).default({})}).passthrough();function MF(e){return e.length===0?"the lockfile":e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function Xh(e){let[t]=e.issues;return t?`${MF([...t.path])} ${t.message}`:"did not match the expected shape"}function Fd(e){return jF.safeParse(e)}var _d=w(require("path"));ql();C();var BF="webflow-skills-lock.json",UF="skills-lock.json";function ei(e){if(typeof e!="string"||e.trim()==="")throw new f("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return _d.default.join(_d.default.resolve(e),BF)}function ti(){return _d.default.join(zl(),UF)}function wl(e,t){return e==="global"?ti():ei(t??"")}var HF=w(require("fs"));var pL=/^<{7}/m,fL=/^\uFEFF/;async function Nn(e){let t;try{t=await HF.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:mL(c)}}let n=t.replace(fL,"");if(pL.test(n))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(n.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let r;try{r=JSON.parse(n)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:gL(c,n)}}if(r===null||typeof r!="object"||Array.isArray(r))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${WF(r)}, not an object`};let o=r,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${WF(i)})`};let s=typeof i=="number"?i:0;if(s>jt){let c=Fd(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<jt?{...o,lockfileVersion:jt}:o,l=Fd(a);return l.success?s<jt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:Xh(l.error)}}function mL(e){let t=e.code,n=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]??n} (${t})`:n}function gL(e,t){let n=e instanceof Error?e.message:String(e),r=/position (\d+)/.exec(n);if(!r)return n;let o=Number(r[1]);if(!Number.isFinite(o)||o<0)return n;let i=t.slice(0,o),s=i.split(`
257
+ `+r+` ${Zo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(n=>Ln(n))}function Dd(e,t){return Nn(e).filter(n=>Gh(n,e,t))}function hF(e,t){return Dd(e,t).filter(n=>n.showInSharedList!==!1)}function yF(e,t){let r=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-r.length,i=r.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function wF(e,t,n=qO){return yF(hF(e,t),n)}function fF(e,t){let n=process.stdout.columns??YO,r=Math.max(20,n-t);return e.length<=r?e:`${e.slice(0,r-1)}\u2026`}function QO(e,t,n){return t==="project"?e.skillsDir:Nt(e,t,n)??""}function bd(e,...t){let n=new Set(t.flat());return Nn(e).filter(r=>n.has(r.id))}async function mF(e,t,n){let r=Dd(e,t),o=new Set(r.map(d=>d.id)),i=Nn(e).filter(d=>!o.has(d.id)),s=new Set(n),a=wF(e,t),l=it(e,t),c=[];r.length>0&&c.push({value:"",name:fF(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let d of i){let m=QO(d,e,t),h=s.has(d.id)?" (detected)":"";c.push({value:d.id,name:fF(`${d.displayName} ${m}${h}`,8),checked:s.has(d.id)})}let p=await vn({message:r.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(XO,Math.max(4,c.length)),validate:d=>d.length>0||r.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return bd(e,r.map(d=>d.id),(p??[]).filter(Boolean))}async function wl(e){let{scope:t,cwd:n,options:r}=e,o=Ss(r.agent),i=r.allAgents===!0||o.includes(yl),s=o.filter(c=>c!==yl),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(p=>pl(p));return{agents:bd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(p=>!pl(p))}}if(s.length>0&&!i){let c=xs(s),p=c.filter(d=>!gd(d,t));if(p.length>0){let d=p.map(m=>m.displayName).join(", ");throw new f(`${k} ${d} does not support global skill installation \u2014 its skills live inside a project.
258
+ Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:bd(t,c.map(d=>d.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Nn(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await fl(t,n);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${it(t,n)}).`);let c=Ln(en);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await mF(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}return r.yes||V()?{agents:bd(t,Dd(t,n).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await mF(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}var EF=w(require("os")),Jr=w(require("path"));pe();M();var zr=1,eL=24,tL=100,vF=8,nL=5;function Qo(e,t={}){if(e==="")return"";let n=Jr.default.resolve(e),r=Jr.default.resolve(t.cwd??process.cwd()),o=Jr.default.resolve(t.home??EF.default.homedir()),i=bF(r,n);if(i!==null)return D(i===""?".":`.${Jr.default.sep}${i}`);let s=bF(o,n);return s!==null?D(s===""?"~":`~${Jr.default.sep}${s}`):D(n)}function kd(e={}){return t=>Qo(t,e)}function bF(e,t){let n=Jr.default.relative(e,t);return n===""?"":n.startsWith("..")||Jr.default.isAbsolute(n)?null:n}var DF={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function zh(e){let{plan:t,materialized:n,dryRun:r}=e,o=[],i=[];for(let h of t.skills){let g=DF[h.storeOverwrite];g!==void 0&&!t.force&&o.push({name:h.name,dir:h.dir,overwrite:h.storeOverwrite,reason:g,requiredFlag:"--force",...h.detail!==void 0?{detail:h.detail}:{}});for(let y of h.targets){if(!y.blocked)continue;let b=DF[y.overwrite];b!==void 0&&o.push({name:h.name,dir:h.dir,agent:y.agent,overwrite:y.overwrite,reason:b,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let h of t.skills)for(let g of h.targets){if(!g.blocked)continue;let y=s.get(h.name)??new Set;y.add(g.path),s.set(h.name,y)}let a=0,l=0,c=0,p=0,d=0,m=0;for(let h of n){if(h.storeAction==="written"&&(l+=1),h.storeAction==="failed"){i.push({name:h.name,message:h.error??"the canonical store could not be written"});continue}if(h.storeAction!=="blocked"){(h.storeAction==="written"||h.storeAction==="adopted"||h.storeAction==="unchanged")&&(a+=1);for(let g of h.targets){if(g.skipped===!0){m+=1;continue}if(!g.success){if(s.get(h.name)?.has(g.path))continue;i.push({name:h.name,agent:g.agent,...g.errno!==void 0?{errno:g.errno}:{},message:g.error??"the destination could not be written"});continue}g.link==="symlink"&&(c+=1),g.link==="copy"&&g.requestedMode==="copy"&&(p+=1),g.symlinkFailed===!0&&(d+=1)}}}return r&&(m=t.skills.reduce((h,g)=>h+g.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:d}}}function qh(e,t){let n=t.display??(o=>o),r=[];r.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),r.push(` scope ${e.scope} (${n(e.root)})`),r.push(` source ${rL(e.source)}`),r.push(` store ${n(e.storeBase)}`),r.push(` mode ${e.mode}`);for(let o of e.skills)r.push(""),r.push(` ${D(o.dir)}`),r.push(` store ${n(o.storePath)}`),r.push(...oL(o,n)),o.blocked&&o.detail!==void 0&&r.push(` ${le("blocked")} ${o.detail}`);if(e.warnings.length>0){r.push("");for(let o of e.warnings)r.push(` ${le("\u26A0")} ${o}`)}return r.join(`
259
+ `)}function rL(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${SF(e.commit)}${t}`}function SF(e){return e.slice(0,vF)}function oL(e,t){let n=[],r=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");r.length>0&&n.push(` shared ${bl(r)}`),o.length>0&&n.push(` symlink \u2192 ${kF(o,t)}`),i.length>0&&n.push(` copy \u2192 ${kF(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&n.push(` ${I("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&n.push(` overwrites ${s.label} ${I(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return n}function kF(e,t){if(e.length===1){let n=e[0];return`${n.label} (${t(n.path)})`}return bl(e)}function bl(e,t=nL){let n=e.map(r=>D(r.label));return n.length<=t?n.join(", "):`${n.slice(0,t).join(", ")} +${n.length-t} more`}function xF(e,t={}){let n=t.display??(i=>i),r=[],{summary:o}=e;r.push(J(`Installed ${o.installed} ${Jh(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;r.push(` ${D(n(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&&r.push(` shared: ${bl(s)}`),a.length>0&&r.push(` symlinked: ${bl(a)}`),l.length>0&&r.push(` copied: ${bl(l)}`),i.detail!==void 0&&r.push(` ${I(i.detail)}`)}if(o.symlinkFallbacks>0){let i=iL(e.materialized);r.push(`${le("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${Jh(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),r.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return r.push(...sL(e.blocked)),r.push(...aL(e.failures)),r.push(...Ed(e.plan.warnings)),r.join(`
260
+ `)}function iL(e){let t=new Set;for(let n of e)for(let r of n.targets)r.symlinkFailed===!0&&r.errno!==void 0&&t.add(r.errno);return[...t].sort()}function sL(e){if(e.length===0)return[];let t=["",le(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let n of e){let r=n.agent===void 0?"shared store":D(n.agent);t.push(` \u2022 ${D(n.name)} (${r})`),n.detail!==void 0&&t.push(` ${n.detail}`)}return t}function aL(e){if(e.length===0)return[];let t=["",Bt(`${e.length} ${Jh(e.length,"failure")}:`)];for(let n of e){let r=n.agent===void 0?"":` (${D(n.agent)})`;t.push(` \u2022 ${D(n.name)}${r}: ${D(n.message)}`)}return t}function Ed(e){return e.length===0?[]:["",...e.map(t=>`${le("\u26A0")} ${t}`)]}function Jh(e,t){return e===1?t:`${t}s`}function vd(e){let{plan:t}=e,n=new Map(e.materialized.map(r=>[r.name,r]));return{kind:"skills.install",schemaVersion:zr,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(r=>lL(r,n.get(r.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function lL(e,t){let n=new Map((t?.targets??[]).map(r=>[r.path,r]));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(r=>cL(r,n.get(r.path)))}}function cL(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 ei=["name","dir","description","status","mode","agents","scope"],Dl="name,status,agents",Cs=["name","dir","status","scope"],uL={"up-to-date":J,modified:le,missing:Bt,unmanaged:I};function CF(e,t,n={}){let r=n.columns??process.stdout.columns??tL,o=e.map(l=>t.map(c=>dL(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((p,d,m)=>{if(m===i)return p;let h=Math.max(d.length,...o.map(g=>g[m].length),0);return p+h+2},0),c=Math.max(eL,r-l-2);for(let p of o)p[i]=fL(p[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((p,d)=>t[d]==="status"?uL[e[c].status](p):p));return qe(s,a)}function dL(e,t){switch(t){case"name":return D(e.name);case"dir":return D(e.dir);case"description":return D(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return pL(e);case"scope":return e.scope}}var FF="shared";function pL(e){let t=[],n=0;for(let r of e.agents){let o=D(r.id);if(!r.present){t.push(`${o} (missing)`);continue}if(r.link==="canonical"){n+=1;continue}t.push(o)}return n>0?[FF,...t].join(", "):t.join(", ")}function _F(e,t={}){let n=t.display??(s=>s),r=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&r.add(a.id);if(r.size===0)return"";let o=[...r].sort().join(", "),i=t.store===void 0?"":` = ${n(t.store)}`;return I(`${FF}${i}, read directly by ${r.size} agent${r.size===1?"":"s"}:
261
+ ${o}`)}function fL(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function AF(e,t={}){let n=t.display??(l=>l),r=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${SF(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${r} skills \u2014 ${n(a)}${s}`)}function Xh(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let n of e)for(let r of n.skills)t.total+=1,r.status==="up-to-date"?t.upToDate+=1:r.status==="modified"?t.modified+=1:r.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function RF(e){return{kind:"skills.list",schemaVersion:zr,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(n=>({name:n.name,dir:n.dir,description:n.description,skillPath:n.skillPath??null,storePath:n.storePath,recordedHash:n.recordedHash,onDiskHash:n.onDiskHash,status:n.status,statusDetail:n.statusDetail??null,mode:n.mode,commit:n.commit??null,ref:n.ref??null,category:n.category??null,agents:n.agents.map(r=>({id:r.id,label:r.label,path:r.path,link:r.link,present:r.present,diverged:r.diverged??!1}))}))})),summary:Xh(e.inventories),warnings:[...e.warnings]}}var Yh="No skills installed. Run `webflow skills install` to get started.";function IF(e,t){let n=t==="desc"?-1:1;return(r,o)=>{let i=String(r[e]??""),s=String(o[e]??"");return i===s?r.name<o.name?-1:r.name>o.name?1:0:(i<s?-1:1)*n}}function TF(e){let t=[],{summary:n}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Yh;if(e.source.upToDate)t.push(`${$} ${D(e.source.repo)}@${D(e.source.ref)} is still ${mL(e.source.resolvedCommit)} \u2014 all ${n.checked} skill${n.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${Ce} ${n.outdated+n.conflicts} of ${n.checked} skills would change.`:`${$} Updated ${n.updated} skill${n.updated===1?"":"s"}`+(n.blocked>0?`, skipped ${n.blocked}`:"")+(n.failed>0?`, ${n.failed} failed`:"");t.push(o)}let r=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[D(o.dir),o.action,o.detail?D(o.detail):""]);r.length>0&&t.push("",qe(["SKILL","ACTION","DETAIL"],r));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${D(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${D(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
262
+ `)}function mL(e){return e===null?"unknown":e.slice(0,vF)}function Zh(e,t,n={}){let r=i=>D((n.display??Qo)(i)),o=[];o.push(`${n.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${D(i.name)} \u2192 ${D(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(` ${r(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>D(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${r(s.path)} ${D(s.label)} (unlink)`)}return n.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
263
+ `)}function PF(e,t={}){let n=o=>D((t.display??Qo)(o));if(e.skills.length===0)return"No skills removed.";let r=[];r.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=>D(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";r.push(` ${D(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&r.push(` removed empty directories: ${e.removedDirectories.map(o=>n(o)).join(", ")}`);for(let o of e.failures)r.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.lockfileDeleted?r.push(`${Ce} ${n(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&r.push(`${Ce} ${n(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),r.join(`
264
+ `)}q();C();be();Oe();A();M();X();be();A();function gL(e){let t=gl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${ml.join(", ")} found in this directory.`}async function Sd(e,t,n){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(n||u.info(gL(t)),hl(t)):wd(e,t)}function Fs(e){return e==="locally-modified"||e==="unmanaged"}var ni=w(require("fs")),wn=w(require("path"));C();var ey=require("crypto"),_d=w(require("fs"));C();var ti=w(require("fs")),jn=w(require("path"));C();var Qh=2e3,OF=8;async function xd(e){let t=jn.default.resolve(e),n=[],r=[],o=async(i,s)=>{if(s>qo)throw new f(`Skill directory ${D(t)} nests deeper than ${qo} levels at ${D(i)}. Refusing to copy or hash a tree this deep.`);let a=await ti.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=jn.default.join(i,l.name);if(Ue(t,c,"a skill file"),l.isSymbolicLink()){r.push($F(t,c));continue}if(l.isDirectory()){if(Jo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||zo.has(l.name))continue;let p=await ti.default.promises.lstat(c);if(n.length>=Qh)throw new f(`Skill directory ${D(t)} contains more than ${Qh} files. Refusing to copy or hash it.`);let d=$F(t,c);n.push({rel:d,key:d.normalize("NFC"),abs:c,mode:p.mode&511,size:p.size})}};return await o(t,1),n.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),r.sort(),{files:n,symlinks:r}}function Cd(e,t){let[n]=t.symlinks;if(n!==void 0)throw new f(`Skill directory ${D(e)} contains a symbolic link ("${D(n)}"); skill files must be regular files. If this came from ${he}, please report it.`)}async function Fd(e,t){let n=jn.default.resolve(e),r=jn.default.resolve(t),o=await xd(n);Cd(n,o),await ti.default.promises.mkdir(r,{recursive:!0});let i=new Set;for(let a of o.files){let l=jn.default.dirname(jn.default.join(r,...a.rel.split("/")));l!==r&&i.add(l)}for(let a of[...i].sort())Ue(r,a,"a skill destination directory"),await ti.default.promises.mkdir(a,{recursive:!0});let s=0;return await hL(o.files,OF,async a=>{let l=jn.default.join(r,...a.rel.split("/"));Ue(r,l,"a skill destination file"),await ti.default.promises.copyFile(a.abs,l),await ti.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function $F(e,t){return jn.default.relative(e,t).split(jn.default.sep).join("/")}async function hL(e,t,n){let r=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;r<e.length;){let i=e[r++];if(i===void 0)return;await n(i)}});await Promise.all(o)}var NF=1024*1024,jF=4294967295,ty=Buffer.from([0]);async function Ad(e){let t=await xd(e);Cd(e,t);let n=(0,ey.createHash)("sha256"),r=(0,ey.createHash)("sha256"),o=0;for(let i of t.files)await yL(n,i),wL(r,i),o+=i.size;return{contentHash:`sha256:${n.digest("hex")}`,modeHash:`sha256:${r.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function tn(e){try{return await Ad(e)}catch(t){if(kL(t))return null;throw t}}function jt(e,t,n=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:n==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function yL(e,t){if(t.size<=NF){let o=await _d.default.promises.readFile(t.abs);return LF(e,t,o.length),e.update(o),o.length}let n=await bL(t.abs);LF(e,t,n);let r=await DL(e,t.abs,n);if(r!==n)throw new f(`${D(t.abs)} changed while it was being hashed (${n} bytes, then ${r}). Re-run the command.`);return r}function LF(e,t,n){if(n>jF)throw new f(`${D(t.abs)} is ${n} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(ty);let r=Buffer.alloc(4);r.writeUInt32BE(n,0),e.update(r)}function wL(e,t){e.update(t.key,"utf8"),e.update(ty),e.update((t.mode&73)!==0?"x":"-"),e.update(ty)}async function bL(e){let t=0;for await(let n of _d.default.createReadStream(e))t+=n.length;return t}async function DL(e,t,n){let r=0;for await(let o of _d.default.createReadStream(t)){let i=o;if(r+=i.length,r>n)return e.update(i.subarray(0,i.length-(r-n))),r;e.update(i)}return r}function kL(e){return qr(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:qr(e.cause)==="ENOENT"}function qr(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var UF=require("crypto"),Ie=w(require("fs")),Ee=w(require("path"));C();A();var EL=/\.[0-9a-f]{6}\.tmp$/,WF=3600*1e3;async function ry(e,t=n=>n){let n=Ee.default.join(e,hd);for(let r of[n,Ee.default.join(n,yd)]){if(await HF(r)==="other")throw new f(`${D(t(r))} 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 Rd(e,r))throw new f(`${D(t(r))} resolves outside ${D(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 Rd(e,t){if(!rt(e,t)||await oy(e,t)!==void 0)return!0;try{await Ie.default.promises.lstat(t)}catch{return!1}return!await Zu(e,t)}async function oy(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await Ie.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await Zu(n,i))return i}}async function Id(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await HF(i);if(a==="absent")return;if(a==="other")return i}}async function kl(e,t={}){if(t.dryRun)return[];let n=t.maxAgeMs??WF,r=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(!EL.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Ue(e,a,"a stale staging directory");let l=await Ie.default.promises.lstat(a);if(r-l.mtimeMs<n)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 Td(e){let{storeDir:t,slug:n,root:r,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)!==n)return p(`Refusing to write ${D(l)}: its final component is not "${D(n)}".`);let d=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${D(l)} for ${D(s)}: ${y}`});if(!rt(r,l))return d(`it resolves outside ${D(r)}.`);let m=await oy(r,l);if(m!==void 0)return d(`${D(m)} is a symbolic link that leaves ${D(r)}.`);let h=await Id(r,l);if(h!==void 0)return p(`${D(h)} 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 g=await xL(l,t);if(g&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!g){let[y,b]=await Promise.all([mn(t),mn(l)]);if(Ye(y,b))return{...c,success:!0,link:"canonical"};if(Ye(await BF(t),await BF(l)))return{...c,success:!0,link:"canonical"};if(await fh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await MF(t,l,n),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:qr(y),error:ny(y)}}try{if(await CL(l,n),await Ie.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await Ie.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await mn(Ee.default.dirname(l));await Ie.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let b=qr(y);try{return await MF(t,l,n),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:b}}catch(S){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:qr(S)??b,error:ny(S)}}}}async function El(e,t,n={}){if(Ue(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new f(`Refusing to write ${D(t.storePath)}: its final component is not "${D(t.dir)}". Please report this.`);let r={name:t.name,dir:t.dir,storePath:t.storePath};if(Fs(t.storeOverwrite)&&!e.force)return{...r,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 fh(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 vL(t),i="written")}catch(l){return{...r,storeAction:"failed",hashes:null,targets:[],success:!1,error:ny(l)}}let a=[];for(let l of t.targets)a.push(await SL(e,t,l,n));return{...r,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function vL(e){await Ie.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=sy(e.storePath);try{await Fd(e.sourceDir,t),await iy(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 Ad(e.storePath)}async function SL(e,t,n,r){let o={agent:n.agent,label:n.label,path:n.path,canonicalPath:t.storePath,requestedMode:e.mode};return n.link==="canonical"?{...o,success:!0,link:"canonical"}:n.skipped?{...o,success:!0,link:n.link,skipped:!0,skipReason:n.skipReason,error:void 0}:n.blocked?{...o,success:!1,link:n.link,error:n.detail}:Td({storeDir:t.storePath,linkPath:n.path,slug:t.dir,root:e.root,mode:e.mode,agent:n.agent,label:n.label,platform:r.platform})}async function MF(e,t,n){await Ie.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let r=sy(t);try{await Fd(e,r),await iy(t,n),await Ie.default.promises.rename(r,t)}finally{await Ie.default.promises.rm(r,{recursive:!0,force:!0}).catch(()=>{})}}async function xL(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch{return!1}if(!n.isSymbolicLink())return!1;let r=await Ie.default.promises.readlink(e).catch(()=>null);if(r===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),r);if(Ye(o,t))return!0;let[i,s]=await Promise.all([mn(o),mn(t)]);return Ye(i,s)}async function CL(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch(r){qr(r)==="ELOOP"&&await Ie.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(n.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await iy(e,t)}async function iy(e,t){if(Ee.default.basename(e)!==t)throw new f(`Refusing to delete ${D(e)}: its final component is not "${D(t)}". Please report this.`);let n;try{n=await Ie.default.promises.lstat(e)}catch{return}if(n.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await Ie.default.promises.rm(e,{recursive:!0,force:!0})}function sy(e){return`${e}.${(0,UF.randomBytes)(3).toString("hex")}.tmp`}async function BF(e){let t=Ee.default.resolve(e),n=await mn(Ee.default.dirname(t));return Ee.default.join(n,Ee.default.basename(t))}async function HF(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 ny(e){let t=e instanceof Error?e.message:String(e);return D(t)}var FL=["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 vl(e){let t=e.platform??process.platform,n=e.display??(c=>c),r=wn.default.resolve(e.root),o=it(e.scope,r),i=e.recorded??{},s=new Set(e.warnings??[]);await ry(r,n);let a=await AL({targets:e.targets,scope:e.scope,root:r,storeBase:o,display:n,warn:c=>s.add(c)});for(let c of await PL({groups:a,skills:e.skills,display:n}))s.add(c);let l=[];for(let c of e.skills)l.push(await TL({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:n}));return{scope:e.scope,root:r,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function AL(e){let{targets:t,scope:n,root:r,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=Nt(c.agent,n,r);if(p===null){s(`${D(c.agent.displayName)} does not support ${n} installation and was skipped.`);continue}let d=a.get(p);d?(d.agents.push(c.agent),d.explicit=d.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let d=p.agents.slice().sort((g,y)=>g.id<y.id?-1:g.id>y.id?1:0);if(Ye(c,o)){l.push({dir:c,agents:d,canonical:!0});continue}if(await Rd(r,c)){let g=Pd(c),y=`${D(i(c))} resolves outside ${D(i(r))}`+(g?` (check $${g})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:d,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await Id(r,c);if(m!==void 0){let g=`${D(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(g),l.push({dir:c,agents:d,canonical:!1,skipReason:"path-conflict",detail:g});continue}if(!(p.explicit||await IL(p.agents,n,r,c))){l.push({dir:c,agents:d,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${D(i(o))}`});continue}l.push({dir:c,agents:d,canonical:!1})}return l}function RL(e,t,n,r){if(t==="global")return wn.default.dirname(r);let[o]=e.skillsDir.split(/[\\/]/);return wn.default.join(n,o??e.skillsDir)}async function IL(e,t,n,r){for(let o of e)if(await $L(RL(o,t,n,r)))return!0;return!1}async function TL(e){let{discovered:t,groups:n,storeBase:r,mode:o,force:i,platform:s,display:a}=e,l=wn.default.join(r,t.dir),c=await OL(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,d=e.recorded!==null&&p===null,m=await GF({dest:l,storePath:l,recorded:p,recordedUnverifiable:d,upstream:c,platform:s}),h=[];for(let S of n){let _=S.canonical?l:wn.default.join(S.dir,t.dir),v=S.canonical?"canonical":o;if(S.canonical||S.skipReason!==void 0){h.push({agent:KF(S),agents:S.agents.map(H=>H.id),label:JF(S),path:_,link:v,overwrite:S.canonical?m.overwrite:"fresh",blocked:S.canonical?m.blocked:!1,skipped:!S.canonical,...S.skipReason!==void 0?{skipReason:S.skipReason}:{},...S.detail!==void 0?{detail:S.detail}:{}});continue}let x=await GF({dest:_,storePath:l,recorded:p,recordedUnverifiable:d,upstream:c,platform:s}),O=Fs(x.overwrite)&&!i;h.push({agent:KF(S),agents:S.agents.map(H=>H.id),label:JF(S),path:_,link:v,overwrite:x.overwrite,blocked:O,skipped:!1,...O?{detail:VF(x,_,a)}:{}})}let g=Fs(m.overwrite)&&!i,y=h.find(S=>S.blocked),b=g?VF(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:h,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:p,blocked:g||y!==void 0,...b!==void 0?{detail:b}:{}}}function VF(e,t,n){return e.problem===void 0?qF(e.overwrite,t,n):`${D(n(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 GF(e){let{dest:t,storePath:n,recorded:r,upstream:o,platform:i}=e,s=(c,p,d)=>({overwrite:c,upToDate:p,onDisk:d,blocked:!1}),a;try{a=await ni.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ni.default.promises.readlink(t).catch(()=>null),p=c===null?null:wn.default.resolve(wn.default.dirname(t),c);return p!==null&&Ye(p,n)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await tn(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:D(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(r===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(r!==null)return jt(l,r,i)?s("managed-update",jt(l,o,i),l):s("locally-modified",!1,l);if(jt(l,o,i)){let c=await zF(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 "${D(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function zF(e,t="",n=0){if(n>qo)return;let r;try{r=await ni.default.promises.readdir(e,{withFileTypes:!0})}catch{return}r.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of r){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(Jo.has(o.name))return i;let s=await zF(wn.default.join(e,o.name),i,n+1);if(s!==void 0)return s;continue}if(!o.isFile()||zo.has(o.name))return i}}function qF(e,t,n=r=>r){let r=D(n(t));return e==="locally-modified"?`${r} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${r} 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 PL(e){let{groups:t,skills:n,display:r}=e,o=new Map(n.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 ni.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=wn.default.join(s.dir,c.name,Ot),d;try{d=Xo(await ni.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(d);m===void 0||m===c.name||i.push(`${D(r(s.dir))} already contains "${D(c.name)}", whose ${Ot} declares the name "${D(d)}" \u2014 the same skill this install writes to "${D(m)}". Your agent would load it twice; remove one of them.`)}}return i}function Pd(e){let t=wn.default.resolve(e);for(let n of FL){let r=process.env[n]?.trim();if(r&&rt(r,t))return n}}function KF(e){return e.agents[0]?.id??""}function JF(e){let t=e.agents.map(n=>n.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function $L(e){try{return await ni.default.promises.lstat(e),!0}catch{return!1}}async function OL(e){let t=await tn(e);if(t!==null)return t;throw new f(`The extracted skill directory ${D(e)} is no longer present. Re-run the command.`)}var Mt=1,e_=/^sha256:[0-9a-f]{64}$/,ay=128,ly=1024,XF=256,LL=/[\x00-\x1f\x7f]/;function t_(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>ay?`must be at most ${ay} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":fs(e)}function $d(e){return e.trim()===""?"must not be empty":e.length>ly?`must be at most ${ly} characters`:fs(e)}function YF(e){return(t,n)=>{let r=e(t);r!==null&&n.addIssue({code:j.ZodIssueCode.custom,message:r})}}var n_=j.string().regex(Zt,"must be a 40-character lowercase commit SHA"),r_=j.string().regex(td,"is not a usable git ref for this repository"),ZF=j.string().regex(e_,'must look like "sha256:<64 lowercase hex>"'),NL=j.string().min(1,"must not be empty").max(pd).refine(e=>e.trim()!=="","must not be blank").refine(e=>!LL.test(e),"must not contain control characters"),QF=j.string().datetime({offset:!0}),o_=j.object({commit:n_,dir:j.string().superRefine(YF(t_)),skillPath:j.string().superRefine(YF($d)).optional(),contentHash:ZF.optional(),modeHash:ZF.optional(),ref:r_.optional(),agents:j.array(j.string().min(1).max(64)).default([]),mode:j.enum(["symlink","copy"]).default("symlink"),category:j.string().min(1).max(64).optional(),installedAt:QF.optional(),updatedAt:QF.optional()}).passthrough(),i_=j.object({repo:j.string().min(1).max(XF).default(he),ref:r_.default(Ge),commit:n_.optional(),pluginVersion:j.string().min(1).max(XF).optional()}).passthrough(),s_=j.object({lockfileVersion:j.number().int().min(0),source:i_.default({}),skills:j.record(NL,o_).default({})}).passthrough();function a_(e){return e.length===0?"the lockfile":e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function cy(e){let[t]=e.issues;return t?`${a_([...t.path])} ${t.message}`:"did not match the expected shape"}function Od(e){return s_.safeParse(e)}var Ld=w(require("path"));nc();C();var l_="webflow-skills-lock.json",c_="skills-lock.json";function ri(e){if(typeof e!="string"||e.trim()==="")throw new f("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return Ld.default.join(Ld.default.resolve(e),l_)}function oi(){return Ld.default.join(tc(),c_)}function Sl(e,t){return e==="global"?oi():ri(t??"")}var d_=w(require("fs"));var jL=/^<{7}/m,ML=/^\uFEFF/;async function Mn(e){let t;try{t=await d_.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:BL(c)}}let n=t.replace(ML,"");if(jL.test(n))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(n.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let r;try{r=JSON.parse(n)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:UL(c,n)}}if(r===null||typeof r!="object"||Array.isArray(r))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${u_(r)}, not an object`};let o=r,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${u_(i)})`};let s=typeof i=="number"?i:0;if(s>Mt){let c=Od(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Mt?{...o,lockfileVersion:Mt}:o,l=Od(a);return l.success?s<Mt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:cy(l.error)}}function BL(e){let t=e.code,n=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]??n} (${t})`:n}function UL(e,t){let n=e instanceof Error?e.message:String(e),r=/position (\d+)/.exec(n);if(!r)return n;let o=Number(r[1]);if(!Number.isFinite(o)||o<0)return n;let i=t.slice(0,o),s=i.split(`
265
265
  `).length,a=o-(i.lastIndexOf(`
266
- `)+1)+1;return`${n.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function WF(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 Dl(e,t){return e<t?-1:e>t?1:0}function Ss(e){return[...new Set(e)].sort(Dl)}function xs(e){return{lockfileVersion:jt,source:{repo:he,ref:Ge,...e},skills:{}}}function wn(e){return Object.keys(e.skills).sort(Dl)}function Ad(e){return Object.keys(e.skills).length===0}function bl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function Yh(e,t){return{...e,skills:{...e.skills,...t}}}function Zh(e,t){return{...e,source:{...e.source,...t}}}function Qh(e,t){let n=[],r=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],n.push(i)):r.push(i);return{lock:{...e,skills:o},removed:n,missing:r}}function kl(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function ey(e){let{installedAt:t,updatedAt:n,...r}=e;return r}var GF=require("crypto"),Cs=w(require("fs")),oy=w(require("path"));_();var VF=w(require("path"));C();function Id(e){return D(VF.default.basename(e))}function ty(e){return D(e)}function ni(e){let t=Id(e.path),n=D(e.detail);if(e.reason==="merge-conflict")return new f(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new f(`Could not read ${t}: ${n}.
267
- ${ty(e.path)}`,{isUserError:!0});let r=e.reason==="invalid-json"?`${t} is not valid JSON: ${n}`:`${t} is not a valid lockfile: ${n}`;return new f(`${r}.
268
- ${ty(e.path)}
269
- 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 ri(e){return new f(`Your ${Id(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${jt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function ny(e,t){return new f(`Refusing to write ${Id(e)}: it is at lockfile version ${t} and this CLI supports ${jt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function ry(e,t){let n=D(t instanceof Error?t.message:String(t));return new f(`Could not write ${Id(e)}: ${n}.
270
- ${ty(e)}
271
- 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 JF=420,KF=448,zF=8;function Rd(e){if(Array.isArray(e))return e.map(Rd);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Dl).map(n=>[n,Rd(t[n])]))}return e}function hL(e,t){let n={};for(let[r,o]of Object.entries(e.skills)){let i={...o,agents:Ss(o.agents??[])};n[r]=t==="project"?ey(i):i}return{...e,skills:n}}function qF(e,t){let n=hL(e,t.kind);return`${JSON.stringify(Rd(n),null,2)}
272
- `}async function XF(e,t,n){if(t.lockfileVersion>jt)throw ny(e,t.lockfileVersion);let r=oy.default.resolve(e),o=oy.default.dirname(r),i=qF(t,n),s=`${r}.${(0,GF.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Cs.default.promises.mkdir(o,{recursive:!0,mode:KF});let l=await Cs.default.promises.open(s,"wx",JF);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Cs.default.promises.rename(s,r),a=!0}catch(l){throw ry(e,l)}finally{a||await Cs.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function iy(e){try{return await Cs.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??zF,n=e.lock,r=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await XF(e.path,n,{kind:e.kind}),r=0,i=!1,o+=1)},a=async()=>{r+=1,i=!0,r>=t&&await s()};return{get lock(){return n},get pendingCount(){return r},get flushCount(){return o},async record(l,c){n=Yh(n,{[l]:c}),await a()},async forget(l){let c=Qh(n,[l]);return n=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){n=Zh(n,l),i=!0},flush:s}}var YF="skills_install";async function Pd(e,t){let n=Date.now(),r=At(),o=r?F.forSkills({authToken:r}):null;try{let i=await yL(e??[],t);await o?.sendUsage(YF,{duration:Date.now()-n,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),YF,{duration:Date.now()-n}),new f(i,{prefix:`${k} Failed to install skills:`,...i instanceof f&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function yL(e,t){let n=t.json===!0||Ye(),r=t.dryRun===!0,o=process.cwd(),i=await hd({global:t.global,project:t.project,yes:t.yes},o,n),s=t.global!==!0&&t.project!==!0,a=i==="global"?ue.home():o,l=fd({cwd:o,home:ue.home()}),c=i==="global"?"global":"project",d=wl(c,a),p=await Nn(d);if(p.kind==="corrupt")throw ni(p);if(p.kind==="too-new")throw ri(p);let m=p.kind==="ok"?p.lock:xs({ref:t.ref??Ge}),h=wn(m),g=e.length===0&&t.allSkills!==!0&&h.length>0&&(V()||t.yes===!0);await gl(it(i,a),{dryRun:r});let y=g?kL(m,h,t.ref):[null],b=[],S=[],A=!1,v=[],x=0,O=0;for(let me of y){let Le=await wL({group:me,names:e,options:t,scope:i,root:a,lock:m,display:l,json:n});Le!==null&&(b.push(Le.plan),A=A||Le.cacheHit,v=Le.agents,x=Math.max(x,Le.detectedCount),O+=Le.duplicateNameWarnings)}if(b.length===0||b.every(me=>me.skills.length===0))return n?u.info(JSON.stringify(gd(_L({plan:b[0]??null,scope:i,root:a,lockPath:d,dryRun:r,restore:g,cacheHit:A,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O});let H=b[0];if(r){let me=e_({plans:b,materialized:[],dryRun:!0,restore:g,cacheHit:A,lockPath:d});if(n)u.info(JSON.stringify(gd(me),null,2));else{for(let Le of b)u.info(Lh(Le,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O})}if(t.yes!==!0&&!V()&&n)throw new f(`Installation requires confirmation, and --json cannot prompt.
273
- Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Le of b)u.info(Lh(Le,{dryRun:!1,display:l}));if(!await Re({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O,cancelled:!0})}let B=oi({path:d,kind:c,lock:m}),ye=new Date().toISOString();for(let me of b)for(let Le of me.skills){let E=await hl(me,Le);S.push(E);let z=FL({plan:me,skill:E,skillPath:Le.skillPath,existing:bl(B.lock,E.name),previousAgents:bl(m,E.name)?.agents??[],restore:g,kind:c,now:ye});z!==null&&await B.record(E.name,z)}B.updateSource({repo:H.source.repo,ref:H.source.ref,commit:H.source.commit,pluginVersion:H.source.pluginVersion}),await B.flush({force:!0});let ve=e_({plans:b,materialized:S,dryRun:!1,restore:g,cacheHit:A,lockPath:d});return n?u.info(JSON.stringify(gd(ve),null,2)):(u.info(rF(ve,{display:l})),u.info(`Wrote ${l(d)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(ve.failures.length>0||ve.summary.blocked>0&&ve.summary.installed===0)&&(process.exitCode=1),Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:S,agents:v,detectedCount:x,duplicateNameWarnings:O})}async function wL(e){let{group:t,names:n,options:r,scope:o,root:i,lock:s,display:a}=e,l=await ms(t===null||t.commit===void 0?{ref:t?.ref??r.ref}:{commit:t.commit,ref:t.ref}),c=await hs(l.root),d=await Ds(c.skillsDir,l.root),p=[...c.warnings,...d.warnings],m=await EL({discovered:d.skills,names:n,allSkills:r.allSkills===!0,restoreNames:t?.names,recordedNames:wn(s),warn:v=>p.push(v)});if(m.length===0)return null;let h=t===null?void 0:Ss(t.names.flatMap(v=>bl(s,v)?.agents??[])),g=await DL({scope:o,root:i,options:r,json:e.json,...h!==void 0&&h.length>0?{recordedAgents:h}:{}});for(let v of g.unknownRecorded)p.push(`The lockfile records the agent "${D(v)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=g.source==="explicit"||g.source==="prompt",b=g.agents.map(v=>({agent:v,explicit:y})),S={repo:he,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},A=await yl({scope:o,root:i,mode:t?.mode??(r.copy===!0?"copy":"symlink"),force:r.force===!0,source:S,skills:m,targets:b,recorded:s.skills,warnings:p,display:a});return{plan:A,cacheHit:l.fromCache,agents:g.agents,detectedCount:g.detected.length,duplicateNameWarnings:bL(A.warnings)}}async function DL(e){let{scope:t,root:n,options:r,json:o}=e,i={scope:t,cwd:n,options:{agent:r.agent,allAgents:r.allAgents,yes:r.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(r.agent?.length??0)>0||r.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await al(t,n);if(a.length===0){let l=sd(Qt);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return pl({...i,detected:a})}return pl(i)}function bL(e){return e.filter(t=>t.includes("would load it twice")).length}function kL(e,t,n){let r=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=n===void 0?`${i.commit}|${i.mode}`:i.mode,l=r.get(a);if(l){l.names.push(o);continue}r.set(a,{...n===void 0?{commit:i.commit}:{},ref:n??s,mode:i.mode,names:[o]})}return[...r.values()]}async function EL(e){let{discovered:t,names:n,allSkills:r,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let d of o){let p=t.find(m=>m.name===d);if(p===void 0){s(`${D(d)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(p)}return c}let a=t.filter(c=>!c.internal);if(r)return a;if(n.length>0)return n.map(c=>vL(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new f(`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 xL(a,l)}function vL(e,t){let n=ar(e,[...t]);if(n.kind==="match")return n.skill;throw n.kind==="ambiguous"?new f(`"${D(e)}" matches more than one skill: ${n.matches.map(r=>D(r.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new f(`No skill matches "${D(e)}".`+(n.candidates.length>0?`
274
- Available: ${n.candidates.map(r=>D(r)).join(", ")}`:""),{isUserError:!0})}var SL=20,ZF=60;async function xL(e,t){let n=new Set(t.map(s=>s.name)),r=[...e].sort((s,a)=>QF(s.category??"",a.category??"")||QF(s.name,a.name)),o=await En({message:"Select skills to install",pageSize:Math.min(SL,Math.max(4,r.length)),choices:r.map(s=>({value:s.name,name:`${D(s.name)} ${CL(D(s.description))}`,checked:n.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 r.filter(s=>i.has(s.name))}function QF(e,t){return e<t?-1:e>t?1:0}function CL(e){return e.length<=ZF?e:`${e.slice(0,ZF-1)}\u2026`}function FL(e){let{plan:t,skill:n,existing:r,restore:o,kind:i,now:s}=e;if(!(n.storeAction==="written"||n.storeAction==="adopted"||n.storeAction==="unchanged")||n.hashes===null)return null;let l=new Map(t.skills.find(p=>p.name===n.name)?.targets.map(p=>[p.path,p.agents])??[]),c=[];for(let p of n.targets)p.skipped===!0||!p.success||c.push(...l.get(p.path)??[p.agent]);o&&c.push(...e.previousAgents);let d={agents:Ss(c),commit:t.source.commit,contentHash:n.hashes.contentHash,modeHash:n.hashes.modeHash,dir:n.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?kl(d,{...r?{existing:r}:{},now:s}):d}function e_(e){let{plans:t,materialized:n,dryRun:r,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(d=>d.skills),warnings:[...new Set(t.flatMap(d=>d.warnings))],blocked:t.flatMap(d=>d.blocked)},c=Oh({plan:l,materialized:n,dryRun:r});return{plan:l,dryRun:r,restored:o,cacheHit:i,materialized:[...n],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(d=>d.source)}:{}}}function _L(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:he,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 Td(e){let t=e.plans[0],n=e.plans.flatMap(i=>i.skills),r={};for(let i of n)r[i.storeOverwrite]=(r[i.storeOverwrite]??0)+1;let o=t?Oh({plan:{...t,skills:n,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:n.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:n.map(i=>i.name),refKind:AL(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:r,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 AL(e){return e===void 0||e===Ge?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}q();C();we();_();M();X();var $d=w(require("fs")),Fs=w(require("path"));var IL=256;async function t_(e){let{scope:t,lock:n}=e,r=Fs.default.resolve(e.root),o=it(t,r),i=e.display??(d=>d),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let d of Object.keys(n.skills).sort()){let p=n.skills[d];c.add(p.dir),l.push(await RL({name:d,entry:p,scope:t,root:r,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await OL({scope:t,root:r,store:o,recordedDirs:c})),{scope:t,root:r,store:o,lockfile:e.lockfile,source:n.source,skills:l,warnings:a}}async function RL(e){let{name:t,entry:n,scope:r,root:o,store:i,platform:s,display:a,warn:l}=e,c=Fs.default.join(i,n.dir),d=PL(n),p=await en(c),m={name:t,dir:n.dir,description:await LL(c),scope:r,status:"up-to-date",mode:n.mode,storePath:c,recordedHash:n.contentHash??null,onDiskHash:p?.contentHash??null,...n.skillPath!==void 0?{skillPath:n.skillPath}:{},...n.commit!==void 0?{commit:n.commit}:{},...n.ref!==void 0?{ref:n.ref}:{},...n.category!==void 0?{category:n.category}:{},agents:[]},h=[],g;for(let y of n.agents){let b=$n(y);if(b===void 0){h.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${D(t)} records the agent "${D(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let S=Lt(b,r,o);if(S===null){h.push({id:y,label:b.displayName,path:null,link:"missing",present:!1});continue}let A=Fs.default.join(S,n.dir);if(qe(A,c)){h.push({id:y,label:b.displayName,path:A,link:"canonical",present:p!==null});continue}let v=await $L(A);if(v==="missing"){h.push({id:y,label:b.displayName,path:A,link:"missing",present:!1}),l(`${D(t)} is recorded for ${D(b.displayName)} but ${D(a(A))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let x=!1;if(n.mode==="copy"&&v==="copy"&&d!==null){let O=await en(A);x=O===null||!Nt(O,d,s),x&&g===void 0&&(g=b.displayName)}h.push({id:y,label:b.displayName,path:A,link:v,present:!0,...x?{diverged:!0}:{}})}return{...m,agents:h,...TL({onDisk:p,recorded:d,platform:s,divergedLabel:g})}}function TL(e){let{onDisk:t,recorded:n,platform:r,divergedLabel:o}=e;return t===null?{status:"missing"}:n!==null&&!Nt(t,n,r)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${D(o)} copy diverges`}:{status:"up-to-date"}}function PL(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function $L(e){try{let t=await $d.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function OL(e){let{scope:t,store:n,recordedDirs:r}=e,o;try{o=await $d.default.promises.readdir(n,{withFileTypes:!0})}catch{return[]}let i=[],s=IL;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()||r.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=Fs.default.join(n,a.name),c=await en(l);if(c===null)continue;let d=await n_(l);d!==null&&Gx(d.name)&&i.push({name:d.name,dir:a.name,description:d.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function LL(e){return(await n_(e))?.description??""}async function n_(e){try{let t=await $d.default.promises.readFile(Fs.default.join(e,$t),"utf8"),n=Ko(t);return{name:n.frontmatter.name,description:n.frontmatter.description}}catch{return null}}var r_="skills_list",NL="name",jL=ut(Yo);async function Od(e){let t=Date.now(),n=At(),r=n?F.forSkills({authToken:n}):null;try{let o=await ML(e);await r?.sendUsage(r_,{duration:Date.now()-t,...o})}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),r_,{duration:Date.now()-t}),new f(o,{prefix:`${k} Failed to list skills:`,...o instanceof f&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function ML(e){let t=e.json===!0||Ye(),n=process.cwd(),r=fd({cwd:n,home:ue.home()}),o=[],i=UL(e.fields,o),s=WL(e.sortBy),a=HL(e.order),l=VL(e.agent),c=BL(e),d=[],p=0;for(let g of c){let y=g==="global"?ue.home():n,b=wl(g==="global"?"global":"project",y),S=await Nn(b),A;if(S.kind==="ok")A=S.lock;else if(S.kind==="too-new")A=S.lock??xs(),o.push(`${r(b)} was written by a newer Webflow CLI (lockfile version ${S.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(S.kind==="corrupt"){o.push(`Skipped ${r(b)} \u2014 ${S.detail}. Fix the file and re-run.`);continue}else A=xs();let v=await t_({scope:g,root:y,lockfile:b,lock:A,display:r});o.push(...v.warnings),p+=v.skills.length,l!==null&&(v.skills=v.skills.filter(x=>x.agents.some(O=>l.has(O.id)))),v.skills.sort(cF(s,a)),d.push(v)}let m=Nh(d);if(t)return u.info(JSON.stringify(lF({inventories:d,warnings:o}),null,2)),sy({inventories:d,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&p>0?`No skills are linked into ${[...l].sort().join(", ")}. ${p} ${p===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${p===1?"it":"them"}.`:jh);for(let g of md(o))u.info(g);return sy({inventories:d,summary:m,fields:i,json:t,agentFilter:l})}let h=[];for(let g of d){if(g.skills.length===0)continue;let y=sF(g.skills,{store:g.store,display:r});h.push([aF(g,{display:r}),"",oF(g.skills,i),...y===""?[]:["",y]].join(`
266
+ `)+1)+1;return`${n.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function u_(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 xl(e,t){return e<t?-1:e>t?1:0}function _s(e){return[...new Set(e)].sort(xl)}function As(e){return{lockfileVersion:Mt,source:{repo:he,ref:Ge,...e},skills:{}}}function bn(e){return Object.keys(e.skills).sort(xl)}function Nd(e){return Object.keys(e.skills).length===0}function Cl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function uy(e,t){return{...e,skills:{...e.skills,...t}}}function dy(e,t){return{...e,source:{...e.source,...t}}}function py(e,t){let n=[],r=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],n.push(i)):r.push(i);return{lock:{...e,skills:o},removed:n,missing:r}}function Fl(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function fy(e){let{installedAt:t,updatedAt:n,...r}=e;return r}var f_=require("crypto"),Rs=w(require("fs")),yy=w(require("path"));A();var p_=w(require("path"));C();function jd(e){return D(p_.default.basename(e))}function my(e){return D(e)}function ii(e){let t=jd(e.path),n=D(e.detail);if(e.reason==="merge-conflict")return new f(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new f(`Could not read ${t}: ${n}.
267
+ ${my(e.path)}`,{isUserError:!0});let r=e.reason==="invalid-json"?`${t} is not valid JSON: ${n}`:`${t} is not a valid lockfile: ${n}`;return new f(`${r}.
268
+ ${my(e.path)}
269
+ 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 si(e){return new f(`Your ${jd(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Mt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function gy(e,t){return new f(`Refusing to write ${jd(e)}: it is at lockfile version ${t} and this CLI supports ${Mt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function hy(e,t){let n=D(t instanceof Error?t.message:String(t));return new f(`Could not write ${jd(e)}: ${n}.
270
+ ${my(e)}
271
+ 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 m_=420,g_=448,h_=8;function Md(e){if(Array.isArray(e))return e.map(Md);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(xl).map(n=>[n,Md(t[n])]))}return e}function WL(e,t){let n={};for(let[r,o]of Object.entries(e.skills)){let i={...o,agents:_s(o.agents??[])};n[r]=t==="project"?fy(i):i}return{...e,skills:n}}function y_(e,t){let n=WL(e,t.kind);return`${JSON.stringify(Md(n),null,2)}
272
+ `}async function w_(e,t,n){if(t.lockfileVersion>Mt)throw gy(e,t.lockfileVersion);let r=yy.default.resolve(e),o=yy.default.dirname(r),i=y_(t,n),s=`${r}.${(0,f_.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Rs.default.promises.mkdir(o,{recursive:!0,mode:g_});let l=await Rs.default.promises.open(s,"wx",m_);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Rs.default.promises.rename(s,r),a=!0}catch(l){throw hy(e,l)}finally{a||await Rs.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function wy(e){try{return await Rs.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 ai(e){let t=e.batchSize??h_,n=e.lock,r=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await w_(e.path,n,{kind:e.kind}),r=0,i=!1,o+=1)},a=async()=>{r+=1,i=!0,r>=t&&await s()};return{get lock(){return n},get pendingCount(){return r},get flushCount(){return o},async record(l,c){n=uy(n,{[l]:c}),await a()},async forget(l){let c=py(n,[l]);return n=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){n=dy(n,l),i=!0},flush:s}}var b_="skills_install";async function Ud(e,t){let n=Date.now(),r=Rt(),o=r?F.forSkills({authToken:r}):null;try{let i=await HL(e??[],t);await o?.sendUsage(b_,{duration:Date.now()-n,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),b_,{duration:Date.now()-n}),new f(i,{prefix:`${k} Failed to install skills:`,...i instanceof f&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function HL(e,t){let n=t.json===!0||et(),r=t.dryRun===!0,o=process.cwd(),i=await Sd({global:t.global,project:t.project,yes:t.yes},o,n),s=t.global!==!0&&t.project!==!0,a=i==="global"?ce.home():o,l=kd({cwd:o,home:ce.home()}),c=i==="global"?"global":"project",p=Sl(c,a),d=await Mn(p);if(d.kind==="corrupt")throw ii(d);if(d.kind==="too-new")throw si(d);let m=d.kind==="ok"?d.lock:As({ref:t.ref??Ge}),h=bn(m),g=e.length===0&&t.allSkills!==!0&&h.length>0&&(V()||t.yes===!0);await kl(it(i,a),{dryRun:r});let y=g?JL(m,h,t.ref):[null],b=[],S=[],_=!1,v=[],x=0,O=0;for(let me of y){let Ne=await VL({group:me,names:e,options:t,scope:i,root:a,lock:m,display:l,json:n});Ne!==null&&(b.push(Ne.plan),_=_||Ne.cacheHit,v=Ne.agents,x=Math.max(x,Ne.detectedCount),O+=Ne.duplicateNameWarnings)}if(b.length===0||b.every(me=>me.skills.length===0))return n?u.info(JSON.stringify(vd(eN({plan:b[0]??null,scope:i,root:a,lockPath:p,dryRun:r,restore:g,cacheHit:_,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O});let H=b[0];if(r){let me=E_({plans:b,materialized:[],dryRun:!0,restore:g,cacheHit:_,lockPath:p});if(n)u.info(JSON.stringify(vd(me),null,2));else{for(let Ne of b)u.info(qh(Ne,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O})}if(t.yes!==!0&&!V()&&n)throw new f(`Installation requires confirmation, and --json cannot prompt.
273
+ Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Ne of b)u.info(qh(Ne,{dryRun:!1,display:l}));if(!await $e({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O,cancelled:!0})}let B=ai({path:p,kind:c,lock:m}),we=new Date().toISOString();for(let me of b)for(let Ne of me.skills){let E=await El(me,Ne);S.push(E);let z=QL({plan:me,skill:E,skillPath:Ne.skillPath,existing:Cl(B.lock,E.name),previousAgents:Cl(m,E.name)?.agents??[],restore:g,kind:c,now:we});z!==null&&await B.record(E.name,z)}B.updateSource({repo:H.source.repo,ref:H.source.ref,commit:H.source.commit,pluginVersion:H.source.pluginVersion}),await B.flush({force:!0});let Se=E_({plans:b,materialized:S,dryRun:!1,restore:g,cacheHit:_,lockPath:p});return n?u.info(JSON.stringify(vd(Se),null,2)):(u.info(xF(Se,{display:l})),u.info(`Wrote ${l(p)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(Se.failures.length>0||Se.summary.blocked>0&&Se.summary.installed===0)&&(process.exitCode=1),Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:S,agents:v,detectedCount:x,duplicateNameWarnings:O})}async function VL(e){let{group:t,names:n,options:r,scope:o,root:i,lock:s,display:a}=e,l=await ws(t===null||t.commit===void 0?{ref:t?.ref??r.ref}:{commit:t.commit,ref:t.ref}),c=await Ds(l.root),p=await vs(c.skillsDir,l.root),d=[...c.warnings,...p.warnings],m=await zL({discovered:p.skills,names:n,allSkills:r.allSkills===!0,restoreNames:t?.names,recordedNames:bn(s),warn:v=>d.push(v)});if(m.length===0)return null;let h=t===null?void 0:_s(t.names.flatMap(v=>Cl(s,v)?.agents??[])),g=await GL({scope:o,root:i,options:r,json:e.json,...h!==void 0&&h.length>0?{recordedAgents:h}:{}});for(let v of g.unknownRecorded)d.push(`The lockfile records the agent "${D(v)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=g.source==="explicit"||g.source==="prompt",b=g.agents.map(v=>({agent:v,explicit:y})),S={repo:he,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},_=await vl({scope:o,root:i,mode:t?.mode??(r.copy===!0?"copy":"symlink"),force:r.force===!0,source:S,skills:m,targets:b,recorded:s.skills,warnings:d,display:a});return{plan:_,cacheHit:l.fromCache,agents:g.agents,detectedCount:g.detected.length,duplicateNameWarnings:KL(_.warnings)}}async function GL(e){let{scope:t,root:n,options:r,json:o}=e,i={scope:t,cwd:n,options:{agent:r.agent,allAgents:r.allAgents,yes:r.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(r.agent?.length??0)>0||r.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await fl(t,n);if(a.length===0){let l=md(en);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return wl({...i,detected:a})}return wl(i)}function KL(e){return e.filter(t=>t.includes("would load it twice")).length}function JL(e,t,n){let r=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=n===void 0?`${i.commit}|${i.mode}`:i.mode,l=r.get(a);if(l){l.names.push(o);continue}r.set(a,{...n===void 0?{commit:i.commit}:{},ref:n??s,mode:i.mode,names:[o]})}return[...r.values()]}async function zL(e){let{discovered:t,names:n,allSkills:r,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let p of o){let d=t.find(m=>m.name===p);if(d===void 0){s(`${D(p)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(d)}return c}let a=t.filter(c=>!c.internal);if(r)return a;if(n.length>0)return n.map(c=>qL(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new f(`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 YL(a,l)}function qL(e,t){let n=cr(e,[...t]);if(n.kind==="match")return n.skill;throw n.kind==="ambiguous"?new f(`"${D(e)}" matches more than one skill: ${n.matches.map(r=>D(r.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new f(`No skill matches "${D(e)}".`+(n.candidates.length>0?`
274
+ Available: ${n.candidates.map(r=>D(r)).join(", ")}`:""),{isUserError:!0})}var XL=20,D_=60;async function YL(e,t){let n=new Set(t.map(s=>s.name)),r=[...e].sort((s,a)=>k_(s.category??"",a.category??"")||k_(s.name,a.name)),o=await vn({message:"Select skills to install",pageSize:Math.min(XL,Math.max(4,r.length)),choices:r.map(s=>({value:s.name,name:`${D(s.name)} ${ZL(D(s.description))}`,checked:n.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 r.filter(s=>i.has(s.name))}function k_(e,t){return e<t?-1:e>t?1:0}function ZL(e){return e.length<=D_?e:`${e.slice(0,D_-1)}\u2026`}function QL(e){let{plan:t,skill:n,existing:r,restore:o,kind:i,now:s}=e;if(!(n.storeAction==="written"||n.storeAction==="adopted"||n.storeAction==="unchanged")||n.hashes===null)return null;let l=new Map(t.skills.find(d=>d.name===n.name)?.targets.map(d=>[d.path,d.agents])??[]),c=[];for(let d of n.targets)d.skipped===!0||!d.success||c.push(...l.get(d.path)??[d.agent]);o&&c.push(...e.previousAgents);let p={agents:_s(c),commit:t.source.commit,contentHash:n.hashes.contentHash,modeHash:n.hashes.modeHash,dir:n.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?Fl(p,{...r?{existing:r}:{},now:s}):p}function E_(e){let{plans:t,materialized:n,dryRun:r,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=zh({plan:l,materialized:n,dryRun:r});return{plan:l,dryRun:r,restored:o,cacheHit:i,materialized:[...n],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(p=>p.source)}:{}}}function eN(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:he,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 Bd(e){let t=e.plans[0],n=e.plans.flatMap(i=>i.skills),r={};for(let i of n)r[i.storeOverwrite]=(r[i.storeOverwrite]??0)+1;let o=t?zh({plan:{...t,skills:n,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:n.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:n.map(i=>i.name),refKind:tN(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:r,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 tN(e){return e===void 0||e===Ge?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}q();C();be();A();M();X();var Wd=w(require("fs")),Is=w(require("path"));var nN=256;async function v_(e){let{scope:t,lock:n}=e,r=Is.default.resolve(e.root),o=it(t,r),i=e.display??(p=>p),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let p of Object.keys(n.skills).sort()){let d=n.skills[p];c.add(d.dir),l.push(await rN({name:p,entry:d,scope:t,root:r,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await aN({scope:t,root:r,store:o,recordedDirs:c})),{scope:t,root:r,store:o,lockfile:e.lockfile,source:n.source,skills:l,warnings:a}}async function rN(e){let{name:t,entry:n,scope:r,root:o,store:i,platform:s,display:a,warn:l}=e,c=Is.default.join(i,n.dir),p=iN(n),d=await tn(c),m={name:t,dir:n.dir,description:await lN(c),scope:r,status:"up-to-date",mode:n.mode,storePath:c,recordedHash:n.contentHash??null,onDiskHash:d?.contentHash??null,...n.skillPath!==void 0?{skillPath:n.skillPath}:{},...n.commit!==void 0?{commit:n.commit}:{},...n.ref!==void 0?{ref:n.ref}:{},...n.category!==void 0?{category:n.category}:{},agents:[]},h=[],g;for(let y of n.agents){let b=Ln(y);if(b===void 0){h.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${D(t)} records the agent "${D(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let S=Nt(b,r,o);if(S===null){h.push({id:y,label:b.displayName,path:null,link:"missing",present:!1});continue}let _=Is.default.join(S,n.dir);if(Ye(_,c)){h.push({id:y,label:b.displayName,path:_,link:"canonical",present:d!==null});continue}let v=await sN(_);if(v==="missing"){h.push({id:y,label:b.displayName,path:_,link:"missing",present:!1}),l(`${D(t)} is recorded for ${D(b.displayName)} but ${D(a(_))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let x=!1;if(n.mode==="copy"&&v==="copy"&&p!==null){let O=await tn(_);x=O===null||!jt(O,p,s),x&&g===void 0&&(g=b.displayName)}h.push({id:y,label:b.displayName,path:_,link:v,present:!0,...x?{diverged:!0}:{}})}return{...m,agents:h,...oN({onDisk:d,recorded:p,platform:s,divergedLabel:g})}}function oN(e){let{onDisk:t,recorded:n,platform:r,divergedLabel:o}=e;return t===null?{status:"missing"}:n!==null&&!jt(t,n,r)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${D(o)} copy diverges`}:{status:"up-to-date"}}function iN(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function sN(e){try{let t=await Wd.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function aN(e){let{scope:t,store:n,recordedDirs:r}=e,o;try{o=await Wd.default.promises.readdir(n,{withFileTypes:!0})}catch{return[]}let i=[],s=nN;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()||r.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=Is.default.join(n,a.name),c=await tn(l);if(c===null)continue;let p=await S_(l);p!==null&&fC(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 lN(e){return(await S_(e))?.description??""}async function S_(e){try{let t=await Wd.default.promises.readFile(Is.default.join(e,Ot),"utf8"),n=Xo(t);return{name:n.frontmatter.name,description:n.frontmatter.description}}catch{return null}}var x_="skills_list",cN="name",uN=ut(ei);async function Hd(e){let t=Date.now(),n=Rt(),r=n?F.forSkills({authToken:n}):null;try{let o=await dN(e);await r?.sendUsage(x_,{duration:Date.now()-t,...o})}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),x_,{duration:Date.now()-t}),new f(o,{prefix:`${k} Failed to list skills:`,...o instanceof f&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function dN(e){let t=e.json===!0||et(),n=process.cwd(),r=kd({cwd:n,home:ce.home()}),o=[],i=fN(e.fields,o),s=mN(e.sortBy),a=gN(e.order),l=hN(e.agent),c=pN(e),p=[],d=0;for(let g of c){let y=g==="global"?ce.home():n,b=Sl(g==="global"?"global":"project",y),S=await Mn(b),_;if(S.kind==="ok")_=S.lock;else if(S.kind==="too-new")_=S.lock??As(),o.push(`${r(b)} was written by a newer Webflow CLI (lockfile version ${S.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(S.kind==="corrupt"){o.push(`Skipped ${r(b)} \u2014 ${S.detail}. Fix the file and re-run.`);continue}else _=As();let v=await v_({scope:g,root:y,lockfile:b,lock:_,display:r});o.push(...v.warnings),d+=v.skills.length,l!==null&&(v.skills=v.skills.filter(x=>x.agents.some(O=>l.has(O.id)))),v.skills.sort(IF(s,a)),p.push(v)}let m=Xh(p);if(t)return u.info(JSON.stringify(RF({inventories:p,warnings:o}),null,2)),by({inventories:p,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&d>0?`No skills are linked into ${[...l].sort().join(", ")}. ${d} ${d===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${d===1?"it":"them"}.`:Yh);for(let g of Ed(o))u.info(g);return by({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}let h=[];for(let g of p){if(g.skills.length===0)continue;let y=_F(g.skills,{store:g.store,display:r});h.push([AF(g,{display:r}),"",CF(g.skills,i),...y===""?[]:["",y]].join(`
275
275
  `))}u.info(h.join(`
276
276
 
277
- `));for(let g of md(o))u.info(g);return sy({inventories:d,summary:m,fields:i,json:t,agentFilter:l})}function BL(e){if(e.global===!0&&e.project===!0)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function UL(e,t){let n=(e??ml).split(",").map(i=>i.trim()).filter(Boolean),{valid:r,invalid:o}=jL(n);if(r.length===0)throw new f(`No valid fields specified. Available: ${Yo.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${Yo.join(", ")}`),r}function WL(e){if(e===void 0||e==="")return NL;let t=Es.find(n=>n===e.trim().toLowerCase());if(t===void 0)throw new f(`Cannot sort by "${e}". Available: ${Es.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function HL(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new f(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function VL(e){let t=bs(e);return t.length===0?null:new Set(ks(t).map(n=>n.id))}function sy(e){let t=new Set;for(let n of e.inventories)for(let r of n.skills)for(let o of r.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(n=>n.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 Ct=w(require("fs")),El=w(require("os")),st=w(require("path"));q();C();we();Te();_();M();X();async function Md(e,t){let n=Date.now(),r=lN();try{let o=t.json===!0||Ye(),i=await GL(e,t,o);await r?.sendUsage("skills_remove",{duration:Date.now()-n,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}),rN(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-n,dryRun:t.dryRun===!0}),o instanceof f?o:new f(o,{prefix:`${k} Failed to remove skills:`})}}async function GL(e,t,n){let r=process.cwd(),o=[],i=t.dryRun===!0,s=await hd(t,r,n),a=s==="global"?El.default.homedir():r,l=it(s,a),c=s==="global"?ti():ei(a),d=await Nn(c);if(d.kind==="corrupt")throw ni(d);if(d.kind==="too-new")throw ri(d);let p=d.kind==="ok"?d.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=bs(t.agent),g=m.length===0||m.includes(dl)?null:ks(m).map(E=>E.id),y=On(s),b=await JL({agents:y,scope:s,root:a,storeBase:l,warnings:o}),S=l_(b.dirNames,p),A=await zL({names:e,options:t,identities:S,scope:s,cwd:r,json:n,warnings:o});if(A.length===0)return a_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p});let v=new Set(g??[...qo,Qt]);if(g?.includes(Qt))for(let E of A){let z=(E.entry?.agents??[]).filter(U=>U!==Qt&&!v.has(U));if(z.length>0)throw new f(`Cannot remove the shared store for "${D(E.name)}" while ${z.map(U=>D(U)).join(", ")} still link to it.
278
- Remove those first, or run \`webflow skills remove ${D(E.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${k} Cannot remove skills:`})}let x=[];for(let E of A)x.push(await XL({identity:E,agents:g===null?y:y.filter(z=>g.includes(z.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:v}));if(i)return{...ay({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p,plans:x}),skills:x.map(E=>sN(E,s)),summary:{requested:x.length,removed:0,storeDeleted:x.filter(E=>E.storeWillBeDeleted).length,storeKept:x.filter(E=>E.onDisk&&!E.storeWillBeDeleted).length,staleLockEntriesRemoved:x.filter(E=>!E.onDisk).length,failed:0},lockfileEmpty:iN(p,x),lockfileDeleted:!1};if(!await nN(x,s,t,n))return n||u.info("Removal cancelled \u2014 no changes made."),a_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p});let O=new Set(b.skillDirs),H=oi({path:c,kind:s,lock:p}),B=[],ye=[],ve=[];for(let E of x){let z=A.find(U=>U.dir===E.dir);ye.push(await ZL({plan:E,identity:z,scope:s,root:a,storeBase:l,knownDirs:O,writer:H,failures:B,removedDirectories:ve}))}await H.flush({force:!0});let me=Ad(H.lock),Le=!1;return me&&s==="global"&&(Le=await iy(c)),{...ay({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p,plans:x}),skills:ye,removedDirectories:ve,failures:B,summary:{requested:x.length,removed:ye.filter(E=>E.success).length,storeDeleted:ye.filter(E=>E.storeAction==="deleted").length,storeKept:ye.filter(E=>E.storeAction==="kept").length,staleLockEntriesRemoved:ye.filter(E=>E.storeAction==="absent"&&E.lockEntry==="removed").length,failed:B.length},lockfileEmpty:me,lockfileDeleted:Le}}async function JL(e){let{agents:t,scope:n,root:r,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...cy(t,n,r,l)]){if(await aN(c)){i.push(`${vl(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 d;try{d=await Ct.default.promises.readdir(c,{withFileTypes:!0})}catch(p){let m=p.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${vl(c)}: ${ly(p)}`);continue}for(let p of d)(p.isDirectory()||p.isSymbolicLink())&&s.add(p.name)}return{dirNames:s,skillDirs:a}}function cy(e,t,n,r){let o=new Set;for(let i of e){try{let a=Lt(i,t,n);if(a!==null){if(rt(n,a))o.add(a);else if(r){let l=xd(a);r(`${vl(a)} resolves outside ${vl(n)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=st.default.resolve(n,...i.skillsDir.split("/"));s.startsWith(st.default.resolve(n)+st.default.sep)&&o.add(s)}return[...o]}function l_(e,t){let n=new Map;for(let r of e)n.set(r,{name:r,dir:r,folderName:r,entry:null});for(let r of wn(t)){let o=t.skills[r];n.set(o.dir,{name:r,dir:o.dir,folderName:o.skillPath?Vr(o.skillPath):o.dir,entry:o})}return[...n.values()]}function Ld(e){return e.entry===null}function KL(e){return new f(`"${D(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
279
- It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${k} Refusing to remove an unmanaged skill directory:`})}async function zL(e){let{names:t,options:n,identities:r,scope:o,cwd:i,json:s,warnings:a}=e,l=n.force===!0,c=r.filter(h=>!Ld(h)),d=r.filter(Ld);if(t.length>0){let h=[];for(let g of t){let y=ar(g,r);if(y.kind==="match"){if(!l&&Ld(y.skill))throw KL(y.skill);h.includes(y.skill)||h.push(y.skill);continue}throw y.kind==="ambiguous"?new f(`"${D(g)}" matches ${y.matches.length} installed skills: ${y.matches.map(b=>D(b.dir)).join(", ")}.
280
- Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot remove skills:`}):await qL(g,y.candidates,o,i)}return h}if(n.all)return l?r:(o_(d,a),c);if(V()||s)throw new f("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${k} Nothing to remove:`});let p=l?r:c;return l||o_(d,a),p.length===0?[]:await En({message:`Which skills should be removed (${o} scope)?`,choices:p.map(h=>({value:h,name:`${D(h.dir)}${Ld(h)?" (not in the lockfile)":""}`})),validate:h=>h.length>0?!0:"Select at least one skill."})??[]}function o_(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(n=>D(n.dir)).join(", ")}. Pass --force to remove them too.`)}async function qL(e,t,n,r){let o=n==="project"?"global":"project",i=o==="global"?El.default.homedir():r,s=o==="global"?ti():ei(i),a=await Nn(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await Ct.default.promises.readdir(it(o,i)).catch(()=>[]);if(ar(e,l_(c,l)).kind!=="none")return new f(`"${D(e)}" is not installed at ${n} scope (${vl(n==="global"?El.default.homedir():r)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${k} Cannot remove skills:`})}}return new f(`"${D(e)}" is not installed at ${n} scope.
281
- `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>D(l)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot remove skills:`})}async function XL(e){let{identity:t,agents:n,scope:r,root:o,storeBase:i,removalTargets:s}=e,a=st.default.join(i,t.dir),l=new Map;for(let m of n)for(let h of cy([m],r,o)){let g=st.default.join(h,t.dir);if(qe(g,a))continue;let y=l.get(g);if(y){y.agents.push(m.id);continue}await jd(g)&&l.set(g,{agent:m.id,agents:[m.id],label:m.displayName,path:g})}let c=[...l.values()].sort((m,h)=>m.path<h.path?-1:m.path>h.path?1:0),{deleted:d,keptBecause:p}=await YL({identity:t,allAgents:e.allAgents,scope:r,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await jd(a),targets:c,storeWillBeDeleted:d,keptBecause:p}}async function YL(e){let{identity:t,removalTargets:n}=e,r=t.entry?.agents??[];if(r.length>0){let i=r.filter(s=>!n.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(!n.has(i.id))for(let s of cy([i],e.scope,e.root)){let a=st.default.join(s,t.dir);if(!qe(a,st.default.join(e.storeBase,t.dir))&&await jd(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function ZL(e){let{plan:t,identity:n,scope:r,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let p of t.targets){let m=await jd(p.path);try{await i_({target:p.path,slug:t.dir,knownDirs:o,root:e.root}),await s_(p.path),a.push({...p,action:m?"unlinked":"absent",error:null})}catch(h){l=!0;let g=ly(h);s.push({name:n.name,agent:p.agent,...Nd(h)!==void 0?{errno:Nd(h)}:{},message:g}),a.push({...p,action:"failed",error:g})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await i_({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await s_(t.storePath),c="deleted"}catch(p){l=!0,c="failed",s.push({name:n.name,...Nd(p)!==void 0?{errno:Nd(p)}:{},message:ly(p)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let d="absent";return!l&&n.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(n.name,{...n.entry,agents:t.keptBecause}),d="updated"):d=await i.forget(n.name)?"removed":"absent"),l||e.removedDirectories.push(...await eN({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:r})),{name:n.name,dir:t.dir,scope:r,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:d,targets:a,success:!l,error:null}}async function i_(e){let{target:t,slug:n,knownDirs:r,root:o}=e;if(st.default.basename(t)!==n)throw new f(`Refusing to delete ${D(t)}: its final component is not "${D(n)}".`);let i=st.default.dirname(t),s;try{s=await Ct.default.promises.realpath(i)}catch{throw new f(`Refusing to delete ${D(t)}: its parent directory ${D(i)} could not be resolved.`)}if(!await QL(r,s))throw new f(`Refusing to delete ${D(t)}: ${D(i)} is not a known skills directory.`);let l=await Ct.default.promises.realpath(o).catch(()=>o);if(qe(s,l))throw new f(`Refusing to delete ${D(t)}: ${D(i)} resolves to the scope root itself, not to a skills directory.`);Be(l,st.default.join(s,st.default.basename(t)),"a skill directory being removed")}async function QL(e,t){for(let n of e){if(qe(n,t))return!0;let r=await Ct.default.promises.realpath(n).catch(()=>null);if(r!==null&&qe(r,t))return!0}return!1}async function s_(e){let t=null;try{t=await Ct.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await Ct.default.promises.rm(e,{force:!0});return}await Ct.default.promises.rm(e,{recursive:!0,force:!0})}async function eN(e){let t=[],n=new Set([e.root,El.default.homedir(),st.default.dirname(e.root)].map(o=>st.default.resolve(o))),r=[];for(let o of e.targets)r.push(st.default.dirname(o.path));e.storeDeleted&&r.push(e.storeBase,st.default.dirname(e.storeBase));for(let o of r){let i=st.default.resolve(o);if(!n.has(i)&&rt(e.root,i))try{let s=await Ct.default.promises.realpath(i);if(n.has(s)||!await tN(e.root,s))continue;await Ct.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function tN(e,t){let n=await Ct.default.promises.realpath(e).catch(()=>e);return rt(n,t)&&!qe(n,t)}async function nN(e,t,n,r){if(n.yes)return!0;if(V()||r)throw new f(`Removal requires confirmation in non-interactive mode.
282
- Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot remove skills:`});return u.info(Mh(e,t)),Re({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function rN(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${re} ${D(n)}`);if(e.dryRun){u.info(Mh(e.skills.map(n=>({name:n.name,dir:n.dir,storePath:n.storePath,onDisk:n.storeAction!=="absent",targets:n.targets,storeWillBeDeleted:n.storeAction==="deleted",keptBecause:n.keptBecause})),e.scope,{dryRun:!0}));return}u.info(dF(e))}function oN(e,t){let n=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&n.add(i)}if(n.size!==1)return null;let[r]=[...n];return r==="copy"?"copy":"symlink"}function ay(e){return{kind:"skills.remove",schemaVersion:Jr,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:oN(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 a_(e){return{...ay(e),lockfileEmpty:Ad(e.lock)}}function iN(e,t){let n=new Set(t.filter(r=>r.keptBecause.length===0).map(r=>r.name));return wn(e).every(r=>n.has(r))}function sN(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(n=>({...n,action:"unlinked",error:null})),success:!0,error:null}}async function aN(e){try{return(await Ct.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function jd(e){try{return await Ct.default.promises.lstat(e),!0}catch{return!1}}function Nd(e){let t=e?.code;return typeof t=="string"?t:void 0}function ly(e){return D(e instanceof Error?e.message:String(e))}function lN(){let e=At();return e?F.forSkills({authToken:e}):null}function vl(e){return Xo(e)}var _s=w(require("fs")),d_=w(require("os")),Dn=w(require("path"));q();C();we();Te();_();M();X();function p_(e){let{presence:t,upstream:n,local:r,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=r==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:r==="absent"||n==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(r==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(r==="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:r==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":r==="differs"?n==="differs"?"conflict":"locally-modified":n==="differs"?"upstream-changed":"unchanged";if(r==="same")return i?{guard:"grid",state:s,action:n==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:n==="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?n==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":n==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?n==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&n==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function Bd(e,t){let n=Date.now(),r=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});let i=TN(),s=t.json===!0||Ye();try{let a=await cN({names:e,options:t,checkOnly:r,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-n,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:r,force:o,scopeCount:a.scopes.length}),IN(a,s),(a.failures.length>0||!r&&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()-n,checkOnly:r,force:o}),a instanceof f?a:new f(a,{prefix:`${k} Failed to update skills:`})}}async function cN(e){let{names:t,options:n,checkOnly:r,force:o,json:i}=e,s=[],a=process.cwd(),l=await uN(n,a,r,s);if(l.length===0)return dy({checkOnly:r,force:o,warnings:s});let c=dN(l,t,n);if(c.length===0)return dy({checkOnly:r,force:o,warnings:s,scopes:l.map(x=>x.scope)});let d=new Map;for(let{state:x,key:O}of c){let H=uy(n,x.lock,O);d.has(H)||d.set(H,(await nl(H)).commit)}let p=new Map;for(let{state:x,key:O}of c){let H=x.lock.skills[O];p.set(`${x.scope}\0${O}`,await gN(x,H))}let m=c.every(({state:x,key:O})=>{let H=x.lock.skills[O];return d.get(uy(n,x.lock,O))===H.commit}),h=c.every(({state:x,key:O})=>p.get(`${x.scope}\0${O}`)!==null);if(m&&h&&n.ref===void 0&&!o)return AN({selected:c,states:l,localDigests:p,refs:d,options:n,checkOnly:r,force:o,warnings:s});let g=new Map;for(let x of new Set(d.values()))g.set(x,await mN(x,s));let y=[],b=[];for(let{state:x,key:O}of c){let H=x.lock.skills[O],B=uy(n,x.lock,O),ye=d.get(B),ve=g.get(ye);try{y.push(await hN({state:x,key:O,entry:H,ref:B,commit:ye,catalog:ve,force:o,checkOnly:r,localDigest:p.get(`${x.scope}\0${O}`)??null,warnings:s}))}catch(me){b.push({name:O,errno:u_(me),message:py(me)})}}let S=y.filter(x=>x.localDrift==="differs"&&x.outcome.willWrite);if(!r&&S.length>0&&!await xN(S,n,i))return dy({checkOnly:r,force:o,warnings:s,scopes:l.map(O=>O.scope),cancelled:!0});let A=new Map,v=[];if(!r)for(let x of l)x.readOnly||await gl(x.storeBase,{dryRun:!1});for(let x of y)try{v.push(await DN({candidate:x,checkOnly:r,force:o,options:n,writers:A,failures:b,warnings:s}))}catch(O){b.push({name:x.key,errno:u_(O),message:py(O)}),v.push(CN(x,py(O)))}if(n.ref!==void 0&&!r)for(let x of l)x.readOnly||f_(x,A);for(let[x,O]of A){let H=l.find(me=>me.scope===x),B=n.ref??H.lock.source.ref??Ge,ye=d.get(B)??y.find(me=>me.scopeState.scope===x)?.commit,ve=y_(g);O.updateSource({ref:B,...ye!==void 0?{commit:ye}:{},...ve!==void 0?{pluginVersion:ve}:{}}),await O.flush({force:!0})}return _N({reports:v,candidates:y,failures:b,states:l,refs:d,catalogs:g,options:n,checkOnly:r,force:o,warnings:s})}async function uN(e,t,n,r){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?d_.default.homedir():t,l=s==="global"?ti():ei(a),c=await Nn(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ni(c);if(c.kind==="too-new"){if(!n||c.lock===null)throw ri(c);r.push(`${xl(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:it(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&r.push(`${xl(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:it(s,a),readOnly:n})}}return i}function dN(e,t,n){if(t.length===0)return e.flatMap(s=>wn(s.lock).map(a=>({state:s,key:a})));let r=n.global===!0||n.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=ar(s,fN(l.lock));if(c.kind==="ambiguous")throw new f(`"${D(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(d=>D(d.name)).join(", ")}.
283
- Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw pN(s,e);if(a.length>1&&!r)throw new f(`"${D(s)}" is installed at more than one scope:
284
- `+a.map(l=>` ${l.state.scope}: ${xl(l.state.lockPath)}`).join(`
277
+ `));for(let g of Ed(o))u.info(g);return by({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}function pN(e){if(e.global===!0&&e.project===!0)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function fN(e,t){let n=(e??Dl).split(",").map(i=>i.trim()).filter(Boolean),{valid:r,invalid:o}=uN(n);if(r.length===0)throw new f(`No valid fields specified. Available: ${ei.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${ei.join(", ")}`),r}function mN(e){if(e===void 0||e==="")return cN;let t=Cs.find(n=>n===e.trim().toLowerCase());if(t===void 0)throw new f(`Cannot sort by "${e}". Available: ${Cs.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function gN(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new f(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function hN(e){let t=Ss(e);return t.length===0?null:new Set(xs(t).map(n=>n.id))}function by(e){let t=new Set;for(let n of e.inventories)for(let r of n.skills)for(let o of r.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(n=>n.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")),_l=w(require("os")),st=w(require("path"));q();C();be();Oe();A();M();X();async function Jd(e,t){let n=Date.now(),r=$N();try{let o=t.json===!0||et(),i=await yN(e,t,o);await r?.sendUsage("skills_remove",{duration:Date.now()-n,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}),AN(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-n,dryRun:t.dryRun===!0}),o instanceof f?o:new f(o,{prefix:`${k} Failed to remove skills:`})}}async function yN(e,t,n){let r=process.cwd(),o=[],i=t.dryRun===!0,s=await Sd(t,r,n),a=s==="global"?_l.default.homedir():r,l=it(s,a),c=s==="global"?oi():ri(a),p=await Mn(c);if(p.kind==="corrupt")throw ii(p);if(p.kind==="too-new")throw si(p);let d=p.kind==="ok"?p.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=Ss(t.agent),g=m.length===0||m.includes(yl)?null:xs(m).map(E=>E.id),y=Nn(s),b=await wN({agents:y,scope:s,root:a,storeBase:l,warnings:o}),S=R_(b.dirNames,d),_=await DN({names:e,options:t,identities:S,scope:s,cwd:r,json:n,warnings:o});if(_.length===0)return A_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d});let v=new Set(g??[...Zo,en]);if(g?.includes(en))for(let E of _){let z=(E.entry?.agents??[]).filter(U=>U!==en&&!v.has(U));if(z.length>0)throw new f(`Cannot remove the shared store for "${D(E.name)}" while ${z.map(U=>D(U)).join(", ")} still link to it.
278
+ Remove those first, or run \`webflow skills remove ${D(E.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${k} Cannot remove skills:`})}let x=[];for(let E of _)x.push(await EN({identity:E,agents:g===null?y:y.filter(z=>g.includes(z.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:v}));if(i)return{...Dy({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d,plans:x}),skills:x.map(E=>TN(E,s)),summary:{requested:x.length,removed:0,storeDeleted:x.filter(E=>E.storeWillBeDeleted).length,storeKept:x.filter(E=>E.onDisk&&!E.storeWillBeDeleted).length,staleLockEntriesRemoved:x.filter(E=>!E.onDisk).length,failed:0},lockfileEmpty:IN(d,x),lockfileDeleted:!1};if(!await _N(x,s,t,n))return n||u.info("Removal cancelled \u2014 no changes made."),A_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d});let O=new Set(b.skillDirs),H=ai({path:c,kind:s,lock:d}),B=[],we=[],Se=[];for(let E of x){let z=_.find(U=>U.dir===E.dir);we.push(await SN({plan:E,identity:z,scope:s,root:a,storeBase:l,knownDirs:O,writer:H,failures:B,removedDirectories:Se}))}await H.flush({force:!0});let me=Nd(H.lock),Ne=!1;return me&&s==="global"&&(Ne=await wy(c)),{...Dy({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d,plans:x}),skills:we,removedDirectories:Se,failures:B,summary:{requested:x.length,removed:we.filter(E=>E.success).length,storeDeleted:we.filter(E=>E.storeAction==="deleted").length,storeKept:we.filter(E=>E.storeAction==="kept").length,staleLockEntriesRemoved:we.filter(E=>E.storeAction==="absent"&&E.lockEntry==="removed").length,failed:B.length},lockfileEmpty:me,lockfileDeleted:Ne}}async function wN(e){let{agents:t,scope:n,root:r,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...Ey(t,n,r,l)]){if(await PN(c)){i.push(`${Al(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(d){let m=d.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${Al(c)}: ${ky(d)}`);continue}for(let d of p)(d.isDirectory()||d.isSymbolicLink())&&s.add(d.name)}return{dirNames:s,skillDirs:a}}function Ey(e,t,n,r){let o=new Set;for(let i of e){try{let a=Nt(i,t,n);if(a!==null){if(rt(n,a))o.add(a);else if(r){let l=Pd(a);r(`${Al(a)} resolves outside ${Al(n)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=st.default.resolve(n,...i.skillsDir.split("/"));s.startsWith(st.default.resolve(n)+st.default.sep)&&o.add(s)}return[...o]}function R_(e,t){let n=new Map;for(let r of e)n.set(r,{name:r,dir:r,folderName:r,entry:null});for(let r of bn(t)){let o=t.skills[r];n.set(o.dir,{name:r,dir:o.dir,folderName:o.skillPath?Kr(o.skillPath):o.dir,entry:o})}return[...n.values()]}function Vd(e){return e.entry===null}function bN(e){return new f(`"${D(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
279
+ It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${k} Refusing to remove an unmanaged skill directory:`})}async function DN(e){let{names:t,options:n,identities:r,scope:o,cwd:i,json:s,warnings:a}=e,l=n.force===!0,c=r.filter(h=>!Vd(h)),p=r.filter(Vd);if(t.length>0){let h=[];for(let g of t){let y=cr(g,r);if(y.kind==="match"){if(!l&&Vd(y.skill))throw bN(y.skill);h.includes(y.skill)||h.push(y.skill);continue}throw y.kind==="ambiguous"?new f(`"${D(g)}" matches ${y.matches.length} installed skills: ${y.matches.map(b=>D(b.dir)).join(", ")}.
280
+ Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot remove skills:`}):await kN(g,y.candidates,o,i)}return h}if(n.all)return l?r:(C_(p,a),c);if(V()||s)throw new f("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${k} Nothing to remove:`});let d=l?r:c;return l||C_(p,a),d.length===0?[]:await vn({message:`Which skills should be removed (${o} scope)?`,choices:d.map(h=>({value:h,name:`${D(h.dir)}${Vd(h)?" (not in the lockfile)":""}`})),validate:h=>h.length>0?!0:"Select at least one skill."})??[]}function C_(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(n=>D(n.dir)).join(", ")}. Pass --force to remove them too.`)}async function kN(e,t,n,r){let o=n==="project"?"global":"project",i=o==="global"?_l.default.homedir():r,s=o==="global"?oi():ri(i),a=await Mn(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(it(o,i)).catch(()=>[]);if(cr(e,R_(c,l)).kind!=="none")return new f(`"${D(e)}" is not installed at ${n} scope (${Al(n==="global"?_l.default.homedir():r)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${k} Cannot remove skills:`})}}return new f(`"${D(e)}" is not installed at ${n} scope.
281
+ `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>D(l)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot remove skills:`})}async function EN(e){let{identity:t,agents:n,scope:r,root:o,storeBase:i,removalTargets:s}=e,a=st.default.join(i,t.dir),l=new Map;for(let m of n)for(let h of Ey([m],r,o)){let g=st.default.join(h,t.dir);if(Ye(g,a))continue;let y=l.get(g);if(y){y.agents.push(m.id);continue}await Kd(g)&&l.set(g,{agent:m.id,agents:[m.id],label:m.displayName,path:g})}let c=[...l.values()].sort((m,h)=>m.path<h.path?-1:m.path>h.path?1:0),{deleted:p,keptBecause:d}=await vN({identity:t,allAgents:e.allAgents,scope:r,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await Kd(a),targets:c,storeWillBeDeleted:p,keptBecause:d}}async function vN(e){let{identity:t,removalTargets:n}=e,r=t.entry?.agents??[];if(r.length>0){let i=r.filter(s=>!n.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(!n.has(i.id))for(let s of Ey([i],e.scope,e.root)){let a=st.default.join(s,t.dir);if(!Ye(a,st.default.join(e.storeBase,t.dir))&&await Kd(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function SN(e){let{plan:t,identity:n,scope:r,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let d of t.targets){let m=await Kd(d.path);try{await F_({target:d.path,slug:t.dir,knownDirs:o,root:e.root}),await __(d.path),a.push({...d,action:m?"unlinked":"absent",error:null})}catch(h){l=!0;let g=ky(h);s.push({name:n.name,agent:d.agent,...Gd(h)!==void 0?{errno:Gd(h)}:{},message:g}),a.push({...d,action:"failed",error:g})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await F_({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await __(t.storePath),c="deleted"}catch(d){l=!0,c="failed",s.push({name:n.name,...Gd(d)!==void 0?{errno:Gd(d)}:{},message:ky(d)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let p="absent";return!l&&n.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(n.name,{...n.entry,agents:t.keptBecause}),p="updated"):p=await i.forget(n.name)?"removed":"absent"),l||e.removedDirectories.push(...await CN({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:r})),{name:n.name,dir:t.dir,scope:r,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:p,targets:a,success:!l,error:null}}async function F_(e){let{target:t,slug:n,knownDirs:r,root:o}=e;if(st.default.basename(t)!==n)throw new f(`Refusing to delete ${D(t)}: its final component is not "${D(n)}".`);let i=st.default.dirname(t),s;try{s=await Ft.default.promises.realpath(i)}catch{throw new f(`Refusing to delete ${D(t)}: its parent directory ${D(i)} could not be resolved.`)}if(!await xN(r,s))throw new f(`Refusing to delete ${D(t)}: ${D(i)} is not a known skills directory.`);let l=await Ft.default.promises.realpath(o).catch(()=>o);if(Ye(s,l))throw new f(`Refusing to delete ${D(t)}: ${D(i)} resolves to the scope root itself, not to a skills directory.`);Ue(l,st.default.join(s,st.default.basename(t)),"a skill directory being removed")}async function xN(e,t){for(let n of e){if(Ye(n,t))return!0;let r=await Ft.default.promises.realpath(n).catch(()=>null);if(r!==null&&Ye(r,t))return!0}return!1}async function __(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 CN(e){let t=[],n=new Set([e.root,_l.default.homedir(),st.default.dirname(e.root)].map(o=>st.default.resolve(o))),r=[];for(let o of e.targets)r.push(st.default.dirname(o.path));e.storeDeleted&&r.push(e.storeBase,st.default.dirname(e.storeBase));for(let o of r){let i=st.default.resolve(o);if(!n.has(i)&&rt(e.root,i))try{let s=await Ft.default.promises.realpath(i);if(n.has(s)||!await FN(e.root,s))continue;await Ft.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function FN(e,t){let n=await Ft.default.promises.realpath(e).catch(()=>e);return rt(n,t)&&!Ye(n,t)}async function _N(e,t,n,r){if(n.yes)return!0;if(V()||r)throw new f(`Removal requires confirmation in non-interactive mode.
282
+ Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot remove skills:`});return u.info(Zh(e,t)),$e({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function AN(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${re} ${D(n)}`);if(e.dryRun){u.info(Zh(e.skills.map(n=>({name:n.name,dir:n.dir,storePath:n.storePath,onDisk:n.storeAction!=="absent",targets:n.targets,storeWillBeDeleted:n.storeAction==="deleted",keptBecause:n.keptBecause})),e.scope,{dryRun:!0}));return}u.info(PF(e))}function RN(e,t){let n=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&n.add(i)}if(n.size!==1)return null;let[r]=[...n];return r==="copy"?"copy":"symlink"}function Dy(e){return{kind:"skills.remove",schemaVersion:zr,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:RN(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 A_(e){return{...Dy(e),lockfileEmpty:Nd(e.lock)}}function IN(e,t){let n=new Set(t.filter(r=>r.keptBecause.length===0).map(r=>r.name));return bn(e).every(r=>n.has(r))}function TN(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(n=>({...n,action:"unlinked",error:null})),success:!0,error:null}}async function PN(e){try{return(await Ft.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function Kd(e){try{return await Ft.default.promises.lstat(e),!0}catch{return!1}}function Gd(e){let t=e?.code;return typeof t=="string"?t:void 0}function ky(e){return D(e instanceof Error?e.message:String(e))}function $N(){let e=Rt();return e?F.forSkills({authToken:e}):null}function Al(e){return Qo(e)}var Ts=w(require("fs")),P_=w(require("os")),Dn=w(require("path"));q();C();be();Oe();A();M();X();function $_(e){let{presence:t,upstream:n,local:r,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=r==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:r==="absent"||n==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(r==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(r==="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:r==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":r==="differs"?n==="differs"?"conflict":"locally-modified":n==="differs"?"upstream-changed":"unchanged";if(r==="same")return i?{guard:"grid",state:s,action:n==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:n==="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?n==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":n==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?n==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&n==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function zd(e,t){let n=Date.now(),r=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});let i=oj(),s=t.json===!0||et();try{let a=await ON({names:e,options:t,checkOnly:r,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-n,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:r,force:o,scopeCount:a.scopes.length}),nj(a,s),(a.failures.length>0||!r&&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()-n,checkOnly:r,force:o}),a instanceof f?a:new f(a,{prefix:`${k} Failed to update skills:`})}}async function ON(e){let{names:t,options:n,checkOnly:r,force:o,json:i}=e,s=[],a=process.cwd(),l=await LN(n,a,r,s);if(l.length===0)return Sy({checkOnly:r,force:o,warnings:s});let c=NN(l,t,n);if(c.length===0)return Sy({checkOnly:r,force:o,warnings:s,scopes:l.map(x=>x.scope)});let p=new Map;for(let{state:x,key:O}of c){let H=vy(n,x.lock,O);p.has(H)||p.set(H,(await ll(H)).commit)}let d=new Map;for(let{state:x,key:O}of c){let H=x.lock.skills[O];d.set(`${x.scope}\0${O}`,await UN(x,H))}let m=c.every(({state:x,key:O})=>{let H=x.lock.skills[O];return p.get(vy(n,x.lock,O))===H.commit}),h=c.every(({state:x,key:O})=>d.get(`${x.scope}\0${O}`)!==null);if(m&&h&&n.ref===void 0&&!o)return tj({selected:c,states:l,localDigests:d,refs:p,options:n,checkOnly:r,force:o,warnings:s});let g=new Map;for(let x of new Set(p.values()))g.set(x,await BN(x,s));let y=[],b=[];for(let{state:x,key:O}of c){let H=x.lock.skills[O],B=vy(n,x.lock,O),we=p.get(B),Se=g.get(we);try{y.push(await WN({state:x,key:O,entry:H,ref:B,commit:we,catalog:Se,force:o,checkOnly:r,localDigest:d.get(`${x.scope}\0${O}`)??null,warnings:s}))}catch(me){b.push({name:O,errno:T_(me),message:xy(me)})}}let S=y.filter(x=>x.localDrift==="differs"&&x.outcome.willWrite);if(!r&&S.length>0&&!await YN(S,n,i))return Sy({checkOnly:r,force:o,warnings:s,scopes:l.map(O=>O.scope),cancelled:!0});let _=new Map,v=[];if(!r)for(let x of l)x.readOnly||await kl(x.storeBase,{dryRun:!1});for(let x of y)try{v.push(await GN({candidate:x,checkOnly:r,force:o,options:n,writers:_,failures:b,warnings:s}))}catch(O){b.push({name:x.key,errno:T_(O),message:xy(O)}),v.push(ZN(x,xy(O)))}if(n.ref!==void 0&&!r)for(let x of l)x.readOnly||O_(x,_);for(let[x,O]of _){let H=l.find(me=>me.scope===x),B=n.ref??H.lock.source.ref??Ge,we=p.get(B)??y.find(me=>me.scopeState.scope===x)?.commit,Se=M_(g);O.updateSource({ref:B,...we!==void 0?{commit:we}:{},...Se!==void 0?{pluginVersion:Se}:{}}),await O.flush({force:!0})}return ej({reports:v,candidates:y,failures:b,states:l,refs:p,catalogs:g,options:n,checkOnly:r,force:o,warnings:s})}async function LN(e,t,n,r){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?P_.default.homedir():t,l=s==="global"?oi():ri(a),c=await Mn(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ii(c);if(c.kind==="too-new"){if(!n||c.lock===null)throw si(c);r.push(`${Il(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:it(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&r.push(`${Il(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:it(s,a),readOnly:n})}}return i}function NN(e,t,n){if(t.length===0)return e.flatMap(s=>bn(s.lock).map(a=>({state:s,key:a})));let r=n.global===!0||n.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=cr(s,MN(l.lock));if(c.kind==="ambiguous")throw new f(`"${D(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(p=>D(p.name)).join(", ")}.
283
+ Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw jN(s,e);if(a.length>1&&!r)throw new f(`"${D(s)}" is installed at more than one scope:
284
+ `+a.map(l=>` ${l.state.scope}: ${Il(l.state.lockPath)}`).join(`
285
285
  `)+`
286
- Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${k} 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 pN(e,t){let n=t.flatMap(r=>wn(r.lock).map(o=>r.lock.skills[o]?.dir??o));return new f(`"${D(e)}" is not installed.
287
- `+(n.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(n)].sort().map(r=>D(r)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot update skills:`})}function fN(e){return wn(e).map(t=>{let n=e.skills[t];return{name:t,dir:n.dir,folderName:n.skillPath?Vr(n.skillPath):n.dir}})}function uy(e,t,n){return e.ref??t.skills[n]?.ref??t.source.ref??Ge}async function mN(e,t){let n=await ms({commit:e}),r=await hs(n.root),o=await Ds(r.skillsDir,n.root);return t.push(...r.warnings,...o.warnings),{commit:e,root:n.root,pluginVersion:r.version,skills:o.skills}}async function gN(e,t){let n=Dn.default.join(e.storeBase,t.dir),r=await en(n);if(r===null)return null;if(t.mode!=="copy")return r;let o=my(t);if(o===null)return r;for(let i of RN(t)){let s=Lt(i,e.scope,e.root);if(s===null)continue;let a=await en(Dn.default.join(s,t.dir));if(a!==null&&!Nt(a,o))return a}return r}async function hN(e){let{state:t,key:n,entry:r,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=my(r),d=Dn.default.join(t.storeBase,r.dir),p=yN(r,s,l,n),m=s.skills.find(ye=>ye.name===n)??null,h=p!==null?"exists":m!==null?"moved":"missing",g=h==="exists"?p:h==="moved"?m.path:null,y=g===null?null:await en(g),b=e.localDigest===null?"absent":c===null||Nt(e.localDigest,c)?"same":"differs",S=Nt(y,c)?"same":"differs",A=p_({hasSkillPath:typeof r.skillPath=="string"&&r.skillPath!=="",foundByName:m!==null,presence:h,upstream:S,local:b,force:a}),v=h==="moved"&&m!==null?m.dir:r.dir,x=h==="exists"?r.skillPath:h==="moved"?m.skillPath:r.skillPath??null,{agents:O,dropped:H}=wN(t,r,l),B=g===null||x===null?null:{name:n,dir:v,folderName:Vr(x),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:g,skillPath:x,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:n,entry:r,dir:r.dir,newDir:v,storeDir:d,mode:r.mode,agents:O,droppedAgents:H,presence:h,upstreamDrift:S,localDrift:b,outcome:A,recorded:c,onDisk:e.localDigest,upstream:y,discovered:B,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:FN(A,{key:n,storeDir:d,recordedSkillPath:r.skillPath??null,newSkillPath:x,checkOnly:e.checkOnly})}}function yN(e,t,n,r){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Cd(o);if(i!==null)return n.push(`The recorded path for "${D(r)}" ${i}; locating it by name instead.`),null;let s=Dn.default.resolve(t.root,...o.split("/"));return Be(t.root,s,"the recorded skill path"),_s.default.existsSync(s)?Dn.default.dirname(s):null}function wN(e,t,n){let r=[],o=[];for(let i of t.agents??[]){if(i===Qt){r.push(i);continue}let s=$n(i);if(s===void 0){r.push(i);continue}if(Lt(s,e.scope,e.root)===null){o.push(i),n.push(`${D(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}r.push(i)}return{agents:r,dropped:o}}async function DN(e){let{candidate:t,checkOnly:n,force:r,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Sl(t,n,[]);let l=await bN(t,r),c=new Set(t.droppedAgents);for(let g of l.targets)if(g.skipReason==="agent-dir-absent")for(let y of g.agents)c.add(y);e.warnings.push(...l.warnings);let d=t.agents.filter(g=>!c.has(g));if(d.length===0&&d.push(Qt),n)return Sl(t,!0,l.targets.map(g=>fy(g)),[...c]);let p,m=t.onDisk;if(a.willWrite){let g=await hl(l.plan,l.skill);if(p=g.targets.map((y,b)=>m_(y,l.targets[b])),m=g.hashes,!g.success||g.storeAction==="failed"){let y=g.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let b of g.targets)!b.success&&b.error&&s.push({name:t.key,agent:b.agent,...b.errno!==void 0?{errno:b.errno}:{},message:b.error});return{...Sl(t,!1,p,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await EN(t,l.targets)}else{p=[];for(let g of l.targets)p.push(await kN(t,g))}let h=d.length!==(t.entry.agents??[]).length||d.some((g,y)=>(t.entry.agents??[])[y]!==g);return vN(t,a,h,o)&&!t.scopeState.readOnly&&await f_(t.scopeState,i).record(t.key,SN(t,m,a,o,d)),Sl(t,!1,p,[...c])}async function bN(e,t){let n={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},r=[];for(let s of e.agents){if(s===Qt)continue;let a=$n(s);a!==void 0&&r.push({agent:a,explicit:!1})}let o=await yl({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:n,skills:[e.discovered],targets:r,recorded:e.scopeState.lock.skills,platform:process.platform,display:xl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function kN(e,t){if(t.skipped||t.link==="canonical")return fy(t);if(t.overwrite!=="fresh")return{...fy(t),action:"unchanged"};let n=await Sd({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...m_(n,t),action:n.success?"relinked":"failed"}}async function EN(e,t){let n=e.dir,r=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>Dn.default.dirname(i.path))];for(let i of new Set(o)){let s=Dn.default.join(i,n);if(Dn.default.basename(s)===n&&s!==Dn.default.join(i,e.newDir))try{let a=await _s.default.promises.realpath(i);if(!rt(r,a))continue;await ls(r,Dn.default.join(a,n),"a renamed skill directory"),(await _s.default.promises.lstat(s)).isSymbolicLink()?await _s.default.promises.rm(s,{force:!0}):await _s.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function vN(e,t,n,r){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||r.ref!==void 0&&r.ref!==e.entry.ref?!0:n}function SN(e,t,n,r,o){let i=n.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}:{},...r.ref!==void 0?{ref:r.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?kl(s,{existing:e.entry,now:new Date().toISOString()}):s}function f_(e,t){let n=t.get(e.scope);if(n)return n;let r=oi({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,r),r}async function xN(e,t,n){if(t.yes)return!0;if(V()||n)throw new f(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
286
+ Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${k} 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 jN(e,t){let n=t.flatMap(r=>bn(r.lock).map(o=>r.lock.skills[o]?.dir??o));return new f(`"${D(e)}" is not installed.
287
+ `+(n.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(n)].sort().map(r=>D(r)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot update skills:`})}function MN(e){return bn(e).map(t=>{let n=e.skills[t];return{name:t,dir:n.dir,folderName:n.skillPath?Kr(n.skillPath):n.dir}})}function vy(e,t,n){return e.ref??t.skills[n]?.ref??t.source.ref??Ge}async function BN(e,t){let n=await ws({commit:e}),r=await Ds(n.root),o=await vs(r.skillsDir,n.root);return t.push(...r.warnings,...o.warnings),{commit:e,root:n.root,pluginVersion:r.version,skills:o.skills}}async function UN(e,t){let n=Dn.default.join(e.storeBase,t.dir),r=await tn(n);if(r===null)return null;if(t.mode!=="copy")return r;let o=Fy(t);if(o===null)return r;for(let i of rj(t)){let s=Nt(i,e.scope,e.root);if(s===null)continue;let a=await tn(Dn.default.join(s,t.dir));if(a!==null&&!jt(a,o))return a}return r}async function WN(e){let{state:t,key:n,entry:r,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=Fy(r),p=Dn.default.join(t.storeBase,r.dir),d=HN(r,s,l,n),m=s.skills.find(we=>we.name===n)??null,h=d!==null?"exists":m!==null?"moved":"missing",g=h==="exists"?d:h==="moved"?m.path:null,y=g===null?null:await tn(g),b=e.localDigest===null?"absent":c===null||jt(e.localDigest,c)?"same":"differs",S=jt(y,c)?"same":"differs",_=$_({hasSkillPath:typeof r.skillPath=="string"&&r.skillPath!=="",foundByName:m!==null,presence:h,upstream:S,local:b,force:a}),v=h==="moved"&&m!==null?m.dir:r.dir,x=h==="exists"?r.skillPath:h==="moved"?m.skillPath:r.skillPath??null,{agents:O,dropped:H}=VN(t,r,l),B=g===null||x===null?null:{name:n,dir:v,folderName:Kr(x),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:g,skillPath:x,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:n,entry:r,dir:r.dir,newDir:v,storeDir:p,mode:r.mode,agents:O,droppedAgents:H,presence:h,upstreamDrift:S,localDrift:b,outcome:_,recorded:c,onDisk:e.localDigest,upstream:y,discovered:B,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:QN(_,{key:n,storeDir:p,recordedSkillPath:r.skillPath??null,newSkillPath:x,checkOnly:e.checkOnly})}}function HN(e,t,n,r){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=$d(o);if(i!==null)return n.push(`The recorded path for "${D(r)}" ${i}; locating it by name instead.`),null;let s=Dn.default.resolve(t.root,...o.split("/"));return Ue(t.root,s,"the recorded skill path"),Ts.default.existsSync(s)?Dn.default.dirname(s):null}function VN(e,t,n){let r=[],o=[];for(let i of t.agents??[]){if(i===en){r.push(i);continue}let s=Ln(i);if(s===void 0){r.push(i);continue}if(Nt(s,e.scope,e.root)===null){o.push(i),n.push(`${D(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}r.push(i)}return{agents:r,dropped:o}}async function GN(e){let{candidate:t,checkOnly:n,force:r,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Rl(t,n,[]);let l=await KN(t,r),c=new Set(t.droppedAgents);for(let g of l.targets)if(g.skipReason==="agent-dir-absent")for(let y of g.agents)c.add(y);e.warnings.push(...l.warnings);let p=t.agents.filter(g=>!c.has(g));if(p.length===0&&p.push(en),n)return Rl(t,!0,l.targets.map(g=>Cy(g)),[...c]);let d,m=t.onDisk;if(a.willWrite){let g=await El(l.plan,l.skill);if(d=g.targets.map((y,b)=>L_(y,l.targets[b])),m=g.hashes,!g.success||g.storeAction==="failed"){let y=g.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let b of g.targets)!b.success&&b.error&&s.push({name:t.key,agent:b.agent,...b.errno!==void 0?{errno:b.errno}:{},message:b.error});return{...Rl(t,!1,d,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await zN(t,l.targets)}else{d=[];for(let g of l.targets)d.push(await JN(t,g))}let h=p.length!==(t.entry.agents??[]).length||p.some((g,y)=>(t.entry.agents??[])[y]!==g);return qN(t,a,h,o)&&!t.scopeState.readOnly&&await O_(t.scopeState,i).record(t.key,XN(t,m,a,o,p)),Rl(t,!1,d,[...c])}async function KN(e,t){let n={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},r=[];for(let s of e.agents){if(s===en)continue;let a=Ln(s);a!==void 0&&r.push({agent:a,explicit:!1})}let o=await vl({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:n,skills:[e.discovered],targets:r,recorded:e.scopeState.lock.skills,platform:process.platform,display:Il}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function JN(e,t){if(t.skipped||t.link==="canonical")return Cy(t);if(t.overwrite!=="fresh")return{...Cy(t),action:"unchanged"};let n=await Td({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...L_(n,t),action:n.success?"relinked":"failed"}}async function zN(e,t){let n=e.dir,r=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>Dn.default.dirname(i.path))];for(let i of new Set(o)){let s=Dn.default.join(i,n);if(Dn.default.basename(s)===n&&s!==Dn.default.join(i,e.newDir))try{let a=await Ts.default.promises.realpath(i);if(!rt(r,a))continue;await ps(r,Dn.default.join(a,n),"a renamed skill directory"),(await Ts.default.promises.lstat(s)).isSymbolicLink()?await Ts.default.promises.rm(s,{force:!0}):await Ts.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function qN(e,t,n,r){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||r.ref!==void 0&&r.ref!==e.entry.ref?!0:n}function XN(e,t,n,r,o){let i=n.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}:{},...r.ref!==void 0?{ref:r.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?Fl(s,{existing:e.entry,now:new Date().toISOString()}):s}function O_(e,t){let n=t.get(e.scope);if(n)return n;let r=ai({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,r),r}async function YN(e,t,n){if(t.yes)return!0;if(V()||n)throw new f(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
288
288
  `+e.map(r=>` ${D(r.key)}`).join(`
289
289
  `)+`
290
- Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let r of e)u.warn(` ${D(r.key)}`);return Re({message:"Discard local changes and replace with upstream?",default:!1})}function Sl(e,t,n,r=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:g_(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!r.includes(o)),droppedAgents:r,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:n}}function CN(e,t){return{...Sl(e,!1,[]),state:"failed",action:"failed",detail:t}}function fy(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 m_(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 g_(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 FN(e,t){let n=D(t.key),{checkOnly:r}=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 ${n}\`.`;case"store-directory-missing":return r?"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 ${n}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${n}\`.`;case"locally-modified":return e.willWrite?c_(r):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?c_(r):`updating would discard your edits. Review ${xl(t.storeDir)}, then run \`webflow skills update ${n} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${D(t.recordedSkillPath)} \u2192 ${D(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?r?"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?r?"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 c_(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function _N(e){let{reports:t,candidates:n,failures:r,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ge;return{kind:"skills.update",schemaVersion:Jr,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:y_(e.catalogs)??null,upToDate:!1},skills:t,blocked:n.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:r,summary:h_(t,r,e.checkOnly),warnings:[...new Set(e.warnings)]}}function h_(e,t,n){let r=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:r("upstream-changed","renamed-upstream","missing","untracked"),unchanged:r("unchanged"),locallyModified:r("locally-modified"),conflicts:r("conflict"),removedUpstream:r("removed-upstream","stale-entry"),updated:n?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 AN(e){let{selected:t,states:n,localDigests:r,refs:o,options:i}=e,s=n[0],a=i.ref??s?.lock.source.ref??Ge,l=t.map(({state:c,key:d})=>{let p=c.lock.skills[d],m=my(p),h=r.get(`${c.scope}\0${d}`)??null,g=m!==null&&!Nt(h,m);return{name:d,dir:p.dir,scope:c.scope,guard:"grid",state:g?"locally-modified":"unchanged",action:g?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:h?.contentHash??null,agents:p.agents??[],droppedAgents:[],reason:g?"locally-modified":null,detail:g?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:p.commit,toCommit:null,skillPath:p.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:Jr,checkOnly:e.checkOnly,force:e.force,scopes:n.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:h_(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function dy(e){return{kind:"skills.update",schemaVersion:Jr,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 IN(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${re} ${D(n)}`);u.info(uF(e))}function my(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function RN(e){let t=[];for(let n of e.agents??[]){let r=$n(n);r!==void 0&&t.push(r)}return t}function y_(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function u_(e){let t=e?.code;return typeof t=="string"?t:void 0}function py(e){return D(e instanceof Error?e.message:String(e))}function TN(){let e=At();return e?F.forSkills({authToken:e}):null}function xl(e){return Xo(e)}var w_=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.
291
- With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Kc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(ha()).addOption(ya()).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(Pe()).addOption(oe()).action(Pd),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(ha()).addOption(ya()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ii()).addOption(Pe()).addOption(oe()).action(Bd),t.command("list").description("List installed skills and the agents they are linked into").addOption(ha()).addOption(ya()).addOption(Kc()).addOption(He([...Yo]).default(ml)).addOption(Ti([...Es]).default("name")).addOption(Ri()).addOption(oe()).action(Od),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(Kc()).option("--all","Remove every installed skill for the scope").addOption(ha()).addOption(ya()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ii()).addOption(Pe()).addOption(oe()).action(Md)};var b_=w(Wl());function gy(e,t){t.forEach(n=>{e.addOption(n())}),e.commands.forEach(n=>gy(n,t))}function k_(e){let t=b_.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(n,r){return D_.Help.prototype.formatHelp.call(this,n,r).split(`
292
- `).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[Ey(o)]:o.trim()===""?[o]:[R(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
290
+ Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let r of e)u.warn(` ${D(r.key)}`);return $e({message:"Discard local changes and replace with upstream?",default:!1})}function Rl(e,t,n,r=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:N_(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!r.includes(o)),droppedAgents:r,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:n}}function ZN(e,t){return{...Rl(e,!1,[]),state:"failed",action:"failed",detail:t}}function Cy(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 L_(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 N_(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 QN(e,t){let n=D(t.key),{checkOnly:r}=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 ${n}\`.`;case"store-directory-missing":return r?"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 ${n}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${n}\`.`;case"locally-modified":return e.willWrite?I_(r):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?I_(r):`updating would discard your edits. Review ${Il(t.storeDir)}, then run \`webflow skills update ${n} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${D(t.recordedSkillPath)} \u2192 ${D(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?r?"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?r?"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 I_(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function ej(e){let{reports:t,candidates:n,failures:r,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ge;return{kind:"skills.update",schemaVersion:zr,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:M_(e.catalogs)??null,upToDate:!1},skills:t,blocked:n.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:r,summary:j_(t,r,e.checkOnly),warnings:[...new Set(e.warnings)]}}function j_(e,t,n){let r=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:r("upstream-changed","renamed-upstream","missing","untracked"),unchanged:r("unchanged"),locallyModified:r("locally-modified"),conflicts:r("conflict"),removedUpstream:r("removed-upstream","stale-entry"),updated:n?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 tj(e){let{selected:t,states:n,localDigests:r,refs:o,options:i}=e,s=n[0],a=i.ref??s?.lock.source.ref??Ge,l=t.map(({state:c,key:p})=>{let d=c.lock.skills[p],m=Fy(d),h=r.get(`${c.scope}\0${p}`)??null,g=m!==null&&!jt(h,m);return{name:p,dir:d.dir,scope:c.scope,guard:"grid",state:g?"locally-modified":"unchanged",action:g?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:h?.contentHash??null,agents:d.agents??[],droppedAgents:[],reason:g?"locally-modified":null,detail:g?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:d.commit,toCommit:null,skillPath:d.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:zr,checkOnly:e.checkOnly,force:e.force,scopes:n.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:j_(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function Sy(e){return{kind:"skills.update",schemaVersion:zr,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 nj(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${re} ${D(n)}`);u.info(TF(e))}function Fy(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function rj(e){let t=[];for(let n of e.agents??[]){let r=Ln(n);r!==void 0&&t.push(r)}return t}function M_(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function T_(e){let t=e?.code;return typeof t=="string"?t:void 0}function xy(e){return D(e instanceof Error?e.message:String(e))}function oj(){let e=Rt();return e?F.forSkills({authToken:e}):null}function Il(e){return Qo(e)}var B_=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.
291
+ With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(eu()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(ka()).addOption(Ea()).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(Ti()).addOption(Ae()).addOption(ne()).action(Ud),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(ka()).addOption(Ea()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ti()).addOption(Ae()).addOption(ne()).action(zd),t.command("list").description("List installed skills and the agents they are linked into").addOption(ka()).addOption(Ea()).addOption(eu()).addOption(He([...ei]).default(Dl)).addOption($i([...Cs]).default("name")).addOption(Pi()).addOption(ne()).action(Hd),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(eu()).option("--all","Remove every installed skill for the scope").addOption(ka()).addOption(Ea()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ti()).addOption(Ae()).addOption(ne()).action(Jd)};var W_=w(zl());function _y(e,t){t.forEach(n=>{e.addOption(n())}),e.commands.forEach(n=>_y(n,t))}function H_(e){let t=W_.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(n,r){return U_.Help.prototype.formatHelp.call(this,n,r).split(`
292
+ `).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[Oy(o)]:o.trim()===""?[o]:[I(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
293
293
  `)+`
294
- `}}).addOption(Zf()).addOption(tE()).addOption(Qf()).addOption(em()).addOption(tm()).showHelpAfterError(),e.hook("preAction",async(n,r)=>{let o=n.opts();o.input?n.getOptionValueSource("input")==="cli"&&_w(!0):Fw(!0),r.opts().json&&Iw(!0),Bn.start(),o.manifest&&Rw(o.manifest);try{await F.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!Ye()&&await new zs().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Bn.displayGrouped(),Bn.stop()}),CD(e),DS(e),nb(e),dE(e),Hv(e),tt()&&lS(e),uE(e),_S(e),bx(e),Ax(e),w_(e),Hk(e),e.commands.forEach(n=>{gy(n,[Zf,Qf,em,tm])})}_();C();we();var S_=new v_.Command;k_(S_);function PN(e){let t=e instanceof Error?e.message:String(e),n=e instanceof f?e.missingFlag:void 0,r=e instanceof f?e.prefix:void 0,o=r?wt(r).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Yw(e,{prefix:r});let i=JSON.stringify({error:{message:t,context:o,missingFlag:n}});E_.default.writeSync(1,`${i}
295
- `)}S_.parseAsync().catch(e=>{if(!(e instanceof f&&e.skipLogging))if(Ye())PN(e);else if(e instanceof f)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)});
294
+ `}}).addOption(lm()).addOption(yE()).addOption(um()).addOption(dm()).addOption(pm()).showHelpAfterError(),Je()&&e.addOption(cm()),e.hook("preAction",async(n,r)=>{let o=n.opts();o.input?n.getOptionValueSource("input")==="cli"&&Uw(!0):Bw(!0),r.opts().json&&Hw(!0),Wn.start(),o.manifest&&Vw(o.manifest),Je()&&nb(ob(o.region));try{await F.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!et()&&await new Qs().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Wn.displayGrouped(),Wn.stop()}),Hb(e),US(e),bD(e),FE(e),lS(e),Je()&&RS(e),CE(e),XS(e),Wx(e),Yx(e),B_(e),iE(e),e.commands.forEach(n=>{_y(n,[lm,um,...Je()?[cm]:[],dm,pm])})}A();C();be();var K_=new G_.Command;H_(K_);function ij(e){let t=e instanceof Error?e.message:String(e),n=e instanceof f?e.missingFlag:void 0,r=e instanceof f?e.prefix:void 0,o=r?wt(r).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;mb(e,{prefix:r});let i=JSON.stringify({error:{message:t,context:o,missingFlag:n}});V_.default.writeSync(1,`${i}
295
+ `)}K_.parseAsync().catch(e=>{if(!(e instanceof f&&e.skipLogging))if(et())ij(e);else if(e instanceof f)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)});
296
296
  //# sourceMappingURL=index.js.map